├── .gitignore ├── .idea └── encodings.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── senon │ │ └── xfhmoudel │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── senon │ │ │ └── xfhmoudel │ │ │ ├── App.java │ │ │ ├── FragmentHomeActivity.java │ │ │ ├── SplashActivity.java │ │ │ └── TestActivity.java │ └── res │ │ ├── drawable │ │ ├── ic_launcher_background.xml │ │ └── shape_splash_timer.xml │ │ ├── layout │ │ ├── activity_fragment_home.xml │ │ ├── activity_splash.xml │ │ └── activity_test.xml │ │ ├── mipmap-xhdpi │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher_round.png │ │ └── splash_appname.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── senon │ └── xfhmoudel │ └── ExampleUnitTest.java ├── build.gradle ├── dependencies.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib_common ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── senon │ │ └── lib_common │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── senon │ │ │ └── lib_common │ │ │ ├── AppConfig.java │ │ │ ├── ComUtil.java │ │ │ ├── ConstantArouter.java │ │ │ ├── ConstantLoginArouter.java │ │ │ ├── adapter │ │ │ ├── CommonAdapter.java │ │ │ ├── CommonHolder.java │ │ │ ├── RecycleHolder.java │ │ │ └── RecyclerAdapter.java │ │ │ ├── api │ │ │ └── BaseApi.java │ │ │ ├── base │ │ │ ├── BaseActivity.java │ │ │ ├── BaseAppDeletage.java │ │ │ ├── BaseApplication.java │ │ │ ├── BaseFragment.java │ │ │ ├── BaseLazyFragment.java │ │ │ ├── BaseNestingLazyFragment.java │ │ │ ├── BasePresenter.java │ │ │ ├── BaseResponse.java │ │ │ └── BaseViewImp.java │ │ │ ├── bean │ │ │ ├── Banner.java │ │ │ ├── CollectionArticle.java │ │ │ ├── HomeArticle.java │ │ │ ├── KnowledgeSysArticle.java │ │ │ ├── KnowledgeSystem.java │ │ │ ├── Login.java │ │ │ ├── ProjectArticle.java │ │ │ ├── WXarticle.java │ │ │ └── WXchapters.java │ │ │ ├── common │ │ │ ├── contract │ │ │ │ ├── LoginContract.java │ │ │ │ └── WebviewContract.java │ │ │ ├── presenter │ │ │ │ ├── LoginPresenter.java │ │ │ │ └── WebviewPresenter.java │ │ │ └── ui │ │ │ │ ├── Common_LoginActivity.java │ │ │ │ ├── Common_RegisterActivity.java │ │ │ │ └── Common_WebviewActivity.java │ │ │ ├── net │ │ │ ├── RequestInterceptor.java │ │ │ ├── ServerUtils.java │ │ │ ├── callback │ │ │ │ ├── ErrorListener.java │ │ │ │ ├── RequestCallback.java │ │ │ │ └── RxErrorHandler.java │ │ │ ├── cookies │ │ │ │ ├── CookiesManager.java │ │ │ │ ├── OkHttpCookies.java │ │ │ │ └── PersistentCookieStore.java │ │ │ └── progress │ │ │ │ ├── ProgressCancelListener.java │ │ │ │ └── ProgressDialogHandler.java │ │ │ ├── service │ │ │ └── InitializeService.java │ │ │ └── utils │ │ │ ├── ACache.java │ │ │ ├── BaseEvent.java │ │ │ ├── ConstantUtils.java │ │ │ ├── LogUtils.java │ │ │ ├── MD5Utils.java │ │ │ ├── PreferenceTool.java │ │ │ ├── RetryWithDelay.java │ │ │ ├── RxUtils.java │ │ │ ├── StatusBarUtils.java │ │ │ └── ToastUtil.java │ └── res │ │ ├── drawable │ │ ├── head.png │ │ ├── login_bg.png │ │ ├── login_password.png │ │ ├── login_phone.png │ │ ├── logo.png │ │ ├── news_renovate.png │ │ ├── register_bg_border_1.png │ │ ├── register_border.xml │ │ ├── register_border_2.xml │ │ ├── register_border_9.xml │ │ ├── shape_gradient.xml │ │ ├── style_progress_bar.xml │ │ └── toast_shape.xml │ │ ├── layout │ │ ├── activity_common__login.xml │ │ ├── activity_common__register.xml │ │ ├── activity_common__webview.xml │ │ ├── layout_fragmhome_tab.xml │ │ ├── layout_toolbar.xml │ │ └── toast_layout.xml │ │ ├── mipmap-xxhdpi │ │ ├── back_black.png │ │ ├── ic_logo.png │ │ ├── ic_right.png │ │ ├── ic_tabbar_discover.png │ │ ├── ic_tabbar_discoverhl.png │ │ ├── ic_tabbar_mainframe.png │ │ ├── ic_tabbar_mainframehl.png │ │ ├── ic_tabbar_me.png │ │ ├── ic_tabbar_mehl.png │ │ ├── ic_tabbar_order.png │ │ ├── ic_tabbar_orderhl.png │ │ ├── news_renovate.png │ │ └── splash_bg.jpg │ │ └── values │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── senon │ └── lib_common │ └── ExampleUnitTest.java ├── lib_opensource ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── senon │ │ └── lib_opensource │ │ └── ExampleInstrumentedTest.java │ ├── main │ └── AndroidManifest.xml │ └── test │ └── java │ └── com │ └── senon │ └── lib_opensource │ └── ExampleUnitTest.java ├── module_art ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── senon │ │ └── module_art │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── debug │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── senon │ │ │ └── module_art │ │ │ ├── App_Art.java │ │ │ ├── MainActivity.java │ │ │ ├── SplashActivity.java │ │ │ ├── adapter │ │ │ └── ArtMainAdapter.java │ │ │ ├── contract │ │ │ └── ArtMainFragmentCon.java │ │ │ ├── fragment │ │ │ └── ArtMainFragment.java │ │ │ └── presenter │ │ │ └── ArtMainFragmentPre.java │ ├── release │ │ └── AndroidManifest.xml │ └── res │ │ ├── drawable │ │ ├── art_launcher_background.xml │ │ ├── art_shape_transp_con20.xml │ │ ├── art_shape_white_con30.xml │ │ └── art_shape_yellow_con20.xml │ │ ├── layout │ │ ├── art_activity_main.xml │ │ ├── art_activity_splash.xml │ │ ├── art_adapter_artmain_fragment_article.xml │ │ ├── art_adapter_artmain_fragment_head.xml │ │ ├── art_adapter_artmain_fragment_head_item.xml │ │ └── art_fragment_main.xml │ │ ├── mipmap-xhdpi │ │ └── art_ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ └── art_ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── senon │ └── module_art │ └── ExampleUnitTest.java ├── module_home ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── senon │ │ └── module_home │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── debug │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── senon │ │ │ └── module_home │ │ │ ├── App_Home.java │ │ │ ├── MainActivity.java │ │ │ ├── SplashActivity.java │ │ │ ├── activity │ │ │ ├── HomeArticleActivity.java │ │ │ └── HomeProjectActivity.java │ │ │ ├── adapter │ │ │ └── HomeMainAdapter.java │ │ │ ├── contract │ │ │ ├── HomeArticleActivityCon.java │ │ │ ├── HomeMainFragmentCon.java │ │ │ └── HomeProjectActivityCon.java │ │ │ ├── fragment │ │ │ └── HomeMainFragment.java │ │ │ └── presenter │ │ │ ├── HomeArticleActivityPre.java │ │ │ ├── HomeMainFragmentPre.java │ │ │ └── HomeProjectActivityPre.java │ ├── release │ │ └── AndroidManifest.xml │ └── res │ │ ├── drawable │ │ ├── home_ic_launcher_background.xml │ │ ├── home_shape_stro_red_con30.xml │ │ └── home_shape_white_con30.xml │ │ ├── layout │ │ ├── home_activity_home_article.xml │ │ ├── home_activity_home_project.xml │ │ ├── home_activity_main.xml │ │ ├── home_activity_splash.xml │ │ ├── home_adapter_homemain_fragment_article.xml │ │ ├── home_adapter_homemain_fragment_banneritem.xml │ │ ├── home_adapter_homemain_fragment_head.xml │ │ ├── home_adapter_homemain_fragment_project.xml │ │ └── home_fragment_main.xml │ │ ├── mipmap-xhdpi │ │ ├── home_ic_launcher.png │ │ └── home_ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── senon │ └── module_home │ └── ExampleUnitTest.java ├── module_life ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── senon │ │ └── module_life │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── debug │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── senon │ │ │ └── module_life │ │ │ ├── App_Life.java │ │ │ ├── MainActivity.java │ │ │ ├── SplashActivity.java │ │ │ ├── activity │ │ │ └── KnowledgeSystemActivity.java │ │ │ ├── contract │ │ │ ├── KnowledgeSysActivityCon.java │ │ │ └── LifeMainFragmentCon.java │ │ │ ├── fragment │ │ │ └── LifeMainFragment.java │ │ │ └── presenter │ │ │ ├── KnowledgeSysActivityPre.java │ │ │ └── LifeMainFragmentPre.java │ ├── release │ │ └── AndroidManifest.xml │ └── res │ │ ├── drawable │ │ ├── life_ic_launcher_background.xml │ │ ├── life_shape_gray_10.xml │ │ └── life_shape_white_con30.xml │ │ ├── layout │ │ ├── life_activity_home_article.xml │ │ ├── life_activity_main.xml │ │ ├── life_activity_splash.xml │ │ ├── life_adapter_knowledgesys_item.xml │ │ ├── life_adapter_lifemain_flowlayout_item.xml │ │ ├── life_adapter_lifemain_fragment.xml │ │ └── life_fragment_main.xml │ │ ├── mipmap-xhdpi │ │ ├── life_ic_launcher.png │ │ └── life_ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── senon │ └── module_life │ └── ExampleUnitTest.java ├── module_talent ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── senon │ │ └── module_talent │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── debug │ │ └── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── senon │ │ │ └── module_talent │ │ │ ├── App_Talent.java │ │ │ ├── MainActivity.java │ │ │ ├── activity │ │ │ ├── AboutActivity.java │ │ │ └── CollectionActivity.java │ │ │ ├── contract │ │ │ ├── CollectionActivityCon.java │ │ │ └── TalentMainFragmentCon.java │ │ │ ├── fragment │ │ │ └── TalentMainFragment.java │ │ │ └── presenter │ │ │ ├── CollectionActivityPre.java │ │ │ └── TalentMainFragmentPre.java │ ├── release │ │ └── AndroidManifest.xml │ └── res │ │ ├── drawable │ │ ├── talent_ic_launcher_background.xml │ │ └── talent_shape_white_con30.xml │ │ ├── layout │ │ ├── talent_activity_about.xml │ │ ├── talent_activity_collection.xml │ │ ├── talent_activity_main.xml │ │ ├── talent_adapter_collection.xml │ │ └── talent_fragment_main.xml │ │ ├── mipmap-xhdpi │ │ └── talent_ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── talent_conan.png │ │ ├── talent_ic_about.png │ │ ├── talent_ic_cache.png │ │ ├── talent_ic_collect.png │ │ ├── talent_ic_launcher_round.png │ │ ├── talent_ic_login.png │ │ └── talent_mainfragmbg.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── senon │ └── module_talent │ └── ExampleUnitTest.java ├── screenshot ├── main.png ├── main2.png ├── main3.png └── qrcode.png ├── senon.jks └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # WanAndroid 2 | 玩安卓http://www.wanandroid.com/ 客户端模块化设计app,包含MVP+Retrofit+Rxjava+Rxlifecycle+Glide+Eventbus+ARouter. 3 | 构建一个平面化、简而美的玩安卓app客户端。

4 | 如果不清楚如何将Android工程模块化,请看Android模块化使用 5 | 6 | 7 | # API 8 | app采用玩安卓开放api 9 | 10 | # 主要功能 11 | 首页:Banner
12 | 首页:最新博文(5条)、最新项目(5条)
13 | 体系:一级二级下面全部博文
14 | 公众号:所有公众号列表
15 | 公众号:某公众号下所有博文
16 | 个人中心:登录、退出、收藏、清除缓存
17 | 18 | # 屏幕截图 19 |
20 |
21 |

22 | 23 | # 子模块打包 24 | 工程采用的是模块化,如果想要单独跑或者打包各个子模块,那么请将gradle.properties改为
25 | isBuildModule=true

26 | 如果需要整体打包app,则
27 | isBuildModule=false
28 | 29 | # 三方轮子 30 | Rxjava
31 | RxAndroid
32 | Retrofit
33 | Okhttp
34 | ARouter
35 | Glide
36 | EventBus
37 | FlowLayout
38 | MZBannerView
39 | AndroidAutoSize
40 | HTextView
41 | CircleImageView
42 | LRecyclerView
43 | Sweetalertdialog
44 | Awesome-WanAndroid
45 | 46 | # APK下载 47 |
48 | 因为图方便,apk资源是放在leancloud上的,微信扫码下载不了,用手机浏览器扫码可下载。 49 | 50 | # 版本 51 | 52 |

V 1.0.1

53 | 1.修复各模块清单文件合并问题 54 | 55 |

V 1.0.0

56 | 1.第一版 57 | 58 | # Thanks 59 | 感谢以上所有开源框架。项目用于学习交流,如果你觉得本项目好,谢谢star哦! 60 | 61 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | signingConfigs { 5 | config { 6 | keyAlias 'senon' 7 | keyPassword '123456' 8 | storeFile file('../senon.jks') 9 | storePassword '123456' 10 | } 11 | } 12 | 13 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 14 | 15 | defaultConfig { 16 | applicationId "com.senon.xfhmoudel" 17 | 18 | minSdkVersion rootProject.ext.android["minSdkVersion"] 19 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 20 | versionCode rootProject.ext.android["versionCode"] 21 | versionName rootProject.ext.android["versionName"] 22 | 23 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 24 | 25 | javaCompileOptions { 26 | annotationProcessorOptions { 27 | includeCompileClasspath = true 28 | arguments = [AROUTER_MODULE_NAME: project.getName()] 29 | } 30 | } 31 | } 32 | buildTypes { 33 | release { 34 | minifyEnabled false 35 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 36 | } 37 | debug { 38 | minifyEnabled false 39 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 40 | signingConfig signingConfigs.config 41 | } 42 | } 43 | aaptOptions { 44 | cruncherEnabled = false 45 | } 46 | lintOptions { 47 | checkReleaseBuilds false 48 | abortOnError false 49 | } 50 | } 51 | 52 | dependencies { 53 | implementation fileTree(dir: 'libs', include: ['*.jar']) 54 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 55 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 56 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 57 | testImplementation rootProject.ext.dependencies["junit"] 58 | 59 | 60 | 61 | if (isBuildModule.toBoolean()) { 62 | implementation project(':lib_common') 63 | } else { 64 | implementation project(':module_home') 65 | implementation project(':module_life') 66 | implementation project(':module_art') 67 | implementation project(':module_talent') 68 | } 69 | annotationProcessor rootProject.ext.dependencies["butterknife-compiler"] 70 | annotationProcessor rootProject.ext.dependencies["router-compiler"] 71 | 72 | api rootProject.ext.dependencies["htextview-base"] 73 | api rootProject.ext.dependencies["htextview-fall"] 74 | 75 | } 76 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/senon/xfhmoudel/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.xfhmoudel; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.senon.xfhmoudel", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/senon/xfhmoudel/App.java: -------------------------------------------------------------------------------- 1 | package com.senon.xfhmoudel; 2 | 3 | import com.alibaba.android.arouter.launcher.ARouter; 4 | import com.senon.lib_common.base.BaseApplication; 5 | import com.senon.lib_common.utils.ConstantUtils; 6 | 7 | /** 8 | * 工程Application 9 | */ 10 | public class App extends BaseApplication { 11 | @Override 12 | public void onCreate() { 13 | super.onCreate(); 14 | 15 | initARouter(); 16 | } 17 | 18 | private void initARouter() { 19 | if (ConstantUtils.isAppDebug()) { 20 | //开启InstantRun之后,一定要在ARouter.init之前调用openDebug 21 | ARouter.openDebug(); 22 | ARouter.openLog(); 23 | } 24 | ARouter.init(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/senon/xfhmoudel/TestActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.xfhmoudel; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | 7 | import com.alibaba.android.arouter.facade.annotation.Route; 8 | import com.alibaba.android.arouter.launcher.ARouter; 9 | import com.senon.lib_common.ComUtil; 10 | import com.senon.lib_common.ConstantArouter; 11 | import com.senon.lib_common.ConstantLoginArouter; 12 | import com.senon.lib_common.utils.StatusBarUtils; 13 | 14 | /** 15 | * app 模块主页面 16 | */ 17 | @Route(path = ConstantLoginArouter.PATH_APP_MAINACTIVITY) 18 | public class TestActivity extends AppCompatActivity { 19 | 20 | @Override 21 | protected void onCreate(Bundle savedInstanceState) { 22 | super.onCreate(savedInstanceState); 23 | StatusBarUtils.with(this).init(); 24 | setContentView(R.layout.activity_test); 25 | ComUtil.changeStatusBarTextColor(this,true); 26 | 27 | } 28 | 29 | public void toA(View view){ 30 | // 1. 应用内简单的跳转(通过URL跳转在'进阶用法'中) 31 | // ARouter.getInstance().build(ConstantLoginArouter.PATH_FIRST_MAINACTIVITY).navigation(); 32 | 33 | // String curUrl = ConstantLoginArouter.getCurRouter(this.getClass().getSimpleName()); 34 | String curUrl = ConstantLoginArouter.getCurRouter(ConstantLoginArouter.PATH_HOME_MAINACTIVITY); 35 | ARouter.getInstance().build(ConstantLoginArouter.PATH_COMMON_LOGINACTIVITY)//指定跳到那个页面 36 | .withString("targetUrl",ConstantArouter.PATH_APP_FRAGMENTHOMEACTIVITY)//传入目标页面路由地址 可以在指定页面跳入到目标页面 37 | .navigation(); 38 | 39 | 40 | // Uri testUriMix = Uri.parse("router://com.senon.firstmoduel/firstmoduel/firstmainactivity"); 41 | // ARouter.getInstance().build(testUriMix) 42 | // .withString("key1", "value1") 43 | // .navigation(); 44 | } 45 | 46 | public void toB(View view){ 47 | ARouter.getInstance().build(ConstantArouter.PATH_APP_FRAGMENTHOMEACTIVITY) 48 | .navigation(); 49 | } 50 | } 51 | 52 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_splash_timer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fragment_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 20 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 20 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/splash_appname.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/app/src/main/res/mipmap-xxhdpi/splash_appname.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 玩安卓 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/test/java/com/senon/xfhmoudel/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.xfhmoudel; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | apply from: "dependencies.gradle" 3 | 4 | buildscript { 5 | 6 | repositories { 7 | google() 8 | jcenter() 9 | } 10 | dependencies { 11 | classpath 'com.android.tools.build:gradle:3.0.1' 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | maven { url "https://jitpack.io" } 23 | } 24 | } 25 | 26 | task clean(type: Delete) { 27 | delete rootProject.buildDir 28 | } 29 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/gradle.properties -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Nov 17 20:54:41 CST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 7 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /lib_common/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /lib_common/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 5 | 6 | defaultConfig { 7 | minSdkVersion rootProject.ext.android["minSdkVersion"] 8 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 9 | versionCode rootProject.ext.android["versionCode"] 10 | versionName rootProject.ext.android["versionName"] 11 | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | 14 | javaCompileOptions { 15 | annotationProcessorOptions { 16 | arguments = [AROUTER_MODULE_NAME: project.getName()] 17 | } 18 | } 19 | } 20 | 21 | buildTypes { 22 | release { 23 | minifyEnabled false 24 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 25 | } 26 | } 27 | 28 | } 29 | 30 | dependencies { 31 | implementation fileTree(dir: 'libs', include: ['*.jar']) 32 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 33 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 34 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 35 | testImplementation rootProject.ext.dependencies["junit"] 36 | 37 | 38 | api project(':lib_opensource') 39 | annotationProcessor rootProject.ext.dependencies["router-compiler"] 40 | } 41 | -------------------------------------------------------------------------------- /lib_common/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /lib_common/src/androidTest/java/com/senon/lib_common/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.senon.lib_common", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib_common/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/AppConfig.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common; 2 | 3 | import com.senon.lib_common.utils.ConstantUtils; 4 | 5 | /** 6 | * APP配置参数 7 | */ 8 | public class AppConfig { 9 | 10 | 11 | public static final String BASE_URL = "https://www.wanandroid.com/"; 12 | 13 | public static final String PATH_DATA = ConstantUtils.getAPPContext().getCacheDir().getAbsolutePath()+"/"+"data"; 14 | 15 | public static final String PATH_CACHE = PATH_DATA+"/"+"Cache"; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/ConstantArouter.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common; 2 | 3 | /** 4 | * 所有模块均依赖commonmoduel 所以路由跳转均写入本Constant方便调用 5 | * 常量类 6 | * 其中: 路由跳转命名统一用:path+模块名+Activity名 7 | */ 8 | public class ConstantArouter { 9 | 10 | /** 11 | * App 12 | */ 13 | public static final String PATH_APP_SPLASHACTIVITY = "/app/SplashActivity"; 14 | public static final String PATH_APP_FRAGMENTHOMEACTIVITY = "/app/FragmentHomeActivity"; 15 | 16 | 17 | /** 18 | * home 主页 19 | */ 20 | public static final String PATH_HOME_MAINACTIVITY = "/home/MainActivity"; 21 | public static final String PATH_HOME_HOMEARTICLEACTIVITY = "/home/HomeArticleActivity"; 22 | public static final String PATH_HOME_HOMEPROJECTACTIVITY = "/home/HomeProjectActivity"; 23 | 24 | /** 25 | * life 知识体系 26 | */ 27 | public static final String PATH_LIFE_KNOWLEDGESYSTEMACTIVITY = "/life/KnowledgeSystemActivity"; 28 | 29 | /** 30 | * common 31 | */ 32 | public static final String PATH_COMMON_REGISTERACTIVITY = "/lib_common/CommonRegisterActivity"; 33 | public static final String PATH_COMMON_WEBVIEWCTIVITY = "/lib_common/CommonWebviewActivity"; 34 | 35 | /** 36 | * talent 个人中心 37 | */ 38 | public static final String PATH_TALENT_COLLECTIONACTIVITY = "/talent/CollectionActivity"; 39 | public static final String PATH_TALENT_ABOUTACTIVITY = "/talent/AboutActivity"; 40 | 41 | 42 | } 43 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/ConstantLoginArouter.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * 判断是某个模块登录的 8 | */ 9 | public class ConstantLoginArouter { 10 | 11 | public static Map activityRouterMap = new HashMap<>(); 12 | 13 | //app主页 14 | public static final String PATH_APP_MAINACTIVITY = "/app/MainActivity"; 15 | 16 | //home主页 17 | public static final String PATH_HOME_MAINACTIVITY = "/home/HomeMainActivity"; 18 | //Life首页 19 | public static final String PATH_LIFE_MAINACTIVITY = "/life/LifeMainActivity"; 20 | //Art首页 21 | public static final String PATH_ART_MAINACTIVITY = "/art/ArtMainActivity"; 22 | //Talent首页 23 | public static final String PATH_TALENT_MAINACTIVITY = "/talent/TalentMainActivity"; 24 | 25 | 26 | //登录 注册 27 | public static final String PATH_COMMON_LOGINACTIVITY = "/lib_common/CommonLoginActivity"; 28 | 29 | static { 30 | activityRouterMap.put(getActivityName(PATH_APP_MAINACTIVITY), PATH_APP_MAINACTIVITY); 31 | activityRouterMap.put(getActivityName(PATH_HOME_MAINACTIVITY), PATH_HOME_MAINACTIVITY); 32 | activityRouterMap.put(getActivityName(PATH_LIFE_MAINACTIVITY), PATH_LIFE_MAINACTIVITY); 33 | activityRouterMap.put(getActivityName(PATH_ART_MAINACTIVITY), PATH_ART_MAINACTIVITY); 34 | activityRouterMap.put(getActivityName(PATH_TALENT_MAINACTIVITY), PATH_TALENT_MAINACTIVITY); 35 | 36 | activityRouterMap.put(getActivityName(PATH_COMMON_LOGINACTIVITY), PATH_COMMON_LOGINACTIVITY); 37 | } 38 | 39 | private static String getActivityName(String routerUrl) { 40 | int pos = routerUrl.lastIndexOf("/"); 41 | return routerUrl.substring(pos + 1); 42 | } 43 | 44 | public static String getCurRouter(String activityName) { 45 | return activityRouterMap.get(activityName); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/adapter/CommonAdapter.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.BaseAdapter; 8 | 9 | import java.util.List; 10 | 11 | public abstract class CommonAdapter extends BaseAdapter { 12 | protected LayoutInflater mInflater; 13 | protected Context mContext; 14 | protected List mDatas; 15 | protected final int mItemLayoutId; 16 | 17 | public CommonAdapter(Context context, List mDatas, int itemLayoutId) { 18 | mInflater = LayoutInflater.from(context); 19 | this.mContext = context; 20 | this.mDatas = mDatas; 21 | this.mItemLayoutId = itemLayoutId; 22 | } 23 | 24 | @Override 25 | public int getCount() { 26 | return mDatas.size(); 27 | } 28 | 29 | @Override 30 | public T getItem(int position) { 31 | return mDatas.get(position); 32 | } 33 | 34 | 35 | @Override 36 | public long getItemId(int position) { 37 | return position; 38 | } 39 | 40 | @Override 41 | public View getView(int position, View convertView, ViewGroup parent) { 42 | final CommonHolder viewHolder = getViewHolder(position, convertView, parent); 43 | convert(viewHolder, getItem(position),position); 44 | return viewHolder.getConvertView(); 45 | 46 | } 47 | 48 | public abstract void convert(CommonHolder helper, T item,int position); 49 | 50 | private CommonHolder getViewHolder(int position, View convertView, ViewGroup parent) { 51 | return CommonHolder.get(mContext, convertView, parent, mItemLayoutId, position); 52 | } 53 | } -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/adapter/RecyclerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | 9 | import java.util.List; 10 | 11 | 12 | public abstract class RecyclerAdapter extends RecyclerView.Adapter { 13 | 14 | private Context mContext; 15 | private List mDatas; 16 | private int mLayoutId; 17 | private LayoutInflater mInflater; 18 | 19 | private OnItemClickListener onItemClickListener; 20 | 21 | public RecyclerAdapter(Context mContext, List mDatas, int mLayoutId) { 22 | this.mContext = mContext; 23 | this.mDatas = mDatas; 24 | this.mLayoutId = mLayoutId; 25 | mInflater = LayoutInflater.from(mContext); 26 | } 27 | 28 | @Override 29 | public RecycleHolder onCreateViewHolder(ViewGroup parent, int viewType) { 30 | return new RecycleHolder(mInflater.inflate(mLayoutId, parent, false)); 31 | } 32 | 33 | @Override 34 | public void onBindViewHolder(final RecycleHolder holder, int position) { 35 | convert(holder, mDatas.get(position), position); 36 | if (onItemClickListener != null) { 37 | //设置背景 38 | holder.itemView.setOnClickListener(new View.OnClickListener() { 39 | @Override 40 | public void onClick(View v) { 41 | //注意,这里的position不要用上面参数中的position,会出现位置错乱\ 42 | onItemClickListener.OnItemClickListener(holder.itemView, holder.getLayoutPosition()); 43 | } 44 | }); 45 | } 46 | 47 | } 48 | 49 | public abstract void convert(RecycleHolder holder, T data, int position); 50 | 51 | @Override 52 | public int getItemCount() { 53 | return mDatas.size(); 54 | } 55 | 56 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) { 57 | this.onItemClickListener = onItemClickListener; 58 | } 59 | 60 | public interface OnItemClickListener { 61 | void OnItemClickListener(View view, int position); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/api/BaseApi.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.api; 2 | 3 | import com.senon.lib_common.bean.Banner; 4 | import com.senon.lib_common.bean.CollectionArticle; 5 | import com.senon.lib_common.bean.HomeArticle; 6 | import com.senon.lib_common.bean.KnowledgeSysArticle; 7 | import com.senon.lib_common.bean.KnowledgeSystem; 8 | import com.senon.lib_common.bean.Login; 9 | import com.senon.lib_common.base.BaseResponse; 10 | import com.senon.lib_common.bean.ProjectArticle; 11 | import com.senon.lib_common.bean.WXarticle; 12 | import com.senon.lib_common.bean.WXchapters; 13 | import java.util.List; 14 | import java.util.Map; 15 | import io.reactivex.Observable; 16 | import retrofit2.http.Field; 17 | import retrofit2.http.FieldMap; 18 | import retrofit2.http.FormUrlEncoded; 19 | import retrofit2.http.GET; 20 | import retrofit2.http.POST; 21 | import retrofit2.http.Path; 22 | import retrofit2.http.Query; 23 | 24 | /** 25 | * 网络请求接口 26 | */ 27 | public interface BaseApi { 28 | 29 | 30 | //登录 31 | @POST("user/login") 32 | @FormUrlEncoded 33 | Observable> login(@FieldMap Map map); 34 | //登出 35 | @GET("user/logout/json") 36 | Observable logout(); 37 | //注册 38 | @POST("user/register") 39 | @FormUrlEncoded 40 | Observable> register(@FieldMap Map map); 41 | 42 | //首页banner 43 | @GET("banner/json") 44 | Observable>> banner(); 45 | //首页文章列表 46 | @GET("article/list/{page}/json") 47 | Observable> getHomeArticle(@Path("page") int page); 48 | //首页最新项目 49 | @GET("article/listproject/{page}/json") 50 | Observable> getHomeProject(@Path("page") int page); 51 | 52 | //项目列表数据 53 | @GET("project/list/{page}/json") 54 | Observable> getProjectList(@Path("page") int page, @Query("cid") int cid); 55 | 56 | //体系数据 57 | @GET("tree/json") 58 | Observable>> getKnowledgeList(); 59 | //知识体系下的文章 60 | @GET("article/list/{page}/json") 61 | Observable> getKnowledgeArticle(@Path("page") int page, @Query("cid") int cid); 62 | 63 | //获取公众号列表 64 | @GET("wxarticle/chapters/json") 65 | Observable>> getWXarticleChapters(); 66 | //查看某个公众号历史数据 67 | @GET("wxarticle/list/{id}/{page}/json") 68 | Observable> getWXarticleList(@Path("id") int id, @Path("page") int page); 69 | 70 | //收藏站内文章 71 | @POST("lg/collect/{id}/json") 72 | Observable getCollect(@Path("id") int id); 73 | //取消收藏-->文章列表 74 | @POST("lg/uncollect_originId/{id}/json") 75 | Observable getUncollectOriginId(@Path("id") int id); 76 | //取消收藏-->我的收藏页面 77 | @POST("lg/uncollect/{id}/json") 78 | Observable getUncollect(@Path("id") int id,@Query("originId") int originId); 79 | 80 | //收藏文章列表 81 | @GET("lg/collect/list/{page}/json") 82 | Observable> getCollectList(@Path("page") int page); 83 | } 84 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/base/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.base; 2 | 3 | import android.content.pm.ActivityInfo; 4 | import android.os.Bundle; 5 | import android.view.Window; 6 | import com.alibaba.android.arouter.launcher.ARouter; 7 | import com.trello.rxlifecycle2.components.support.RxAppCompatActivity; 8 | 9 | /** 10 | * 父类->基类->动态指定类型->泛型设计(通过泛型指定动态类型->由子类指定,父类只需要规定范围即可) 11 | */ 12 | public abstract class BaseActivity> extends RxAppCompatActivity { 13 | 14 | //引用V层和P层 15 | private P presenter; 16 | private V view; 17 | 18 | public P getPresenter(){ 19 | return presenter; 20 | } 21 | 22 | @Override 23 | protected void onCreate(Bundle savedInstanceState) { 24 | super.onCreate(savedInstanceState); 25 | requestWindowFeature(Window.FEATURE_NO_TITLE); 26 | setContentView(getLayoutId()); 27 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); // 禁止所有的activity横屏 28 | ARouter.getInstance().inject(this); 29 | if(presenter == null){ 30 | presenter = createPresenter(); 31 | } 32 | if(view == null){ 33 | view = createView(); 34 | } 35 | if(presenter != null && view != null){ 36 | presenter.attachView(view); 37 | } 38 | init(); 39 | } 40 | 41 | //由子类指定具体类型 42 | public abstract int getLayoutId(); 43 | public abstract P createPresenter(); 44 | public abstract V createView(); 45 | public abstract void init(); 46 | 47 | @Override 48 | protected void onDestroy() { 49 | super.onDestroy(); 50 | if(presenter != null){ 51 | presenter.detachView(); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/base/BaseAppDeletage.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.base; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | import com.scwang.smartrefresh.layout.SmartRefreshLayout; 7 | import com.scwang.smartrefresh.layout.api.DefaultRefreshFooterCreator; 8 | import com.scwang.smartrefresh.layout.api.DefaultRefreshHeaderCreator; 9 | import com.scwang.smartrefresh.layout.api.RefreshFooter; 10 | import com.scwang.smartrefresh.layout.api.RefreshHeader; 11 | import com.scwang.smartrefresh.layout.api.RefreshLayout; 12 | import com.scwang.smartrefresh.layout.footer.ClassicsFooter; 13 | import com.scwang.smartrefresh.layout.header.ClassicsHeader; 14 | import com.senon.lib_common.R; 15 | import com.senon.lib_common.net.cookies.PersistentCookieStore; 16 | import com.senon.lib_common.service.InitializeService; 17 | import com.senon.lib_common.utils.ConstantUtils; 18 | import com.senon.lib_common.utils.LogUtils; 19 | import com.senon.lib_common.utils.PreferenceTool; 20 | import com.senon.lib_common.utils.ToastUtil; 21 | import me.jessyan.autosize.AutoSizeConfig; 22 | import me.jessyan.autosize.unit.Subunits; 23 | 24 | 25 | public class BaseAppDeletage { 26 | 27 | private Application mApplication; 28 | 29 | //static 代码段可以防止内存泄露 30 | static { 31 | //设置全局的Header构建器 32 | SmartRefreshLayout.setDefaultRefreshHeaderCreator(new DefaultRefreshHeaderCreator() { 33 | @Override 34 | public RefreshHeader createRefreshHeader(Context context, RefreshLayout layout) { 35 | // 指定为经典Header,默认是 贝塞尔雷达Header 36 | return new ClassicsHeader(context); 37 | } 38 | }); 39 | //设置全局的Footer构建器 40 | SmartRefreshLayout.setDefaultRefreshFooterCreator(new DefaultRefreshFooterCreator() { 41 | @Override 42 | public RefreshFooter createRefreshFooter(Context context, RefreshLayout layout) { 43 | //指定为经典Footer,默认是 BallPulseFooter 44 | return new ClassicsFooter(context).setDrawableSize(20); 45 | } 46 | }); 47 | } 48 | 49 | public BaseAppDeletage(Application application) { 50 | mApplication = application; 51 | } 52 | 53 | public void onCreate() { 54 | ConstantUtils.init(mApplication); //全局Utils 55 | LogUtils.setLogEnable(ConstantUtils.isAppDebug()); //Log日志 56 | PreferenceTool.init(mApplication); //Preference参数 57 | PersistentCookieStore.init(mApplication); //Cookies持久化Preference参数 58 | ToastUtil.init(mApplication); //吐司初始化 59 | initAutoSizeUnits(); //配置全局 布局适配单位mm 60 | 61 | InitializeService.start(mApplication); //初始化服务Service 62 | } 63 | 64 | private void initAutoSizeUnits() { 65 | AutoSizeConfig.getInstance().getUnitsManager() 66 | //支持dp适配 默认true 67 | .setSupportDP(false) 68 | //支持sp适配 默认true 69 | .setSupportSP(false) 70 | .setSupportSubunits(Subunits.MM); 71 | AutoSizeConfig.getInstance() 72 | //按照宽度适配 默认true 73 | .setBaseOnWidth(true) 74 | //是否让框架支持自定义 Fragment 的适配参数, 由于这个需求是比较少见的, 所以须要使用者手动开启 75 | //如果没有这个需求建议不开启 76 | .setCustomFragment(true); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/base/BaseApplication.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.base; 2 | 3 | import android.app.Application; 4 | 5 | /** 6 | * 要想使用BaseApplication,必须在组件中实现自己的Application,并且继承BaseApplication; 7 | * 组件模块中实现的Application必须在debug包中的AndroidManifest.xml中注册,否则无法使用; 8 | * 组件模块的Application需置于java/debug文件夹中,不得放于主代码; 9 | * 组件模块中获取Context的方法必须为:ConstantUtils.getAPPContext(),不允许其他写法; 10 | */ 11 | public class BaseApplication extends Application { 12 | 13 | @Override 14 | public void onCreate() { 15 | super.onCreate(); 16 | BaseAppDeletage baseAppDeletage = new BaseAppDeletage(this); 17 | baseAppDeletage.onCreate(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/base/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.base; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.view.LayoutInflater; 6 | import android.view.View; 7 | import android.view.ViewGroup; 8 | import com.trello.rxlifecycle2.components.support.RxFragment; 9 | 10 | /** 11 | * 父类->基类->动态指定类型->泛型设计(通过泛型指定动态类型->由子类指定,父类只需要规定范围即可) 12 | */ 13 | public abstract class BaseFragment> extends RxFragment { 14 | 15 | //引用V层和P层 16 | private P presenter; 17 | private V view; 18 | public Context mContext; 19 | 20 | public P getPresenter() { 21 | return presenter; 22 | } 23 | 24 | @Override 25 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 26 | View view = inflater.inflate(getLayoutId(), container, false); 27 | mContext = getActivity(); 28 | if (presenter == null) { 29 | presenter = createPresenter(); 30 | } 31 | if (this.view == null) { 32 | this.view = createView(); 33 | } 34 | if (presenter != null && view != null) { 35 | presenter.attachView(this.view); 36 | } 37 | init(); 38 | return view; 39 | } 40 | 41 | //由子类指定具体类型 42 | public abstract int getLayoutId(); 43 | public abstract P createPresenter(); 44 | public abstract V createView(); 45 | public abstract void init(); 46 | 47 | @Override 48 | public void onDestroyView() { 49 | super.onDestroyView(); 50 | if (presenter != null) { 51 | presenter.detachView(); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/base/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.base; 2 | 3 | 4 | /** 5 | * BasePresenter 6 | */ 7 | public abstract class BasePresenter{ 8 | 9 | private V mView; 10 | 11 | public V getView(){ 12 | return mView; 13 | } 14 | 15 | public void attachView(V v){ 16 | mView = v; 17 | } 18 | 19 | public void detachView(){ 20 | mView = null; 21 | } 22 | 23 | 24 | } 25 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/base/BaseResponse.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.base; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * BaseResponse 7 | */ 8 | public class BaseResponse { 9 | 10 | @SerializedName("errorMsg") 11 | private String msg; 12 | @SerializedName("errorCode") 13 | private int code; 14 | private T data; 15 | 16 | 17 | 18 | public String getMsg() { 19 | return msg; 20 | } 21 | 22 | public int getCode() { 23 | return code; 24 | } 25 | 26 | public T getData() { 27 | return data; 28 | } 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/base/BaseViewImp.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.base; 2 | 3 | /** 4 | * View 父类接口 5 | */ 6 | public interface BaseViewImp { 7 | } 8 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/bean/Banner.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.bean; 2 | 3 | /** 4 | * 首页Banner 5 | */ 6 | public class Banner { 7 | 8 | /** 9 | * desc : 一起来做个App吧 10 | * id : 10 11 | * imagePath : http://www.wanandroid.com/blogimgs/50c115c2-cf6c-4802-aa7b-a4334de444cd.png 12 | * isVisible : 1 13 | * order : 3 14 | * title : 一起来做个App吧 15 | * type : 0 16 | * url : http://www.wanandroid.com/blog/show/2 17 | */ 18 | 19 | private String desc; 20 | private int id; 21 | private String imagePath; 22 | private int isVisible; 23 | private int order; 24 | private String title; 25 | private int type; 26 | private String url; 27 | 28 | public String getDesc() { 29 | return desc; 30 | } 31 | 32 | public void setDesc(String desc) { 33 | this.desc = desc; 34 | } 35 | 36 | public int getId() { 37 | return id; 38 | } 39 | 40 | public void setId(int id) { 41 | this.id = id; 42 | } 43 | 44 | public String getImagePath() { 45 | return imagePath; 46 | } 47 | 48 | public void setImagePath(String imagePath) { 49 | this.imagePath = imagePath; 50 | } 51 | 52 | public int getIsVisible() { 53 | return isVisible; 54 | } 55 | 56 | public void setIsVisible(int isVisible) { 57 | this.isVisible = isVisible; 58 | } 59 | 60 | public int getOrder() { 61 | return order; 62 | } 63 | 64 | public void setOrder(int order) { 65 | this.order = order; 66 | } 67 | 68 | public String getTitle() { 69 | return title; 70 | } 71 | 72 | public void setTitle(String title) { 73 | this.title = title; 74 | } 75 | 76 | public int getType() { 77 | return type; 78 | } 79 | 80 | public void setType(int type) { 81 | this.type = type; 82 | } 83 | 84 | public String getUrl() { 85 | return url; 86 | } 87 | 88 | public void setUrl(String url) { 89 | this.url = url; 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/bean/Login.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.bean; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 登录--实体 7 | */ 8 | public class Login { 9 | 10 | /** 11 | * chapterTops : [] 12 | * collectIds : [2683,2880,2875,2868,2831,2829,2807] 13 | * email : 14 | * icon : 15 | * id : 1864 16 | * password : 17 | * token : 18 | * type : 0 19 | * username : senonwx 20 | */ 21 | 22 | private String email; 23 | private String icon; 24 | private int id; 25 | private String password; 26 | private String token; 27 | private int type; 28 | private String username; 29 | private List chapterTops; 30 | private List collectIds; 31 | 32 | public String getEmail() { 33 | return email; 34 | } 35 | 36 | public void setEmail(String email) { 37 | this.email = email; 38 | } 39 | 40 | public String getIcon() { 41 | return icon; 42 | } 43 | 44 | public void setIcon(String icon) { 45 | this.icon = icon; 46 | } 47 | 48 | public int getId() { 49 | return id; 50 | } 51 | 52 | public void setId(int id) { 53 | this.id = id; 54 | } 55 | 56 | public String getPassword() { 57 | return password; 58 | } 59 | 60 | public void setPassword(String password) { 61 | this.password = password; 62 | } 63 | 64 | public String getToken() { 65 | return token; 66 | } 67 | 68 | public void setToken(String token) { 69 | this.token = token; 70 | } 71 | 72 | public int getType() { 73 | return type; 74 | } 75 | 76 | public void setType(int type) { 77 | this.type = type; 78 | } 79 | 80 | public String getUsername() { 81 | return username; 82 | } 83 | 84 | public void setUsername(String username) { 85 | this.username = username; 86 | } 87 | 88 | public List getChapterTops() { 89 | return chapterTops; 90 | } 91 | 92 | public void setChapterTops(List chapterTops) { 93 | this.chapterTops = chapterTops; 94 | } 95 | 96 | public List getCollectIds() { 97 | return collectIds; 98 | } 99 | 100 | public void setCollectIds(List collectIds) { 101 | this.collectIds = collectIds; 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/bean/WXchapters.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.bean; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * 微信公众号列表 7 | */ 8 | 9 | public class WXchapters { 10 | 11 | /** 12 | * children : [] 13 | * courseId : 13 14 | * id : 408 15 | * name : 鸿洋 16 | * order : 190000 17 | * parentChapterId : 407 18 | * userControlSetTop : false 19 | * visible : 1 20 | */ 21 | 22 | private int courseId; 23 | private int id; 24 | private String name; 25 | private int order; 26 | private int parentChapterId; 27 | private boolean userControlSetTop; 28 | private int visible; 29 | private List children; 30 | 31 | public int getCourseId() { 32 | return courseId; 33 | } 34 | 35 | public void setCourseId(int courseId) { 36 | this.courseId = courseId; 37 | } 38 | 39 | public int getId() { 40 | return id; 41 | } 42 | 43 | public void setId(int id) { 44 | this.id = id; 45 | } 46 | 47 | public String getName() { 48 | return name; 49 | } 50 | 51 | public void setName(String name) { 52 | this.name = name; 53 | } 54 | 55 | public int getOrder() { 56 | return order; 57 | } 58 | 59 | public void setOrder(int order) { 60 | this.order = order; 61 | } 62 | 63 | public int getParentChapterId() { 64 | return parentChapterId; 65 | } 66 | 67 | public void setParentChapterId(int parentChapterId) { 68 | this.parentChapterId = parentChapterId; 69 | } 70 | 71 | public boolean isUserControlSetTop() { 72 | return userControlSetTop; 73 | } 74 | 75 | public void setUserControlSetTop(boolean userControlSetTop) { 76 | this.userControlSetTop = userControlSetTop; 77 | } 78 | 79 | public int getVisible() { 80 | return visible; 81 | } 82 | 83 | public void setVisible(int visible) { 84 | this.visible = visible; 85 | } 86 | 87 | public List getChildren() { 88 | return children; 89 | } 90 | 91 | public void setChildren(List children) { 92 | this.children = children; 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/common/contract/LoginContract.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.common.contract; 2 | 3 | 4 | import com.senon.lib_common.base.BasePresenter; 5 | import com.senon.lib_common.base.BaseViewImp; 6 | import com.senon.lib_common.base.BaseResponse; 7 | import com.senon.lib_common.bean.Login; 8 | 9 | import java.util.HashMap; 10 | 11 | /** 12 | * LoginContract 13 | */ 14 | public interface LoginContract { 15 | 16 | //方法命名以 请求方法+Result 命名 17 | interface View extends BaseViewImp { 18 | 19 | void getLoginResult(BaseResponse data); 20 | 21 | void getRegisterResult(BaseResponse data); 22 | 23 | } 24 | 25 | //方法命名以 get+方法 命名 26 | abstract class Presenter extends BasePresenter { 27 | 28 | public abstract void getLogin(HashMap map, boolean isDialog, boolean cancelable); 29 | 30 | public abstract void getRegister(HashMap map, boolean isDialog, boolean cancelable); 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/common/contract/WebviewContract.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.common.contract; 2 | 3 | 4 | import com.senon.lib_common.base.BasePresenter; 5 | import com.senon.lib_common.base.BaseResponse; 6 | import com.senon.lib_common.base.BaseViewImp; 7 | import com.senon.lib_common.bean.Login; 8 | 9 | import java.util.HashMap; 10 | 11 | /** 12 | * WebviewContract 13 | */ 14 | public interface WebviewContract { 15 | 16 | //方法命名以 请求方法+Result 命名 17 | interface View extends BaseViewImp { 18 | 19 | void getCollectResult(int id,boolean isCollect); 20 | 21 | void getCollFailResult(int id); 22 | 23 | } 24 | 25 | //方法命名以 get+方法 命名 26 | abstract class Presenter extends BasePresenter { 27 | 28 | public abstract void getCollect(int id ,boolean isDialog, boolean cancelable); 29 | 30 | public abstract void getUnollect(int id, boolean isDialog, boolean cancelable); 31 | 32 | 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/common/presenter/LoginPresenter.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.common.presenter; 2 | 3 | import android.content.Context; 4 | 5 | import com.senon.lib_common.bean.Login; 6 | import com.senon.lib_common.common.contract.LoginContract; 7 | import com.senon.lib_common.net.ServerUtils; 8 | import com.senon.lib_common.base.BaseResponse; 9 | import com.senon.lib_common.net.callback.RequestCallback; 10 | import com.senon.lib_common.net.callback.RxErrorHandler; 11 | import com.senon.lib_common.utils.RetryWithDelay; 12 | import com.senon.lib_common.utils.RxUtils; 13 | import com.senon.lib_common.utils.ToastUtil; 14 | import java.util.HashMap; 15 | 16 | /** 17 | * 登录 P 18 | */ 19 | public class LoginPresenter extends LoginContract.Presenter { 20 | 21 | private Context context; 22 | 23 | public LoginPresenter(Context context) { 24 | this.context = context; 25 | } 26 | 27 | @Override 28 | public void getLogin(HashMap map, boolean isDialog, boolean cancelable) { 29 | ServerUtils.getCommonApi().login(map) 30 | .retryWhen(new RetryWithDelay(3,2)) 31 | .compose(RxUtils.>bindToLifecycle(getView())) 32 | .compose(RxUtils.>getSchedulerTransformer()) 33 | .subscribe(new RequestCallback>(context, RxErrorHandler.getInstance(),isDialog,cancelable) { 34 | @Override 35 | public void onNext(BaseResponse baseResponse) { 36 | super.onNext(baseResponse); 37 | if(baseResponse.getCode() == 0){ 38 | getView().getLoginResult(baseResponse); 39 | }else{ 40 | ToastUtil.initToast(baseResponse.getMsg()); 41 | } 42 | } 43 | @Override 44 | public void onError(Throwable e) { 45 | super.onError(e); 46 | } 47 | }); 48 | } 49 | 50 | @Override 51 | public void getRegister(HashMap map, boolean isDialog, boolean cancelable) { 52 | ServerUtils.getCommonApi().register(map) 53 | .retryWhen(new RetryWithDelay(3,2)) 54 | .compose(RxUtils.>bindToLifecycle(getView())) 55 | .compose(RxUtils.>getSchedulerTransformer()) 56 | .subscribe(new RequestCallback>(context, RxErrorHandler.getInstance(),isDialog,cancelable) { 57 | @Override 58 | public void onNext(BaseResponse baseResponse) { 59 | super.onNext(baseResponse); 60 | if(baseResponse.getCode() == 0){ 61 | getView().getRegisterResult(baseResponse); 62 | }else{ 63 | ToastUtil.initToast(baseResponse.getMsg()); 64 | } 65 | } 66 | @Override 67 | public void onError(Throwable e) { 68 | super.onError(e); 69 | } 70 | }); 71 | } 72 | 73 | 74 | } 75 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/net/RequestInterceptor.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.net; 2 | 3 | import org.json.JSONObject; 4 | import java.io.IOException; 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | import okhttp3.Interceptor; 8 | import okhttp3.Request; 9 | import okhttp3.Response; 10 | 11 | 12 | /** 13 | * 网络统一拦截 14 | */ 15 | public class RequestInterceptor implements Interceptor { 16 | 17 | private final int DEVICE_TYPE = 1; // 设备类型 18 | 19 | private RequestInterceptor() { 20 | } 21 | 22 | private static RequestInterceptor instance; 23 | 24 | public static RequestInterceptor getInstance() { 25 | if (instance == null) { 26 | synchronized (RequestInterceptor.class) { 27 | if (instance == null) { 28 | instance = new RequestInterceptor(); 29 | } 30 | } 31 | } 32 | return instance; 33 | } 34 | 35 | @Override 36 | public Response intercept(Chain chain) throws IOException { 37 | Request original = chain.request(); 38 | Request.Builder requestBuilder = original.newBuilder() 39 | .header("data", fetchHeaderInfo()) 40 | .method(original.method(), original.body()); 41 | return chain.proceed(requestBuilder.build()); 42 | } 43 | 44 | private String fetchHeaderInfo() { 45 | // String deviceCode = MD5Utils.GetMD5Code(MobileInfo.phoneOnlyCode(context)); 46 | 47 | 48 | Map map = new HashMap<>(); 49 | // map.put("DeviceType", String.valueOf(DEVICE_TYPE)); 50 | // map.put("DeviceToken", deviceCode); 51 | // map.put("APPVersion", APP_VERSION_NAME); 52 | // map.put("RegistrationID", jpushID); 53 | // map.put("Authorization", token); 54 | JSONObject json = new JSONObject(map); 55 | return json.toString(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/net/callback/ErrorListener.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.net.callback; 2 | 3 | 4 | 5 | public interface ErrorListener { 6 | void handleError(Throwable e); 7 | } -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/net/callback/RequestCallback.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.net.callback; 2 | 3 | import android.content.Context; 4 | import com.senon.lib_common.net.progress.ProgressCancelListener; 5 | import com.senon.lib_common.net.progress.ProgressDialogHandler; 6 | import io.reactivex.Observer; 7 | import io.reactivex.annotations.NonNull; 8 | import io.reactivex.disposables.Disposable; 9 | 10 | 11 | /** 12 | * RxJava 自定义回调 13 | */ 14 | public abstract class RequestCallback implements Observer,ProgressCancelListener { 15 | 16 | private ErrorListener errorListener; 17 | private Disposable mDisposable; 18 | private Context mContext; 19 | private boolean cancelable = false;//该dialog如果开启 则可以设置是否能够返回键取消请求 20 | private ProgressDialogHandler mProgressDialogHandler;//默认为null 即不开启dialog 21 | 22 | public RequestCallback(Context context,ErrorListener errorListener) { 23 | this(context,errorListener,false); 24 | } 25 | 26 | /** 27 | * 传这个构造默认开启dialog 28 | * @param cancelable 该dialog如果开启 则可以设置是否能够返回键取消请求 29 | */ 30 | public RequestCallback(Context context,ErrorListener errorListener,boolean cancelable) { 31 | this(context,errorListener,true,cancelable); 32 | } 33 | 34 | public RequestCallback(Context context,ErrorListener errorListener,boolean showDialog,boolean cancelable) { 35 | this.mContext = context; 36 | this.errorListener = errorListener; 37 | this.cancelable = cancelable; 38 | if(showDialog){ 39 | this.mProgressDialogHandler = new ProgressDialogHandler(context, this, cancelable); 40 | } 41 | } 42 | 43 | private void showProgressDialog() { 44 | if (mProgressDialogHandler != null) { 45 | mProgressDialogHandler.obtainMessage(ProgressDialogHandler.SHOW_PROGRESS_DIALOG).sendToTarget(); 46 | } 47 | } 48 | 49 | private void dismissProgressDialog() { 50 | if (mProgressDialogHandler != null) { 51 | mProgressDialogHandler.obtainMessage(ProgressDialogHandler.DISMISS_PROGRESS_DIALOG).sendToTarget(); 52 | mProgressDialogHandler = null; 53 | } 54 | } 55 | 56 | @Override 57 | public void onSubscribe(@NonNull Disposable d) { 58 | this.mDisposable = d; 59 | showProgressDialog(); 60 | 61 | } 62 | 63 | @Override 64 | public void onNext(@NonNull T t) { 65 | 66 | } 67 | 68 | @Override 69 | public void onError(@NonNull Throwable e) { 70 | e.printStackTrace(); 71 | dismissProgressDialog(); 72 | 73 | if (errorListener != null) { 74 | errorListener.handleError(e); 75 | } 76 | } 77 | 78 | @Override 79 | public void onComplete() { 80 | dismissProgressDialog(); 81 | 82 | } 83 | 84 | @Override 85 | public void onCancelProgress() { 86 | //如果处于订阅状态,则取消订阅 87 | if (!mDisposable.isDisposed()) { 88 | mDisposable.dispose(); 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/net/callback/RxErrorHandler.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.net.callback; 2 | 3 | 4 | import com.senon.lib_common.utils.LogUtils; 5 | import com.senon.lib_common.utils.ToastUtil; 6 | 7 | public class RxErrorHandler implements ErrorListener { 8 | 9 | private volatile static RxErrorHandler rxErrorHandler; 10 | 11 | private RxErrorHandler() { 12 | } 13 | 14 | public static RxErrorHandler getInstance() { 15 | if (rxErrorHandler == null) { 16 | synchronized (RxErrorHandler.class) { 17 | if (rxErrorHandler == null) { 18 | rxErrorHandler = new RxErrorHandler(); 19 | } 20 | } 21 | } 22 | return rxErrorHandler; 23 | } 24 | 25 | @Override 26 | public void handleError(Throwable throwable) { 27 | String errorString = throwable.toString(); 28 | LogUtils.e("网络错误信息为 ========>>>" + throwable.toString()); 29 | //返回的错误为空 30 | if (errorString == null) { 31 | ToastUtil.initToast("网络数据异常,请重试"); 32 | 33 | } else { 34 | //请求超时 35 | if (errorString.contains("TimeoutException") || errorString.contains("SocketTimeoutException")) { 36 | ToastUtil.initToast("网络请求超时,请重试"); 37 | } 38 | //能识别的请求异常,忽略不提示 39 | if (errorString.contains("SSLException")) { 40 | 41 | } 42 | //403、404等服务错误 43 | if (errorString.contains("ServiceConfigurationError") || errorString.contains("AuthenticatorException")) { 44 | ToastUtil.initToast("网络数据异常,请重试"); 45 | } 46 | //网络未连接 47 | if (errorString.contains("NetworkErrorException") || errorString.contains("NoConnectionPendingException") || errorString.contains("UnknownHostException")) { 48 | ToastUtil.initToast("您的网络不给力,请检查网络设置"); 49 | } 50 | //连接不到服务器 51 | if (errorString.contains("ConnectException")) { 52 | ToastUtil.initToast("网络连接失败"); 53 | } 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/net/cookies/CookiesManager.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.net.cookies; 2 | 3 | import android.support.annotation.NonNull; 4 | 5 | import java.util.List; 6 | 7 | import okhttp3.Cookie; 8 | import okhttp3.CookieJar; 9 | import okhttp3.HttpUrl; 10 | 11 | /** 12 | * @author lw 13 | * @date 2018/1/25 14 | */ 15 | 16 | public class CookiesManager implements CookieJar { 17 | 18 | private static final PersistentCookieStore COOKIE_STORE = PersistentCookieStore.getCookieStore(); 19 | 20 | @Override 21 | public void saveFromResponse(@NonNull HttpUrl url, @NonNull List cookies) { 22 | if (cookies.size() > 0) { 23 | for (Cookie item : cookies) { 24 | COOKIE_STORE.add(url, item); 25 | } 26 | } 27 | } 28 | 29 | @Override 30 | public List loadForRequest(@NonNull HttpUrl url) { 31 | return COOKIE_STORE.get(url); 32 | } 33 | 34 | /** 35 | * 清除所有cookie 36 | */ 37 | public static void clearAllCookies() { 38 | COOKIE_STORE.removeAll(); 39 | } 40 | 41 | /** 42 | * 清除指定cookie 43 | * 44 | * @param url HttpUrl 45 | * @param cookie Cookie 46 | * @return if clear cookies 47 | */ 48 | public static boolean clearCookies(HttpUrl url, Cookie cookie) { 49 | return COOKIE_STORE.remove(url, cookie); 50 | } 51 | 52 | /** 53 | * 获取cookies 54 | * 55 | * @return List 56 | */ 57 | public static List getCookies() { 58 | return COOKIE_STORE.getCookies(); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/net/cookies/OkHttpCookies.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.net.cookies; 2 | 3 | import java.io.IOException; 4 | import java.io.ObjectInputStream; 5 | import java.io.ObjectOutputStream; 6 | import java.io.Serializable; 7 | 8 | import okhttp3.Cookie; 9 | 10 | /** 11 | * Cookies对象 12 | */ 13 | 14 | class OkHttpCookies implements Serializable { 15 | 16 | private transient final Cookie cookies; 17 | private transient Cookie clientCookies; 18 | 19 | OkHttpCookies(Cookie cookies) { 20 | this.cookies = cookies; 21 | } 22 | 23 | Cookie getCookies() { 24 | Cookie bestCookies = cookies; 25 | if (clientCookies != null) { 26 | bestCookies = clientCookies; 27 | } 28 | return bestCookies; 29 | } 30 | 31 | private void writeObject(ObjectOutputStream out) throws IOException { 32 | out.writeObject(cookies.name()); 33 | out.writeObject(cookies.value()); 34 | out.writeLong(cookies.expiresAt()); 35 | out.writeObject(cookies.domain()); 36 | out.writeObject(cookies.path()); 37 | out.writeBoolean(cookies.secure()); 38 | out.writeBoolean(cookies.httpOnly()); 39 | out.writeBoolean(cookies.hostOnly()); 40 | out.writeBoolean(cookies.persistent()); 41 | } 42 | 43 | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { 44 | String name = (String) in.readObject(); 45 | String value = (String) in.readObject(); 46 | long expiresAt = in.readLong(); 47 | String domain = (String) in.readObject(); 48 | String path = (String) in.readObject(); 49 | boolean secure = in.readBoolean(); 50 | boolean httpOnly = in.readBoolean(); 51 | boolean hostOnly = in.readBoolean(); 52 | Cookie.Builder builder = new Cookie.Builder(); 53 | builder = builder.name(name); 54 | builder = builder.value(value); 55 | builder = builder.expiresAt(expiresAt); 56 | builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain); 57 | builder = builder.path(path); 58 | builder = secure ? builder.secure() : builder; 59 | builder = httpOnly ? builder.httpOnly() : builder; 60 | clientCookies = builder.build(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/net/progress/ProgressCancelListener.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.net.progress; 2 | 3 | /** 4 | * 取消请求监听 5 | */ 6 | public interface ProgressCancelListener { 7 | void onCancelProgress(); 8 | } 9 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/net/progress/ProgressDialogHandler.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.net.progress; 2 | 3 | import android.content.Context; 4 | import android.content.DialogInterface; 5 | import android.os.Handler; 6 | import android.os.Message; 7 | import cn.pedant.SweetAlert.SweetAlertDialog; 8 | 9 | /** 10 | * Dialog的进度控制 11 | */ 12 | public class ProgressDialogHandler extends Handler { 13 | public static final int SHOW_PROGRESS_DIALOG = 1; 14 | public static final int DISMISS_PROGRESS_DIALOG = 2; 15 | 16 | private SweetAlertDialog sad; 17 | private Context context; 18 | private boolean cancelable; 19 | private ProgressCancelListener mProgressCancelListener; 20 | 21 | public ProgressDialogHandler(Context context, ProgressCancelListener mProgressCancelListener, boolean cancelable) { 22 | super(); 23 | this.context = context; 24 | this.mProgressCancelListener = mProgressCancelListener; 25 | this.cancelable = cancelable; 26 | } 27 | 28 | private void initProgressDialog() { 29 | if (sad == null) { 30 | sad = new SweetAlertDialog(context); 31 | sad.changeAlertType(SweetAlertDialog.PROGRESS_TYPE); 32 | sad.setTitleText("正在加载..."); 33 | sad.setCancelable(cancelable); 34 | 35 | if (cancelable) { 36 | sad.setOnCancelListener(new DialogInterface.OnCancelListener() { 37 | @Override 38 | public void onCancel(DialogInterface dialogInterface) { 39 | mProgressCancelListener.onCancelProgress(); 40 | } 41 | }); 42 | } 43 | 44 | if (!sad.isShowing()) { 45 | sad.show(); 46 | } 47 | } 48 | } 49 | 50 | private void dismissProgressDialog() { 51 | if (sad != null) { 52 | sad.dismiss(); 53 | sad = null; 54 | } 55 | } 56 | 57 | @Override 58 | public void handleMessage(Message msg) { 59 | switch (msg.what) { 60 | case SHOW_PROGRESS_DIALOG: 61 | initProgressDialog(); 62 | break; 63 | case DISMISS_PROGRESS_DIALOG: 64 | dismissProgressDialog(); 65 | break; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/service/InitializeService.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.service; 2 | 3 | import android.app.IntentService; 4 | import android.content.Context; 5 | import android.content.Intent; 6 | 7 | /** 8 | * 在Service中 初始化耗时的SDK等(BaseAppDeletage调用) 9 | * 为了在application中 不进行耗时操作 影响冷启动 白屏时间增加 10 | * 11 | * IntentService特点: 12 | * 1.在任务完成后将自动停止。 13 | * 2.任务在队列中执行,是有先后顺序的。 14 | * 3.任务在子线程中运行,可以执行耗时任务。 15 | */ 16 | 17 | public class InitializeService extends IntentService { 18 | 19 | private static final String ACTION_INIT = "initApplication"; 20 | 21 | public InitializeService() { 22 | super("InitializeService"); 23 | } 24 | 25 | public static void start(Context context) { 26 | Intent intent = new Intent(context, InitializeService.class); 27 | intent.setAction(ACTION_INIT); 28 | context.startService(intent); 29 | } 30 | 31 | @Override 32 | protected void onHandleIntent(Intent intent) { 33 | if (intent != null) { 34 | final String action = intent.getAction(); 35 | if (ACTION_INIT.equals(action)) { 36 | 37 | initApplication(); 38 | } 39 | } 40 | } 41 | 42 | //初始化 43 | private void initApplication() { 44 | 45 | } 46 | 47 | } 48 | 49 | 50 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/utils/BaseEvent.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.utils; 2 | 3 | /** 4 | * eventbus发送实体 5 | */ 6 | public class BaseEvent { 7 | 8 | /** 9 | // * -1:退出登录时通知Mainactivity finish 10 | * 0:登录成功 刷新所有主界面数据列表 11 | * 1:退出成功 。。。 12 | * 13 | * 101:文章收藏/取消收藏 (HomeMainFragment、ArtMainFragment、HomeArticleActivity、HomeProjectActivity) 14 | * 102:文章收藏/取消收藏失败 。。。 15 | * 16 | * 17 | * 18 | * 19 | */ 20 | private int code; 21 | private String msg; 22 | private T data; 23 | private boolean isCollect; 24 | private int id; 25 | private boolean ingored; 26 | 27 | 28 | public int getCode() { 29 | return code; 30 | } 31 | 32 | public void setCode(int code) { 33 | this.code = code; 34 | } 35 | 36 | public String getMsg() { 37 | return msg; 38 | } 39 | 40 | public void setMsg(String msg) { 41 | this.msg = msg; 42 | } 43 | 44 | public T getData() { 45 | return data; 46 | } 47 | 48 | public void setData(T data) { 49 | this.data = data; 50 | } 51 | 52 | public boolean isCollect() { 53 | return isCollect; 54 | } 55 | 56 | public void setCollect(boolean collect) { 57 | isCollect = collect; 58 | } 59 | 60 | public int getId() { 61 | return id; 62 | } 63 | 64 | public void setId(int id) { 65 | this.id = id; 66 | } 67 | 68 | public boolean isIngored() { 69 | return ingored; 70 | } 71 | 72 | public void setIngored(boolean ingored) { 73 | this.ingored = ingored; 74 | } 75 | 76 | 77 | } 78 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/utils/ConstantUtils.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.utils; 2 | 3 | import android.content.Context; 4 | import android.content.pm.ApplicationInfo; 5 | import android.content.pm.PackageManager; 6 | 7 | /** 8 | * 基础常量工具类 9 | */ 10 | public class ConstantUtils { 11 | private static Context context; 12 | /** 13 | * 初始化工具类 14 | * @param context 上下文 15 | */ 16 | public static void init(Context context) { 17 | ConstantUtils.context = context.getApplicationContext(); 18 | } 19 | 20 | /** 21 | * 获取ApplicationContext 22 | * @return ApplicationContext 23 | */ 24 | public static Context getAPPContext() { 25 | if (context != null) return context; 26 | throw new NullPointerException("u should init first"); 27 | } 28 | 29 | /** 30 | * 判断App是否是Debug版本 31 | * @return {@code true}: 是
{@code false}: 否 32 | */ 33 | public static boolean isAppDebug() { 34 | String packageName = context.getPackageName(); 35 | if (packageName == null || packageName.trim().length() == 0) 36 | return false; 37 | try { 38 | PackageManager pm = context.getPackageManager(); 39 | ApplicationInfo ai = pm.getApplicationInfo(context.getPackageName(), 0); 40 | return ai != null && (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; 41 | } catch (PackageManager.NameNotFoundException e) { 42 | e.printStackTrace(); 43 | return false; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/utils/LogUtils.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.utils; 2 | 3 | import android.util.Log; 4 | 5 | import java.util.Locale; 6 | 7 | /** 8 | * 打印log日志工具类 9 | */ 10 | public class LogUtils { 11 | private static boolean LOG = true; 12 | private static boolean LOGV = true; 13 | private static boolean LOGD = true; 14 | private static boolean LOGI = true; 15 | private static boolean LOGW = true; 16 | private static boolean LOGE = true; 17 | 18 | public static void setLogEnable(boolean enable) { 19 | LOG = enable; 20 | } 21 | 22 | public static void v(String mess) { 23 | if (LOG && LOGV) { 24 | Log.v(getTag(), buildMessage(mess)); 25 | } 26 | } 27 | 28 | public static void d(String mess) { 29 | if (LOG && LOGD) { 30 | Log.d(getTag(), buildMessage(mess)); 31 | } 32 | } 33 | 34 | public static void i(String mess) { 35 | if (LOG && LOGI) { 36 | Log.i(getTag(), buildMessage(mess)); 37 | } 38 | } 39 | 40 | public static void w(String mess) { 41 | if (LOG && LOGW) { 42 | Log.w(getTag(), buildMessage(mess)); 43 | } 44 | } 45 | 46 | public static void e(String mess) { 47 | if (LOG && LOGE) { 48 | log(getTag(), buildMessage(mess)); 49 | } 50 | } 51 | 52 | public static void log(String tag, String msg){ 53 | if(msg.length() > 4000) { 54 | for(int i=0;i clazz = trace[i].getClass(); 70 | if (!clazz.equals(LogUtils.class)) { 71 | callingClass = trace[i].getClassName(); 72 | callingClass = callingClass.substring(callingClass 73 | .lastIndexOf('.') + 1); 74 | break; 75 | } 76 | } 77 | return callingClass; 78 | } 79 | 80 | private static String buildMessage(String msg) { 81 | StackTraceElement[] trace = new Throwable().fillInStackTrace() 82 | .getStackTrace(); 83 | String caller = ""; 84 | for (int i = 2; i < trace.length; i++) { 85 | Class clazz = trace[i].getClass(); 86 | if (!clazz.equals(LogUtils.class)) { 87 | caller = trace[i].getMethodName(); 88 | break; 89 | } 90 | } 91 | return String.format(Locale.US, "[%d] %s: %s", Thread.currentThread() 92 | .getId(), caller, msg); 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/utils/MD5Utils.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.utils; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | /** 7 | * MD5工具 8 | */ 9 | public class MD5Utils { 10 | //静态方法,便于作为工具类 11 | public static String getMd5(String plainText) { 12 | try { 13 | MessageDigest md = MessageDigest.getInstance("MD5"); 14 | md.update(plainText.getBytes()); 15 | byte b[] = md.digest(); 16 | int i; 17 | StringBuffer buf = new StringBuffer(""); 18 | for (int offset = 0; offset < b.length; offset++) { 19 | i = b[offset]; 20 | if (i < 0) 21 | i += 256; 22 | if (i < 16) 23 | buf.append("0"); 24 | buf.append(Integer.toHexString(i)); 25 | } 26 | //32位加密 27 | return buf.toString(); 28 | // 16位的加密 29 | //return buf.toString().substring(8, 24); 30 | } catch (NoSuchAlgorithmException e) { 31 | e.printStackTrace(); 32 | return null; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/utils/PreferenceTool.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.utils; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | 6 | import com.senon.lib_opensource.BuildConfig; 7 | 8 | import java.util.Map; 9 | 10 | /** 11 | * 共享参数工具类 12 | */ 13 | public class PreferenceTool { 14 | 15 | private static final String PREF_NAME = BuildConfig.APPLICATION_ID + "_preferences"; 16 | private static SharedPreferences.Editor editor; 17 | private static SharedPreferences pref; 18 | 19 | 20 | public static void init(Context context) { 21 | pref = context.getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); 22 | editor = pref.edit(); 23 | } 24 | 25 | public static void clear() { 26 | if (editor == null) return; 27 | editor.clear(); 28 | } 29 | 30 | public static void commit() { 31 | if (editor == null) return; 32 | editor.commit(); 33 | } 34 | 35 | public static void apply() { 36 | if (editor == null) return; 37 | editor.apply(); 38 | } 39 | 40 | public static boolean contains(String key) { 41 | return pref != null && pref.contains(key); 42 | } 43 | 44 | public static float getFloat(String key, float defValue) { 45 | return pref != null ? pref.getFloat(key, defValue) : defValue; 46 | } 47 | 48 | public static int getInt(String key, int defValue) { 49 | return pref != null ? pref.getInt(key, defValue) : defValue; 50 | } 51 | 52 | public static long getLong(String key, long defValue) { 53 | return pref != null ? pref.getLong(key, defValue) : defValue; 54 | } 55 | 56 | public static String getString(String key) { 57 | return pref != null ? pref.getString(key, "") : ""; 58 | } 59 | 60 | public static String getString(String key, String defValue) { 61 | return pref != null ? pref.getString(key, defValue) : defValue; 62 | } 63 | 64 | public static boolean getBoolean(String key, boolean defValue) { 65 | return pref != null ? pref.getBoolean(key, defValue) : defValue; 66 | } 67 | 68 | public static Map getAll() { 69 | return pref != null ? pref.getAll() : null; 70 | } 71 | 72 | 73 | 74 | public static void putFloat(String key, float value) { 75 | if (editor == null) return; 76 | editor.putFloat(key, value); 77 | } 78 | 79 | public static void putInt(String key, int value) { 80 | if (editor == null) return; 81 | editor.putInt(key, value); 82 | } 83 | 84 | public static void putLong(String key, long value) { 85 | if (editor == null) return; 86 | editor.putLong(key, value); 87 | } 88 | 89 | public static void putString(String key, String value) { 90 | if (editor == null) return; 91 | editor.putString(key, value); 92 | } 93 | 94 | public static void putBoolean(String key, boolean value) { 95 | if (editor == null) return; 96 | editor.putBoolean(key, value); 97 | } 98 | 99 | public static void remove(String key) { 100 | if (editor == null) return; 101 | editor.remove(key); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/utils/RetryWithDelay.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.utils; 2 | 3 | 4 | import java.util.concurrent.TimeUnit; 5 | 6 | import io.reactivex.Observable; 7 | import io.reactivex.ObservableSource; 8 | import io.reactivex.annotations.NonNull; 9 | import io.reactivex.functions.Function; 10 | 11 | public class RetryWithDelay implements Function, ObservableSource> { 12 | 13 | private final int maxRetries; 14 | private final int retryDelaySecond; 15 | private int retryCount; 16 | 17 | public RetryWithDelay(int maxRetries, int retryDelaySecond) { 18 | this.maxRetries = maxRetries; 19 | this.retryDelaySecond = retryDelaySecond; 20 | } 21 | 22 | @Override 23 | public ObservableSource apply(@NonNull Observable throwableObservable) throws Exception { 24 | return throwableObservable 25 | .flatMap(new Function>() { 26 | @Override 27 | public ObservableSource apply(@NonNull Throwable throwable) throws Exception { 28 | if (++retryCount <= maxRetries) { 29 | // When this Observable calls onNext, the original Observable will be retried (i.e. re-subscribed). 30 | LogUtils.d("get error, it will try after " + retryDelaySecond 31 | + " second, retry count " + retryCount); 32 | return Observable.timer(retryDelaySecond, 33 | TimeUnit.SECONDS); 34 | } 35 | // Max retries hit. Just pass the error along. 36 | return Observable.error(throwable); 37 | } 38 | }); 39 | } 40 | } -------------------------------------------------------------------------------- /lib_common/src/main/java/com/senon/lib_common/utils/RxUtils.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common.utils; 2 | 3 | import com.senon.lib_common.base.BaseViewImp; 4 | import com.trello.rxlifecycle2.LifecycleTransformer; 5 | import com.trello.rxlifecycle2.android.ActivityEvent; 6 | import com.trello.rxlifecycle2.android.FragmentEvent; 7 | import com.trello.rxlifecycle2.components.support.RxAppCompatActivity; 8 | import com.trello.rxlifecycle2.components.support.RxFragment; 9 | import io.reactivex.Observable; 10 | import io.reactivex.ObservableSource; 11 | import io.reactivex.ObservableTransformer; 12 | import io.reactivex.android.schedulers.AndroidSchedulers; 13 | import io.reactivex.annotations.NonNull; 14 | import io.reactivex.schedulers.Schedulers; 15 | 16 | /** 17 | * 在presenter中使用生命周期管理,防止内存泄漏 18 | */ 19 | public class RxUtils { 20 | 21 | public static LifecycleTransformer bindToLifecycle(BaseViewImp view) { 22 | if (view instanceof RxAppCompatActivity) { 23 | return ((RxAppCompatActivity) view).bindToLifecycle(); 24 | } else if (view instanceof RxFragment) { 25 | return ((RxFragment) view).bindToLifecycle(); 26 | } else { 27 | throw new IllegalArgumentException("view isn't activity or fragment"); 28 | } 29 | } 30 | 31 | public static LifecycleTransformer bindActivityUntilEvent(BaseViewImp view,ActivityEvent event) { 32 | if (view instanceof RxAppCompatActivity) { 33 | return ((RxAppCompatActivity) view).bindUntilEvent(event); 34 | } else { 35 | throw new IllegalArgumentException("view isn't activity"); 36 | } 37 | } 38 | 39 | public static LifecycleTransformer bindFragmentUntilEvent(BaseViewImp view,FragmentEvent event) { 40 | if (view instanceof RxFragment) { 41 | return ((RxFragment) view).bindUntilEvent(event); 42 | } else { 43 | throw new IllegalArgumentException("view isn't fragment"); 44 | } 45 | } 46 | 47 | public static ObservableTransformer getSchedulerTransformer(){ 48 | return new ObservableTransformer() { 49 | @Override 50 | public ObservableSource apply(@NonNull Observable upstream) { 51 | return upstream 52 | .subscribeOn(Schedulers.io()) 53 | .unsubscribeOn(Schedulers.io()) 54 | .observeOn(AndroidSchedulers.mainThread()); 55 | } 56 | }; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/head.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/drawable/head.png -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/login_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/drawable/login_bg.png -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/login_password.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/drawable/login_password.png -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/login_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/drawable/login_phone.png -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/drawable/logo.png -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/news_renovate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/drawable/news_renovate.png -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/register_bg_border_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/drawable/register_bg_border_1.png -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/register_border.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/register_border_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/register_border_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/shape_gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/style_progress_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /lib_common/src/main/res/drawable/toast_shape.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /lib_common/src/main/res/layout/activity_common__webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 20 | 21 | 29 | 30 | -------------------------------------------------------------------------------- /lib_common/src/main/res/layout/layout_fragmhome_tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 19 | 20 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /lib_common/src/main/res/layout/layout_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 22 | 23 | 33 | 34 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /lib_common/src/main/res/layout/toast_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 24 | 25 | -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/back_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/back_black.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_logo.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_right.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_discover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_discover.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_discoverhl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_discoverhl.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_mainframe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_mainframe.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_mainframehl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_mainframehl.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_me.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_me.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_mehl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_mehl.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_order.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_order.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_orderhl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/ic_tabbar_orderhl.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/news_renovate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/news_renovate.png -------------------------------------------------------------------------------- /lib_common/src/main/res/mipmap-xxhdpi/splash_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/lib_common/src/main/res/mipmap-xxhdpi/splash_bg.jpg -------------------------------------------------------------------------------- /lib_common/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #2BBBE6 7 | #00ffffff 8 | 9 | 10 | #282828 11 | 12 | #666666 13 | #FFFFFF 14 | #FF7219 15 | #80000000 16 | #99000000 17 | #dd000000 18 | #ff000000 19 | 20 | #BDBDBD 21 | #F0F0F0 22 | #cccccc 23 | #dddddd 24 | #5e5656 25 | #f2f2f2 26 | 27 | 28 | #FF8519 29 | #EA5038 30 | #FF8519 31 | #999999 32 | #B3B3B3 33 | #FF8519 34 | #303030 35 | #a53c3c 36 | #5e99ff 37 | #f1f0f6 38 | #9b9b9b 39 | 40 | 41 | #5f93fb 42 | #aeb0b4 43 | #777777 44 | #999999 45 | #aaaaaa 46 | #F5F5F5 47 | #ffcc3131 48 | #232323 49 | #EA5038 50 | #1086C2 51 | #f9f8f2 52 | #e19917 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /lib_common/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | lib_common 3 | 4 | -------------------------------------------------------------------------------- /lib_common/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /lib_common/src/test/java/com/senon/lib_common/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_common; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /lib_opensource/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /lib_opensource/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 5 | 6 | defaultConfig { 7 | minSdkVersion rootProject.ext.android["minSdkVersion"] 8 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 9 | versionCode rootProject.ext.android["versionCode"] 10 | versionName rootProject.ext.android["versionName"] 11 | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | 14 | } 15 | 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | testImplementation rootProject.ext.dependencies["junit"] 28 | 29 | api rootProject.ext.dependencies["support-v4"] 30 | api rootProject.ext.dependencies["appcompat-v7"] 31 | api rootProject.ext.dependencies["design"] 32 | api rootProject.ext.dependencies["recyclerview-v7"] 33 | api rootProject.ext.dependencies["cardview-v7"] 34 | 35 | api rootProject.ext.dependencies["rxandroid"] 36 | api rootProject.ext.dependencies["retrofit"] 37 | api rootProject.ext.dependencies["rxlifecycle"] 38 | api rootProject.ext.dependencies["rxlifecycle-components"] 39 | api rootProject.ext.dependencies["adapter-rxjava"] 40 | api rootProject.ext.dependencies["retrofit-converter"] 41 | api rootProject.ext.dependencies["retrofit-converter-gson"] 42 | 43 | api rootProject.ext.dependencies["stetho"] 44 | api rootProject.ext.dependencies["stetho-okhttp3"] 45 | 46 | api rootProject.ext.dependencies["okhttp3"] 47 | api rootProject.ext.dependencies["okhttp3-logging-interceptor"] 48 | 49 | api rootProject.ext.dependencies["router"] 50 | 51 | api rootProject.ext.dependencies["sweetalert"] 52 | api rootProject.ext.dependencies["autosize"] 53 | api (rootProject.ext.dependencies["lrecyclerview"]) { 54 | exclude group: 'com.android.support' 55 | } 56 | api rootProject.ext.dependencies["smartrefreshlayout"] 57 | 58 | api rootProject.ext.dependencies["glide"] 59 | api rootProject.ext.dependencies["eventbus"] 60 | api rootProject.ext.dependencies["circleimageview"] 61 | 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /lib_opensource/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /lib_opensource/src/androidTest/java/com/senon/lib_opensource/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_opensource; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.senon.lib_opensource", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib_opensource/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /lib_opensource/src/test/java/com/senon/lib_opensource/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.lib_opensource; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /module_art/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /module_art/build.gradle: -------------------------------------------------------------------------------- 1 | if(isBuildModule.toBoolean()){ 2 | apply plugin: 'com.android.application' 3 | }else{ 4 | apply plugin: 'com.android.library' 5 | } 6 | 7 | android { 8 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 9 | 10 | resourcePrefix "art_" 11 | 12 | sourceSets { 13 | main { 14 | if (isBuildModule.toBoolean()) { 15 | manifest.srcFile 'src/main/debug/AndroidManifest.xml' 16 | } else { 17 | manifest.srcFile 'src/main/release/AndroidManifest.xml' 18 | java{ 19 | //全部Module一起编译的时候剔除debug目录 20 | exclude '**/**/debug/**' 21 | } 22 | } 23 | } 24 | } 25 | 26 | defaultConfig { 27 | if(isBuildModule.toBoolean()){ 28 | applicationId "com.senon.module_art" 29 | } 30 | minSdkVersion rootProject.ext.android["minSdkVersion"] 31 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 32 | versionCode rootProject.ext.android["versionCode"] 33 | versionName rootProject.ext.android["versionName"] 34 | 35 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 36 | javaCompileOptions { 37 | annotationProcessorOptions { 38 | arguments = [AROUTER_MODULE_NAME: project.getName()] 39 | } 40 | } 41 | } 42 | 43 | buildTypes { 44 | release { 45 | minifyEnabled false 46 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 47 | } 48 | } 49 | 50 | } 51 | 52 | dependencies { 53 | implementation fileTree(dir: 'libs', include: ['*.jar']) 54 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 55 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 56 | testImplementation rootProject.ext.dependencies["junit"] 57 | 58 | api project(':lib_common') 59 | annotationProcessor rootProject.ext.dependencies["router-compiler"] 60 | } 61 | -------------------------------------------------------------------------------- /module_art/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /module_art/src/androidTest/java/com/senon/module_art/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_art; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.senon.module_art", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /module_art/src/main/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /module_art/src/main/java/com/senon/module_art/App_Art.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_art; 2 | 3 | import com.alibaba.android.arouter.launcher.ARouter; 4 | import com.senon.lib_common.base.BaseApplication; 5 | import com.senon.lib_common.utils.ConstantUtils; 6 | 7 | /** 8 | * art debug Application 9 | */ 10 | public class App_Art extends BaseApplication { 11 | @Override 12 | public void onCreate() { 13 | super.onCreate(); 14 | 15 | initARouter(); 16 | } 17 | 18 | private void initARouter() { 19 | if (ConstantUtils.isAppDebug()) { 20 | //开启InstantRun之后,一定要在ARouter.init之前调用openDebug 21 | ARouter.openDebug(); 22 | ARouter.openLog(); 23 | } 24 | ARouter.init(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /module_art/src/main/java/com/senon/module_art/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_art; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import android.support.v4.view.ViewPager; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.os.Bundle; 9 | import com.alibaba.android.arouter.facade.annotation.Route; 10 | import com.alibaba.android.arouter.launcher.ARouter; 11 | import com.senon.lib_common.ComUtil; 12 | import com.senon.lib_common.ConstantLoginArouter; 13 | import com.senon.lib_common.utils.ConstantUtils; 14 | import com.senon.lib_common.utils.LogUtils; 15 | import com.senon.lib_common.utils.StatusBarUtils; 16 | import com.senon.module_art.fragment.ArtMainFragment; 17 | 18 | /** 19 | * 公众号 art fragment 20 | */ 21 | @Route(path = ConstantLoginArouter.PATH_ART_MAINACTIVITY) 22 | public class MainActivity extends AppCompatActivity { 23 | private ViewPager viewPager; 24 | private FragmentManager fragmentManager;//声明fragment管理 25 | private ArtMainFragment fragment; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | StatusBarUtils.with(this).init(); 31 | setContentView(R.layout.art_activity_main); 32 | ComUtil.changeStatusBarTextColor(this,true); 33 | 34 | ARouter.getInstance().inject(this); 35 | LogUtils.e("------->isAppDebug===== "+ ConstantUtils.isAppDebug()); 36 | findView(); 37 | 38 | } 39 | 40 | private void findView() { 41 | viewPager = findViewById(R.id.art_main_vp); 42 | fragmentManager = getSupportFragmentManager(); 43 | fragment = new ArtMainFragment(); 44 | viewPager.setAdapter(new MyFragmentPagerAdapter(fragmentManager)); 45 | 46 | } 47 | 48 | 49 | //FragmentPagerAdapter 50 | class MyFragmentPagerAdapter extends FragmentPagerAdapter { 51 | public MyFragmentPagerAdapter(FragmentManager fm) { 52 | super(fm); 53 | } 54 | @Override 55 | public Fragment getItem(int position) { 56 | return fragment; 57 | } 58 | @Override 59 | public int getCount() { 60 | return 1; 61 | } 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /module_art/src/main/java/com/senon/module_art/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_art; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | 7 | import com.alibaba.android.arouter.launcher.ARouter; 8 | import com.senon.lib_common.ConstantLoginArouter; 9 | 10 | public class SplashActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.art_activity_splash); 16 | 17 | findViewById(R.id.art_main_login_tv).setOnClickListener(new View.OnClickListener() { 18 | @Override 19 | public void onClick(View view) { 20 | String curUrl = ConstantLoginArouter.PATH_ART_MAINACTIVITY; 21 | ARouter.getInstance().build(ConstantLoginArouter.PATH_COMMON_LOGINACTIVITY) 22 | .withString("targetUrl",curUrl) 23 | .navigation(); 24 | } 25 | }); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /module_art/src/main/java/com/senon/module_art/contract/ArtMainFragmentCon.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_art.contract; 2 | 3 | import com.senon.lib_common.base.BasePresenter; 4 | import com.senon.lib_common.base.BaseResponse; 5 | import com.senon.lib_common.base.BaseViewImp; 6 | import com.senon.lib_common.bean.Banner; 7 | import com.senon.lib_common.bean.HomeArticle; 8 | import com.senon.lib_common.bean.ProjectArticle; 9 | import com.senon.lib_common.bean.WXarticle; 10 | import com.senon.lib_common.bean.WXchapters; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * ArtMainFragmentCon V 、P契约类 16 | */ 17 | public interface ArtMainFragmentCon { 18 | 19 | interface View extends BaseViewImp { 20 | 21 | void getWXartChapResult(BaseResponse> data); 22 | 23 | void getWXartListResult(BaseResponse data); 24 | 25 | 26 | } 27 | 28 | abstract class Presenter extends BasePresenter { 29 | 30 | public abstract void getWXarticleChapters(boolean isDialog, boolean cancelable); 31 | 32 | public abstract void getWXarticleList(int id,int page,boolean isDialog, boolean cancelable); 33 | 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /module_art/src/main/release/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /module_art/src/main/res/drawable/art_shape_transp_con20.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 11 | -------------------------------------------------------------------------------- /module_art/src/main/res/drawable/art_shape_white_con30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /module_art/src/main/res/drawable/art_shape_yellow_con20.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 12 | -------------------------------------------------------------------------------- /module_art/src/main/res/layout/art_activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /module_art/src/main/res/layout/art_activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /module_art/src/main/res/layout/art_adapter_artmain_fragment_head.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 17 | 18 | 26 | -------------------------------------------------------------------------------- /module_art/src/main/res/layout/art_adapter_artmain_fragment_head_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 19 | 20 | -------------------------------------------------------------------------------- /module_art/src/main/res/layout/art_fragment_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 17 | 18 | 23 | 24 | 28 | 29 | 30 | 31 | 37 | 38 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /module_art/src/main/res/mipmap-xhdpi/art_ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_art/src/main/res/mipmap-xhdpi/art_ic_launcher_round.png -------------------------------------------------------------------------------- /module_art/src/main/res/mipmap-xxhdpi/art_ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_art/src/main/res/mipmap-xxhdpi/art_ic_launcher_round.png -------------------------------------------------------------------------------- /module_art/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /module_art/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 玩安卓_公众号 3 | 4 | -------------------------------------------------------------------------------- /module_art/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /module_art/src/test/java/com/senon/module_art/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_art; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /module_home/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /module_home/build.gradle: -------------------------------------------------------------------------------- 1 | if (isBuildModule.toBoolean()) { 2 | apply plugin: 'com.android.application' 3 | } else { 4 | apply plugin: 'com.android.library' 5 | } 6 | 7 | android { 8 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 9 | 10 | resourcePrefix "home_" 11 | 12 | sourceSets { 13 | main { 14 | if (isBuildModule.toBoolean()) { 15 | manifest.srcFile 'src/main/debug/AndroidManifest.xml' 16 | } else { 17 | manifest.srcFile 'src/main/release/AndroidManifest.xml' 18 | java { 19 | //全部Module一起编译的时候剔除debug目录 20 | exclude '**/**/debug/**' 21 | } 22 | } 23 | } 24 | } 25 | 26 | defaultConfig { 27 | if (isBuildModule.toBoolean()) { 28 | applicationId "com.senon.module_home" 29 | } 30 | minSdkVersion rootProject.ext.android["minSdkVersion"] 31 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 32 | versionCode rootProject.ext.android["versionCode"] 33 | versionName rootProject.ext.android["versionName"] 34 | 35 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 36 | javaCompileOptions { 37 | annotationProcessorOptions { 38 | arguments = [AROUTER_MODULE_NAME: project.getName()] 39 | } 40 | } 41 | } 42 | 43 | buildTypes { 44 | release { 45 | minifyEnabled false 46 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 47 | } 48 | } 49 | 50 | } 51 | 52 | dependencies { 53 | implementation fileTree(dir: 'libs', include: ['*.jar']) 54 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 55 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 56 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 57 | testImplementation rootProject.ext.dependencies["junit"] 58 | 59 | api project(':lib_common') 60 | annotationProcessor rootProject.ext.dependencies["router-compiler"] 61 | api rootProject.ext.dependencies["bannerview"] 62 | 63 | 64 | } 65 | -------------------------------------------------------------------------------- /module_home/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /module_home/src/androidTest/java/com/senon/module_home/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_home; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.senon.module_home", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /module_home/src/main/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /module_home/src/main/java/com/senon/module_home/App_Home.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_home; 2 | 3 | import com.alibaba.android.arouter.launcher.ARouter; 4 | import com.senon.lib_common.base.BaseApplication; 5 | import com.senon.lib_common.utils.ConstantUtils; 6 | 7 | /** 8 | * home debug Application 9 | */ 10 | public class App_Home extends BaseApplication { 11 | @Override 12 | public void onCreate() { 13 | super.onCreate(); 14 | 15 | initARouter(); 16 | } 17 | 18 | private void initARouter() { 19 | if (ConstantUtils.isAppDebug()) { 20 | //开启InstantRun之后,一定要在ARouter.init之前调用openDebug 21 | ARouter.openDebug(); 22 | ARouter.openLog(); 23 | } 24 | ARouter.init(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /module_home/src/main/java/com/senon/module_home/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_home; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v4.app.FragmentPagerAdapter; 7 | import android.support.v4.view.ViewPager; 8 | import android.support.v7.app.AppCompatActivity; 9 | import com.alibaba.android.arouter.facade.annotation.Route; 10 | import com.alibaba.android.arouter.launcher.ARouter; 11 | import com.senon.lib_common.ComUtil; 12 | import com.senon.lib_common.ConstantLoginArouter; 13 | import com.senon.lib_common.utils.ConstantUtils; 14 | import com.senon.lib_common.utils.LogUtils; 15 | import com.senon.lib_common.utils.StatusBarUtils; 16 | import com.senon.module_home.fragment.HomeMainFragment; 17 | 18 | /** 19 | * home 首页 20 | */ 21 | @Route(path = ConstantLoginArouter.PATH_HOME_MAINACTIVITY) 22 | public class MainActivity extends AppCompatActivity { 23 | 24 | private ViewPager viewPager; 25 | private FragmentManager fragmentManager;//声明fragment管理 26 | private HomeMainFragment fragment; 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | StatusBarUtils.with(this).init(); 32 | setContentView(R.layout.home_activity_main); 33 | ComUtil.changeStatusBarTextColor(this,true); 34 | 35 | ARouter.getInstance().inject(this); 36 | LogUtils.e("------->isAppDebug===== "+ ConstantUtils.isAppDebug()); 37 | findView(); 38 | 39 | } 40 | 41 | private void findView() { 42 | viewPager = findViewById(R.id.home_main_vp); 43 | fragmentManager = getSupportFragmentManager(); 44 | fragment = new HomeMainFragment(); 45 | viewPager.setAdapter(new MyFragmentPagerAdapter(fragmentManager)); 46 | 47 | } 48 | 49 | 50 | //FragmentPagerAdapter 51 | class MyFragmentPagerAdapter extends FragmentPagerAdapter { 52 | public MyFragmentPagerAdapter(FragmentManager fm) { 53 | super(fm); 54 | } 55 | @Override 56 | public Fragment getItem(int position) { 57 | return fragment; 58 | } 59 | @Override 60 | public int getCount() { 61 | return 1; 62 | } 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /module_home/src/main/java/com/senon/module_home/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_home; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | 7 | import com.alibaba.android.arouter.launcher.ARouter; 8 | import com.senon.lib_common.ConstantLoginArouter; 9 | 10 | public class SplashActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.home_activity_splash); 16 | 17 | findViewById(R.id.home_main_login_tv).setOnClickListener(new View.OnClickListener() { 18 | @Override 19 | public void onClick(View view) { 20 | String curUrl = ConstantLoginArouter.PATH_HOME_MAINACTIVITY; 21 | ARouter.getInstance().build(ConstantLoginArouter.PATH_COMMON_LOGINACTIVITY) 22 | .withString("targetUrl",curUrl) 23 | .navigation(); 24 | } 25 | }); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /module_home/src/main/java/com/senon/module_home/contract/HomeArticleActivityCon.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_home.contract; 2 | 3 | import com.senon.lib_common.base.BasePresenter; 4 | import com.senon.lib_common.base.BaseResponse; 5 | import com.senon.lib_common.base.BaseViewImp; 6 | import com.senon.lib_common.bean.HomeArticle; 7 | 8 | 9 | public interface HomeArticleActivityCon { 10 | 11 | interface View extends BaseViewImp { 12 | 13 | void getDataResult(BaseResponse data); 14 | 15 | void getCollectResult(int id,boolean isCollect); 16 | 17 | void getCollFailResult(int id); 18 | 19 | } 20 | 21 | abstract class Presenter extends BasePresenter { 22 | 23 | public abstract void getData(int page,boolean isDialog, boolean cancelable); 24 | 25 | public abstract void getCollect(int id ,boolean isDialog, boolean cancelable); 26 | 27 | public abstract void getUnollect(int id, boolean isDialog, boolean cancelable); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /module_home/src/main/java/com/senon/module_home/contract/HomeMainFragmentCon.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_home.contract; 2 | 3 | import com.senon.lib_common.base.BasePresenter; 4 | import com.senon.lib_common.base.BaseViewImp; 5 | import com.senon.lib_common.base.BaseResponse; 6 | import com.senon.lib_common.bean.Banner; 7 | import com.senon.lib_common.bean.HomeArticle; 8 | import com.senon.lib_common.bean.ProjectArticle; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | * HomeMainFragmentCon V 、P契约类 14 | */ 15 | public interface HomeMainFragmentCon { 16 | 17 | interface View extends BaseViewImp { 18 | 19 | void getBannerResult(BaseResponse> data); 20 | 21 | void getHomeArticleResult(BaseResponse data); 22 | 23 | void getHomeProjectResult(BaseResponse data); 24 | 25 | } 26 | 27 | abstract class Presenter extends BasePresenter { 28 | 29 | public abstract void getBanner(boolean isDialog, boolean cancelable); 30 | 31 | public abstract void getHomeArticle(int page,boolean isDialog, boolean cancelable); 32 | 33 | public abstract void getHomeProject(int page,boolean isDialog, boolean cancelable); 34 | 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /module_home/src/main/java/com/senon/module_home/contract/HomeProjectActivityCon.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_home.contract; 2 | 3 | import com.senon.lib_common.base.BasePresenter; 4 | import com.senon.lib_common.base.BaseResponse; 5 | import com.senon.lib_common.base.BaseViewImp; 6 | import com.senon.lib_common.bean.ProjectArticle; 7 | 8 | 9 | public interface HomeProjectActivityCon { 10 | 11 | interface View extends BaseViewImp { 12 | 13 | void getDataResult(BaseResponse data); 14 | 15 | } 16 | 17 | abstract class Presenter extends BasePresenter { 18 | 19 | public abstract void getData(int page,boolean isDialog, boolean cancelable); 20 | 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /module_home/src/main/java/com/senon/module_home/presenter/HomeProjectActivityPre.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_home.presenter; 2 | 3 | import android.content.Context; 4 | import com.senon.lib_common.base.BaseResponse; 5 | import com.senon.lib_common.bean.ProjectArticle; 6 | import com.senon.lib_common.net.ServerUtils; 7 | import com.senon.lib_common.net.callback.RequestCallback; 8 | import com.senon.lib_common.net.callback.RxErrorHandler; 9 | import com.senon.lib_common.utils.RetryWithDelay; 10 | import com.senon.lib_common.utils.RxUtils; 11 | import com.senon.lib_common.utils.ToastUtil; 12 | import com.senon.module_home.contract.HomeProjectActivityCon; 13 | 14 | /** 15 | * HomeProjectActivityCon P 16 | */ 17 | public class HomeProjectActivityPre extends HomeProjectActivityCon.Presenter{ 18 | 19 | private Context context; 20 | 21 | public HomeProjectActivityPre(Context context) { 22 | this.context = context; 23 | } 24 | 25 | @Override 26 | public void getData(int page,boolean isDialog, boolean cancelable) { 27 | ServerUtils.getCommonApi().getHomeProject(page) 28 | .retryWhen(new RetryWithDelay(3,2)) 29 | .compose(RxUtils.>bindToLifecycle(getView())) 30 | .compose(RxUtils.>getSchedulerTransformer()) 31 | .subscribe(new RequestCallback>(context, RxErrorHandler.getInstance(),isDialog,cancelable) { 32 | @Override 33 | public void onNext(BaseResponse baseResponse) { 34 | super.onNext(baseResponse); 35 | if(baseResponse.getCode() == 0){ 36 | getView().getDataResult(baseResponse); 37 | }else{ 38 | ToastUtil.initToast(baseResponse.getMsg()); 39 | } 40 | } 41 | @Override 42 | public void onError(Throwable e) { 43 | super.onError(e); 44 | } 45 | }); 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /module_home/src/main/release/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /module_home/src/main/res/drawable/home_shape_stro_red_con30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | 11 | -------------------------------------------------------------------------------- /module_home/src/main/res/drawable/home_shape_white_con30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /module_home/src/main/res/layout/home_activity_home_article.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 15 | 16 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /module_home/src/main/res/layout/home_activity_home_project.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /module_home/src/main/res/layout/home_activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /module_home/src/main/res/layout/home_activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /module_home/src/main/res/layout/home_adapter_homemain_fragment_banneritem.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /module_home/src/main/res/layout/home_adapter_homemain_fragment_head.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | 31 | -------------------------------------------------------------------------------- /module_home/src/main/res/layout/home_fragment_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 17 | 18 | 23 | 24 | 28 | 29 | 30 | 31 | 37 | 38 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /module_home/src/main/res/mipmap-xhdpi/home_ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_home/src/main/res/mipmap-xhdpi/home_ic_launcher.png -------------------------------------------------------------------------------- /module_home/src/main/res/mipmap-xhdpi/home_ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_home/src/main/res/mipmap-xhdpi/home_ic_launcher_round.png -------------------------------------------------------------------------------- /module_home/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /module_home/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 玩安卓_主页 3 | 4 | -------------------------------------------------------------------------------- /module_home/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /module_home/src/test/java/com/senon/module_home/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_home; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /module_life/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /module_life/build.gradle: -------------------------------------------------------------------------------- 1 | if(isBuildModule.toBoolean()){ 2 | apply plugin: 'com.android.application' 3 | }else{ 4 | apply plugin: 'com.android.library' 5 | } 6 | 7 | android { 8 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 9 | 10 | resourcePrefix "life_" 11 | 12 | sourceSets { 13 | main { 14 | if (isBuildModule.toBoolean()) { 15 | manifest.srcFile 'src/main/debug/AndroidManifest.xml' 16 | } else { 17 | manifest.srcFile 'src/main/release/AndroidManifest.xml' 18 | java{ 19 | //全部Module一起编译的时候剔除debug目录 20 | exclude '**/**/debug/**' 21 | } 22 | } 23 | } 24 | } 25 | 26 | defaultConfig { 27 | if(isBuildModule.toBoolean()){ 28 | applicationId "com.senon.module_life" 29 | } 30 | minSdkVersion rootProject.ext.android["minSdkVersion"] 31 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 32 | versionCode rootProject.ext.android["versionCode"] 33 | versionName rootProject.ext.android["versionName"] 34 | 35 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 36 | javaCompileOptions { 37 | annotationProcessorOptions { 38 | arguments = [AROUTER_MODULE_NAME: project.getName()] 39 | } 40 | } 41 | } 42 | 43 | buildTypes { 44 | release { 45 | minifyEnabled false 46 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 47 | } 48 | } 49 | 50 | } 51 | 52 | dependencies { 53 | implementation fileTree(dir: 'libs', include: ['*.jar']) 54 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 55 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 56 | testImplementation rootProject.ext.dependencies["junit"] 57 | 58 | api project(':lib_common') 59 | annotationProcessor rootProject.ext.dependencies["router-compiler"] 60 | api rootProject.ext.dependencies["flowlayout"] 61 | 62 | 63 | } 64 | -------------------------------------------------------------------------------- /module_life/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /module_life/src/androidTest/java/com/senon/module_life/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_life; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.senon.module_life", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /module_life/src/main/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /module_life/src/main/java/com/senon/module_life/App_Life.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_life; 2 | 3 | import com.alibaba.android.arouter.launcher.ARouter; 4 | import com.senon.lib_common.base.BaseApplication; 5 | import com.senon.lib_common.utils.ConstantUtils; 6 | 7 | /** 8 | * life debug Application 9 | */ 10 | public class App_Life extends BaseApplication { 11 | @Override 12 | public void onCreate() { 13 | super.onCreate(); 14 | 15 | initARouter(); 16 | } 17 | 18 | private void initARouter() { 19 | if (ConstantUtils.isAppDebug()) { 20 | //开启InstantRun之后,一定要在ARouter.init之前调用openDebug 21 | ARouter.openDebug(); 22 | ARouter.openLog(); 23 | } 24 | ARouter.init(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /module_life/src/main/java/com/senon/module_life/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_life; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import android.support.v4.view.ViewPager; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.os.Bundle; 9 | import com.alibaba.android.arouter.facade.annotation.Route; 10 | import com.alibaba.android.arouter.launcher.ARouter; 11 | import com.senon.lib_common.ComUtil; 12 | import com.senon.lib_common.ConstantLoginArouter; 13 | import com.senon.lib_common.utils.StatusBarUtils; 14 | import com.senon.module_life.fragment.LifeMainFragment; 15 | 16 | /** 17 | * life 首页 18 | */ 19 | @Route(path = ConstantLoginArouter.PATH_LIFE_MAINACTIVITY) 20 | public class MainActivity extends AppCompatActivity { 21 | 22 | private ViewPager viewPager; 23 | private FragmentManager fragmentManager;//声明fragment管理 24 | private LifeMainFragment fragment; 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | StatusBarUtils.with(this).init(); 29 | setContentView(R.layout.life_activity_main); 30 | ComUtil.changeStatusBarTextColor(this,true); 31 | ARouter.getInstance().inject(this); 32 | findView(); 33 | } 34 | 35 | private void findView() { 36 | viewPager = findViewById(R.id.life_main_vp); 37 | fragmentManager = getSupportFragmentManager(); 38 | fragment = new LifeMainFragment(); 39 | viewPager.setAdapter(new MyFragmentPagerAdapter(fragmentManager)); 40 | 41 | } 42 | 43 | 44 | //FragmentPagerAdapter 45 | class MyFragmentPagerAdapter extends FragmentPagerAdapter { 46 | public MyFragmentPagerAdapter(FragmentManager fm) { 47 | super(fm); 48 | } 49 | @Override 50 | public Fragment getItem(int position) { 51 | return fragment; 52 | } 53 | @Override 54 | public int getCount() { 55 | return 1; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /module_life/src/main/java/com/senon/module_life/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_life; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.view.View; 6 | 7 | import com.alibaba.android.arouter.launcher.ARouter; 8 | import com.senon.lib_common.ConstantLoginArouter; 9 | 10 | public class SplashActivity extends AppCompatActivity { 11 | 12 | @Override 13 | protected void onCreate(Bundle savedInstanceState) { 14 | super.onCreate(savedInstanceState); 15 | setContentView(R.layout.life_activity_splash); 16 | 17 | findViewById(R.id.life_main_login_tv).setOnClickListener(new View.OnClickListener() { 18 | @Override 19 | public void onClick(View view) { 20 | String curUrl = ConstantLoginArouter.PATH_LIFE_MAINACTIVITY; 21 | ARouter.getInstance().build(ConstantLoginArouter.PATH_COMMON_LOGINACTIVITY) 22 | .withString("targetUrl",curUrl) 23 | .navigation(); 24 | } 25 | }); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /module_life/src/main/java/com/senon/module_life/contract/KnowledgeSysActivityCon.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_life.contract; 2 | 3 | import com.senon.lib_common.base.BasePresenter; 4 | import com.senon.lib_common.base.BaseResponse; 5 | import com.senon.lib_common.base.BaseViewImp; 6 | import com.senon.lib_common.bean.KnowledgeSysArticle; 7 | 8 | 9 | public interface KnowledgeSysActivityCon { 10 | 11 | interface View extends BaseViewImp { 12 | 13 | void getDataResult(BaseResponse data); 14 | 15 | void getCollectResult(int id,boolean isCollect); 16 | 17 | void getCollFailResult(int id); 18 | 19 | } 20 | 21 | abstract class Presenter extends BasePresenter { 22 | 23 | public abstract void getData(int cid,int page,boolean isDialog, boolean cancelable); 24 | 25 | public abstract void getCollect(int id ,boolean isDialog, boolean cancelable); 26 | 27 | public abstract void getUnollect(int id, boolean isDialog, boolean cancelable); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /module_life/src/main/java/com/senon/module_life/contract/LifeMainFragmentCon.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_life.contract; 2 | 3 | import com.senon.lib_common.base.BasePresenter; 4 | import com.senon.lib_common.base.BaseViewImp; 5 | import com.senon.lib_common.base.BaseResponse; 6 | import com.senon.lib_common.bean.KnowledgeSystem; 7 | 8 | import java.util.HashMap; 9 | import java.util.List; 10 | 11 | /** 12 | * LifeMainFragmentCon V 、P契约类 13 | */ 14 | public interface LifeMainFragmentCon { 15 | 16 | interface View extends BaseViewImp { 17 | 18 | void getKnowledgeListResult(BaseResponse> data); 19 | 20 | } 21 | 22 | abstract class Presenter extends BasePresenter { 23 | 24 | public abstract void getKnowledgeList(boolean isDialog, boolean cancelable); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /module_life/src/main/java/com/senon/module_life/presenter/LifeMainFragmentPre.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_life.presenter; 2 | 3 | import android.content.Context; 4 | 5 | import com.senon.lib_common.bean.KnowledgeSystem; 6 | import com.senon.lib_common.bean.Login; 7 | import com.senon.lib_common.net.ServerUtils; 8 | import com.senon.lib_common.base.BaseResponse; 9 | import com.senon.lib_common.net.callback.RequestCallback; 10 | import com.senon.lib_common.net.callback.RxErrorHandler; 11 | import com.senon.lib_common.utils.RetryWithDelay; 12 | import com.senon.lib_common.utils.RxUtils; 13 | import com.senon.lib_common.utils.ToastUtil; 14 | import com.senon.module_life.contract.LifeMainFragmentCon; 15 | 16 | import java.util.HashMap; 17 | import java.util.List; 18 | 19 | /** 20 | * LifeMainFragmentCon P 21 | */ 22 | public class LifeMainFragmentPre extends LifeMainFragmentCon.Presenter{ 23 | 24 | private Context context; 25 | 26 | public LifeMainFragmentPre(Context context) { 27 | this.context = context; 28 | } 29 | 30 | 31 | @Override 32 | public void getKnowledgeList(boolean isDialog, boolean cancelable) { 33 | ServerUtils.getCommonApi().getKnowledgeList() 34 | .retryWhen(new RetryWithDelay(3,2)) 35 | .compose(RxUtils.>>bindToLifecycle(getView())) 36 | .compose(RxUtils.>>getSchedulerTransformer()) 37 | .subscribe(new RequestCallback>>(context, RxErrorHandler.getInstance(),isDialog,cancelable) { 38 | @Override 39 | public void onNext(BaseResponse> baseResponse) { 40 | super.onNext(baseResponse); 41 | if(baseResponse.getCode() == 0){ 42 | getView().getKnowledgeListResult(baseResponse); 43 | }else{ 44 | ToastUtil.initToast(baseResponse.getMsg()); 45 | } 46 | } 47 | @Override 48 | public void onError(Throwable e) { 49 | super.onError(e); 50 | } 51 | }); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /module_life/src/main/release/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /module_life/src/main/res/drawable/life_shape_gray_10.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /module_life/src/main/res/drawable/life_shape_white_con30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /module_life/src/main/res/layout/life_activity_home_article.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /module_life/src/main/res/layout/life_activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /module_life/src/main/res/layout/life_activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /module_life/src/main/res/layout/life_adapter_lifemain_flowlayout_item.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /module_life/src/main/res/layout/life_adapter_lifemain_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | 28 | 29 | 40 | 50 | 51 | 52 | 53 | 54 | 59 | 60 | -------------------------------------------------------------------------------- /module_life/src/main/res/layout/life_fragment_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 17 | 18 | 23 | 24 | 28 | 29 | 30 | 31 | 37 | 38 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /module_life/src/main/res/mipmap-xhdpi/life_ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_life/src/main/res/mipmap-xhdpi/life_ic_launcher.png -------------------------------------------------------------------------------- /module_life/src/main/res/mipmap-xhdpi/life_ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_life/src/main/res/mipmap-xhdpi/life_ic_launcher_round.png -------------------------------------------------------------------------------- /module_life/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /module_life/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 玩安卓_体系 3 | 4 | -------------------------------------------------------------------------------- /module_life/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /module_life/src/test/java/com/senon/module_life/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_life; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /module_talent/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /module_talent/build.gradle: -------------------------------------------------------------------------------- 1 | if (isBuildModule.toBoolean()) { 2 | apply plugin: 'com.android.application' 3 | } else { 4 | apply plugin: 'com.android.library' 5 | } 6 | 7 | android { 8 | compileSdkVersion rootProject.ext.android["compileSdkVersion"] 9 | 10 | resourcePrefix "talent_" 11 | 12 | sourceSets { 13 | main { 14 | if (isBuildModule.toBoolean()) { 15 | manifest.srcFile 'src/main/debug/AndroidManifest.xml' 16 | } else { 17 | manifest.srcFile 'src/main/release/AndroidManifest.xml' 18 | java { 19 | //全部Module一起编译的时候剔除debug目录 20 | exclude '**/**/debug/**' 21 | } 22 | } 23 | } 24 | } 25 | 26 | defaultConfig { 27 | if (isBuildModule.toBoolean()) { 28 | applicationId "com.senon.module_talent" 29 | } 30 | minSdkVersion rootProject.ext.android["minSdkVersion"] 31 | targetSdkVersion rootProject.ext.android["targetSdkVersion"] 32 | versionCode rootProject.ext.android["versionCode"] 33 | versionName rootProject.ext.android["versionName"] 34 | 35 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 36 | javaCompileOptions { 37 | annotationProcessorOptions { 38 | arguments = [AROUTER_MODULE_NAME: project.getName()] 39 | } 40 | } 41 | } 42 | 43 | buildTypes { 44 | release { 45 | minifyEnabled false 46 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 47 | } 48 | } 49 | 50 | } 51 | 52 | dependencies { 53 | implementation fileTree(dir: 'libs', include: ['*.jar']) 54 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 55 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 56 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 57 | testImplementation rootProject.ext.dependencies["junit"] 58 | 59 | api project(':lib_common') 60 | annotationProcessor rootProject.ext.dependencies["router-compiler"] 61 | } 62 | -------------------------------------------------------------------------------- /module_talent/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /module_talent/src/androidTest/java/com/senon/module_talent/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_talent; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.senon.module_talent", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /module_talent/src/main/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /module_talent/src/main/java/com/senon/module_talent/App_Talent.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_talent; 2 | 3 | import com.alibaba.android.arouter.launcher.ARouter; 4 | import com.senon.lib_common.base.BaseApplication; 5 | import com.senon.lib_common.utils.ConstantUtils; 6 | 7 | /** 8 | * home debug Application 9 | */ 10 | public class App_Talent extends BaseApplication { 11 | @Override 12 | public void onCreate() { 13 | super.onCreate(); 14 | 15 | initARouter(); 16 | } 17 | 18 | private void initARouter() { 19 | if (ConstantUtils.isAppDebug()) { 20 | //开启InstantRun之后,一定要在ARouter.init之前调用openDebug 21 | ARouter.openDebug(); 22 | ARouter.openLog(); 23 | } 24 | ARouter.init(this); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /module_talent/src/main/java/com/senon/module_talent/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_talent; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import android.support.v4.view.ViewPager; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.os.Bundle; 9 | import com.alibaba.android.arouter.facade.annotation.Route; 10 | import com.alibaba.android.arouter.launcher.ARouter; 11 | import com.senon.lib_common.ComUtil; 12 | import com.senon.lib_common.ConstantLoginArouter; 13 | import com.senon.lib_common.utils.StatusBarUtils; 14 | import com.senon.module_talent.fragment.TalentMainFragment; 15 | 16 | /** 17 | * talent 首页 18 | */ 19 | @Route(path = ConstantLoginArouter.PATH_TALENT_MAINACTIVITY) 20 | public class MainActivity extends AppCompatActivity { 21 | 22 | private ViewPager viewPager; 23 | private FragmentManager fragmentManager;//声明fragment管理 24 | private TalentMainFragment fragment; 25 | 26 | @Override 27 | protected void onCreate(Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | StatusBarUtils.with(this).init(); 30 | setContentView(R.layout.talent_activity_main); 31 | ComUtil.changeStatusBarTextColor(this,true); 32 | ARouter.getInstance().inject(this); 33 | 34 | findView(); 35 | } 36 | 37 | private void findView() { 38 | viewPager = findViewById(R.id.talent_main_vp); 39 | fragmentManager = getSupportFragmentManager(); 40 | fragment = new TalentMainFragment(); 41 | viewPager.setAdapter(new MyFragmentPagerAdapter(fragmentManager)); 42 | 43 | } 44 | 45 | 46 | //FragmentPagerAdapter 47 | class MyFragmentPagerAdapter extends FragmentPagerAdapter { 48 | public MyFragmentPagerAdapter(FragmentManager fm) { 49 | super(fm); 50 | } 51 | @Override 52 | public Fragment getItem(int position) { 53 | return fragment; 54 | } 55 | @Override 56 | public int getCount() { 57 | return 1; 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /module_talent/src/main/java/com/senon/module_talent/activity/AboutActivity.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_talent.activity; 2 | 3 | 4 | import android.content.pm.PackageManager; 5 | import android.text.Html; 6 | import android.text.method.LinkMovementMethod; 7 | import android.view.View; 8 | import android.widget.TextView; 9 | 10 | import com.alibaba.android.arouter.facade.annotation.Route; 11 | import com.senon.lib_common.ComUtil; 12 | import com.senon.lib_common.ConstantArouter; 13 | import com.senon.lib_common.base.BaseActivity; 14 | import com.senon.lib_common.base.BasePresenter; 15 | import com.senon.lib_common.base.BaseViewImp; 16 | import com.senon.lib_common.utils.StatusBarUtils; 17 | import com.senon.module_talent.R; 18 | 19 | /** 20 | * 关于 页面 21 | */ 22 | @Route(path = ConstantArouter.PATH_TALENT_ABOUTACTIVITY) 23 | public class AboutActivity extends BaseActivity> implements 24 | BaseViewImp{ 25 | 26 | private TextView version_tv,content_tv,toolbar_title_tv; 27 | 28 | 29 | @Override 30 | public int getLayoutId() { 31 | StatusBarUtils.with(this).init(); 32 | return R.layout.talent_activity_about; 33 | } 34 | @Override 35 | public BasePresenter createPresenter() { 36 | return getPresenter(); 37 | } 38 | @Override 39 | public BaseViewImp createView() { 40 | return this; 41 | } 42 | 43 | @Override 44 | public void init() { 45 | ComUtil.changeStatusBarTextColor(this,true); 46 | 47 | version_tv = findViewById(R.id.version_tv); 48 | content_tv = findViewById(R.id.content_tv); 49 | toolbar_title_tv = findViewById(R.id.toolbar_title_tv); 50 | toolbar_title_tv.setText("关于"); 51 | 52 | content_tv.setText(Html.fromHtml(getString(R.string.talent_about_content))); 53 | content_tv.setMovementMethod(LinkMovementMethod.getInstance()); 54 | try { 55 | String versionStr = getString(R.string.talent_wanandroid) 56 | + " V" + getPackageManager().getPackageInfo(getPackageName(), 0).versionName; 57 | version_tv.setText(versionStr); 58 | } catch (PackageManager.NameNotFoundException e) { 59 | e.printStackTrace(); 60 | } 61 | 62 | findViewById(R.id.toolbar_back_igv).setOnClickListener(new View.OnClickListener() { 63 | @Override 64 | public void onClick(View v) { 65 | finish(); 66 | } 67 | }); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /module_talent/src/main/java/com/senon/module_talent/contract/CollectionActivityCon.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_talent.contract; 2 | 3 | import com.senon.lib_common.base.BasePresenter; 4 | import com.senon.lib_common.base.BaseResponse; 5 | import com.senon.lib_common.base.BaseViewImp; 6 | import com.senon.lib_common.bean.CollectionArticle; 7 | 8 | 9 | public interface CollectionActivityCon { 10 | 11 | interface View extends BaseViewImp { 12 | 13 | void getDataResult(BaseResponse data); 14 | 15 | void getCollectResult(int id, boolean isCollect); 16 | 17 | } 18 | 19 | abstract class Presenter extends BasePresenter { 20 | 21 | public abstract void getData(int page,boolean isDialog, boolean cancelable); 22 | 23 | public abstract void getUnollect(int id,int originId, boolean isDialog, boolean cancelable); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /module_talent/src/main/java/com/senon/module_talent/contract/TalentMainFragmentCon.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_talent.contract; 2 | 3 | import com.senon.lib_common.base.BasePresenter; 4 | import com.senon.lib_common.base.BaseViewImp; 5 | import com.senon.lib_common.base.BaseResponse; 6 | 7 | import java.util.HashMap; 8 | 9 | /** 10 | * TalentMainFragmentCon V 、P契约类 11 | */ 12 | public interface TalentMainFragmentCon { 13 | 14 | interface View extends BaseViewImp { 15 | 16 | void getLogoutResult(BaseResponse data); 17 | 18 | } 19 | 20 | abstract class Presenter extends BasePresenter { 21 | 22 | public abstract void getLogout(boolean isDialog, boolean cancelable); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /module_talent/src/main/java/com/senon/module_talent/presenter/CollectionActivityPre.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_talent.presenter; 2 | 3 | import android.content.Context; 4 | 5 | import com.alibaba.android.arouter.launcher.ARouter; 6 | import com.senon.lib_common.ConstantLoginArouter; 7 | import com.senon.lib_common.base.BaseResponse; 8 | import com.senon.lib_common.bean.CollectionArticle; 9 | import com.senon.lib_common.net.ServerUtils; 10 | import com.senon.lib_common.net.callback.RequestCallback; 11 | import com.senon.lib_common.net.callback.RxErrorHandler; 12 | import com.senon.lib_common.utils.RetryWithDelay; 13 | import com.senon.lib_common.utils.RxUtils; 14 | import com.senon.lib_common.utils.ToastUtil; 15 | import com.senon.module_talent.contract.CollectionActivityCon; 16 | 17 | /** 18 | * CollectionActivity P 19 | */ 20 | public class CollectionActivityPre extends CollectionActivityCon.Presenter{ 21 | 22 | private Context context; 23 | 24 | public CollectionActivityPre(Context context) { 25 | this.context = context; 26 | } 27 | 28 | @Override 29 | public void getData(int page,boolean isDialog, boolean cancelable) { 30 | ServerUtils.getCommonApi().getCollectList(page) 31 | .retryWhen(new RetryWithDelay(3,2)) 32 | .compose(RxUtils.>bindToLifecycle(getView())) 33 | .compose(RxUtils.>getSchedulerTransformer()) 34 | .subscribe(new RequestCallback>(context, RxErrorHandler.getInstance(),isDialog,cancelable) { 35 | @Override 36 | public void onNext(BaseResponse baseResponse) { 37 | super.onNext(baseResponse); 38 | 39 | getView().getDataResult(baseResponse); 40 | } 41 | @Override 42 | public void onError(Throwable e) { 43 | super.onError(e); 44 | } 45 | }); 46 | } 47 | 48 | @Override 49 | public void getUnollect(final int id,int originId, boolean isDialog, boolean cancelable) { 50 | ServerUtils.getCommonApi().getUncollect(id,originId) 51 | .retryWhen(new RetryWithDelay(3,2)) 52 | .compose(RxUtils.bindToLifecycle(getView())) 53 | .compose(RxUtils.getSchedulerTransformer()) 54 | .subscribe(new RequestCallback(context, RxErrorHandler.getInstance(),isDialog,cancelable) { 55 | @Override 56 | public void onNext(BaseResponse baseResponse) { 57 | super.onNext(baseResponse); 58 | if(baseResponse.getCode() == 0){ 59 | getView().getCollectResult(id,false); 60 | }else{ 61 | 62 | ToastUtil.initToast(baseResponse.getMsg()); 63 | } 64 | } 65 | @Override 66 | public void onError(Throwable e) { 67 | super.onError(e); 68 | } 69 | }); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /module_talent/src/main/java/com/senon/module_talent/presenter/TalentMainFragmentPre.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_talent.presenter; 2 | 3 | import android.content.Context; 4 | import com.senon.lib_common.bean.Login; 5 | import com.senon.lib_common.net.ServerUtils; 6 | import com.senon.lib_common.base.BaseResponse; 7 | import com.senon.lib_common.net.callback.RequestCallback; 8 | import com.senon.lib_common.net.callback.RxErrorHandler; 9 | import com.senon.lib_common.utils.RetryWithDelay; 10 | import com.senon.lib_common.utils.RxUtils; 11 | import com.senon.lib_common.utils.ToastUtil; 12 | import com.senon.module_talent.contract.TalentMainFragmentCon; 13 | import java.util.HashMap; 14 | 15 | /** 16 | * HomeMainFragmentCon P 17 | */ 18 | public class TalentMainFragmentPre extends TalentMainFragmentCon.Presenter{ 19 | 20 | private Context context; 21 | 22 | public TalentMainFragmentPre(Context context) { 23 | this.context = context; 24 | } 25 | 26 | @Override 27 | public void getLogout( boolean isDialog, boolean cancelable) { 28 | ServerUtils.getCommonApi().logout() 29 | .retryWhen(new RetryWithDelay(3,2)) 30 | .compose(RxUtils.bindToLifecycle(getView())) 31 | .compose(RxUtils.getSchedulerTransformer()) 32 | .subscribe(new RequestCallback(context, RxErrorHandler.getInstance(),isDialog,cancelable) { 33 | @Override 34 | public void onNext(BaseResponse baseResponse) { 35 | super.onNext(baseResponse); 36 | BaseResponse response = baseResponse; 37 | if(response.getCode()==0){ 38 | getView().getLogoutResult(response); 39 | }else{ 40 | ToastUtil.initToast(response.getMsg()); 41 | } 42 | } 43 | @Override 44 | public void onError(Throwable e) { 45 | super.onError(e); 46 | } 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /module_talent/src/main/release/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /module_talent/src/main/res/drawable/talent_shape_white_con30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 10 | 11 | -------------------------------------------------------------------------------- /module_talent/src/main/res/layout/talent_activity_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 22 | 23 | 36 | 37 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /module_talent/src/main/res/layout/talent_activity_collection.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /module_talent/src/main/res/layout/talent_activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /module_talent/src/main/res/mipmap-xhdpi/talent_ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_talent/src/main/res/mipmap-xhdpi/talent_ic_launcher_round.png -------------------------------------------------------------------------------- /module_talent/src/main/res/mipmap-xxhdpi/talent_conan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_talent/src/main/res/mipmap-xxhdpi/talent_conan.png -------------------------------------------------------------------------------- /module_talent/src/main/res/mipmap-xxhdpi/talent_ic_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_talent/src/main/res/mipmap-xxhdpi/talent_ic_about.png -------------------------------------------------------------------------------- /module_talent/src/main/res/mipmap-xxhdpi/talent_ic_cache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_talent/src/main/res/mipmap-xxhdpi/talent_ic_cache.png -------------------------------------------------------------------------------- /module_talent/src/main/res/mipmap-xxhdpi/talent_ic_collect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_talent/src/main/res/mipmap-xxhdpi/talent_ic_collect.png -------------------------------------------------------------------------------- /module_talent/src/main/res/mipmap-xxhdpi/talent_ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_talent/src/main/res/mipmap-xxhdpi/talent_ic_launcher_round.png -------------------------------------------------------------------------------- /module_talent/src/main/res/mipmap-xxhdpi/talent_ic_login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_talent/src/main/res/mipmap-xxhdpi/talent_ic_login.png -------------------------------------------------------------------------------- /module_talent/src/main/res/mipmap-xxhdpi/talent_mainfragmbg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/module_talent/src/main/res/mipmap-xxhdpi/talent_mainfragmbg.png -------------------------------------------------------------------------------- /module_talent/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /module_talent/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 玩安卓_我的 3 | 4 | 网站内容 6 |

\t\t\t\t本网站内容来源于鸿洋wanandroid,网站内提供大量优质技术博客、平时开发过程中常用的工具以及常用的网址导航。

7 |

目前本App含有如下功能:

8 | \t\t\t\t首页:包含Banner、最新博文、最新项目 9 |
\t\t\t\t体系:一级、二级全部博文 10 |
\t\t\t\t公众号:所有公众号及公众号博文 11 |
\t\t\t\t个人中心:登录、退出、收藏、清除缓存 12 |


13 |

项目源码

14 |

\t\t本软件为开源软件,地址GitHub,如有交流,请提issue。测试账号:12341234,密码123456。

15 | ]]>
16 | 17 | WanAndroid 18 | 19 | 20 |
21 | -------------------------------------------------------------------------------- /module_talent/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /module_talent/src/test/java/com/senon/module_talent/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.senon.module_talent; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /screenshot/main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/screenshot/main.png -------------------------------------------------------------------------------- /screenshot/main2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/screenshot/main2.png -------------------------------------------------------------------------------- /screenshot/main3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/screenshot/main3.png -------------------------------------------------------------------------------- /screenshot/qrcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/screenshot/qrcode.png -------------------------------------------------------------------------------- /senon.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/senonwx/WanAndroid/548831d6c068d9ea74e5136245ae38d0fe1c248f/senon.jks -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':module_home', ':module_life', ':module_art', ':module_talent', ':lib_opensource', ':lib_common' 2 | --------------------------------------------------------------------------------