Skip to content

Commit

Permalink
Merge pull request #28 from znyang/not-allowd-directly
Browse files Browse the repository at this point in the history
Not allowd directly
  • Loading branch information
znyang authored Jan 10, 2018
2 parents 7d7b057 + a169c01 commit 336923c
Show file tree
Hide file tree
Showing 33 changed files with 282 additions and 105 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
build/
*.log
local.properties
*.ipr
*.ipr
*.iws
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ buildscript {
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.github.znyang:library-analysis:0.2'
classpath 'com.github.znyang:library-analysis:0.2.1'
}
}
Expand All @@ -46,9 +46,11 @@ libReport {
## 使用

```
gradle libReportCompile
gradle libReportCompile // or libReportReleaseCompileClasspath ...
```

注意:在使用gradle 4.x以后,建议使用libReportReleaseCompileClasspath输出(libReportCompile无法输出使用implementation加入的相关依赖库),如果工程都只用compile添加依赖,那么没有影响。

### output

**/build/reports/zen/analysis/library/compile/Tree.html**
Expand Down
75 changes: 27 additions & 48 deletions analysis-sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,15 @@
apply plugin: 'com.android.application'
apply plugin: 'com.zen.lib.analysis'
apply from: "${projectDir}/retrolambda.gradle"

buildscript {
repositories repoProvider
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.github.znyang:library-analysis:0.2-SNAPSHOT'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'me.tatarka.retrolambda.projectlombok:lombok.ast:0.2.3.a2'
}
// Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
}
//apply plugin: 'kotlin-android'
//apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 24
buildToolsVersion "24.0.3"
compileSdkVersion 25

defaultConfig {
applicationId "com.zen.android.analysis.sample"
minSdkVersion 9
targetSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"

Expand All @@ -34,57 +22,48 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

dexOptions {
dexInProcess false
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

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

compile 'com.android.support:design:24.0.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:palette-v7:24.0.0'
compile 'com.android.support:palette-v7:24.0.0'
compile 'com.android.support:support-vector-drawable:24.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])

compile 'com.android.support:support-v4:24.1.1'
implementation 'com.android.support:multidex:1.0.1'

compile 'com.squareup.moshi:moshi:1.2.0'
compile 'com.alibaba:fastjson:1.1.54.android'
compile 'com.fasterxml.jackson.core:jackson-databind:2.7.0'
implementation 'com.squareup.moshi:moshi:1.2.0'
implementation 'com.alibaba:fastjson:1.1.54.android'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.7.0'

compile "com.github.Raizlabs.DBFlow:dbflow:3.1.1"
implementation "com.github.Raizlabs.DBFlow:dbflow:3.1.1"

compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.squareup.retrofit2:retrofit:2.1.0'

compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.fresco:fresco:0.13.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.facebook.fresco:fresco:0.13.0'

compile 'com.jakewharton.timber:timber:4.3.0'
implementation 'com.jakewharton.timber:timber:4.3.0'

compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
// compile 'io.reactivex.rxjava2:rxjava:2.0.0-RC2'
compile 'com.google.android.agera:rvdatabinding:1.2.0-beta2'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.0'
// implementation 'io.reactivex.rxjava2:rxjava:2.0.0-RC2'

compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.jakewharton.scalpel:scalpel:1.1.2'
compile 'com.jakewharton:process-phoenix:1.0.2'
implementation 'com.jakewharton:butterknife:8.4.0'
implementation 'com.jakewharton.scalpel:scalpel:1.1.2'
implementation 'com.jakewharton:process-phoenix:1.0.2'

androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})

testCompile 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'
}

libReport {
Expand Down
17 changes: 0 additions & 17 deletions analysis-sample/retrolambda.gradle

This file was deleted.

3 changes: 1 addition & 2 deletions analysis-sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
android:supportsRtl="true">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package com.zen.android.analysis.sample;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;

import rx.Observable;
import rx.Observable.OnSubscribe;
import rx.Subscriber;
import rx.functions.Func1;

/**
* @author zen
* @version 2016/9/13
*/

public abstract class BaseActivity extends AppCompatActivity {
public abstract class BaseActivity extends Activity {

Observable<?> ready;

Expand All @@ -35,9 +38,12 @@ private void createReady(Bundle state) {
if (ready == null) {
ready = InitManager
.ready()
.map(result -> {
afterCreate(state);
return result;
.map(new Func1<Object, Object>() {
@Override
public Object call(Object result) {
afterCreate(state);
return result;
}
});
}
}
Expand Down Expand Up @@ -68,10 +74,13 @@ protected void onPause() {
}

protected Observable<?> genObsResume() {
return Observable.create(subscriber -> {
onObsResume();
subscriber.onNext(null);
subscriber.onCompleted();
return Observable.create(new OnSubscribe<Object>() {
@Override
public void call(Subscriber<? super Object> subscriber) {
BaseActivity.this.onObsResume();
subscriber.onNext(null);
subscriber.onCompleted();
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.functions.Func0;
import rx.schedulers.Schedulers;

/**
Expand Down Expand Up @@ -34,9 +35,12 @@ public static Context getContext() {

public static Observable<?> ready() {
return Observable.defer(
() -> {
init(sCache);
return Observable.just(true);
new Func0<Observable<Boolean>>() {
@Override
public Observable<Boolean> call() {
init(sCache);
return Observable.just(true);
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

Expand All @@ -29,10 +31,13 @@ protected void onBaseCreate(@Nullable Bundle savedInstanceState) {
protected void onObsResume() {
super.onObsResume();
mTextMain.setText(InitManager.getContext().getString(R.string.success));
mBtnGo.setOnClickListener(listener -> {
InitManager.clear();
Intent intent = new Intent(this, MainActivity.class);
startActivity(intent);
mBtnGo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View listener) {
InitManager.clear();
Intent intent = new Intent(MainActivity.this, MainActivity.class);
MainActivity.this.startActivity(intent);
}
});
}
}
8 changes: 0 additions & 8 deletions analysis-sample/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
<resources>

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>

</resources>
24 changes: 18 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,33 @@ allprojects {
isEnvCi = System.getenv('ENV_CI')
buildToolsVersion = isEnvCi ? "22.0.1" : "25.0.0"
repoProvider = {
// maven { url "file:///c:/repo"}
// maven {
// url 'http://maven.aliyun.com/nexus/content/groups/public/'
// }
if (!isEnvCi) {
maven { url "file:///c:/repo" }
maven {
url 'http://maven.aliyun.com/nexus/content/groups/public/'
}
}
google()
jcenter()
maven { url "https://jitpack.io" }
}
}

repositories repoProvider

buildscript {
repositories repoProvider
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.github.znyang:library-analysis:0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.51"
}
}
}

task wrapper(type: Wrapper) {
gradleVersion = '3.1'
distributionUrl = 'http://services.gradle.org/distributions/gradle-3.1-all.zip'
gradleVersion = '4.1'
distributionUrl = 'http://services.gradle.org/distributions/gradle-4.1-all.zip'
}

task clean(type: Delete) {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GROUP=com.github.znyang
VERSION_NAME=0.2
VERSION_NAME=0.2.1

POM_ARTIFACT_ID=library-analysis
POM_NAME=Library Analysis Gradle Plugin
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-3.0-all.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-4.1-all.zip
1 change: 1 addition & 0 deletions kotlin-sample/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
Loading

0 comments on commit 336923c

Please sign in to comment.