Skip to content

Commit

Permalink
// 第三次重构(first commit)
Browse files Browse the repository at this point in the history
  • Loading branch information
razerdp committed Jul 30, 2019
1 parent cbbe4bc commit 60b8b53
Show file tree
Hide file tree
Showing 115 changed files with 6,212 additions and 172 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ FriendCircle
【简略更新日志】
---

* 2019/07/30
* 第三次初步重构。

* 2019/07/23
* 准备开始第三轮重构

Expand Down
18 changes: 18 additions & 0 deletions README_REFACTOR.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
朋友圈工程第三次重构记录

### 2019/07/30

第三次组件化大致结构:

基类lib
ui类库uilib
通用类common + network
路由router
各个组件
组件私有application

51 changes: 1 addition & 50 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,13 @@ android {

defaultConfig {
applicationId "razerdp.friendcircle"
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName

renderscriptTargetApi 27
renderscriptTargetApi 18
renderscriptSupportModeEnabled true

if (isModule.toBoolean()) {
buildConfigField 'boolean', 'isModule', 'true'
} else {
buildConfigField 'boolean', 'isModule', 'false'
}

javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

//jni
sourceSets {
main {
jniLibs.srcDirs = ['libs']
jni.srcDirs = [] //disable automatic ndk-build call
}

}

lintOptions {
abortOnError false
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
//图片选择模块尚未完成,所以暂时不需要分开依赖
if (!isModule.toBoolean()) {
implementation project(':circle_base_library')
implementation project(':circle_base_ui')
implementation project(':circle_photoselect')
implementation project(':circle_publish')
annotationProcessor rootProject.ext.dependencies.arouter_compiler

} else {
implementation project(':circle_base_library')
implementation project(':circle_base_ui')
implementation project(':circle_common')
}

}
10 changes: 0 additions & 10 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<application
android:name=".app.FriendCircleApp"
Expand Down
73 changes: 69 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
}
}

Expand All @@ -32,3 +29,71 @@ allprojects {
task clean(type: Delete) {
delete rootProject.buildDir
}

//子项目配置,所有子项目的gradle配置将会在这里完成,子项目gradle仅保留最基本的元素即可
subprojects { project ->
afterEvaluate {
//配置android通用属性
if (project.hasProperty("android")) {
android {
compileSdkVersion rootProject.ext.android.compileSdkVersion

defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.android.versionCode
versionName rootProject.ext.android.versionName
}

lintOptions {
abortOnError false
}
}
}

//对library进行配置
if (project.plugins.hasPlugin('com.android.library')) {
android {
buildTypes {
debug {
minifyEnabled false
consumerProguardFiles 'proguard-rules.pro'
}
release {
minifyEnabled true
consumerProguardFiles 'proguard-rules.pro'
}
}
}
} else if (project.plugins.hasPlugin('com.android.application')) {
//对application工程配置混淆
android {
buildTypes {
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
shrinkResources true
zipAlignEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jniLibs.srcDirs = ['libs']
jni.srcDirs = [] //disable automatic ndk-build call
}
}

dexOptions {
javaMaxHeapSize '4g'
jumboMode true
}
}
}

}
}
39 changes: 1 addition & 38 deletions circle_base_library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,35 +1,5 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion rootProject.ext.android.compileSdkVersion

defaultConfig {
minSdkVersion rootProject.ext.android.minSdkVersion
targetSdkVersion rootProject.ext.android.targetSdkVersion
versionCode rootProject.ext.baselib.versionCode
versionName rootProject.ext.baselib.versionName

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
javaCompileOptions {
annotationProcessorOptions {
arguments = [AROUTER_MODULE_NAME: project.getName()]
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
resValue("string", "PORT_NUMBER", "8083")
}
}
lintOptions {
abortOnError false
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
Expand All @@ -38,10 +8,6 @@ dependencies {

testImplementation 'junit:junit:4.12'

api rootProject.ext.dependencies.appcompat_v7
api rootProject.ext.dependencies.design
api rootProject.ext.dependencies.support_util

api 'com.github.razerdp:BasePopup:2.1.9'
//over scroller helper
api 'me.everything:overscroll-decor-android:1.0.4'
Expand Down Expand Up @@ -69,10 +35,7 @@ dependencies {
exclude group: 'glide-parent'
exclude group: 'com.squareup.okio'
}

//ARouter
api rootProject.ext.dependencies.arouter_api
annotationProcessor rootProject.ext.dependencies.arouter_compiler
//朋友圈九宫格控件
api 'com.github.razerdp:PhotoContents:1.4.5'
api 'org.apmem.tools:layouts:1.10@aar'
}
33 changes: 0 additions & 33 deletions circle_base_library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,2 @@
<resources>
<string name="app_name">BaseLibrary</string>

<!--other-->
<string name="format_time_year" formatted="false">%s年前</string>
<string name="format_time_month" formatted="false">%s个月前</string>
<string name="format_time_day" formatted="false">%s天前</string>
<string name="format_time_hour" formatted="false">%s小时前</string>
<string name="format_time_minute" formatted="false">%s分钟前</string>
<string name="format_time_sec">刚刚</string>


<!--权限-->
<string-array name="permissions">
<item>@string/permission_recode_audio_hint</item>
<item>@string/permission_get_accounts_hint</item>
<item>@string/permission_read_phone_hint</item>
<item>@string/permission_call_phone_hint</item>
<item>@string/permission_camera_hint</item>
<item>@string/permission_access_fine_location_hint</item>
<item>@string/permission_access_coarse_location_hint</item>
<item>@string/permission_read_external_hint</item>
<item>@string/permission_white_external_hint</item>
</string-array>

<string name="permission_get_accounts_hint">没有此权限,无法开启这个功能。\n请手动开启权限:\n【PERMISSION_GET_ACCOUNTS】</string>
<string name="permission_read_phone_hint">没有此权限,无法开启这个功能。\n请手动开启权限:\n【PERMISSION_READ_PHONE_STATE】</string>
<string name="permission_call_phone_hint">没有此权限,无法开启这个功能。\n请手动开启权限:\n【PERMISSION_CALL_PHONE】</string>
<string name="permission_camera_hint">没有此权限,无法开启这个功能。\n请手动开启权限:\n【PERMISSION_CAMERA】</string>
<string name="permission_access_fine_location_hint">没有此权限,无法开启这个功能。\n请手动开启权限:\n【PERMISSION_ACCESS_FINE_LOCATION】</string>
<string name="permission_access_coarse_location_hint">没有此权限,无法开启这个功能。\n请手动开启权限:\n【PERMISSION_ACCESS_COARSE_LOCATION】</string>
<string name="permission_read_external_hint">没有此权限,无法开启这个功能。\n请手动开启权限:\n【PERMISSION_READ_EXTERNAL_STORAGE】</string>
<string name="permission_white_external_hint">没有此权限,无法开启这个功能。\n请手动开启权限:\n【PERMISSION_WRITE_EXTERNAL_STORAGE】</string>
<string name="permission_recode_audio_hint">没有此权限,无法开启这个功能。\n请手动开启权限:\n【PERMISSION_RECORD_AUDIO】</string>
</resources>
1 change: 1 addition & 0 deletions common/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
8 changes: 8 additions & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apply plugin: 'com.android.library'


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

api project(':uilib')
}
21 changes: 21 additions & 0 deletions common/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.razerdp.github.common;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("com.razerdp.github.common.test", appContext.getPackageName());
}
}
17 changes: 17 additions & 0 deletions common/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<manifest package="com.razerdp.github.common"
xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>



</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.razerdp.github.common.base;

import android.content.Intent;

import com.razerdp.github.lib.base.BaseLibActivity;

/**
* Created by 大灯泡 on 2019/7/30.
*
* app用的activity
*/
public class BaseAppActivity extends BaseLibActivity {
@Override
public void onHandleIntent(Intent intent) {

}
}
Loading

0 comments on commit 60b8b53

Please sign in to comment.