Skip to content

Commit

Permalink
集成第三方登录分享并进行抽取隔离,新增界面状态布局(空数据、请求异常、网络异常)、集成 EventBus Apt 插件、新增常用界面模板(…
Browse files Browse the repository at this point in the history
…个人资料、校验手机、重置手机、查看大图)、新增两个对话框(更新对话框、分享对话框)
  • Loading branch information
880634 committed May 7, 2019
1 parent 436af49 commit fe7162d
Show file tree
Hide file tree
Showing 239 changed files with 5,551 additions and 1,154 deletions.
Binary file modified AndroidProject.apk
Binary file not shown.
2 changes: 0 additions & 2 deletions ProjectDetails.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

* widget:自定义一些精品的 View,不集成任何框架

* umeng:集成友盟 SDK 相关文件,不集成任何框架

> 本项目基于最新的 Android SDK 28 编译,[点击此处查看配置](build.gradle),最低安装要求为 Android 4.0
> 其中 Android Studio 的版本为3.2,Gradle的版本为 4.4
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@

![](picture/25.png)

![](picture/26.png)

![](picture/27.png)

![](picture/28.png)

![](picture/29.png)

![](picture/30.png)

![](picture/31.png)

#### 集成框架

* 权限请求框架:[https://github.com/getActivity/XXPermissions](https://github.com/getActivity/XXPermissions)
Expand All @@ -74,6 +86,8 @@

* 圆形ImageView:[https://github.com/hdodenhof/CircleImageView](https://github.com/hdodenhof/CircleImageView)

* 缩放ImageView:[https://github.com/chrisbanes/PhotoView](https://github.com/chrisbanes/PhotoView)

* ButterKnife注解:[https://github.com/JakeWharton/butterknife](https://github.com/JakeWharton/butterknife)

#### 模板项目亮点,[查看详细](ProjectDetails.md)
Expand Down
116 changes: 81 additions & 35 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

// 使用 JDK 1.8
// compileOptions {
// targetCompatibility JavaVersion.VERSION_1_8
// sourceCompatibility JavaVersion.VERSION_1_8
// }

defaultConfig {
// 无痛修改包名:https://www.jianshu.com/p/17327e191d2e
applicationId "com.hjq.demo"
Expand All @@ -11,6 +18,16 @@ android {
versionCode 10
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

// 混淆配置
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-app.pro'

javaCompileOptions {
annotationProcessorOptions {
// EventBus Apt 索引类生成位置
arguments = [ eventBusIndex : applicationId + '.MyEventBusIndex' ]
}
}
}

//APK 签名的那些事:https://www.jianshu.com/p/a1f8e5896aa2
Expand Down Expand Up @@ -39,33 +56,29 @@ android {
zipAlignEnabled true
// 设置混淆
minifyEnabled true
//加载默认混淆配置涵
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// 正式环境签名
//signingConfig signingConfigs.release
}

debug {
//ZipAlign优化
// ZipAlign优化
zipAlignEnabled false
//设置混淆
// 设置混淆
minifyEnabled false
//加载默认混淆配置涵
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// 开发环境签名
//signingConfig signingConfigs.debug
}
}

flavorDimensions "default"//这个名字貌似随便取,也可以有多个,总之一定要有
//多渠道打包
flavorDimensions "default" // 这个名字貌似随便取,也可以有多个,总之一定要有
// 友盟多渠道打包
productFlavors {
kuan {} //酷安
tencent {} //应用宝
baidu {} //百度
xiaomi {} //小米
huawei {} //华为
google {} //谷歌
kuan {} // 酷安
tencent {} // 应用宝
baidu {} // 百度
xiaomi {} // 小米
huawei {} // 华为
google {} // 谷歌

productFlavors.all { flavor ->
flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name]
Expand All @@ -78,69 +91,102 @@ android {
jniLibs.srcDirs = ['libs']
}
}

// 执行配置
applicationVariants.all { variant ->

// Apk 输出配置
variant.outputs.all { output ->
def appName = "AndroidProject"
if (variant.buildType.name == 'debug') {
outputFileName = appName + '_v' + versionName + '_' + variant.buildType.name + '.apk'
} else {
outputFileName = appName + '_v' + versionName + '_' + new Date().format("yyyyMMdd") + '_' + variant.productFlavors[0].name + '_' + variant.buildType.name + '.apk'
}
}

// AndroidManifest 输出配置
variant.outputs[0].processManifest.doLast {
def manifestFile = "${manifestOutputDirectory}/AndroidManifest.xml"
def updatedContent = new File(manifestFile).getText('UTF-8')
.replaceAll("UMENG_APPKEY_VALUE", "5cb16d93570df399fd0014e2") // 友盟 AppKey
.replaceAll("QQ_APPID_VALUE", "100424468") // QQ AppId
.replaceAll("QQ_APPKEY_VALUE", "c7394704798a158208a74ab60104f0ba") // QQ Key
.replaceAll("WX_APPID_VALUE", "wxdc1e388c3822c80b") // 微信 AppId
.replaceAll("WX_APPKEY_VALUE", "3baf1193c85774b3fd9d18447d76cab0") // 微信 Key
.replaceAll("SN_APPID_VALUE", "3921700954") // 新浪 AppId
.replaceAll("SN_APPKEY_VALUE", "04b48b094faeb16683c32669824ebdad") // 新浪 Key
new File(manifestFile).write(updatedContent, 'UTF-8')
}
}
}

// api 与 implementation的区别:https://www.jianshu.com/p/8962d6ba936e
// api 与 implementation 的区别:https://www.jianshu.com/p/8962d6ba936e
dependencies {
// 依赖 libs 目录下所有 Jar
// 依赖 libs 目录下所有 jar
implementation fileTree(include: ['*.jar'], dir: 'libs')
// 依赖 libs 目录下所有 aar 包
implementation fileTree(include: ['*.aar'], dir: 'libs')

// 基础库(不包任何第三方框架)
implementation project(':base')
// 自定义 View
implementation project(':widget')
// 图片加载封装
// Dialog 封装
implementation project(':dialog')
// Glide 隔离
implementation project(':image')
// 友盟
// 友盟隔离
implementation project(':umeng')
// Dialog
implementation project(':dialog')

// 示例:添加一个 aar 包
// implementation(name: 'library', ext: 'aar')

implementation "com.android.support:appcompat-v7:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:design:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:support-v4:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support:cardview-v7:$rootProject.ext.supportLibraryVersion"
implementation "com.android.support.constraint:constraint-layout:$rootProject.ext.constraintLayoutVersion"

// Dex分包,解决 65k 问题
// Dex分包,解决 64k 问题
implementation 'com.android.support:multidex:1.0.3'

// ButterKnife注解库:https://github.com/JakeWharton/butterknife
// ButterKnife 注解库:https://github.com/JakeWharton/butterknife
implementation 'com.jakewharton:butterknife:9.0.0-rc1'
annotationProcessor 'com.jakewharton:butterknife-compiler:9.0.0-rc1'

// EventBus 事件总线
implementation "org.greenrobot:eventbus:3.1.1"
annotationProcessor 'org.greenrobot:eventbus-annotation-processor:3.1.1'

// 状态栏沉浸:https://github.com/gyf-dev/ImmersionBar
implementation 'com.gyf.immersionbar:immersionbar:2.3.3'
// 侧滑功能:https://github.com/bingoogolapple/BGASwipeBackLayout-Android
implementation 'cn.bingoogolapple:bga-swipebacklayout:1.2.0'

// 权限请求框架:https://github.com/getActivity/XXPermissions
implementation 'com.hjq:xxpermissions:latest.integration'
implementation 'com.hjq:xxpermissions:5.5'
// 标题栏:https://github.com/getActivity/TitleBar
implementation 'com.hjq:titlebar:latest.integration'
implementation 'com.hjq:titlebar:5.0'
// 吐司工具类:https://github.com/getActivity/ToastUtils
implementation 'com.hjq:toast:latest.integration'
implementation 'com.hjq:toast:6.0'

// 圆形的ImageView:https://github.com/hdodenhof/CircleImageView
implementation 'de.hdodenhof:circleimageview:2.2.0'

// 支持放大缩放的ImageView:https://github.com/chrisbanes/PhotoView
implementation 'com.github.chrisbanes:PhotoView:2.0.0'

// 布局优化:https://github.com/getActivity/Layouts
// 分割线:https://github.com/getActivity/RecyclerItemDecoration
// 国际化:https://github.com/getActivity/MultiLanguages
// 悬浮窗:https://github.com/getActivity/XToast
// 网络请求:https://github.com/zhou-you/RxEasyHttp
// RxJava: https://github.com/ReactiveX/RxAndroid
// RecyclerView:https://github.com/CymChad/BaseRecyclerViewAdapterHelper
// 上拉刷新下拉加载:https://github.com/scwang90/SmartRefreshLayout
// 工具类:https://github.com/Blankj/AndroidUtilCode
// 图片选择:https://github.com/zhihu/Matisse
// 上拉下拉:https://github.com/bingoogolapple/BGARefreshLayout-Android
// 轮播图:https://github.com/bingoogolapple/BGABanner-Android
// 二维码:https://github.com/bingoogolapple/BGAQRCode-Android
// 第三方支付:https://github.com/getActivity/RxPay
// Log 打印:https://github.com/JakeWharton/timber
}

repositories {
flatDir {
dirs 'libs' //就是你放aar的目录地址
}
// 重要数据存储:https://github.com/Tencent/MMKV
}
125 changes: 52 additions & 73 deletions app/proguard-rules.pro → app/proguard-app.pro
Original file line number Diff line number Diff line change
@@ -1,73 +1,52 @@
# 混淆保护自己项目的部分代码以及引用的第三方jar包
#-libraryjars libs/umeng-analytics-v5.2.4.jar

# 标题栏框架
-keep class com.hjq.bar.** {*;}

# 吐司框架
-keep class com.hjq.toast.** {*;}

# 权限请求框架
-keep class com.hjq.permissions.** {*;}

# 友盟
-keep class com.umeng.**{*;}

# 支付宝
-keep class com.alipay.android.app.IAliPay{*;}
-keep class com.alipay.android.app.IAlixPay{*;}
-keep class com.alipay.android.app.IRemoteServiceCallback{*;}
-keep class com.alipay.android.app.lib.ResourceMap{*;}

#移除log 测试了下没有用还是建议自己定义一个开关控制是否输出日志
#-assumenosideeffects class android.util.Log {
# public static boolean isLoggable(java.lang.String, int);
# public static int v(...);
# public static int i(...);
# public static int w(...);
# public static int d(...);
# public static int e(...);
#}

# webview + js
-keepattributes *JavascriptInterface*
# keep 使用 webview 的类
-keepclassmembers class com.veidy.activity.WebViewActivity {
public *;
}
# keep 使用 webview 的类的所有的内部类
-keepclassmembers class com.veidy.activity.WebViewActivity$*{
*;
}

# 不混淆WebChromeClient中的openFileChooser方法
-keepclassmembers class * extends android.webkit.WebChromeClient{
public void openFileChooser(...);
}

#极光推送
-dontoptimize
-dontpreverify

-dontwarn cn.jpush.**
-keep class cn.jpush.** { *; }
-keep class * extends cn.jpush.android.helpers.JPushMessageReceiver { *; }

-dontwarn cn.jiguang.**
-keep class cn.jiguang.** { *; }

########################################################

# 友盟统计
-keep class com.umeng.** {*;}
-keepclassmembers class * {
public <init> (org.json.JSONObject);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}

-keep public class [您的应用包名].R$*{
public static final int *;
}
# 忽略警告
#-ignorewarning

# 混淆保护自己项目的部分代码以及引用的第三方jar包
#-libraryjars libs/umeng-analytics-v5.2.4.jar

-keep class com.github.chrisbanes.photoview.** {*;}

# 标题栏框架
-keep class com.hjq.bar.** {*;}

# 吐司框架
-keep class com.hjq.toast.** {*;}

# 权限请求框架
-keep class com.hjq.permissions.** {*;}

#移除log 测试了下没有用还是建议自己定义一个开关控制是否输出日志
#-assumenosideeffects class android.util.Log {
# public static boolean isLoggable(java.lang.String, int);
# public static int v(...);
# public static int i(...);
# public static int w(...);
# public static int d(...);
# public static int e(...);
#}

# webview + js
-keepattributes *JavascriptInterface*
# keep 使用 webview 的类
-keepclassmembers class com.veidy.activity.WebViewActivity {
public *;
}
# keep 使用 webview 的类的所有的内部类
-keepclassmembers class com.veidy.activity.WebViewActivity$*{
*;
}

# 不混淆WebChromeClient中的openFileChooser方法
-keepclassmembers class * extends android.webkit.WebChromeClient{
public void openFileChooser(...);
}

# EventBus3
-keepattributes *Annotation*
-keepclassmembers class ** {
@org.greenrobot.eventbus.Subscribe <methods>;
}
-keep enum org.greenrobot.eventbus.ThreadMode { *; }
-keepclassmembers class * extends org.greenrobot.eventbus.util.ThrowableFailureEvent {
<init>(java.lang.Throwable);
}
Loading

0 comments on commit fe7162d

Please sign in to comment.