Skip to content

Commit

Permalink
Create AS3.0 Branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Zweihui committed Jan 10, 2018
1 parent 9fe7d09 commit 3031021
Show file tree
Hide file tree
Showing 113 changed files with 3,506 additions and 2,717 deletions.
91 changes: 52 additions & 39 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import com.zwh.plugin.AspectjPlugin

apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
apply from: 'tinkerpatch.gradle'
apply from: 'tinkerpatch.gradle'

Expand All @@ -28,6 +27,7 @@ android {
targetSdkVersion rootProject.ext.android["targetSdkVersion"]
versionCode rootProject.ext.android["versionCode"]
versionName rootProject.ext.android["versionName"]
flavorDimensions "versionCode"
testInstrumentationRunner rootProject.ext.dependencies["androidJUnitRunner"]
vectorDrawables.useSupportLibrary = true
manifestPlaceholders = [BUGLY_APP_CHANNEL_VALUE:"other"]
Expand All @@ -45,6 +45,7 @@ android {
buildConfigField "boolean", "LOG_DEBUG", "true"
buildConfigField "boolean", "USE_CANARY", "true"
minifyEnabled false
multiDexEnabled true
multiDexKeepProguard file('multiDexKeep.pro')
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ndk {
Expand All @@ -62,6 +63,7 @@ android {
shrinkResources true
zipAlignEnabled true
signingConfig signingConfigs.release
multiDexEnabled true
multiDexKeepProguard file('multiDexKeep.pro')
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ndk {
Expand All @@ -71,19 +73,31 @@ android {
}
}
productFlavors {
baidu {manifestPlaceholders = [BUGLY_APP_CHANNEL_VALUE:"baidu"]}
fir {manifestPlaceholders = [BUGLY_APP_CHANNEL_VALUE:"fir"]}
xiaomi {manifestPlaceholders = [BUGLY_APP_CHANNEL_VALUE:"xiaomi"]}
baidu {

manifestPlaceholders = [BUGLY_APP_CHANNEL_VALUE:"baidu"]

}
fir {

manifestPlaceholders = [BUGLY_APP_CHANNEL_VALUE:"fir"]

}
xiaomi {

manifestPlaceholders = [BUGLY_APP_CHANNEL_VALUE:"xiaomi"]

}
}

applicationVariants.all { variant ->
variant.outputs.each { output ->
variant.outputs.all { output ->
def outputFile = output.outputFile
if (variant.buildType.name.equals('release')) {
//生成apk名字的格式:Channel1.0.0_2016-06-22_baidu.apk
//可自定义自己想要生成的格式
def fileName = "Channel${defaultConfig.versionName}_${releaseTime()}_${variant.productFlavors[0].name}.apk"
output.outputFile = new File(outputFile.parent, fileName)
outputFileName = new File(outputFile.parent, fileName)
}
}
}
Expand Down Expand Up @@ -118,9 +132,9 @@ def releaseTime() {


dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
implementation fileTree(include: ['*.jar'], dir: 'libs')
//support
compile(rootProject.ext.dependencies["cardview-v7"]) {
implementation(rootProject.ext.dependencies["cardview-v7"]) {
exclude module: 'support-annotations'
}
//tools
Expand All @@ -129,46 +143,45 @@ dependencies {
//view
annotationProcessor(rootProject.ext.dependencies["butterknife-compiler"]) {
exclude module: 'support-annotations'
exclude module: 'butterknife-annotations'
}
compile rootProject.ext.dependencies["paginate"]
implementation rootProject.ext.dependencies["paginate"]
//arms
compile project(':arms')
implementation project(':arms')
// compile 'me.jessyan:arms:2.1.5'
compile rootProject.ext.dependencies["multidex"]
testCompile rootProject.ext.dependencies["junit"]
testCompile rootProject.ext.dependencies["mockito-core"]
testCompile rootProject.ext.dependencies["robolectric"]
testCompile rootProject.ext.dependencies["DaggerMock"]
androidTestCompile rootProject.ext.dependencies["robolectric"]
debugCompile rootProject.ext.dependencies["canary-debug"]
releaseCompile rootProject.ext.dependencies["canary-release"]
testCompile rootProject.ext.dependencies["canary-release"]
implementation rootProject.ext.dependencies["multidex"]
testImplementation rootProject.ext.dependencies["junit"]
testImplementation rootProject.ext.dependencies["mockito-core"]
testImplementation rootProject.ext.dependencies["robolectric"]
testImplementation rootProject.ext.dependencies["DaggerMock"]
androidTestImplementation rootProject.ext.dependencies["robolectric"]
debugImplementation rootProject.ext.dependencies["canary-debug"]
releaseImplementation rootProject.ext.dependencies["canary-release"]
testImplementation rootProject.ext.dependencies["canary-release"]
annotationProcessor project(':apt')
compile project(':apt-lib')
compile rootProject.ext.dependencies["constraint-layout"]
compile rootProject.ext.dependencies["aspectjrt"]
compile rootProject.ext.dependencies["appbarspring"]
compile rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
compile rootProject.ext.dependencies["gsyVideoPlayer-java"]
compile rootProject.ext.dependencies["gsyVideoPlayer-armv7a"]
compile rootProject.ext.dependencies["gsyVideoPlayer-x86"]
compile rootProject.ext.dependencies["gsyVideoPlayer-arm64"]
compile(rootProject.ext.dependencies["bmob-sdk"]) {
implementation project(':apt-lib')
implementation rootProject.ext.dependencies["constraint-layout"]
implementation rootProject.ext.dependencies["aspectjrt"]
implementation rootProject.ext.dependencies["appbarspring"]
implementation rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
implementation rootProject.ext.dependencies["gsyVideoPlayer-java"]
implementation rootProject.ext.dependencies["gsyVideoPlayer-armv7a"]
implementation rootProject.ext.dependencies["gsyVideoPlayer-x86"]
implementation rootProject.ext.dependencies["gsyVideoPlayer-arm64"]
implementation(rootProject.ext.dependencies["bmob-sdk"]) {
exclude group: 'com.squareup.okhttp3'
exclude module: 'com.squareup.okio'
}
compile rootProject.ext.dependencies["http-legacy"]
compile rootProject.ext.dependencies["bmob-sms"]
compile rootProject.ext.dependencies["ucrop"]
compile rootProject.ext.dependencies["greendao"]
compile rootProject.ext.dependencies["materialprogressbar"]
compile rootProject.ext.dependencies["filedownloader"]
compile rootProject.ext.dependencies["crashreport_upgrade"]
implementation rootProject.ext.dependencies["http-legacy"]
implementation rootProject.ext.dependencies["bmob-sms"]
implementation rootProject.ext.dependencies["ucrop"]
implementation rootProject.ext.dependencies["greendao"]
implementation rootProject.ext.dependencies["materialprogressbar"]
implementation rootProject.ext.dependencies["filedownloader"]
implementation rootProject.ext.dependencies["crashreport_upgrade"]
// compile rootProject.ext.dependencies["tinkerpatch-android-sdk"]
// provided rootProject.ext.dependencies["tinker-android-anno"]
compile(name: 'matisse_ucrop_1.0.0', ext: 'aar')
compile(name: 'progress-release', ext: 'aar')
implementation(name: 'matisse_ucrop_1.0.0', ext: 'aar')
implementation(name: 'progress-release', ext: 'aar')
}

apply plugin: AspectjPlugin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.zwh.mvparms.eyepetizer.app.utils;

import com.jess.arms.mvp.IView;
import com.trello.rxlifecycle2.LifecycleProvider;
import com.jess.arms.utils.RxLifecycleUtils;
import com.trello.rxlifecycle2.LifecycleTransformer;

import io.reactivex.Observable;
Expand Down Expand Up @@ -44,7 +44,7 @@ public void accept(@NonNull Disposable disposable) throws Exception {
public void run() {
view.hideLoading();//隐藏进度条
}
}).compose(RxUtils.bindToLifecycle(view));
}).compose(RxLifecycleUtils.bindToLifecycle(view));
}
};
}
Expand All @@ -60,7 +60,7 @@ public void run() {
view.hideLoading();//隐藏进度条
}
})
.compose(RxUtils.bindToLifecycle(view));
.compose(RxLifecycleUtils.bindToLifecycle(view));
}
};
}
Expand All @@ -76,11 +76,7 @@ public Observable<T> apply(Observable<T> observable) {


public static <T> LifecycleTransformer<T> bindToLifecycle(IView view) {
if (view instanceof LifecycleProvider){
return ((LifecycleProvider)view).bindToLifecycle();
}else {
throw new IllegalArgumentException("view isn't activity or fragment");
}
return RxLifecycleUtils.bindToLifecycle(view);

}

Expand Down
163 changes: 163 additions & 0 deletions app/src/main/java/com/zwh/mvparms/eyepetizer/app/utils/UUIDS.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
package com.zwh.mvparms.eyepetizer.app.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Environment;
import android.util.Log;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;

/**
* Created by Administrator on 2017\12\15 0015.
* 设备唯一表示ID
*/

public class UUIDS {

private static final String TAG = UUIDS.class.getName();
private static UUIDS device;
private Context context;
private final static String DEFAULT_NAME = ".system_device_id";
private final static String DEFAULT_FILE_NAME = ".system_device_id";
private final static String DEFAULT_DEVICE_ID = "dervice_id";
private final static String FILE_ANDROID = Environment.getExternalStoragePublicDirectory("Android") + File.separator + DEFAULT_FILE_NAME;
private final static String FILE_DCIM = Environment.getExternalStoragePublicDirectory("DCIM") + File.separator + DEFAULT_FILE_NAME;
private static SharedPreferences preferences = null;

public UUIDS(Context context) {
this.context = context;
}

private String uuid;

public static UUIDS buidleID(Context context) {
if (device == null) {
synchronized (UUIDS.class) {
if (device == null) {
device = new UUIDS(context);
}
}
}
return device;
}

public static String getUUID() {
if (preferences == null) {
Log.d(TAG, "Please check the UUIDS.buidleID in Application (this).Check ()");
return "dervice_id";
}
return preferences.getString("dervice_id", "dervice_id");
}

//生成一个128位的唯一标识符
private String createUUID() {
return java.util.UUID.randomUUID().toString();
}


public void check() {
preferences = context.getSharedPreferences(DEFAULT_NAME, 0);
uuid = preferences.getString(DEFAULT_DEVICE_ID, null);
if (uuid == null) {
if (checkAndroidFile() == null && checkDCIMFile() == null) {
uuid = createUUID();
saveAndroidFile(uuid);
saveDCIMFile(uuid);
Log.d(TAG, "new devices,create only id");
}

if (checkAndroidFile() == null) {
uuid = checkDCIMFile();
saveAndroidFile(uuid);
Log.d(TAG, "Android directory was not found in UUID, from the DCIM directory to take out UUID\n");
}

if (checkDCIMFile() == null) {
uuid = checkAndroidFile();
saveDCIMFile(uuid);
Log.d(TAG, "DCIM directory was not found in UUID, from the Android directory to take out UUID");
}

uuid = checkAndroidFile();
SharedPreferences.Editor editor = preferences.edit();
editor.putString(DEFAULT_DEVICE_ID, uuid);
editor.commit();
Log.d(TAG,"save uuid SharePref:" + uuid);
} else {

if (checkAndroidFile() == null) {
saveAndroidFile(uuid);
}

if (checkDCIMFile() == null) {
saveDCIMFile(uuid);
}
}
Log.d(TAG,"result uuid:" + uuid);
}

private String checkAndroidFile() {
BufferedReader reader = null;
try {
File file = new File(FILE_ANDROID);
reader = new BufferedReader(new FileReader(file));
return reader.readLine();
} catch (Exception e) {
return null;
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

private void saveAndroidFile(String id) {
try {
File file = new File(FILE_ANDROID);
FileWriter writer = new FileWriter(file);
writer.write(id);
writer.flush();
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}

private String checkDCIMFile() {
BufferedReader reader = null;
try {
File file = new File(FILE_DCIM);
reader = new BufferedReader(new FileReader(file));
return reader.readLine();
} catch (Exception e) {
return null;
} finally {
try {
if (reader != null) {
reader.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

private void saveDCIMFile(String id) {
try {
File file = new File(FILE_DCIM);
FileWriter writer = new FileWriter(file);
writer.write(id);
writer.flush();
writer.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import android.app.Application;

import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.widget.imageloader.ImageLoader;
import com.zwh.mvparms.eyepetizer.app.utils.RxUtils;
import com.zwh.mvparms.eyepetizer.mvp.contract.AttentionContract;
import com.zwh.mvparms.eyepetizer.mvp.model.entity.AttentionInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import android.app.Application;

import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.widget.imageloader.ImageLoader;
import com.zwh.mvparms.eyepetizer.app.utils.RxUtils;
import com.zwh.mvparms.eyepetizer.mvp.contract.AuthorDetailContract;
import com.zwh.mvparms.eyepetizer.mvp.model.entity.AuthorAlbumInfo;
Expand Down
Loading

0 comments on commit 3031021

Please sign in to comment.