Skip to content

Commit

Permalink
gradle升级。将Calendar单独创建为library.
Browse files Browse the repository at this point in the history
  • Loading branch information
lieeber committed Jun 27, 2018
1 parent 3020b75 commit 538e9f5
Show file tree
Hide file tree
Showing 26 changed files with 135 additions and 21 deletions.
1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 24
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "demo.lieeber.com.myapplication"
minSdkVersion 15
targetSdkVersion 24
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -24,10 +24,11 @@ dependencies {
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:24.2.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
implementation 'joda-time:joda-time:2.9.4'
implementation 'com.android.support:recyclerview-v7:24.2.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'io.reactivex:rxjava:1.3.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation project(':library')
}
7 changes: 4 additions & 3 deletions app/src/main/java/demo/lieeber/com/calendar/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.lieeber.library.LBCalendarView;
import com.lieeber.library.ScheduleDate;

import org.joda.time.DateTime;

import java.util.ArrayList;
import java.util.List;

import demo.lieeber.com.calendar.LBCalendarView.ItemClickListener;

public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -50,7 +51,7 @@ protected void onCreate(Bundle savedInstanceState) {
dateTime = new DateTime(2018, 11, 22, 0, 0);
dateList.add(new ScheduleDate(dateTime, true, 0));
calendarView.setCalendarData(dateList);
calendarView.setItemClickListener(new ItemClickListener() {
calendarView.setItemClickListener(new LBCalendarView.ItemClickListener() {
@Override public void onItemClick(ScheduleDate scheduleDate) {
if (scheduleDate.isSelected && scheduleDate.todoCount > 0) {
Toast.makeText(MainActivity.this, "有课", Toast.LENGTH_SHORT).show();
Expand Down
Binary file removed app/src/main/res/drawable/aa.jpg
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
android:text=""/>
</LinearLayout>

<demo.lieeber.com.calendar.LBCalendarView
<com.lieeber.library.LBCalendarView
android:id="@+id/calendar_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ buildscript {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
Expand All @@ -16,6 +20,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}

Expand Down
1 change: 1 addition & 0 deletions library/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
39 changes: 39 additions & 0 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 27



defaultConfig {
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'com.android.support:appcompat-v7:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'io.reactivex:rxjava:1.3.0'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'joda-time:joda-time:2.9.4'
}
21 changes: 21 additions & 0 deletions library/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# 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 *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.lieeber.library;

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.*;

/**
* Instrumented 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() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.lieeber.library.test", appContext.getPackageName());
}
}
2 changes: 2 additions & 0 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.lieeber.library" />
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package demo.lieeber.com.calendar;
package com.lieeber.library;

import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package demo.lieeber.com.calendar;
package com.lieeber.library;

import android.content.Context;
import android.graphics.Color;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package demo.lieeber.com.calendar;
package com.lieeber.library;

import android.content.Context;
import android.graphics.Canvas;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package demo.lieeber.com.calendar;
package com.lieeber.library;

import android.content.Context;
import android.support.annotation.Nullable;
Expand All @@ -16,7 +16,6 @@
import java.util.List;
import java.util.Locale;

import demo.lieeber.com.calendar.CalendarViewAdapter.CellClickListener;
import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Subscriber;
Expand Down Expand Up @@ -89,7 +88,7 @@ private void initVeiw() {
}
});

mAdapter.setOnCellClickListener(new CellClickListener() {
mAdapter.setOnCellClickListener(new CalendarViewAdapter.CellClickListener() {
@Override public void onCellClick(ScheduleDate scheduleDate) {
if (itemClickListener != null) {
itemClickListener.onItemClick(scheduleDate);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package demo.lieeber.com.calendar;
package com.lieeber.library;

import android.support.v7.widget.RecyclerView.ViewHolder;
import android.view.View;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package demo.lieeber.com.calendar;
package com.lieeber.library;

/**
* Created by lieeber on 16/9/9.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package demo.lieeber.com.calendar;
package com.lieeber.library;

import org.joda.time.DateTime;
import org.joda.time.Days;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 3 additions & 0 deletions library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<string name="app_name">library</string>
</resources>
17 changes: 17 additions & 0 deletions library/src/test/java/com/lieeber/library/ExampleUnitTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.lieeber.library;

import org.junit.Test;

import static org.junit.Assert.*;

/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':app'
include ':app', ':library'

0 comments on commit 538e9f5

Please sign in to comment.