-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures | ||
.externalNativeBuild |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 24 | ||
buildToolsVersion "24.0.2" | ||
defaultConfig { | ||
applicationId "com.loonggg.weekcalendar" | ||
minSdkVersion 15 | ||
targetSdkVersion 24 | ||
versionCode 1 | ||
versionName "1.0" | ||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(include: ['*.jar'], dir: 'libs') | ||
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | ||
exclude group: 'com.android.support', module: 'support-annotations' | ||
}) | ||
compile 'com.android.support:appcompat-v7:24.2.1' | ||
testCompile 'junit:junit:4.12' | ||
compile project(':weekcalendarlib') | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in D:\android\sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.loonggg.weekcalendar; | ||
|
||
import android.content.Context; | ||
import android.support.test.InstrumentationRegistry; | ||
import android.support.test.runner.AndroidJUnit4; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
/** | ||
* Instrumentation test, which will execute on an Android device. | ||
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
@RunWith(AndroidJUnit4.class) | ||
public class ExampleInstrumentedTest { | ||
@Test | ||
public void useAppContext() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.loonggg.weekcalendar", appContext.getPackageName()); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.loonggg.weekcalendar.test"> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.loonggg.weekcalendar.test; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.support.v7.widget.Toolbar; | ||
import android.view.View; | ||
import android.widget.TextView; | ||
import android.widget.Toast; | ||
|
||
import com.loonggg.weekcalendar.view.WeekCalendar; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class MainActivity extends AppCompatActivity { | ||
Toolbar mToolbar; | ||
TextView mTvTitle;//标题 | ||
WeekCalendar mMcCalendar;//自定义日历控件 | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
mMcCalendar = (WeekCalendar) findViewById(R.id.mc_calendar); | ||
List<String> list = new ArrayList<>(); | ||
list.add("2016-09-13"); | ||
list.add("2016-10-13"); | ||
list.add("2016-10-11"); | ||
list.add("2016-10-10"); | ||
list.add("2016-10-16"); | ||
mMcCalendar.setSelectDates(list); | ||
//设置日历点击事件 | ||
mMcCalendar.setOnItemClickLitener(new WeekCalendar.OnItemClickLitener() { | ||
@Override | ||
public void onItemClick(View view, int position) { | ||
Toast.makeText(MainActivity.this, mMcCalendar.getTheDayOfSelected(), Toast.LENGTH_SHORT).show(); | ||
} | ||
}); | ||
|
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate android:fromXDelta="100%p" android:toXDelta="0" | ||
android:duration="500" /> | ||
<alpha android:fromAlpha="0.1" android:toAlpha="1.0" | ||
android:duration="500" /> | ||
</set> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate android:fromXDelta="0" android:toXDelta="-100%p" | ||
android:duration="500" /> | ||
<alpha android:fromAlpha="1.0" android:toAlpha="0.1" | ||
android:duration="500" /> | ||
</set> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate android:fromXDelta="-100%p" android:toXDelta="0" | ||
android:duration="500" /> | ||
<alpha android:fromAlpha="0.1" android:toAlpha="1.0" | ||
android:duration="500" /> | ||
</set> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<set xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<translate android:fromXDelta="0" android:toXDelta="100%p" | ||
android:duration="500" /> | ||
<alpha android:fromAlpha="1.0" android:toAlpha="0.1" | ||
android:duration="500" /> | ||
</set> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<shape xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:shape="oval"> | ||
|
||
<solid android:color="@color/color_green" /> | ||
<size | ||
android:width="10dp" | ||
android:height="10dp" /> | ||
|
||
</shape> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<com.loonggg.weekcalendar.view.WeekCalendar | ||
android:id="@+id/mc_calendar" | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:background="#ffffff" | ||
android:paddingBottom="10dp" | ||
app:cornerMarkBg="@mipmap/order_book_icon" | ||
app:daysSelectedBackground="@drawable/green_oval_bg" | ||
app:isCornerMark="true" | ||
app:monthBackgroundColor="#8F83F1" | ||
app:nextArrowBg="@mipmap/white_right_arrow" | ||
app:preArrowBg="@mipmap/white_left_arrow" /> | ||
</RelativeLayout> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!--menu_main.xml--> | ||
<menu xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
tools:context=".MainActivity"> | ||
<item | ||
android:id="@+id/action_inbox" | ||
app:showAsAction="always" | ||
android:title="@string/today" | ||
android:icon="@mipmap/ic_launcher" | ||
/> | ||
|
||
</menu> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<declare-styleable name="WeekCalendar"> | ||
<attr name="daysTextSize" format="dimension" /> | ||
<attr name="todayTextColor" format="color" /> | ||
<attr name="daysSelectedTextColor" format="color" /> | ||
<attr name="daysSelectedBackground" format="reference|color" /> | ||
<attr name="weekTextSize" format="dimension" /> | ||
<attr name="weekTextColor" format="color" /> | ||
<attr name="weekBackgroundColor" format="reference|color" /> | ||
<attr name="hideTodayName" format="boolean" /> | ||
<attr name="isCornerMark" format="boolean"/> | ||
<attr name="cornerMarkBg" format="reference|color" /> | ||
<attr name="monthBackgroundColor" format="color" /> | ||
<attr name="nextArrowBg" format="reference|color" /> | ||
<attr name="preArrowBg" format="reference|color" /> | ||
<attr name="isShowMonth" format="boolean"/> | ||
</declare-styleable> | ||
</resources> |