Skip to content

Commit

Permalink
init 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
0xm1nam0 committed Dec 10, 2019
1 parent 92f6bb1 commit dd9bdc1
Show file tree
Hide file tree
Showing 78 changed files with 103 additions and 15,365 deletions.
7 changes: 5 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
implementation "com.jakewharton:butterknife:$rootProject.ext.butterknifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.ext.butterknifeVersion"
implementation 'com.tencent.bugly:crashreport:2.4.0'
implementation 'in.srain.cube:ultra-ptr:1.0.11'
implementation "com.android.support:cardview-v7:$rootProject.ext.androidSupportSdkVersion"
implementation "com.android.support:appcompat-v7:$rootProject.ext.androidSupportSdkVersion"
implementation "com.android.support:design:$rootProject.ext.androidSupportSdkVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.ext.androidSupportSdkVersion"
implementation "com.android.support:support-v4:$rootProject.ext.androidSupportSdkVersion"
implementation 'com.github.chrisbanes.photoview:library:1.2.3'
implementation 'pub.devrel:easypermissions:2.0.0'
implementation project(':core')
implementation "com.github.0xm1nam0:Common:$rootProject.ext.commonVersion"
}
6 changes: 3 additions & 3 deletions app/src/main/java/com/github/weiss/example/BaseActivity.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.github.weiss.example;

import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.ToastUtils;
import com.github.weiss.core.base.BaseRxActivity;
import com.github.weiss.core.entity.BaseHttpResult;
import com.github.weiss.core.utils.LogUtils;
import com.github.weiss.core.utils.ToastUtils;

/**
* Created by Weiss on 2017/1/17.
Expand All @@ -15,7 +15,7 @@ public abstract class BaseActivity extends BaseRxActivity {
public void tokenInvalid() {
LogUtils.d("tokenInvalid");
App.userManager.logout();
ToastUtils.show("请安全退出,重新登录账号");
ToastUtils.showShort("请安全退出,重新登录账号");

}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/github/weiss/example/api/Api.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.weiss.example.api;


import com.github.weiss.core.utils.LogUtils;
import com.github.weiss.core.utils.NetworkUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.NetworkUtils;
import com.github.weiss.example.App;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package com.github.weiss.example.entity;

import com.github.weiss.core.entity.ListEntity;
import com.github.weiss.core.utils.CollectionUtils;
import com.github.weiss.core.utils.helper.RxSchedulers;
import com.github.weiss.example.HttpResult;
import com.github.weiss.example.api.Api;
import com.minamo.utils.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import android.widget.ProgressBar;
import android.widget.TextView;

import com.github.weiss.core.ContainerActivity;
import com.github.weiss.core.utils.ClipboardUtils;
import com.github.weiss.core.utils.ImageLoaderUtil;
import com.github.weiss.example.BaseActivity;
import com.github.weiss.example.R;
Expand All @@ -24,6 +22,7 @@
import com.github.weiss.example.view.webview.CommonWebChromeClient;
import com.github.weiss.example.view.webview.CommonWebView;
import com.github.weiss.example.view.webview.CommonWebViewClient;
import com.minamo.utils.ClipboardUtils;

import butterknife.BindView;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import android.view.MenuItem;
import android.widget.ProgressBar;

import com.github.weiss.core.utils.ClipboardUtils;
import com.github.weiss.example.BaseActivity;
import com.github.weiss.example.R;
import com.github.weiss.example.util.JsHandler;
import com.github.weiss.example.util.SnackbarUtil;
import com.github.weiss.example.view.webview.CommonWebChromeClient;
import com.github.weiss.example.view.webview.CommonWebView;
import com.github.weiss.example.view.webview.CommonWebViewClient;
import com.minamo.utils.ClipboardUtils;

import butterknife.BindView;

Expand Down
14 changes: 7 additions & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0'

classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// classpath 'me.tatarka:gradle-retrolambda:3.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down Expand Up @@ -51,10 +50,10 @@ task clean(type: Delete) {
}

ext {
androidVersionCode = 5
androidVersionName = '1.3.3'
androidVersionCode = 6
androidVersionName = '1.5.0'

androidCompileSdkVersion = 28
androidCompileSdkVersion = 26
androidBuildToolsVersion = '26.1.0'
androidSupportSdkVersion = '28.0.0'
androidMinSdkVersion = 17
Expand All @@ -64,6 +63,7 @@ ext {

rxjava2Version = '2.2.13'
retrofit2Version = '2.6.2'
gsonVersion = '2.6.2'
gsonVersion = '2.8.5'
butterknifeVersion = '9.0.0'
commonVersion = '1.1.0'
}
13 changes: 8 additions & 5 deletions core/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group = 'com.github.0xm1nam0'
//apply plugin: 'me.tatarka.retrolambda'

// Java8 not fully supported in library projects yet, https://code.google.com/p/android/issues/detail?id=211386
Expand Down Expand Up @@ -46,10 +48,10 @@ dependencies {
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.ext.butterknifeVersion"
api 'com.github.bumptech.glide:glide:4.6.1'

api "com.android.support:appcompat-v7:$rootProject.ext.androidSupportSdkVersion"
api "com.android.support:design:$rootProject.ext.androidSupportSdkVersion"
api "com.android.support:recyclerview-v7:$rootProject.ext.androidSupportSdkVersion"
api "com.android.support:support-v4:$rootProject.ext.androidSupportSdkVersion"
implementation "com.android.support:appcompat-v7:$rootProject.ext.androidSupportSdkVersion"
implementation "com.android.support:design:$rootProject.ext.androidSupportSdkVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.ext.androidSupportSdkVersion"
implementation "com.android.support:support-v4:$rootProject.ext.androidSupportSdkVersion"
api "io.reactivex.rxjava2:rxjava:$rootProject.ext.rxjava2Version"
api "com.squareup.retrofit2:retrofit:$rootProject.ext.retrofit2Version"
api "com.squareup.retrofit2:adapter-rxjava2:$rootProject.ext.retrofit2Version"
Expand All @@ -65,7 +67,8 @@ dependencies {
// releaseApi 'com.github.BolexLiu.AutoEx:AutoEx-Lib-No-Op:v1.0.8'
api "com.google.code.gson:gson:$rootProject.ext.gsonVersion"
api "com.flyco.systembar:FlycoSystemBar_Lib:1.0.0@aar"
implementation "com.github.0xm1nam0:Common:$rootProject.ext.commonVersion"
}


apply from: 'publish.gradle'
//apply from: 'publish.gradle'
14 changes: 7 additions & 7 deletions core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />

<application
android:label="@string/app_name">

<activity
android:name=".ContainerActivity"
android:name="com.github.weiss.core.ContainerActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="landscape"
android:hardwareAccelerated="true" />

<activity
android:name=".crash.DefaultErrorActivity"
android:name="com.github.weiss.core.crash.DefaultErrorActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:screenOrientation="landscape"
android:process=":error_activity" />

<provider
android:name=".crash.CaocInitProvider"
android:authorities="${applicationId}.customactivityoncrashinitprovider"
android:exported="false"
android:initOrder="101" />
</application>

</manifest>
8 changes: 4 additions & 4 deletions core/src/main/java/com/github/weiss/core/UserManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

import android.text.TextUtils;

import com.github.weiss.core.utils.LogUtils;
import com.github.weiss.core.utils.SPUtils;
import com.google.gson.Gson;
import com.minamo.utils.LoggerUtils;
import com.minamo.utils.SPUtils;

/**
* author weiss
Expand Down Expand Up @@ -38,9 +38,9 @@ public T getUserModel() {

public void login(T t) {
if(t == null) {
LogUtils.e("UserManager", "Login Model is Null");
LoggerUtils.e("UserManager", "Login Model is Null");
} else if(SPUtils.getBoolean(FILE, IS_LOGIN)) {
LogUtils.e("UserManager", "Can't Login Again");
LoggerUtils.e("UserManager", "Can't Login Again");
} else {
this.mModel = t;
String user_message = (new Gson()).toJson(t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import android.os.Handler;
import android.os.Looper;

import com.github.weiss.core.utils.FileUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okio.BufferedSink;

Expand Down
59 changes: 11 additions & 48 deletions core/src/main/java/com/github/weiss/core/api/RetryIntercepter.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.weiss.core.api;

import com.github.weiss.core.utils.LogUtils;

import com.minamo.utils.LoggerUtils;

import java.io.IOException;

Expand All @@ -10,61 +11,23 @@

public class RetryIntercepter implements Interceptor {

private int mMaxRetryCount;
private long mRetryInterval;
public int maxRetry;//最大重试次数
private int retryNum = 0;//假如设置为3次重试的话,则最大可能请求4次(默认1次+3次重试)

public RetryIntercepter(int maxRetryCount, long retryInterval) {
mMaxRetryCount = maxRetryCount;
mRetryInterval = retryInterval;
public RetryIntercepter(int maxRetry) {
this.maxRetry = maxRetry;
}

@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Response response = doRequest(chain, request);
int retryNum = 0;
while(((response==null)||!response.isSuccessful())&&retryNum<=mMaxRetryCount){
try {
Thread.sleep(mRetryInterval);
} catch (InterruptedException e) {
e.printStackTrace();
}
LoggerUtils.d("retryNum=" + retryNum);
Response response = chain.proceed(request);
while (!response.isSuccessful() && retryNum < maxRetry) {
retryNum++;
LogUtils.d("response.code:"+response.code()+" retryNum:"+retryNum);
response = doRequest(chain, request);

LoggerUtils.d("retryNum=" + retryNum);
response = chain.proceed(request);
}
return response;
}

private Response doRequest(Chain chain, Request request) {
try {
return chain.proceed(request);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}

public static class Builder {

private int mRetryCount = 2;
private long mRetryInterval = 500;

public Builder buildRetryCount(int retryCount){
this.mRetryCount = retryCount;
return this;
}

public Builder buildRetryInterval(long retryInterval){
this.mRetryInterval = retryInterval;
return this;
}

public RetryIntercepter build(){
return new RetryIntercepter(mRetryCount,mRetryInterval);
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

import android.content.Context;

import com.github.weiss.core.utils.NetworkUtils;

import com.blankj.utilcode.util.NetworkUtils;

import java.io.IOException;

Expand Down
11 changes: 6 additions & 5 deletions core/src/main/java/com/github/weiss/core/base/BaseApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import android.content.Context;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.annotation.NonNull;
import com.github.weiss.core.utils.CrashUtils;
import com.github.weiss.core.utils.SPUtils;
import com.github.weiss.core.utils.Utils;

import com.blankj.utilcode.util.CrashUtils;
import com.blankj.utilcode.util.Utils;
import com.minamo.utils.SPUtils;

/**
* Created by Weiss on 2017/1/10.
Expand All @@ -32,7 +32,8 @@ public void onCreate() {
app = this;
SPUtils.init(this);
Utils.init(this);
CrashUtils.getInstance().init();
CrashUtils.init();
// AutoEx.apply();
// LogUtils2.getBuilder().setTag("MyTag").setLog2FileSwitch(true).create();

//注册监听每个activity的生命周期,便于堆栈式管理
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import android.view.Window;
import android.view.WindowManager;

import com.github.weiss.core.utils.ToastUtils;

import com.blankj.utilcode.util.ToastUtils;

import butterknife.ButterKnife;

Expand All @@ -22,6 +23,9 @@ public abstract class BaseCoreActivity extends AppCompatActivity implements View
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// if(savedInstanceState!=null){
// String name=savedInstanceState.getString("recover");
// }
//隐藏标题栏以及状态栏
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Expand All @@ -48,7 +52,7 @@ protected boolean needLogin() {
}

public void showToast(String msg) {
ToastUtils.show(msg);
ToastUtils.showShort(msg);
}

public void showProgress(String msg) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ protected void initData() {
protected abstract int getLayoutId();

protected abstract void initView();

}
Loading

0 comments on commit dd9bdc1

Please sign in to comment.