forked from tome34/frameDemoMo2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
208 changed files
with
40,758 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
apply from: "${rootProject.rootDir}/config.gradle" | ||
apply plugin: 'com.android.library' | ||
apply plugin: 'me.tatarka.retrolambda' //lambda配置 | ||
apply plugin: 'com.jakewharton.butterknife' | ||
|
||
android { | ||
//compileSdkVersion rootProject.ext.compileSdkVersion | ||
// buildToolsVersion rootProject.ext.buildToolsVersion | ||
project.ext.setDefaultConfig project | ||
defaultConfig { | ||
|
||
//Arouter路由配置 | ||
javaCompileOptions { | ||
annotationProcessorOptions { | ||
arguments = [moduleName: project.getName()] | ||
} | ||
} | ||
|
||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
//防止编译的时候oom、GC | ||
dexOptions { | ||
javaMaxHeapSize "4g" | ||
} | ||
|
||
//解决.9图问题 | ||
aaptOptions { | ||
cruncherEnabled = false | ||
useNewCruncher = false | ||
} | ||
|
||
} | ||
//项目依赖 | ||
dependencies { | ||
|
||
// 在项目中的libs中的所有的.jar结尾的文件,都是依赖 | ||
implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
//把implementation 用api代替,它是对外部公开的, 所有其他的module就不需要添加该依赖 | ||
api "com.android.support:appcompat-v7:$rootProject.androidSupportSdkVersion" | ||
api "com.android.support.constraint:constraint-layout:$rootProject.constraintLayoutVersion" | ||
api "com.android.support:cardview-v7:$rootProject.androidSupportSdkVersion" | ||
api "com.android.support:recyclerview-v7:$rootProject.androidSupportSdkVersion" | ||
api "com.android.support:support-v4:$rootProject.androidSupportSdkVersion" | ||
api "com.android.support:design:$rootProject.androidSupportSdkVersion" | ||
api 'com.android.support:support-annotations:24.0.0' | ||
|
||
|
||
/*implementation fileTree(dir: 'libs', include: ['*.jar']) | ||
implementation rootProject.ext.dependencies["appcompat_v7"] | ||
implementation rootProject.ext.dependencies["cardview-v7"] | ||
implementation rootProject.ext.dependencies["recyclerview-v7"] | ||
implementation rootProject.ext.dependencies["design"] | ||
implementation rootProject.ext.dependencies["constraint_layout"] | ||
implementation rootProject.ext.dependencies["support_annotations"] | ||
testImplementation rootProject.ext.dependencies["junit"] | ||
androidTestImplementation rootProject.ext.dependencies["runner"] | ||
androidTestImplementation rootProject.ext.dependencies["espresso_core"]*/ | ||
|
||
//MultiDex分包方法 | ||
api "com.android.support:multidex:$rootProject.multidex" | ||
|
||
//dagger annotationProcessor代替apt | ||
// api rootProject.ext.dependencies["dagger"] | ||
//annotationProcessor rootProject.ext.dependencies["dagger-compiler"] | ||
// api rootProject.ext.dependencies["javax-annotation"] | ||
//网络 | ||
api "com.squareup.retrofit2:retrofit:$rootProject.retrofitVersion" | ||
api "com.squareup.retrofit2:converter-gson:$rootProject.retrofitVersion" | ||
api "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofitVersion" | ||
api "io.reactivex.rxjava2:rxandroid:2.0.1" | ||
api "io.reactivex.rxjava2:rxjava:2.1.5" | ||
api "com.squareup.okhttp3:logging-interceptor:3.4.1" | ||
//黄油刀 | ||
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterknifeVersion" | ||
api "com.jakewharton:butterknife:$rootProject.butterknifeVersion" | ||
//日志 | ||
api "com.orhanobut:logger:2.1.1" | ||
//仿ios进度条 已抽取到lib中 | ||
//api rootProject.ext.dependencies["kprogresshud"] | ||
//6.0权限 | ||
api "com.github.hotchemi:permissionsdispatcher:3.0.1" | ||
//baseadapter RecyclerView万能适配器 | ||
api "com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.22" | ||
//图片 | ||
api "com.github.bumptech.glide:glide:4.5.0" | ||
//图片选择器 导致夜神在模拟器打不开 | ||
api "com.github.LuckSiege.PictureSelector:picture_library:v2.2.3" | ||
//图片缩放,View Pager中浏览库 | ||
api "com.github.chrisbanes.photoview:library:1.2.4" | ||
//仿ios 的PickerView时间选择器和条件选择器 | ||
api "com.contrarywind:Android-PickerView:3.2.7" | ||
//smartrefresh 上拉加载 | ||
api "com.scwang.smartrefresh:SmartRefreshLayout:1.0.5.1" | ||
api "com.scwang.smartrefresh:SmartRefreshHeader:1.0.5.1" | ||
|
||
//eventbus 发布/订阅事件总线 | ||
api "org.greenrobot:eventbus:3.0.0" | ||
//banner轮播图 | ||
api "com.youth.banner:banner:1.4.10" | ||
//Android屏幕适配 ,暂时不用 | ||
// api rootProject.ext.dependencies["autolayout"] | ||
//安卓调试神器-Stetho | ||
api "com.facebook.stetho:stetho:1.5.0" | ||
api "com.facebook.stetho:stetho-okhttp3:1.5.0" | ||
//bugly sdk | ||
api "com.tencent.bugly:crashreport_upgrade:latest.release" | ||
//节操播放器 | ||
api "fm.jiecao:jiecaovideoplayer:5.7" | ||
//greendao3 | ||
api "org.greenrobot:greendao:3.2.2" | ||
//二维码扫描 | ||
api 'cn.yipianfengye.android:zxing-library:2.2' | ||
//leakcanary-android | ||
debugApi "com.squareup.leakcanary:leakcanary-android:1.5.1" | ||
//release不检测 | ||
releaseApi "com.squareup.leakcanary:leakcanary-android-no-op:1.5.1" | ||
//沉浸式状态栏 | ||
api "com.gyf.barlibrary:barlibrary:2.3.0" | ||
|
||
//常用控件依赖包 | ||
api project(':otherLib:alertview') | ||
// api project(':otherLib:videocompressV2') | ||
api project(':otherLib:kprogresshud') | ||
api project(':otherLib:flowlayout-lib') | ||
api project(':otherLib:customview') | ||
//杀不死的小强,防止app崩溃 | ||
api project(':otherLib:cockroach-x') | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
26 changes: 26 additions & 0 deletions
26
baseLib/core/src/androidTest/java/com/example/tome/core/ExampleInstrumentedTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.example.tome.core; | ||
|
||
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() throws Exception { | ||
// Context of the app under test. | ||
Context appContext = InstrumentationRegistry.getTargetContext(); | ||
|
||
assertEquals("com.example.tome.component_base.test", appContext.getPackageName()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.example.tome.core" > | ||
|
||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> | ||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
<!--调整系统亮度 6.0危险权限--> | ||
<!--<uses-permission android:name="android.permission.WRITE_SETTINGS"/>--> | ||
<uses-permission android:name="android.permission.INTERNET"/> | ||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> | ||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
|
||
</application> | ||
</manifest> |
65 changes: 65 additions & 0 deletions
65
baseLib/core/src/main/java/com/example/tome/core/adapter/BaseFragmentAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.example.tome.core.adapter; | ||
|
||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
import android.support.v4.app.FragmentTransaction; | ||
|
||
import com.example.tome.core.util.ObjectUtils; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* 该类内的每一个生成的 Fragment 都将保存在内存之中, | ||
* 因此适用于那些相对静态的页,数量也比较少的那种; | ||
* 如果需要处理有很多页,并且数据动态性较大、占用内存较多的情况, | ||
* 应该使用FragmentStatePagerAdapter。 | ||
*/ | ||
public class BaseFragmentAdapter extends FragmentPagerAdapter { | ||
|
||
List<Fragment> fragmentList = new ArrayList<Fragment>(); | ||
private List<String> mTitles; | ||
|
||
public BaseFragmentAdapter(FragmentManager fm, List<Fragment> fragmentList) { | ||
super(fm); | ||
this.fragmentList = fragmentList; | ||
} | ||
|
||
public BaseFragmentAdapter(FragmentManager fm, List<Fragment> fragmentList, List<String> mTitles) { | ||
super(fm); | ||
this.mTitles = mTitles; | ||
setFragments(fm,fragmentList,mTitles); | ||
} | ||
//刷新fragment | ||
public void setFragments(FragmentManager fm, List<Fragment> fragments, List<String> mTitles) { | ||
this.mTitles = mTitles; | ||
if (this.fragmentList != null) { | ||
FragmentTransaction ft = fm.beginTransaction(); | ||
for (Fragment f : this.fragmentList) { | ||
ft.remove(f); | ||
} | ||
ft.commitAllowingStateLoss(); | ||
ft = null; | ||
fm.executePendingTransactions(); | ||
} | ||
this.fragmentList = fragments; | ||
notifyDataSetChanged(); | ||
} | ||
|
||
@Override | ||
public CharSequence getPageTitle(int position) { | ||
return !ObjectUtils.isEmpty(mTitles) ? mTitles.get(position) : ""; | ||
} | ||
|
||
@Override | ||
public Fragment getItem(int position) { | ||
return fragmentList.get(position); | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return fragmentList.size(); | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
baseLib/core/src/main/java/com/example/tome/core/adapter/BaseFragmentStateAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.example.tome.core.adapter; | ||
|
||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v4.app.FragmentStatePagerAdapter; | ||
|
||
import com.example.tome.core.util.ObjectUtils; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* FragmentStatePagerAdapter 和前面的 FragmentPagerAdapter 一样,是继承子 PagerAdapter。 | ||
* 但和 FragmentPagerAdapter 不一样的是, | ||
* 正如其类名中的 'State' 所表明的含义一样, | ||
* 该 PagerAdapter 的实现将只保留当前页面, | ||
* 当页面离开视线后,就会被消除,释放其资源; | ||
* 而在页面需要显示时,生成新的页面(就像 ListView 的实现一样)。 | ||
* 这么实现的好处就是当拥有大量的页面时,不必在内存中占用大量的内存。 | ||
*/ | ||
public class BaseFragmentStateAdapter extends FragmentStatePagerAdapter { | ||
|
||
List<Fragment> fragmentList = new ArrayList<Fragment>(); | ||
private List<String> mTitles; | ||
|
||
public BaseFragmentStateAdapter(FragmentManager fm, List<Fragment> fragmentList) { | ||
super(fm); | ||
this.fragmentList = fragmentList; | ||
} | ||
|
||
public BaseFragmentStateAdapter(FragmentManager fm, List<Fragment> fragmentList, List<String> mTitles) { | ||
super(fm); | ||
this.mTitles = mTitles; | ||
this.fragmentList = fragmentList; | ||
} | ||
@Override | ||
public CharSequence getPageTitle(int position) { | ||
return !ObjectUtils.isEmpty(mTitles) ? mTitles.get(position) : ""; | ||
} | ||
|
||
@Override | ||
public Fragment getItem(int position) { | ||
return fragmentList.get(position); | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return fragmentList.size(); | ||
} | ||
|
||
} |
37 changes: 37 additions & 0 deletions
37
baseLib/core/src/main/java/com/example/tome/core/adapter/BaseViewPagerAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.example.tome.core.adapter; | ||
|
||
import android.support.v4.app.Fragment; | ||
import android.support.v4.app.FragmentManager; | ||
import android.support.v4.app.FragmentPagerAdapter; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
/** | ||
* Created by bruce on 2016/11/1. | ||
* BaseViewPagerAdapter | ||
*/ | ||
|
||
public class BaseViewPagerAdapter extends FragmentPagerAdapter { | ||
|
||
private final List<Fragment> mFragmentList = new ArrayList<>(); | ||
|
||
public BaseViewPagerAdapter(FragmentManager manager) { | ||
super(manager); | ||
} | ||
|
||
@Override | ||
public Fragment getItem(int position) { | ||
return mFragmentList.get(position); | ||
} | ||
|
||
@Override | ||
public int getCount() { | ||
return mFragmentList.size(); | ||
} | ||
|
||
public void addFragment(Fragment fragment) { | ||
mFragmentList.add(fragment); | ||
} | ||
|
||
} |
Oops, something went wrong.