Commit e3b05a97e238483a3691ac5d9f25af8608d5eb32
1 parent
8a757481
Subcontract processing, add MultiDexApplication
Showing
6 changed files
with
47 additions
and
10 deletions
cnlive/build.gradle
| @@ -35,6 +35,8 @@ android { | @@ -35,6 +35,8 @@ android { | ||
| 35 | 35 | ||
| 36 | dependencies { | 36 | dependencies { |
| 37 | compile fileTree(include: ['*.jar'], dir: 'libs') | 37 | compile fileTree(include: ['*.jar'], dir: 'libs') |
| 38 | + //分包 | ||
| 39 | + compile 'com.android.support:multidex:1.0.1' | ||
| 38 | //RecyclerView 需要支持库 ,打包时已取消对其发布 | 40 | //RecyclerView 需要支持库 ,打包时已取消对其发布 |
| 39 | compile 'com.android.support:recyclerview-v7:26.+' | 41 | compile 'com.android.support:recyclerview-v7:26.+' |
| 40 | //MVP | 42 | //MVP |
| @@ -75,7 +77,7 @@ ext { | @@ -75,7 +77,7 @@ ext { | ||
| 75 | siteUrl = 'http://bj.gitlab.cnlive.com/cnlive-team/CNVideoDemo' | 77 | siteUrl = 'http://bj.gitlab.cnlive.com/cnlive-team/CNVideoDemo' |
| 76 | gitUrl = 'http://bj.gitlab.cnlive.com/cnlive-team/CNVideoDemo.git' | 78 | gitUrl = 'http://bj.gitlab.cnlive.com/cnlive-team/CNVideoDemo.git' |
| 77 | 79 | ||
| 78 | - libraryVersion = '0.2.4' | 80 | + libraryVersion = '0.2.5' |
| 79 | 81 | ||
| 80 | developerId = 'CNlive' | 82 | developerId = 'CNlive' |
| 81 | developerName = 'Granzon' | 83 | developerName = 'Granzon' |
cnlive/src/main/java/com/cnlive/libs/base/application/AppConfig.java
0 → 100644
| 1 | +package com.cnlive.libs.base.application; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * Created by xiansong on 2017/9/22. | ||
| 5 | + */ | ||
| 6 | + | ||
| 7 | +public class AppConfig { | ||
| 8 | + private static boolean debug = false; | ||
| 9 | + | ||
| 10 | + public static boolean isDebug() { | ||
| 11 | + return debug; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + protected static void setDebug(boolean debug) { | ||
| 15 | + AppConfig.debug = debug; | ||
| 16 | + } | ||
| 17 | +} |
cnlive/src/main/java/com/cnlive/libs/base/application/Application.java
| @@ -8,15 +8,11 @@ import android.content.pm.ApplicationInfo; | @@ -8,15 +8,11 @@ import android.content.pm.ApplicationInfo; | ||
| 8 | 8 | ||
| 9 | public class Application extends android.app.Application { | 9 | public class Application extends android.app.Application { |
| 10 | 10 | ||
| 11 | - private static boolean debug = false; | ||
| 12 | 11 | ||
| 13 | @Override | 12 | @Override |
| 14 | public void onCreate() { | 13 | public void onCreate() { |
| 15 | super.onCreate(); | 14 | super.onCreate(); |
| 16 | - debug = (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; | 15 | + AppConfig.setDebug((getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0); |
| 17 | } | 16 | } |
| 18 | 17 | ||
| 19 | - public static boolean isDebug() { | ||
| 20 | - return debug; | ||
| 21 | - } | ||
| 22 | } | 18 | } |
cnlive/src/main/java/com/cnlive/libs/base/application/MultiDexApplication.java
0 → 100644
| 1 | +package com.cnlive.libs.base.application; | ||
| 2 | + | ||
| 3 | +import android.content.pm.ApplicationInfo; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * Created by xiansong on 2017/9/22. | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +public class MultiDexApplication extends android.support.multidex.MultiDexApplication { | ||
| 10 | + | ||
| 11 | + private static boolean debug = false; | ||
| 12 | + | ||
| 13 | + @Override | ||
| 14 | + public void onCreate() { | ||
| 15 | + super.onCreate(); | ||
| 16 | + debug = (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public static boolean isDebug() { | ||
| 20 | + return debug; | ||
| 21 | + } | ||
| 22 | +} |
cnlive/src/main/java/com/cnlive/libs/base/data/network/RetrofitUtil.java
| @@ -3,7 +3,7 @@ package com.cnlive.libs.base.data.network; | @@ -3,7 +3,7 @@ package com.cnlive.libs.base.data.network; | ||
| 3 | 3 | ||
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | 5 | ||
| 6 | -import com.cnlive.libs.base.application.Application; | 6 | +import com.cnlive.libs.base.application.AppConfig; |
| 7 | import com.cnlive.libs.base.util.LogUtil; | 7 | import com.cnlive.libs.base.util.LogUtil; |
| 8 | 8 | ||
| 9 | import java.security.KeyStore; | 9 | import java.security.KeyStore; |
| @@ -24,7 +24,7 @@ import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; | @@ -24,7 +24,7 @@ import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; | ||
| 24 | import retrofit2.converter.gson.GsonConverterFactory; | 24 | import retrofit2.converter.gson.GsonConverterFactory; |
| 25 | 25 | ||
| 26 | public class RetrofitUtil { | 26 | public class RetrofitUtil { |
| 27 | - private static boolean DEBUG = Application.isDebug(); | 27 | + private static boolean DEBUG = AppConfig.isDebug(); |
| 28 | 28 | ||
| 29 | private static final String TAG = "RetrofitUtil"; | 29 | private static final String TAG = "RetrofitUtil"; |
| 30 | 30 |
cnlive/src/main/java/com/cnlive/libs/base/util/LogUtil.java
| @@ -2,14 +2,14 @@ package com.cnlive.libs.base.util; | @@ -2,14 +2,14 @@ package com.cnlive.libs.base.util; | ||
| 2 | 2 | ||
| 3 | import android.util.Log; | 3 | import android.util.Log; |
| 4 | 4 | ||
| 5 | -import com.cnlive.libs.base.application.Application; | 5 | +import com.cnlive.libs.base.application.AppConfig; |
| 6 | 6 | ||
| 7 | /** | 7 | /** |
| 8 | * Log output tool | 8 | * Log output tool |
| 9 | */ | 9 | */ |
| 10 | public class LogUtil { | 10 | public class LogUtil { |
| 11 | 11 | ||
| 12 | - private static boolean ENABLED = Application.isDebug(); | 12 | + private static boolean ENABLED = AppConfig.isDebug(); |
| 13 | 13 | ||
| 14 | public static void setDebug(boolean debug){ | 14 | public static void setDebug(boolean debug){ |
| 15 | LogUtil.ENABLED = debug; | 15 | LogUtil.ENABLED = debug; |