├── .gitignore ├── .idea ├── caches │ └── build_file_checksums.ser ├── codeStyles │ └── Project.xml ├── compiler.xml ├── gradle.xml ├── misc.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro ├── release │ └── output.json └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── cwd │ │ └── wandroid │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── cwd │ │ │ └── wandroid │ │ │ ├── adapter │ │ │ ├── ArticleAdapter.java │ │ │ ├── NavAdapter.java │ │ │ ├── ProjectCategoryAdapter.java │ │ │ ├── ProjectFragmentAdapter.java │ │ │ ├── SystemAdapter.java │ │ │ └── SystemDetailFragmentAdapter.java │ │ │ ├── api │ │ │ ├── ApiService.java │ │ │ ├── ObserverResponseListener.java │ │ │ └── RetrofitUtils.java │ │ │ ├── app │ │ │ ├── ActivityCollector.java │ │ │ └── App.java │ │ │ ├── base │ │ │ ├── BaseActivity.java │ │ │ ├── BaseContract.java │ │ │ ├── BaseFragment.java │ │ │ ├── BaseObserver.java │ │ │ └── BasePresenter.java │ │ │ ├── constants │ │ │ └── Constants.java │ │ │ ├── contract │ │ │ ├── ArticleContract.java │ │ │ ├── CollectContract.java │ │ │ ├── IntegralContract.java │ │ │ ├── LoginContract.java │ │ │ ├── NavContract.java │ │ │ ├── ProjectContract.java │ │ │ ├── ProjectListContract.java │ │ │ ├── SearchContract.java │ │ │ └── SystemContract.java │ │ │ ├── entity │ │ │ ├── Article.java │ │ │ ├── ArticleInfo.java │ │ │ ├── Banner.java │ │ │ ├── BaseResponse.java │ │ │ ├── HotKey.java │ │ │ ├── Login.java │ │ │ ├── MessageEvent.java │ │ │ ├── MyIntegral.java │ │ │ ├── NavInfo.java │ │ │ ├── NavTitle.java │ │ │ ├── ProjectCategory.java │ │ │ ├── System.java │ │ │ └── SystemDetail.java │ │ │ ├── presenter │ │ │ ├── ArticlePresenter.java │ │ │ ├── CollectPresenter.java │ │ │ ├── IntegralPresenter.java │ │ │ ├── LoginPresenter.java │ │ │ ├── NavPresenter.java │ │ │ ├── ProjectListPresenter.java │ │ │ ├── ProjectPresenter.java │ │ │ ├── SearchPresenter.java │ │ │ └── SystemPresenter.java │ │ │ ├── source │ │ │ └── DataManager.java │ │ │ ├── ui │ │ │ ├── activity │ │ │ │ ├── AboutActivity.java │ │ │ │ ├── CollectActivity.java │ │ │ │ ├── IntegralActivity.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── SearchActivity.java │ │ │ │ ├── SplashActivity.java │ │ │ │ ├── SystemDetailActivity.java │ │ │ │ └── WebViewActivity.java │ │ │ ├── fragment │ │ │ │ ├── ArticleFragment.java │ │ │ │ ├── MineFragment.java │ │ │ │ ├── NavFragment.java │ │ │ │ ├── ProjectFragment.java │ │ │ │ ├── ProjectListFragment.java │ │ │ │ └── SystemFragment.java │ │ │ └── widget │ │ │ │ ├── DynamicNumberTextView.java │ │ │ │ ├── FlowLayout.java │ │ │ │ ├── HotKeyPop.java │ │ │ │ ├── ProjectCategoryPop.java │ │ │ │ └── SplashLogo.java │ │ │ └── utils │ │ │ ├── BottomNavigationViewHelper.java │ │ │ ├── CommonUtils.java │ │ │ ├── DensityUtil.java │ │ │ ├── GlideImageLoader.java │ │ │ ├── LogUtils.java │ │ │ ├── SPUtils.java │ │ │ ├── StatusBarUtils.java │ │ │ └── ToastUtils.java │ └── res │ │ ├── anim │ │ ├── alpha_in.xml │ │ ├── alpha_out.xml │ │ ├── push_in.xml │ │ ├── push_left_in.xml │ │ ├── push_left_out.xml │ │ ├── push_out.xml │ │ └── stop_anim.xml │ │ ├── color │ │ └── navigation_menu_item_color.xml │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable-xxhdpi │ │ ├── about.png │ │ ├── girl.png │ │ ├── girl_tint.png │ │ ├── home.png │ │ ├── home_tint.png │ │ ├── ic_integral.png │ │ ├── ic_rank.png │ │ ├── icon_default.jpeg │ │ ├── icon_down.png │ │ ├── icon_up.png │ │ ├── logo.jpg │ │ ├── mine.png │ │ ├── mine_tint.png │ │ ├── nav.png │ │ ├── nav_tint.png │ │ ├── project.png │ │ ├── project_tint.png │ │ ├── search.png │ │ ├── search_tint.png │ │ ├── system.png │ │ ├── system_tint.png │ │ └── update.png │ │ ├── drawable │ │ ├── btn_login_selector.xml │ │ ├── btn_register_selector.xml │ │ ├── flow_search_hotkey_bg.xml │ │ ├── flow_tab_bg.xml │ │ ├── ic_baseline_arrow_back_24.xml │ │ ├── ic_baseline_arrow_upward_24.xml │ │ ├── ic_baseline_search_24.xml │ │ ├── ic_dashboard_black_24dp.xml │ │ ├── ic_home_black_24dp.xml │ │ ├── ic_launcher_background.xml │ │ ├── ic_level.png │ │ ├── ic_notifications_black_24dp.xml │ │ ├── ic_system_black_24dp.xml │ │ ├── main_tb_search.xml │ │ ├── nav_girl.xml │ │ ├── nav_home.xml │ │ ├── nav_mine.xml │ │ ├── nav_nav.xml │ │ ├── nav_project.xml │ │ ├── nav_system.xml │ │ ├── shape_btn_register.xml │ │ ├── shape_btn_register_press.xml │ │ ├── shape_circle.xml │ │ ├── shape_more_tab_shadow.xml │ │ └── shape_stroke_radius_6.xml │ │ ├── layout │ │ ├── activity_about.xml │ │ ├── activity_collect.xml │ │ ├── activity_main.xml │ │ ├── activity_myintegral.xml │ │ ├── activity_search.xml │ │ ├── activity_splash.xml │ │ ├── activity_system_detail.xml │ │ ├── activity_web_view.xml │ │ ├── banner_layout.xml │ │ ├── empty_view.xml │ │ ├── fragment_article.xml │ │ ├── fragment_mine.xml │ │ ├── fragment_nav.xml │ │ ├── fragment_project.xml │ │ ├── fragment_system.xml │ │ ├── hot_key_layout.xml │ │ ├── item_article.xml │ │ ├── item_nav.xml │ │ ├── item_project_category.xml │ │ ├── item_system.xml │ │ ├── login_layout.xml │ │ ├── project_category_list_layout.xml │ │ └── toolbar.xml │ │ ├── menu │ │ ├── main_menu.xml │ │ ├── navigation.xml │ │ ├── search_menu.xml │ │ └── web_view_menu.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-night │ │ └── colors.xml │ │ ├── values-v21 │ │ └── styles.xml │ │ └── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── cwd │ └── wandroid │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── image └── wandroid_example.gif └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/libraries 5 | /.idea/modules.xml 6 | /.idea/workspace.xml 7 | .DS_Store 8 | /build 9 | /captures 10 | .externalNativeBuild 11 | # Built application files 12 | *.apk 13 | *.ap_ 14 | 15 | # Files for the ART/Dalvik VM 16 | *.dex 17 | 18 | # Java class files 19 | *.class 20 | 21 | # Generated files 22 | bin/ 23 | gen/ 24 | out/ 25 | 26 | # Gradle files 27 | .gradle/ 28 | build/ 29 | 30 | # Local configuration file (sdk path, etc) 31 | local.properties 32 | 33 | # Proguard folder generated by Eclipse 34 | proguard/ 35 | 36 | # Log Files 37 | *.log 38 | 39 | # Android Studio Navigation editor temp files 40 | .navigation/ 41 | 42 | # Android Studio captures folder 43 | captures/ 44 | 45 | # IntelliJ 46 | *.iml 47 | .idea/workspace.xml 48 | .idea/tasks.xml 49 | .idea/gradle.xml 50 | .idea/assetWizardSettings.xml 51 | .idea/dictionaries 52 | .idea/libraries 53 | .idea/caches 54 | 55 | # Keystore files 56 | # Uncomment the following line if you do not want to check your keystore files in. 57 | #*.jks 58 | 59 | # External native build folder generated in Android Studio 2.2 and later 60 | .externalNativeBuild 61 | 62 | # Google Services (e.g. APIs or Firebase) 63 | google-services.json 64 | 65 | # Freeline 66 | freeline.py 67 | freeline/ 68 | freeline_project_description.json 69 | 70 | # fastlane 71 | fastlane/report.xml 72 | fastlane/Preview.html 73 | fastlane/screenshots 74 | fastlane/test_output 75 | fastlane/readme.md 76 | -------------------------------------------------------------------------------- /.idea/caches/build_file_checksums.ser: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/.idea/caches/build_file_checksums.ser -------------------------------------------------------------------------------- /.idea/codeStyles/Project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | xmlns:android 14 | 15 | ^$ 16 | 17 | 18 | 19 |
20 |
21 | 22 | 23 | 24 | xmlns:.* 25 | 26 | ^$ 27 | 28 | 29 | BY_NAME 30 | 31 |
32 |
33 | 34 | 35 | 36 | .*:id 37 | 38 | http://schemas.android.com/apk/res/android 39 | 40 | 41 | 42 |
43 |
44 | 45 | 46 | 47 | .*:name 48 | 49 | http://schemas.android.com/apk/res/android 50 | 51 | 52 | 53 |
54 |
55 | 56 | 57 | 58 | name 59 | 60 | ^$ 61 | 62 | 63 | 64 |
65 |
66 | 67 | 68 | 69 | style 70 | 71 | ^$ 72 | 73 | 74 | 75 |
76 |
77 | 78 | 79 | 80 | .* 81 | 82 | ^$ 83 | 84 | 85 | BY_NAME 86 | 87 |
88 |
89 | 90 | 91 | 92 | .* 93 | 94 | http://schemas.android.com/apk/res/android 95 | 96 | 97 | ANDROID_ATTRIBUTE_ORDER 98 | 99 |
100 |
101 | 102 | 103 | 104 | .* 105 | 106 | .* 107 | 108 | 109 | BY_NAME 110 | 111 |
112 |
113 |
114 |
115 |
116 |
-------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android 版 WanAndroid 客户端 2 | ## 一款浏览Android学习文章的App 3 | **项目地址(https://github.com/chenweide/wanAndroid)** 4 | 5 | **开源不易,如果喜欢的话希望给个 `Star` 或 `Fork` ^_^ ,谢谢~~** 6 | 7 | **该项目主要架构为Material Design+MVP+Retrofit2+Rxjava2,基于鸿洋大神提供的[玩Android](http://www.wanandroid.com/)的开放API构建而成** 8 | ## 主要开源框架 9 | - [Butterknife](https://github.com/JakeWharton/butterknife) 10 | - [Glide](https://github.com/bumptech/glide) 11 | - [Logger](https://github.com/orhanobut/logger) 12 | - [Gson](https://github.com/google/gson) 13 | - [Leakcanary](https://github.com/square/leakcanary) 14 | - [Banner](https://github.com/youth5201314/banner) 15 | - [BaseRecyclerViewAdapterHelper](https://github.com/CymChad/BaseRecyclerViewAdapterHelper) 16 | - [Statusbarutil](https://github.com/laobie/StatusBarUtil) 17 | - [circleimageview](https://github.com/hdodenhof/CircleImageView) 18 | - [PersistentCookieJar](https://github.com/franmontiel/PersistentCookieJar) 19 | - [Eventbus](https://github.com/greenrobot/EventBus) 20 | 21 | ## Thanks 22 | 23 | **感谢所有优秀的开源项目 ^_^** 。 24 | 25 | ## Statement 26 | **项目中的 API 均来自于 [www.wanandroid.com](http://www.wanandroid.com/) 网站,纯属学习交流使用,不得用于商业用途。** 27 | 28 | ## 更新日志 29 | **v1.1.1 2021.1.3**
30 | 添加Bugly异常上报,自动检查更新
31 | 32 | **v1.1.1 2021.1.1**
33 | 添加启动页
34 | 35 | **v1.1.0 2020.12.30**
36 | 添加积分模块,我的积分,积分排名
37 | 自定义数字递增动画效果
38 | 39 | **v1.0.1 2020.12.13**
40 | 改进搜索页的转场动画
41 | 文章列表添加回到顶部按钮
42 | 43 | **v1.0.0 long long ago** 44 | 45 | *** 46 | Apk下载:[WanAndroid.apk](https://pan.baidu.com/s/1PqUS8aho4jMSS_oGeIGpnw) 提取码: 9x89 47 | *** 48 | 49 | **Gif可能需要科学上网才能正常浏览** 50 | ![image](https://github.com/chenweide/wanAndroid/blob/master/image/wandroid_example.gif) 51 |
52 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 |
64 | 65 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 27 5 | defaultConfig { 6 | applicationId "com.cwd.wandroid" 7 | minSdkVersion 21 8 | targetSdkVersion 27 9 | versionCode 3 10 | versionName "1.1.2" 11 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 12 | 13 | ndk { 14 | //设置支持的SO库架构 15 | abiFilters 'armeabi','x86' //, 'x86', 'armeabi-v7a', 'x86_64', 'arm64-v8a' 16 | } 17 | } 18 | buildTypes { 19 | release { 20 | shrinkResources true 21 | minifyEnabled true 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | } 25 | lintOptions { 26 | checkReleaseBuilds false 27 | abortOnError false 28 | } 29 | } 30 | 31 | dependencies { 32 | implementation fileTree(dir: 'libs', include: ['*.jar']) 33 | implementation 'com.android.support:appcompat-v7:27.1.1' 34 | implementation 'com.android.support:design:27.1.1' 35 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 36 | testImplementation 'junit:junit:4.12' 37 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 38 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 39 | implementation 'com.jakewharton:butterknife:8.8.1' 40 | implementation 'com.github.bumptech.glide:glide:4.2.0' 41 | implementation 'com.orhanobut:logger:2.2.0' 42 | implementation 'com.google.code.gson:gson:2.7' 43 | annotationProcessor 'com.github.bumptech.glide:compiler:4.2.0' 44 | debugImplementation 'com.squareup.leakcanary:leakcanary-android:1.5.4' 45 | releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4' 46 | annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1' 47 | implementation 'com.youth.banner:banner:1.4.10' 48 | implementation 'com.squareup.retrofit2:retrofit:2.3.0'//导入retrofit 49 | implementation 'io.reactivex.rxjava2:rxandroid:2.0.2' 50 | implementation 'io.reactivex.rxjava2:rxjava:2.1.1' 51 | implementation 'com.squareup.retrofit2:converter-gson:2.3.0'//转换器,请求结果转换成Model 52 | implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'//配合Rxjava 使用 53 | implementation 'com.squareup.okhttp3:okhttp:3.7.0' 54 | implementation 'com.squareup.okhttp3:logging-interceptor:3.7.0' 55 | implementation 'com.squareup.retrofit2:converter-scalars:2.3.0' 56 | implementation 'com.trello.rxlifecycle2:rxlifecycle:2.0.1' 57 | implementation 'com.trello.rxlifecycle2:rxlifecycle-android:2.0.1' 58 | implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.0.1' 59 | implementation 'cn.pedant.sweetalert:library:1.3' 60 | implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30' 61 | implementation 'com.jaeger.statusbarutil:library:1.4.0' 62 | implementation 'de.hdodenhof:circleimageview:2.2.0' 63 | implementation 'com.github.franmontiel:PersistentCookieJar:v1.0.1' 64 | implementation 'org.greenrobot:eventbus:3.1.1' 65 | implementation 'com.github.paulyung541:LaybelLayout:v1.2.0' 66 | implementation 'com.tencent.bugly:crashreport_upgrade:1.5.0' 67 | } 68 | -------------------------------------------------------------------------------- /app/release/output.json: -------------------------------------------------------------------------------- 1 | [{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":3,"versionName":"1.1.2","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}] -------------------------------------------------------------------------------- /app/src/androidTest/java/com/cwd/wandroid/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid; 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() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.cwd.wandroid", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/adapter/ArticleAdapter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | import android.text.TextUtils; 5 | import android.view.View; 6 | import android.widget.ImageView; 7 | import android.widget.TextView; 8 | 9 | import com.bumptech.glide.Glide; 10 | import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; 11 | import com.bumptech.glide.request.RequestOptions; 12 | import com.bumptech.glide.request.transition.DrawableCrossFadeFactory; 13 | import com.chad.library.adapter.base.BaseQuickAdapter; 14 | import com.chad.library.adapter.base.BaseViewHolder; 15 | import com.cwd.wandroid.R; 16 | import com.cwd.wandroid.entity.ArticleInfo; 17 | 18 | import java.util.List; 19 | 20 | public class ArticleAdapter extends BaseQuickAdapter { 21 | 22 | public ArticleAdapter(int layoutResId, @Nullable List data) { 23 | super(layoutResId, data); 24 | 25 | } 26 | 27 | @Override 28 | protected void convert(BaseViewHolder helper, ArticleInfo item) { 29 | helper.setText(R.id.tv_author,item.getAuthor()); 30 | helper.setText(R.id.tv_date,item.getNiceDate()); 31 | helper.setText(R.id.tv_title,item.getTitle()); 32 | helper.setText(R.id.tv_category,item.getChapterName()); 33 | int type = item.getType(); 34 | if(type == 1){ 35 | helper.setVisible(R.id.tv_flag,true); 36 | helper.setText(R.id.tv_flag,"TOP"); 37 | }else{ 38 | if(item.isFresh()){ 39 | helper.setVisible(R.id.tv_flag,true); 40 | helper.setText(R.id.tv_flag,"NEW"); 41 | }else{ 42 | helper.setVisible(R.id.tv_flag,false); 43 | } 44 | } 45 | ImageView ivPic = helper.getView(R.id.iv_pic); 46 | String pic = item.getEnvelopePic(); 47 | 48 | if(!TextUtils.isEmpty(pic)){ 49 | ivPic.setVisibility(View.VISIBLE); 50 | RequestOptions requestOptions = new RequestOptions(); 51 | requestOptions.placeholder(R.drawable.icon_default); 52 | DrawableCrossFadeFactory drawableCrossFadeFactory = new DrawableCrossFadeFactory.Builder().setCrossFadeEnabled(true).build(); 53 | Glide.with(mContext).load(pic).apply(requestOptions) 54 | .transition(DrawableTransitionOptions.with(drawableCrossFadeFactory)).into(ivPic); 55 | }else{ 56 | ivPic.setVisibility(View.GONE); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/adapter/NavAdapter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | import android.support.v4.content.ContextCompat; 5 | import android.widget.LinearLayout; 6 | import android.widget.TextView; 7 | 8 | import com.chad.library.adapter.base.BaseQuickAdapter; 9 | import com.chad.library.adapter.base.BaseViewHolder; 10 | import com.cwd.wandroid.R; 11 | import com.cwd.wandroid.entity.NavTitle; 12 | import com.cwd.wandroid.entity.System; 13 | import com.cwd.wandroid.entity.SystemDetail; 14 | import com.cwd.wandroid.ui.widget.FlowLayout; 15 | import com.cwd.wandroid.utils.DensityUtil; 16 | 17 | import java.util.List; 18 | 19 | public class NavAdapter extends BaseQuickAdapter { 20 | 21 | private int highLightItemPosition; 22 | 23 | public NavAdapter(int layoutResId, @Nullable List data) { 24 | super(layoutResId, data); 25 | } 26 | 27 | @Override 28 | protected void convert(BaseViewHolder helper, NavTitle item) { 29 | if(helper.getLayoutPosition() == highLightItemPosition){ 30 | helper.itemView.setBackgroundColor(mContext.getResources().getColor(R.color.grayBtn)); 31 | }else{ 32 | helper.itemView.setBackgroundColor(mContext.getResources().getColor(R.color.grayBg)); 33 | } 34 | helper.setText(R.id.tv_title,item.getName()); 35 | } 36 | 37 | public void setHighLightItem(int position){ 38 | this.highLightItemPosition = position; 39 | notifyDataSetChanged(); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/adapter/ProjectCategoryAdapter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | import android.text.TextUtils; 5 | import android.view.View; 6 | import android.widget.ImageView; 7 | 8 | import com.bumptech.glide.Glide; 9 | import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions; 10 | import com.bumptech.glide.request.RequestOptions; 11 | import com.bumptech.glide.request.transition.DrawableCrossFadeFactory; 12 | import com.chad.library.adapter.base.BaseQuickAdapter; 13 | import com.chad.library.adapter.base.BaseViewHolder; 14 | import com.cwd.wandroid.R; 15 | import com.cwd.wandroid.entity.ArticleInfo; 16 | import com.cwd.wandroid.entity.ProjectCategory; 17 | 18 | import java.util.List; 19 | 20 | public class ProjectCategoryAdapter extends BaseQuickAdapter { 21 | 22 | public ProjectCategoryAdapter(int layoutResId, @Nullable List data) { 23 | super(layoutResId, data); 24 | } 25 | 26 | @Override 27 | protected void convert(BaseViewHolder helper, ProjectCategory item) { 28 | helper.setText(R.id.tv_category,item.getName()); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/adapter/ProjectFragmentAdapter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v4.app.FragmentStatePagerAdapter; 7 | 8 | import com.cwd.wandroid.entity.ProjectCategory; 9 | import com.cwd.wandroid.ui.fragment.ProjectListFragment; 10 | 11 | import java.util.List; 12 | 13 | public class ProjectFragmentAdapter extends FragmentStatePagerAdapter { 14 | 15 | private List categoryList; 16 | 17 | public ProjectFragmentAdapter(FragmentManager fm, List categoryList) { 18 | super(fm); 19 | this.categoryList = categoryList; 20 | } 21 | 22 | @Override 23 | public Fragment getItem(int position) { 24 | return ProjectListFragment.newInstance(categoryList.get(position).getId(),false); 25 | } 26 | 27 | @Nullable 28 | @Override 29 | public CharSequence getPageTitle(int position) { 30 | return categoryList.get(position).getName(); 31 | } 32 | 33 | @Override 34 | public int getCount() { 35 | return categoryList.size(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/adapter/SystemAdapter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | import android.support.v4.content.ContextCompat; 5 | import android.view.View; 6 | import android.widget.LinearLayout; 7 | import android.widget.TextView; 8 | 9 | import com.chad.library.adapter.base.BaseQuickAdapter; 10 | import com.chad.library.adapter.base.BaseViewHolder; 11 | import com.cwd.wandroid.R; 12 | import com.cwd.wandroid.entity.ArticleInfo; 13 | import com.cwd.wandroid.entity.ProjectCategory; 14 | import com.cwd.wandroid.entity.System; 15 | import com.cwd.wandroid.entity.SystemDetail; 16 | import com.cwd.wandroid.ui.widget.FlowLayout; 17 | import com.cwd.wandroid.utils.DensityUtil; 18 | 19 | import java.util.List; 20 | 21 | public class SystemAdapter extends BaseQuickAdapter { 22 | 23 | public SystemAdapter(int layoutResId, @Nullable List data) { 24 | super(layoutResId, data); 25 | } 26 | 27 | @Override 28 | protected void convert(BaseViewHolder helper, System item) { 29 | helper.setText(R.id.tv_title,item.getName()); 30 | FlowLayout flowLayout = helper.getView(R.id.fl_system_content); 31 | initTab(flowLayout,item.getChildren()); 32 | } 33 | 34 | private void initTab(FlowLayout flowLayout, final List tags) { 35 | flowLayout.removeAllViews(); 36 | LinearLayout.MarginLayoutParams layoutParams = new LinearLayout.MarginLayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); 37 | // 设置边距 38 | layoutParams.setMargins(5, 3, 5, 3); 39 | for (int i = 0; i < tags.size(); i++) { 40 | final TextView textView = new TextView(mContext); 41 | textView.setTag(i); 42 | textView.setTextSize(14); 43 | textView.setText(tags.get(i).getName()); 44 | textView.setPadding(DensityUtil.dip2px(mContext,8), DensityUtil.dip2px(mContext,3), DensityUtil.dip2px(mContext,8), DensityUtil.dip2px(mContext,3)); 45 | textView.setTextColor(ContextCompat.getColor(mContext,R.color.textColorTint)); 46 | flowLayout.addView(textView, layoutParams); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/adapter/SystemDetailFragmentAdapter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.adapter; 2 | 3 | import android.support.annotation.Nullable; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v4.app.FragmentStatePagerAdapter; 7 | 8 | import com.cwd.wandroid.entity.ProjectCategory; 9 | import com.cwd.wandroid.entity.SystemDetail; 10 | import com.cwd.wandroid.ui.fragment.ProjectListFragment; 11 | 12 | import java.util.List; 13 | 14 | public class SystemDetailFragmentAdapter extends FragmentStatePagerAdapter { 15 | 16 | private List systemDetailList; 17 | 18 | public SystemDetailFragmentAdapter(FragmentManager fm, List systemDetailList) { 19 | super(fm); 20 | this.systemDetailList = systemDetailList; 21 | } 22 | 23 | @Override 24 | public Fragment getItem(int position) { 25 | return ProjectListFragment.newInstance(systemDetailList.get(position).getId(),true); 26 | } 27 | 28 | @Nullable 29 | @Override 30 | public CharSequence getPageTitle(int position) { 31 | return systemDetailList.get(position).getName(); 32 | } 33 | 34 | @Override 35 | public int getCount() { 36 | return systemDetailList.size(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/api/ApiService.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.api; 2 | 3 | import com.cwd.wandroid.entity.Article; 4 | import com.cwd.wandroid.entity.ArticleInfo; 5 | import com.cwd.wandroid.entity.Banner; 6 | import com.cwd.wandroid.entity.BaseResponse; 7 | import com.cwd.wandroid.entity.HotKey; 8 | import com.cwd.wandroid.entity.Login; 9 | import com.cwd.wandroid.entity.MyIntegral; 10 | import com.cwd.wandroid.entity.NavTitle; 11 | import com.cwd.wandroid.entity.ProjectCategory; 12 | import com.cwd.wandroid.entity.System; 13 | 14 | import java.util.List; 15 | import java.util.Map; 16 | 17 | import io.reactivex.Observable; 18 | import retrofit2.http.GET; 19 | import retrofit2.http.POST; 20 | import retrofit2.http.Path; 21 | import retrofit2.http.Query; 22 | import retrofit2.http.QueryMap; 23 | 24 | /** 25 | * api service 26 | */ 27 | public interface ApiService { 28 | 29 | @POST("query") 30 | Observable>> login(@QueryMap Map map); 31 | 32 | @POST("query") 33 | Observable>> logout(@QueryMap Map map); 34 | 35 | /** 36 | * 获取首页文章列表 37 | * @param page 38 | * @return 39 | */ 40 | @GET("/article/list/{page}/json") 41 | Observable> getArticleList(@Path("page") int page); 42 | 43 | /** 44 | * 获取置顶文章 45 | * @return 46 | */ 47 | @GET("/article/top/json") 48 | Observable>> getTopArticleList(); 49 | 50 | /** 51 | * 项目分类 52 | * @return 53 | */ 54 | @GET("/project/tree/json") 55 | Observable>> getProjectCategory(); 56 | 57 | /** 58 | * 项目列表数据 59 | * @return 60 | */ 61 | @GET("/project/list/{page}/json") 62 | Observable> getProjectList(@Path("page") int page,@Query("cid") int cid); 63 | 64 | /** 65 | * 体系数据 66 | * @return 67 | */ 68 | @GET("/tree/json") 69 | Observable>> getSystemInfo(); 70 | 71 | /** 72 | * 获取体系下的文章 73 | * @param page 74 | * @param cid 75 | * @return 76 | */ 77 | @GET("/article/list/{page}/json") 78 | Observable> getSystemArticleList(@Path("page") int page,@Query("cid") int cid); 79 | 80 | /** 81 | * 导航数据 82 | * @return 83 | */ 84 | @GET("/navi/json") 85 | Observable>> getNavInfo(); 86 | 87 | /** 88 | * 搜索 89 | * @param page 90 | * @param keyword 91 | * @return 92 | */ 93 | @POST("/article/query/{page}/json") 94 | Observable> getSearchList(@Path("page") int page,@Query("k") String keyword); 95 | 96 | /** 97 | * banner 98 | * @return 99 | */ 100 | @GET("/banner/json") 101 | Observable>> getBanner(); 102 | 103 | /** 104 | *登录 105 | * @return 106 | */ 107 | @POST("/user/login") 108 | Observable> login(@Query("username") String username,@Query("password") String password); 109 | 110 | /** 111 | *注销 112 | * @return 113 | */ 114 | @GET("/user/logout/json") 115 | Observable logout(); 116 | 117 | /** 118 | *注册 119 | * @return 120 | */ 121 | @POST("/user/register") 122 | Observable> register(@Query("username") String username,@Query("password") String password,@Query("repassword") String repassword); 123 | 124 | /** 125 | * 获取收藏文章列表 126 | * @param page 127 | * @return 128 | */ 129 | @GET("/lg/collect/list/{page}/json") 130 | Observable> getCollectList(@Path("page") int page); 131 | 132 | /** 133 | * 收藏文章 134 | * @param id 135 | * @return 136 | */ 137 | @POST("/lg/collect/{id}/json") 138 | Observable collectArticle(@Path("id") int id); 139 | 140 | /** 141 | * 取消收藏文章 142 | * @param id 143 | * @param originId 144 | * @return 145 | */ 146 | @POST("/lg/uncollect/{id}/json") 147 | Observable cancelCollectArticle(@Path("id") int id,@Query("originId") int originId); 148 | 149 | /** 150 | * 搜索热词 151 | * @return 152 | */ 153 | @GET("/hotkey/json") 154 | Observable>> getHotKey(); 155 | 156 | /** 157 | * 获取个人积分 158 | * @return 159 | */ 160 | @GET("/lg/coin/userinfo/json") 161 | Observable> getMyIntegral(); 162 | } 163 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/api/ObserverResponseListener.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.api; 2 | 3 | public interface ObserverResponseListener { 4 | void onNext(T o); 5 | void onError(Throwable e); 6 | } 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/api/RetrofitUtils.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.api; 2 | 3 | import com.cwd.wandroid.app.App; 4 | import com.cwd.wandroid.constants.Constants; 5 | import com.cwd.wandroid.utils.LogUtils; 6 | import com.cwd.wandroid.utils.SPUtils; 7 | import com.franmontiel.persistentcookiejar.ClearableCookieJar; 8 | import com.franmontiel.persistentcookiejar.PersistentCookieJar; 9 | import com.franmontiel.persistentcookiejar.cache.SetCookieCache; 10 | import com.franmontiel.persistentcookiejar.persistence.SharedPrefsCookiePersistor; 11 | 12 | import java.io.IOException; 13 | import java.util.HashSet; 14 | import java.util.List; 15 | import java.util.concurrent.TimeUnit; 16 | 17 | import okhttp3.Interceptor; 18 | import okhttp3.OkHttpClient; 19 | import okhttp3.Request; 20 | import okhttp3.Response; 21 | import okhttp3.logging.HttpLoggingInterceptor; 22 | import retrofit2.Retrofit; 23 | import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; 24 | import retrofit2.converter.gson.GsonConverterFactory; 25 | 26 | public class RetrofitUtils { 27 | 28 | /** 29 | * 接口地址 30 | */ 31 | public static final String BASE_API = "https://www.wanandroid.com"; 32 | public static final int CONNECT_TIME_OUT = 30; 33 | public static final int READ_TIME_OUT = 30; 34 | public static final int WRITE_TIME_OUT = 30; 35 | private static RetrofitUtils mInstance = null; 36 | 37 | private RetrofitUtils() { 38 | } 39 | 40 | public static RetrofitUtils get() { 41 | if (mInstance == null) { 42 | synchronized (RetrofitUtils.class) { 43 | if (mInstance == null) { 44 | mInstance = new RetrofitUtils(); 45 | } 46 | } 47 | } 48 | return mInstance; 49 | } 50 | 51 | /** 52 | * 设置okHttp 53 | * 54 | * @author ZhongDaFeng 55 | */ 56 | private static OkHttpClient okHttpClient() { 57 | ClearableCookieJar cookieJar = 58 | new PersistentCookieJar(new SetCookieCache(), new SharedPrefsCookiePersistor(App.getContext())); 59 | //开启Log 60 | HttpLoggingInterceptor logging = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() { 61 | @Override 62 | public void log(String message) { 63 | LogUtils.e("okHttp:" + message); 64 | } 65 | }); 66 | logging.setLevel(HttpLoggingInterceptor.Level.BASIC); 67 | OkHttpClient client = new OkHttpClient.Builder() 68 | .connectTimeout(CONNECT_TIME_OUT, TimeUnit.SECONDS) 69 | .writeTimeout(WRITE_TIME_OUT, TimeUnit.SECONDS) 70 | .readTimeout(READ_TIME_OUT, TimeUnit.SECONDS) 71 | .addInterceptor(logging) 72 | .cookieJar(cookieJar) 73 | .build(); 74 | return client; 75 | } 76 | 77 | /** 78 | * 获取Retrofit 79 | * 80 | * @author ZhongDaFeng 81 | */ 82 | public Retrofit retrofit() { 83 | Retrofit retrofit = new Retrofit.Builder() 84 | .client(okHttpClient()) 85 | .baseUrl(BASE_API) 86 | .addConverterFactory(GsonConverterFactory.create()) 87 | .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) 88 | .build(); 89 | return retrofit; 90 | } 91 | 92 | } 93 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/app/ActivityCollector.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.app; 2 | 3 | import android.app.Activity; 4 | 5 | import com.cwd.wandroid.base.BaseActivity; 6 | 7 | import java.util.HashSet; 8 | import java.util.Set; 9 | 10 | public class ActivityCollector { 11 | 12 | private static ActivityCollector activityCollector; 13 | 14 | public static ActivityCollector getInstance() { 15 | if(activityCollector == null){ 16 | synchronized (ActivityCollector.class){ 17 | if(activityCollector == null){ 18 | activityCollector = new ActivityCollector(); 19 | } 20 | } 21 | } 22 | return activityCollector; 23 | } 24 | 25 | private Set allActivities; 26 | 27 | public void addActivity(Activity act) { 28 | if (allActivities == null) { 29 | allActivities = new HashSet<>(); 30 | } 31 | allActivities.add(act); 32 | } 33 | 34 | public void removeActivity(Activity act) { 35 | if (allActivities != null) { 36 | allActivities.remove(act); 37 | } 38 | } 39 | 40 | public void finishActivity(Class c) { 41 | for (Activity activity : allActivities) { 42 | Class aClass = activity.getClass(); 43 | if(aClass == c) { 44 | activity.finish(); 45 | } 46 | } 47 | } 48 | 49 | public void exitApp() { 50 | if (allActivities != null) { 51 | synchronized (allActivities) { 52 | for (Activity act : allActivities) { 53 | act.finish(); 54 | } 55 | } 56 | } 57 | android.os.Process.killProcess(android.os.Process.myPid()); 58 | System.exit(0); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/app/App.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.app; 2 | 3 | import android.app.Activity; 4 | import android.app.Application; 5 | import android.content.Context; 6 | import android.os.Bundle; 7 | import android.support.annotation.Nullable; 8 | 9 | import com.bumptech.glide.Glide; 10 | import com.cwd.wandroid.utils.LogUtils; 11 | import com.orhanobut.logger.AndroidLogAdapter; 12 | import com.orhanobut.logger.BuildConfig; 13 | import com.orhanobut.logger.Logger; 14 | import com.squareup.leakcanary.LeakCanary; 15 | import com.squareup.leakcanary.RefWatcher; 16 | import com.tencent.bugly.Bugly; 17 | import com.tencent.bugly.crashreport.CrashReport; 18 | 19 | public class App extends Application { 20 | 21 | private static App mContext; 22 | private RefWatcher refWatcher; 23 | private boolean isBackground = true; 24 | 25 | @Override 26 | public void onCreate() { 27 | super.onCreate(); 28 | Bugly.init(getApplicationContext(), "4c1a47c021", true); 29 | mContext = this; 30 | registerActivityLifecycleCallbacks(lifecycleCallbacks); 31 | if (LeakCanary.isInAnalyzerProcess(this)) { 32 | // This process is dedicated to LeakCanary for heap analysis. 33 | // You should not init your app in this process. 34 | return; 35 | } 36 | refWatcher = LeakCanary.install(this); 37 | Logger.addLogAdapter(new AndroidLogAdapter(){ 38 | @Override 39 | public boolean isLoggable(int priority, @Nullable String tag) { 40 | return BuildConfig.DEBUG; 41 | } 42 | }); 43 | } 44 | 45 | public static synchronized App getContext(){ 46 | return mContext; 47 | } 48 | 49 | public static RefWatcher getRefWatcher(Context context) { 50 | App application = (App) context.getApplicationContext(); 51 | return application.refWatcher; 52 | } 53 | 54 | @Override 55 | public void onTrimMemory(int level) { 56 | super.onTrimMemory(level); 57 | if (level >= TRIM_MEMORY_UI_HIDDEN) { 58 | isBackground = true; 59 | LogUtils.d("应用进入后台"); 60 | Glide.get(this).clearMemory(); 61 | } 62 | Glide.get(this).trimMemory(level); 63 | } 64 | 65 | @Override 66 | public void onLowMemory() { 67 | super.onLowMemory(); 68 | Glide.get(this).clearMemory(); 69 | } 70 | 71 | private ActivityLifecycleCallbacks lifecycleCallbacks = new ActivityLifecycleCallbacks() { 72 | @Override 73 | public void onActivityCreated(Activity activity, Bundle savedInstanceState) { 74 | 75 | } 76 | 77 | @Override 78 | public void onActivityStarted(Activity activity) { 79 | 80 | } 81 | 82 | @Override 83 | public void onActivityResumed(Activity activity) { 84 | if(isBackground){ 85 | isBackground = false; 86 | LogUtils.d("应用进入前台"); 87 | } 88 | } 89 | 90 | @Override 91 | public void onActivityPaused(Activity activity) { 92 | 93 | } 94 | 95 | @Override 96 | public void onActivityStopped(Activity activity) { 97 | 98 | } 99 | 100 | @Override 101 | public void onActivitySaveInstanceState(Activity activity, Bundle outState) { 102 | 103 | } 104 | 105 | @Override 106 | public void onActivityDestroyed(Activity activity) { 107 | 108 | } 109 | }; 110 | 111 | 112 | } 113 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/base/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.base; 2 | 3 | import android.content.pm.ActivityInfo; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.util.Log; 8 | import android.view.Window; 9 | import android.widget.Toast; 10 | 11 | import com.cwd.wandroid.R; 12 | import com.cwd.wandroid.app.ActivityCollector; 13 | import com.cwd.wandroid.utils.StatusBarUtils; 14 | import com.cwd.wandroid.utils.ToastUtils; 15 | 16 | import org.greenrobot.eventbus.EventBus; 17 | 18 | import butterknife.ButterKnife; 19 | import butterknife.Unbinder; 20 | 21 | public abstract class BaseActivity extends AppCompatActivity implements BaseContract.View { 22 | 23 | private Unbinder unbinder; 24 | public BaseActivity context; 25 | 26 | @Override 27 | protected void onCreate(@Nullable Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | //7.0只用NoTitle无法去掉标题栏 30 | setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 31 | supportRequestWindowFeature(Window.FEATURE_NO_TITLE); 32 | setContentView(getLayoutId()); 33 | StatusBarUtils.StatusBarLightMode(this); 34 | unbinder = ButterKnife.bind(this); 35 | context = this; 36 | ActivityCollector.getInstance().addActivity(this); 37 | createPresenter(); 38 | init(); 39 | } 40 | 41 | /** 42 | * 获取布局 LayoutId 43 | * @return 44 | */ 45 | public abstract int getLayoutId(); 46 | 47 | public abstract void createPresenter(); 48 | public abstract void init(); 49 | 50 | @Override 51 | protected void onDestroy() { 52 | super.onDestroy(); 53 | ActivityCollector.getInstance().removeActivity(this); 54 | if(unbinder != null && unbinder != Unbinder.EMPTY){ 55 | unbinder.unbind(); 56 | unbinder = null; 57 | } 58 | } 59 | 60 | @Override 61 | public void showError(String message) { 62 | ToastUtils.showShort(message); 63 | } 64 | 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/base/BaseContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.base; 2 | 3 | public interface BaseContract { 4 | interface View { 5 | void showError(String message); 6 | } 7 | 8 | interface Presenter { 9 | void attachView(V view); 10 | void detachView(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/base/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.base; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import android.support.annotation.NonNull; 6 | import android.support.annotation.Nullable; 7 | import android.support.v4.app.Fragment; 8 | import android.util.Log; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | import android.widget.Toast; 13 | 14 | import com.cwd.wandroid.utils.ToastUtils; 15 | 16 | import org.greenrobot.eventbus.EventBus; 17 | 18 | import butterknife.ButterKnife; 19 | import butterknife.Unbinder; 20 | 21 | public abstract class BaseFragment extends Fragment implements BaseContract.View { 22 | 23 | public Context context; 24 | private Unbinder unbinder; 25 | public View view; 26 | 27 | @Override 28 | public void onAttach(Context context) { 29 | super.onAttach(context); 30 | this.context = context; 31 | } 32 | 33 | @Nullable 34 | @Override 35 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, 36 | @Nullable Bundle savedInstanceState) { 37 | view = inflater.inflate(getLayoutId(), container, false); 38 | unbinder = ButterKnife.bind(this, view); 39 | onFragmentViewCreated(); 40 | createPresenter(); 41 | init(); 42 | return view; 43 | } 44 | 45 | public abstract int getLayoutId(); 46 | 47 | public void onFragmentViewCreated() {} 48 | 49 | public abstract void createPresenter(); 50 | public abstract void init(); 51 | 52 | @Override 53 | public void onDestroyView() { 54 | super.onDestroyView(); 55 | if (unbinder != null) { 56 | unbinder.unbind(); 57 | } 58 | } 59 | 60 | @Override 61 | public void showError(String message) { 62 | Log.e(getClass().getName(), message); 63 | ToastUtils.showShort(message); 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/base/BaseObserver.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.base; 2 | 3 | import android.widget.Toast; 4 | 5 | import com.cwd.wandroid.api.ObserverResponseListener; 6 | import com.cwd.wandroid.entity.BaseResponse; 7 | import com.cwd.wandroid.utils.ToastUtils; 8 | 9 | import io.reactivex.Observer; 10 | import io.reactivex.disposables.Disposable; 11 | 12 | public class BaseObserver implements Observer { 13 | 14 | private ObserverResponseListener listener; 15 | 16 | public BaseObserver(ObserverResponseListener listener){ 17 | this.listener = listener; 18 | } 19 | 20 | @Override 21 | public void onSubscribe(Disposable d) { 22 | 23 | } 24 | 25 | @Override 26 | public void onNext(T o) { 27 | BaseResponse resp = (BaseResponse) o; 28 | int code = resp.getErrorCode(); 29 | if(code == 0){ 30 | listener.onNext(resp.getData()); 31 | }else{ 32 | ToastUtils.showShort(resp.getErrorMsg()); 33 | } 34 | } 35 | 36 | @Override 37 | public void onError(Throwable e) { 38 | listener.onError(e); 39 | } 40 | 41 | @Override 42 | public void onComplete() { 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/base/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.base; 2 | 3 | public class BasePresenter implements BaseContract.Presenter { 4 | 5 | private V view; 6 | 7 | public BasePresenter() { 8 | } 9 | 10 | @Override 11 | public void attachView(V view) { 12 | this.view = view; 13 | } 14 | 15 | @Override 16 | public void detachView() { 17 | view = null; 18 | } 19 | 20 | public boolean isViewAttached() { 21 | return view != null; 22 | } 23 | 24 | public V getView() { 25 | return view; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/constants/Constants.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.constants; 2 | 3 | public class Constants { 4 | 5 | public static final String USERNAME = "username"; 6 | public static final String PASSWORD = "password"; 7 | public static final String COOKIES = "cookies"; 8 | 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/contract/ArticleContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.contract; 2 | 3 | import com.cwd.wandroid.base.BaseContract; 4 | import com.cwd.wandroid.entity.ArticleInfo; 5 | import com.cwd.wandroid.entity.Banner; 6 | 7 | import java.util.List; 8 | 9 | public interface ArticleContract { 10 | 11 | interface View extends BaseContract.View{ 12 | void showArticleList(List articleInfoList,boolean isEnd); 13 | void showTopArticleList(List topArticleList); 14 | void showNoSearchResultView(); 15 | void showBanner(List banners); 16 | } 17 | 18 | interface Presenter extends BaseContract.Presenter{ 19 | void getArticleList(int page); 20 | void getTopArticleList(); 21 | void getSearchList(int page,String keyword); 22 | void getBanner(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/contract/CollectContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.contract; 2 | 3 | import com.cwd.wandroid.base.BaseContract; 4 | import com.cwd.wandroid.entity.ArticleInfo; 5 | import com.cwd.wandroid.entity.Banner; 6 | 7 | import java.util.List; 8 | 9 | public interface CollectContract { 10 | 11 | interface View extends BaseContract.View{ 12 | void showArticleList(List articleInfoList, boolean isEnd); 13 | void showNoCollectView(); 14 | void showCollectSuccess(); 15 | void showCancelCollectSuccess(); 16 | } 17 | 18 | interface Presenter extends BaseContract.Presenter{ 19 | void getCollectList(int page); 20 | void collectArticle(int id); 21 | void cancelCollectArticle(int id,int originId); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/contract/IntegralContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.contract; 2 | 3 | import com.cwd.wandroid.base.BaseContract; 4 | import com.cwd.wandroid.entity.ArticleInfo; 5 | import com.cwd.wandroid.entity.MyIntegral; 6 | 7 | import java.util.List; 8 | 9 | public interface IntegralContract { 10 | 11 | interface View extends BaseContract.View{ 12 | void showMyIntegral(MyIntegral myIntegral); 13 | } 14 | 15 | interface Presenter extends BaseContract.Presenter{ 16 | void getMyIntegral(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/contract/LoginContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.contract; 2 | 3 | import com.cwd.wandroid.base.BaseContract; 4 | import com.cwd.wandroid.entity.Login; 5 | import com.cwd.wandroid.entity.System; 6 | 7 | import java.util.List; 8 | 9 | public interface LoginContract { 10 | 11 | interface View extends BaseContract.View{ 12 | void showUsername(Login login); 13 | void logoutSuccess(); 14 | } 15 | 16 | interface Presenter extends BaseContract.Presenter{ 17 | void login(String username,String password); 18 | void register(String username,String password,String repassword); 19 | void logout(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/contract/NavContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.contract; 2 | 3 | import com.cwd.wandroid.base.BaseContract; 4 | import com.cwd.wandroid.entity.ArticleInfo; 5 | import com.cwd.wandroid.entity.NavInfo; 6 | import com.cwd.wandroid.entity.NavTitle; 7 | 8 | import java.util.List; 9 | 10 | public interface NavContract { 11 | 12 | interface View extends BaseContract.View{ 13 | void showNavInfo(List navTitleList); 14 | } 15 | 16 | interface Presenter extends BaseContract.Presenter{ 17 | void getNavInfo(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/contract/ProjectContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.contract; 2 | 3 | import com.cwd.wandroid.base.BaseContract; 4 | import com.cwd.wandroid.entity.ArticleInfo; 5 | import com.cwd.wandroid.entity.ProjectCategory; 6 | 7 | import java.util.List; 8 | 9 | public interface ProjectContract { 10 | 11 | interface View extends BaseContract.View{ 12 | void showProjectCategory(List categoryList); 13 | } 14 | 15 | interface Presenter extends BaseContract.Presenter{ 16 | void getProjectCategory(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/contract/ProjectListContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.contract; 2 | 3 | import com.cwd.wandroid.base.BaseContract; 4 | import com.cwd.wandroid.entity.ArticleInfo; 5 | import com.cwd.wandroid.entity.ProjectCategory; 6 | 7 | import java.util.List; 8 | 9 | public interface ProjectListContract { 10 | 11 | interface View extends BaseContract.View{ 12 | void showProjectList(List projectList,boolean isEnd); 13 | } 14 | 15 | interface Presenter extends BaseContract.Presenter{ 16 | void getProjectList(int page,int cid,boolean isSystem); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/contract/SearchContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.contract; 2 | 3 | import com.cwd.wandroid.base.BaseContract; 4 | import com.cwd.wandroid.entity.HotKey; 5 | 6 | import java.util.List; 7 | 8 | public interface SearchContract { 9 | 10 | interface View extends BaseContract.View{ 11 | void showHotKey(List hotKeyList); 12 | } 13 | 14 | interface Presenter extends BaseContract.Presenter{ 15 | void getHotKey(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/contract/SystemContract.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.contract; 2 | 3 | import com.cwd.wandroid.base.BaseContract; 4 | import com.cwd.wandroid.entity.ProjectCategory; 5 | import com.cwd.wandroid.entity.System; 6 | 7 | import java.util.List; 8 | 9 | public interface SystemContract { 10 | 11 | interface View extends BaseContract.View{ 12 | void showSystemList(List systemList); 13 | } 14 | 15 | interface Presenter extends BaseContract.Presenter{ 16 | void getSystemList(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/Article.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | import java.util.List; 4 | 5 | public class Article { 6 | 7 | private int curPage; 8 | private List datas; 9 | private int offset; 10 | private boolean over; 11 | private int pageCount; 12 | private int size; 13 | private int total; 14 | 15 | public int getCurPage() { 16 | return curPage; 17 | } 18 | 19 | public void setCurPage(int curPage) { 20 | this.curPage = curPage; 21 | } 22 | 23 | public List getDatas() { 24 | return datas; 25 | } 26 | 27 | public void setDatas(List datas) { 28 | this.datas = datas; 29 | } 30 | 31 | public int getOffset() { 32 | return offset; 33 | } 34 | 35 | public void setOffset(int offset) { 36 | this.offset = offset; 37 | } 38 | 39 | public boolean isOver() { 40 | return over; 41 | } 42 | 43 | public void setOver(boolean over) { 44 | this.over = over; 45 | } 46 | 47 | public int getPageCount() { 48 | return pageCount; 49 | } 50 | 51 | public void setPageCount(int pageCount) { 52 | this.pageCount = pageCount; 53 | } 54 | 55 | public int getSize() { 56 | return size; 57 | } 58 | 59 | public void setSize(int size) { 60 | this.size = size; 61 | } 62 | 63 | public int getTotal() { 64 | return total; 65 | } 66 | 67 | public void setTotal(int total) { 68 | this.total = total; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/Banner.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | public class Banner { 4 | 5 | private String desc; 6 | private String imagePath; 7 | private String title; 8 | private String url; 9 | private int id; 10 | 11 | public String getDesc() { 12 | return desc; 13 | } 14 | 15 | public void setDesc(String desc) { 16 | this.desc = desc; 17 | } 18 | 19 | public String getImagePath() { 20 | return imagePath; 21 | } 22 | 23 | public void setImagePath(String imagePath) { 24 | this.imagePath = imagePath; 25 | } 26 | 27 | public String getTitle() { 28 | return title; 29 | } 30 | 31 | public void setTitle(String title) { 32 | this.title = title; 33 | } 34 | 35 | public String getUrl() { 36 | return url; 37 | } 38 | 39 | public void setUrl(String url) { 40 | this.url = url; 41 | } 42 | 43 | public int getId() { 44 | return id; 45 | } 46 | 47 | public void setId(int id) { 48 | this.id = id; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/BaseResponse.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | public class BaseResponse { 4 | 5 | public static final int SUCCESS = 0; 6 | public static final int FAIL = 1; 7 | 8 | private int errorCode; 9 | private String errorMsg; 10 | private T data; 11 | 12 | public int getErrorCode() { 13 | return errorCode; 14 | } 15 | 16 | public void setErrorCode(int errorCode) { 17 | this.errorCode = errorCode; 18 | } 19 | 20 | public String getErrorMsg() { 21 | return errorMsg; 22 | } 23 | 24 | public void setErrorMsg(String errorMsg) { 25 | this.errorMsg = errorMsg; 26 | } 27 | 28 | public T getData() { 29 | return data; 30 | } 31 | 32 | public void setData(T data) { 33 | this.data = data; 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/HotKey.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | public class HotKey { 4 | 5 | /** 6 | * id : 6 7 | * link : 8 | * name : 面试 9 | * order : 1 10 | * visible : 1 11 | */ 12 | 13 | private int id; 14 | private String link; 15 | private String name; 16 | private int order; 17 | private int visible; 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | public void setId(int id) { 24 | this.id = id; 25 | } 26 | 27 | public String getLink() { 28 | return link; 29 | } 30 | 31 | public void setLink(String link) { 32 | this.link = link; 33 | } 34 | 35 | public String getName() { 36 | return name; 37 | } 38 | 39 | public void setName(String name) { 40 | this.name = name; 41 | } 42 | 43 | public int getOrder() { 44 | return order; 45 | } 46 | 47 | public void setOrder(int order) { 48 | this.order = order; 49 | } 50 | 51 | public int getVisible() { 52 | return visible; 53 | } 54 | 55 | public void setVisible(int visible) { 56 | this.visible = visible; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/Login.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | import java.util.List; 4 | 5 | public class Login { 6 | 7 | /** 8 | * collectIds : [] 9 | * email : 10 | * icon : 11 | * id : 8645 12 | * password : 123456 13 | * token : 14 | * type : 0 15 | * username : Crossover 16 | */ 17 | 18 | private String email; 19 | private String icon; 20 | private int id; 21 | private String password; 22 | private String token; 23 | private int type; 24 | private String username; 25 | private List collectIds; 26 | 27 | public String getEmail() { 28 | return email; 29 | } 30 | 31 | public void setEmail(String email) { 32 | this.email = email; 33 | } 34 | 35 | public String getIcon() { 36 | return icon; 37 | } 38 | 39 | public void setIcon(String icon) { 40 | this.icon = icon; 41 | } 42 | 43 | public int getId() { 44 | return id; 45 | } 46 | 47 | public void setId(int id) { 48 | this.id = id; 49 | } 50 | 51 | public String getPassword() { 52 | return password; 53 | } 54 | 55 | public void setPassword(String password) { 56 | this.password = password; 57 | } 58 | 59 | public String getToken() { 60 | return token; 61 | } 62 | 63 | public void setToken(String token) { 64 | this.token = token; 65 | } 66 | 67 | public int getType() { 68 | return type; 69 | } 70 | 71 | public void setType(int type) { 72 | this.type = type; 73 | } 74 | 75 | public String getUsername() { 76 | return username; 77 | } 78 | 79 | public void setUsername(String username) { 80 | this.username = username; 81 | } 82 | 83 | public List getCollectIds() { 84 | return collectIds; 85 | } 86 | 87 | public void setCollectIds(List collectIds) { 88 | this.collectIds = collectIds; 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/MessageEvent.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | public class MessageEvent { 4 | 5 | private int code; 6 | private int position; 7 | 8 | public int getCode() { 9 | return code; 10 | } 11 | 12 | public void setCode(int code) { 13 | this.code = code; 14 | } 15 | 16 | public int getPosition() { 17 | return position; 18 | } 19 | 20 | public void setPosition(int position) { 21 | this.position = position; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/MyIntegral.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | import java.io.Serializable; 4 | 5 | public class MyIntegral implements Serializable { 6 | 7 | /** 8 | * coinCount : 451 9 | * rank : 7 10 | * userId : 2 11 | * username : x**oyang 12 | */ 13 | 14 | private Integer coinCount; 15 | private Integer rank; 16 | private Integer userId; 17 | private String username; 18 | private String level; 19 | 20 | public String getLevel() { 21 | return level; 22 | } 23 | 24 | public void setLevel(String level) { 25 | this.level = level; 26 | } 27 | 28 | public Integer getCoinCount() { 29 | return coinCount; 30 | } 31 | 32 | public void setCoinCount(Integer coinCount) { 33 | this.coinCount = coinCount; 34 | } 35 | 36 | public Integer getRank() { 37 | return rank; 38 | } 39 | 40 | public void setRank(Integer rank) { 41 | this.rank = rank; 42 | } 43 | 44 | public Integer getUserId() { 45 | return userId; 46 | } 47 | 48 | public void setUserId(Integer userId) { 49 | this.userId = userId; 50 | } 51 | 52 | public String getUsername() { 53 | return username; 54 | } 55 | 56 | public void setUsername(String username) { 57 | this.username = username; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/NavTitle.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | import java.util.List; 4 | 5 | public class NavTitle { 6 | 7 | private int cid; 8 | private String name; 9 | private List articles; 10 | 11 | public int getCid() { 12 | return cid; 13 | } 14 | 15 | public void setCid(int cid) { 16 | this.cid = cid; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public void setName(String name) { 24 | this.name = name; 25 | } 26 | 27 | public List getArticles() { 28 | return articles; 29 | } 30 | 31 | public void setArticles(List articles) { 32 | this.articles = articles; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/ProjectCategory.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class ProjectCategory implements Serializable { 7 | 8 | 9 | /** 10 | * children : [] 11 | * courseId : 13 12 | * id : 294 13 | * name : 完整项目 14 | * order : 145000 15 | * parentChapterId : 293 16 | * visible : 0 17 | */ 18 | 19 | private int courseId; 20 | private int id; 21 | private String name; 22 | private int order; 23 | private int parentChapterId; 24 | private int visible; 25 | 26 | public int getCourseId() { 27 | return courseId; 28 | } 29 | 30 | public void setCourseId(int courseId) { 31 | this.courseId = courseId; 32 | } 33 | 34 | public int getId() { 35 | return id; 36 | } 37 | 38 | public void setId(int id) { 39 | this.id = id; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | public int getOrder() { 51 | return order; 52 | } 53 | 54 | public void setOrder(int order) { 55 | this.order = order; 56 | } 57 | 58 | public int getParentChapterId() { 59 | return parentChapterId; 60 | } 61 | 62 | public void setParentChapterId(int parentChapterId) { 63 | this.parentChapterId = parentChapterId; 64 | } 65 | 66 | public int getVisible() { 67 | return visible; 68 | } 69 | 70 | public void setVisible(int visible) { 71 | this.visible = visible; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/System.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class System implements Serializable{ 7 | 8 | 9 | /** 10 | * children : [{"children":[],"courseId":13,"id":60,"name":"Android Studio相关","order":1000,"parentChapterId":150,"visible":1},{"children":[],"courseId":13,"id":169,"name":"gradle","order":1001,"parentChapterId":150,"visible":1},{"children":[],"courseId":13,"id":269,"name":"官方发布","order":1002,"parentChapterId":150,"visible":1}] 11 | * courseId : 13 12 | * id : 150 13 | * name : 开发环境 14 | * order : 1 15 | * parentChapterId : 0 16 | * visible : 1 17 | */ 18 | 19 | private int courseId; 20 | private int id; 21 | private String name; 22 | private int order; 23 | private int parentChapterId; 24 | private int visible; 25 | private List children; 26 | 27 | public int getCourseId() { 28 | return courseId; 29 | } 30 | 31 | public void setCourseId(int courseId) { 32 | this.courseId = courseId; 33 | } 34 | 35 | public int getId() { 36 | return id; 37 | } 38 | 39 | public void setId(int id) { 40 | this.id = id; 41 | } 42 | 43 | public String getName() { 44 | return name; 45 | } 46 | 47 | public void setName(String name) { 48 | this.name = name; 49 | } 50 | 51 | public int getOrder() { 52 | return order; 53 | } 54 | 55 | public void setOrder(int order) { 56 | this.order = order; 57 | } 58 | 59 | public int getParentChapterId() { 60 | return parentChapterId; 61 | } 62 | 63 | public void setParentChapterId(int parentChapterId) { 64 | this.parentChapterId = parentChapterId; 65 | } 66 | 67 | public int getVisible() { 68 | return visible; 69 | } 70 | 71 | public void setVisible(int visible) { 72 | this.visible = visible; 73 | } 74 | 75 | public List getChildren() { 76 | return children; 77 | } 78 | 79 | public void setChildren(List children) { 80 | this.children = children; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/entity/SystemDetail.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.entity; 2 | 3 | import java.io.Serializable; 4 | import java.util.List; 5 | 6 | public class SystemDetail implements Serializable{ 7 | 8 | 9 | /** 10 | * children : [] 11 | * courseId : 13 12 | * id : 60 13 | * name : Android Studio相关 14 | * order : 1000 15 | * parentChapterId : 150 16 | * visible : 1 17 | */ 18 | 19 | private int courseId; 20 | private int id; 21 | private String name; 22 | private int order; 23 | private int parentChapterId; 24 | private int visible; 25 | 26 | public int getCourseId() { 27 | return courseId; 28 | } 29 | 30 | public void setCourseId(int courseId) { 31 | this.courseId = courseId; 32 | } 33 | 34 | public int getId() { 35 | return id; 36 | } 37 | 38 | public void setId(int id) { 39 | this.id = id; 40 | } 41 | 42 | public String getName() { 43 | return name; 44 | } 45 | 46 | public void setName(String name) { 47 | this.name = name; 48 | } 49 | 50 | public int getOrder() { 51 | return order; 52 | } 53 | 54 | public void setOrder(int order) { 55 | this.order = order; 56 | } 57 | 58 | public int getParentChapterId() { 59 | return parentChapterId; 60 | } 61 | 62 | public void setParentChapterId(int parentChapterId) { 63 | this.parentChapterId = parentChapterId; 64 | } 65 | 66 | public int getVisible() { 67 | return visible; 68 | } 69 | 70 | public void setVisible(int visible) { 71 | this.visible = visible; 72 | } 73 | 74 | 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/presenter/CollectPresenter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.presenter; 2 | 3 | import com.cwd.wandroid.base.BasePresenter; 4 | import com.cwd.wandroid.contract.ArticleContract; 5 | import com.cwd.wandroid.contract.CollectContract; 6 | import com.cwd.wandroid.entity.Article; 7 | import com.cwd.wandroid.entity.ArticleInfo; 8 | import com.cwd.wandroid.entity.Banner; 9 | import com.cwd.wandroid.entity.BaseResponse; 10 | import com.cwd.wandroid.source.DataManager; 11 | import com.cwd.wandroid.utils.LogUtils; 12 | 13 | import java.util.List; 14 | 15 | import io.reactivex.Observable; 16 | import io.reactivex.Observer; 17 | import io.reactivex.android.schedulers.AndroidSchedulers; 18 | import io.reactivex.disposables.Disposable; 19 | import io.reactivex.schedulers.Schedulers; 20 | 21 | public class CollectPresenter extends BasePresenter implements CollectContract.Presenter { 22 | 23 | private Disposable disposable; 24 | private DataManager dataManager; 25 | 26 | public CollectPresenter(DataManager dataManager){ 27 | this.dataManager = dataManager; 28 | } 29 | 30 | @Override 31 | public void getCollectList(int page) { 32 | Observable> observable = dataManager.getCollectList(page); 33 | observable.subscribeOn(Schedulers.io()) 34 | .observeOn(AndroidSchedulers.mainThread()) 35 | .subscribe(new Observer>() { 36 | @Override 37 | public void onSubscribe(Disposable d) { 38 | disposable = d; 39 | } 40 | 41 | @Override 42 | public void onNext(BaseResponse
articleBaseResponse) { 43 | if(articleBaseResponse.getErrorCode() != 0){ 44 | getView().showError(articleBaseResponse.getErrorMsg()); 45 | return; 46 | } 47 | List articleInfoList = articleBaseResponse.getData().getDatas(); 48 | if(articleInfoList == null){ 49 | getView().showNoCollectView(); 50 | }else{ 51 | getView().showArticleList(articleInfoList,articleBaseResponse.getData().isOver()); 52 | } 53 | } 54 | 55 | @Override 56 | public void onError(Throwable e) { 57 | getView().showError(e.getMessage()); 58 | } 59 | 60 | @Override 61 | public void onComplete() { 62 | 63 | } 64 | }); 65 | } 66 | 67 | @Override 68 | public void collectArticle(int id) { 69 | Observable observable = dataManager.collectArticle(id); 70 | observable.subscribeOn(Schedulers.io()) 71 | .observeOn(AndroidSchedulers.mainThread()) 72 | .subscribe(new Observer() { 73 | @Override 74 | public void onSubscribe(Disposable d) { 75 | disposable = d; 76 | } 77 | 78 | @Override 79 | public void onNext(BaseResponse resp) { 80 | if(resp.getErrorCode() == 0){ 81 | getView().showCollectSuccess(); 82 | }else{ 83 | getView().showError(resp.getErrorMsg()); 84 | } 85 | } 86 | 87 | @Override 88 | public void onError(Throwable e) { 89 | getView().showError(e.getMessage()); 90 | } 91 | 92 | @Override 93 | public void onComplete() { 94 | 95 | } 96 | }); 97 | } 98 | 99 | @Override 100 | public void cancelCollectArticle(int id,int originId) { 101 | Observable observable = dataManager.cancelCollectArticle(id,originId); 102 | observable.subscribeOn(Schedulers.io()) 103 | .observeOn(AndroidSchedulers.mainThread()) 104 | .subscribe(new Observer() { 105 | @Override 106 | public void onSubscribe(Disposable d) { 107 | disposable = d; 108 | } 109 | 110 | @Override 111 | public void onNext(BaseResponse resp) { 112 | if(resp.getErrorCode() == 0){ 113 | getView().showCancelCollectSuccess(); 114 | }else{ 115 | getView().showError(resp.getErrorMsg()); 116 | } 117 | } 118 | 119 | @Override 120 | public void onError(Throwable e) { 121 | getView().showError(e.getMessage()); 122 | } 123 | 124 | @Override 125 | public void onComplete() { 126 | 127 | } 128 | }); 129 | } 130 | 131 | @Override 132 | public void detachView() { 133 | super.detachView(); 134 | if(disposable != null && !disposable.isDisposed()){ 135 | disposable.dispose(); 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/presenter/IntegralPresenter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.presenter; 2 | 3 | import com.cwd.wandroid.base.BasePresenter; 4 | import com.cwd.wandroid.contract.CollectContract; 5 | import com.cwd.wandroid.contract.IntegralContract; 6 | import com.cwd.wandroid.entity.Article; 7 | import com.cwd.wandroid.entity.ArticleInfo; 8 | import com.cwd.wandroid.entity.BaseResponse; 9 | import com.cwd.wandroid.entity.MyIntegral; 10 | import com.cwd.wandroid.source.DataManager; 11 | 12 | import java.util.List; 13 | 14 | import io.reactivex.Observable; 15 | import io.reactivex.Observer; 16 | import io.reactivex.android.schedulers.AndroidSchedulers; 17 | import io.reactivex.disposables.Disposable; 18 | import io.reactivex.schedulers.Schedulers; 19 | 20 | public class IntegralPresenter extends BasePresenter implements IntegralContract.Presenter { 21 | 22 | private Disposable disposable; 23 | private DataManager dataManager; 24 | 25 | public IntegralPresenter(DataManager dataManager){ 26 | this.dataManager = dataManager; 27 | } 28 | 29 | @Override 30 | public void detachView() { 31 | super.detachView(); 32 | if(disposable != null && !disposable.isDisposed()){ 33 | disposable.dispose(); 34 | } 35 | } 36 | 37 | @Override 38 | public void getMyIntegral() { 39 | Observable> observable = dataManager.getMyIntegral(); 40 | observable.subscribeOn(Schedulers.io()) 41 | .observeOn(AndroidSchedulers.mainThread()) 42 | .subscribe(new Observer>() { 43 | @Override 44 | public void onSubscribe(Disposable d) { 45 | disposable = d; 46 | } 47 | 48 | @Override 49 | public void onNext(BaseResponse myIntegralBaseResponse) { 50 | if(myIntegralBaseResponse.getErrorCode() != 0){ 51 | getView().showError(myIntegralBaseResponse.getErrorMsg()); 52 | return; 53 | } 54 | MyIntegral myIntegral = myIntegralBaseResponse.getData(); 55 | if (myIntegral != null) { 56 | getView().showMyIntegral(myIntegral); 57 | } else { 58 | getView().showError("没有积分信息"); 59 | } 60 | 61 | } 62 | 63 | @Override 64 | public void onError(Throwable e) { 65 | getView().showError(e.getMessage()); 66 | } 67 | 68 | @Override 69 | public void onComplete() { 70 | 71 | } 72 | }); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/presenter/NavPresenter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.presenter; 2 | 3 | import com.cwd.wandroid.base.BasePresenter; 4 | import com.cwd.wandroid.contract.NavContract; 5 | import com.cwd.wandroid.entity.BaseResponse; 6 | import com.cwd.wandroid.entity.NavTitle; 7 | import com.cwd.wandroid.source.DataManager; 8 | 9 | import java.util.List; 10 | 11 | import io.reactivex.Observable; 12 | import io.reactivex.Observer; 13 | import io.reactivex.android.schedulers.AndroidSchedulers; 14 | import io.reactivex.disposables.Disposable; 15 | import io.reactivex.schedulers.Schedulers; 16 | 17 | public class NavPresenter extends BasePresenter implements NavContract.Presenter { 18 | 19 | private Disposable disposable; 20 | private DataManager dataManager; 21 | 22 | public NavPresenter(DataManager dataManager){ 23 | this.dataManager = dataManager; 24 | } 25 | 26 | @Override 27 | public void getNavInfo() { 28 | Observable>> observable = dataManager.getNavInfo(); 29 | observable.subscribeOn(Schedulers.io()) 30 | .observeOn(AndroidSchedulers.mainThread()) 31 | .subscribe(new Observer>>() { 32 | @Override 33 | public void onSubscribe(Disposable d) { 34 | disposable = d; 35 | } 36 | 37 | @Override 38 | public void onNext(BaseResponse> navResp) { 39 | if(navResp.getErrorCode() == 0){ 40 | getView().showNavInfo(navResp.getData()); 41 | }else{ 42 | getView().showError(navResp.getErrorMsg()); 43 | } 44 | } 45 | 46 | @Override 47 | public void onError(Throwable e) { 48 | getView().showError(e.getMessage()); 49 | } 50 | 51 | @Override 52 | public void onComplete() { 53 | 54 | } 55 | }); 56 | } 57 | 58 | @Override 59 | public void detachView() { 60 | super.detachView(); 61 | if(disposable != null && !disposable.isDisposed()){ 62 | disposable.dispose(); 63 | } 64 | } 65 | 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/presenter/ProjectListPresenter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.presenter; 2 | 3 | import com.cwd.wandroid.base.BasePresenter; 4 | import com.cwd.wandroid.contract.ProjectListContract; 5 | import com.cwd.wandroid.entity.Article; 6 | import com.cwd.wandroid.entity.BaseResponse; 7 | import com.cwd.wandroid.source.DataManager; 8 | import com.cwd.wandroid.utils.LogUtils; 9 | 10 | import io.reactivex.Observable; 11 | import io.reactivex.Observer; 12 | import io.reactivex.android.schedulers.AndroidSchedulers; 13 | import io.reactivex.disposables.Disposable; 14 | import io.reactivex.schedulers.Schedulers; 15 | 16 | public class ProjectListPresenter extends BasePresenter implements ProjectListContract.Presenter { 17 | 18 | private Disposable disposable; 19 | private DataManager dataManager; 20 | 21 | public ProjectListPresenter(DataManager dataManager){ 22 | this.dataManager = dataManager; 23 | } 24 | 25 | @Override 26 | public void getProjectList(int page,int cid,boolean isSystem) { 27 | Observable> observable; 28 | if(isSystem){ 29 | observable = dataManager.getSystemArticleList(page,cid); 30 | }else{ 31 | observable = dataManager.getProjectList(page,cid); 32 | 33 | } 34 | observable.subscribeOn(Schedulers.io()) 35 | .observeOn(AndroidSchedulers.mainThread()) 36 | .subscribe(new Observer>() { 37 | @Override 38 | public void onSubscribe(Disposable d) { 39 | disposable = d; 40 | } 41 | 42 | @Override 43 | public void onNext(BaseResponse
articleBaseResponse) { 44 | if(articleBaseResponse.getErrorCode() == 0){ 45 | getView().showProjectList(articleBaseResponse.getData().getDatas(),articleBaseResponse.getData().isOver()); 46 | }else{ 47 | getView().showError(articleBaseResponse.getErrorMsg()); 48 | } 49 | } 50 | 51 | @Override 52 | public void onError(Throwable e) { 53 | getView().showError(e.getMessage()); 54 | } 55 | 56 | @Override 57 | public void onComplete() { 58 | 59 | } 60 | }); 61 | } 62 | 63 | @Override 64 | public void detachView() { 65 | super.detachView(); 66 | if(disposable != null && !disposable.isDisposed()){ 67 | disposable.dispose(); 68 | } 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/presenter/ProjectPresenter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.presenter; 2 | 3 | import com.cwd.wandroid.base.BasePresenter; 4 | import com.cwd.wandroid.contract.ProjectContract; 5 | import com.cwd.wandroid.entity.BaseResponse; 6 | import com.cwd.wandroid.entity.ProjectCategory; 7 | import com.cwd.wandroid.source.DataManager; 8 | 9 | import java.util.List; 10 | 11 | import io.reactivex.Observable; 12 | import io.reactivex.Observer; 13 | import io.reactivex.android.schedulers.AndroidSchedulers; 14 | import io.reactivex.disposables.Disposable; 15 | import io.reactivex.schedulers.Schedulers; 16 | 17 | public class ProjectPresenter extends BasePresenter implements ProjectContract.Presenter { 18 | 19 | private Disposable disposable; 20 | private DataManager dataManager; 21 | 22 | public ProjectPresenter(DataManager dataManager){ 23 | this.dataManager = dataManager; 24 | } 25 | 26 | @Override 27 | public void getProjectCategory() { 28 | Observable>> observable = dataManager.getProjectCategory(); 29 | observable.subscribeOn(Schedulers.io()) 30 | .observeOn(AndroidSchedulers.mainThread()) 31 | .subscribe(new Observer>>() { 32 | @Override 33 | public void onSubscribe(Disposable d) { 34 | disposable = d; 35 | } 36 | 37 | @Override 38 | public void onNext(BaseResponse> categoryResp) { 39 | if(categoryResp.getErrorCode() == 0){ 40 | getView().showProjectCategory(categoryResp.getData()); 41 | }else{ 42 | getView().showError(categoryResp.getErrorMsg()); 43 | } 44 | } 45 | 46 | @Override 47 | public void onError(Throwable e) { 48 | getView().showError(e.getMessage()); 49 | } 50 | 51 | @Override 52 | public void onComplete() { 53 | 54 | } 55 | }); 56 | } 57 | 58 | @Override 59 | public void detachView() { 60 | super.detachView(); 61 | if(disposable != null && !disposable.isDisposed()){ 62 | disposable.dispose(); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/presenter/SearchPresenter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.presenter; 2 | 3 | import com.cwd.wandroid.base.BasePresenter; 4 | import com.cwd.wandroid.contract.NavContract; 5 | import com.cwd.wandroid.contract.SearchContract; 6 | import com.cwd.wandroid.entity.BaseResponse; 7 | import com.cwd.wandroid.entity.HotKey; 8 | import com.cwd.wandroid.entity.NavTitle; 9 | import com.cwd.wandroid.source.DataManager; 10 | 11 | import java.util.List; 12 | 13 | import io.reactivex.Observable; 14 | import io.reactivex.Observer; 15 | import io.reactivex.android.schedulers.AndroidSchedulers; 16 | import io.reactivex.disposables.Disposable; 17 | import io.reactivex.schedulers.Schedulers; 18 | 19 | public class SearchPresenter extends BasePresenter implements SearchContract.Presenter { 20 | 21 | private Disposable disposable; 22 | private DataManager dataManager; 23 | 24 | public SearchPresenter(DataManager dataManager){ 25 | this.dataManager = dataManager; 26 | } 27 | 28 | @Override 29 | public void getHotKey() { 30 | Observable>> observable = dataManager.getHotKey(); 31 | observable.subscribeOn(Schedulers.io()) 32 | .observeOn(AndroidSchedulers.mainThread()) 33 | .subscribe(new Observer>>() { 34 | @Override 35 | public void onSubscribe(Disposable d) { 36 | disposable = d; 37 | } 38 | 39 | @Override 40 | public void onNext(BaseResponse> resp) { 41 | if(resp.getErrorCode() == 0){ 42 | getView().showHotKey(resp.getData()); 43 | }else{ 44 | getView().showError(resp.getErrorMsg()); 45 | } 46 | } 47 | 48 | @Override 49 | public void onError(Throwable e) { 50 | getView().showError(e.getMessage()); 51 | } 52 | 53 | @Override 54 | public void onComplete() { 55 | 56 | } 57 | }); 58 | } 59 | 60 | @Override 61 | public void detachView() { 62 | super.detachView(); 63 | if(disposable != null && !disposable.isDisposed()){ 64 | disposable.dispose(); 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/presenter/SystemPresenter.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.presenter; 2 | 3 | import com.cwd.wandroid.base.BasePresenter; 4 | import com.cwd.wandroid.contract.ProjectContract; 5 | import com.cwd.wandroid.contract.SystemContract; 6 | import com.cwd.wandroid.entity.BaseResponse; 7 | import com.cwd.wandroid.entity.ProjectCategory; 8 | import com.cwd.wandroid.entity.System; 9 | import com.cwd.wandroid.source.DataManager; 10 | 11 | import java.util.List; 12 | 13 | import io.reactivex.Observable; 14 | import io.reactivex.Observer; 15 | import io.reactivex.android.schedulers.AndroidSchedulers; 16 | import io.reactivex.disposables.Disposable; 17 | import io.reactivex.schedulers.Schedulers; 18 | 19 | public class SystemPresenter extends BasePresenter implements SystemContract.Presenter { 20 | 21 | private Disposable disposable; 22 | private DataManager dataManager; 23 | 24 | public SystemPresenter(DataManager dataManager){ 25 | this.dataManager = dataManager; 26 | } 27 | 28 | @Override 29 | public void getSystemList() { 30 | Observable>> observable = dataManager.getSystemInfo(); 31 | observable.subscribeOn(Schedulers.io()) 32 | .observeOn(AndroidSchedulers.mainThread()) 33 | .subscribe(new Observer>>() { 34 | @Override 35 | public void onSubscribe(Disposable d) { 36 | disposable = d; 37 | } 38 | 39 | @Override 40 | public void onNext(BaseResponse> systemResp) { 41 | if(systemResp.getErrorCode() == 0){ 42 | getView().showSystemList(systemResp.getData()); 43 | }else{ 44 | getView().showError(systemResp.getErrorMsg()); 45 | } 46 | } 47 | 48 | @Override 49 | public void onError(Throwable e) { 50 | getView().showError(e.getMessage()); 51 | } 52 | 53 | @Override 54 | public void onComplete() { 55 | 56 | } 57 | }); 58 | } 59 | 60 | @Override 61 | public void detachView() { 62 | super.detachView(); 63 | if(disposable != null && !disposable.isDisposed()){ 64 | disposable.dispose(); 65 | } 66 | } 67 | 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/source/DataManager.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.source; 2 | 3 | 4 | import com.cwd.wandroid.api.ApiService; 5 | import com.cwd.wandroid.entity.Article; 6 | import com.cwd.wandroid.entity.ArticleInfo; 7 | import com.cwd.wandroid.entity.Banner; 8 | import com.cwd.wandroid.entity.BaseResponse; 9 | import com.cwd.wandroid.entity.HotKey; 10 | import com.cwd.wandroid.entity.Login; 11 | import com.cwd.wandroid.entity.MyIntegral; 12 | import com.cwd.wandroid.entity.NavTitle; 13 | import com.cwd.wandroid.entity.ProjectCategory; 14 | import com.cwd.wandroid.entity.System; 15 | 16 | import java.util.List; 17 | 18 | import io.reactivex.Observable; 19 | 20 | public class DataManager { 21 | 22 | private ApiService apiService; 23 | 24 | public DataManager(ApiService apiService){ 25 | this.apiService = apiService; 26 | } 27 | 28 | public Observable> getArticleList(int page){ 29 | return apiService.getArticleList(page); 30 | } 31 | 32 | public Observable>> getTopAticleList(){ 33 | return apiService.getTopArticleList(); 34 | } 35 | 36 | public Observable>> getProjectCategory(){ 37 | return apiService.getProjectCategory(); 38 | } 39 | 40 | public Observable> getProjectList(int page,int cid){ 41 | return apiService.getProjectList(page,cid); 42 | } 43 | 44 | public Observable>> getSystemInfo(){ 45 | return apiService.getSystemInfo(); 46 | } 47 | 48 | public Observable> getSystemArticleList(int page,int cid){ 49 | return apiService.getSystemArticleList(page,cid); 50 | } 51 | 52 | public Observable>> getNavInfo(){ 53 | return apiService.getNavInfo(); 54 | } 55 | 56 | public Observable> getSearchList(int page,String keyword){ 57 | return apiService.getSearchList(page,keyword); 58 | } 59 | 60 | public Observable>> getBanner(){ 61 | return apiService.getBanner(); 62 | } 63 | 64 | public Observable> login(String username,String password){ 65 | return apiService.login(username,password); 66 | } 67 | 68 | public Observable logout(){ 69 | return apiService.logout(); 70 | } 71 | 72 | public Observable> register(String username,String password,String repassword){ 73 | return apiService.register(username,password,repassword); 74 | } 75 | 76 | public Observable> getCollectList(int page){ 77 | return apiService.getCollectList(page); 78 | } 79 | 80 | public Observable collectArticle(int id){ 81 | return apiService.collectArticle(id); 82 | } 83 | 84 | public Observable cancelCollectArticle(int id,int originId){ 85 | return apiService.cancelCollectArticle(id,originId); 86 | } 87 | 88 | public Observable>> getHotKey(){ 89 | return apiService.getHotKey(); 90 | } 91 | 92 | public Observable> getMyIntegral(){ 93 | return apiService.getMyIntegral(); 94 | } 95 | 96 | } 97 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/ui/activity/AboutActivity.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.ui.activity; 2 | 3 | import android.os.Build; 4 | import android.support.v7.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | import android.support.v7.widget.Toolbar; 7 | import android.text.Html; 8 | import android.text.method.LinkMovementMethod; 9 | import android.view.MenuItem; 10 | import android.widget.TextView; 11 | 12 | import com.cwd.wandroid.R; 13 | import com.cwd.wandroid.base.BaseActivity; 14 | import com.cwd.wandroid.utils.CommonUtils; 15 | 16 | import butterknife.BindView; 17 | 18 | public class AboutActivity extends BaseActivity { 19 | 20 | @BindView(R.id.tool_bar) 21 | Toolbar toolbar; 22 | @BindView(R.id.tv_desc) 23 | TextView tvDesc; 24 | @BindView(R.id.tv_ver_name) 25 | TextView tvVerName; 26 | 27 | @Override 28 | protected void onCreate(Bundle savedInstanceState) { 29 | super.onCreate(savedInstanceState); 30 | } 31 | 32 | @Override 33 | public int getLayoutId() { 34 | return R.layout.activity_about; 35 | } 36 | 37 | @Override 38 | public void createPresenter() { 39 | 40 | } 41 | 42 | @Override 43 | public void init() { 44 | setSupportActionBar(toolbar); 45 | toolbar.setTitle("关于"); 46 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 47 | String desc = "该项目本着学习Material Design+MVP+Retrofit2+RxJava2的目的,基于鸿洋大神提供的" + "玩Android" + "的开放API构建而成。"; 48 | if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){ 49 | tvDesc.setText(Html.fromHtml(desc,Html.FROM_HTML_MODE_COMPACT)); 50 | }else{ 51 | tvDesc.setText(Html.fromHtml(desc)); 52 | } 53 | tvDesc.setMovementMethod(LinkMovementMethod.getInstance()); 54 | tvVerName.setText("v" + CommonUtils.getVerName(this)); 55 | } 56 | 57 | @Override 58 | public boolean onOptionsItemSelected(MenuItem item) { 59 | switch (item.getItemId()) { 60 | case android.R.id.home: 61 | finish(); 62 | break; 63 | default: 64 | break; 65 | } 66 | return super.onOptionsItemSelected(item); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/ui/activity/IntegralActivity.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.ui.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.widget.Toolbar; 5 | import android.view.MenuItem; 6 | import android.view.View; 7 | import android.view.animation.AccelerateDecelerateInterpolator; 8 | import android.widget.ImageView; 9 | import android.widget.TextView; 10 | 11 | import com.cwd.wandroid.R; 12 | import com.cwd.wandroid.api.ApiService; 13 | import com.cwd.wandroid.api.RetrofitUtils; 14 | import com.cwd.wandroid.base.BaseActivity; 15 | import com.cwd.wandroid.contract.IntegralContract; 16 | import com.cwd.wandroid.entity.MyIntegral; 17 | import com.cwd.wandroid.presenter.CollectPresenter; 18 | import com.cwd.wandroid.presenter.IntegralPresenter; 19 | import com.cwd.wandroid.source.DataManager; 20 | import com.cwd.wandroid.ui.widget.DynamicNumberTextView; 21 | import com.cwd.wandroid.utils.DensityUtil; 22 | import com.cwd.wandroid.utils.ToastUtils; 23 | 24 | import org.greenrobot.eventbus.EventBus; 25 | 26 | import java.util.ArrayList; 27 | import java.util.List; 28 | 29 | import butterknife.BindView; 30 | import butterknife.OnClick; 31 | 32 | public class IntegralActivity extends BaseActivity implements IntegralContract.View { 33 | 34 | @BindView(R.id.tool_bar) 35 | Toolbar toolbar; 36 | @BindView(R.id.tv_integral) 37 | DynamicNumberTextView tvIntegral; 38 | @BindView(R.id.tv_rank) 39 | DynamicNumberTextView tvRank; 40 | @BindView(R.id.iv_integral) 41 | ImageView ivIntegral; 42 | @BindView(R.id.iv_rank) 43 | ImageView ivRank; 44 | 45 | private IntegralPresenter integralPresenter; 46 | private DataManager dataManager; 47 | 48 | @Override 49 | protected void onCreate(Bundle savedInstanceState) { 50 | super.onCreate(savedInstanceState); 51 | } 52 | 53 | @Override 54 | public int getLayoutId() { 55 | return R.layout.activity_myintegral; 56 | } 57 | 58 | @Override 59 | public void createPresenter() { 60 | dataManager = new DataManager(RetrofitUtils.get().retrofit().create(ApiService.class)); 61 | integralPresenter = new IntegralPresenter(dataManager); 62 | integralPresenter.attachView(this); 63 | } 64 | 65 | @Override 66 | public void init() { 67 | setSupportActionBar(toolbar); 68 | toolbar.setTitle("我的积分"); 69 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 70 | integralPresenter.getMyIntegral(); 71 | } 72 | 73 | @OnClick({R.id.ll_integral,R.id.ll_rank}) 74 | public void click(View view) { 75 | switch (view.getId()) { 76 | case R.id.ll_integral: 77 | ToastUtils.showShort("我的积分"); 78 | break; 79 | case R.id.ll_rank: 80 | ToastUtils.showShort("积分排名"); 81 | break; 82 | default: 83 | break; 84 | } 85 | } 86 | 87 | @Override 88 | public boolean onOptionsItemSelected(MenuItem item) { 89 | switch (item.getItemId()) { 90 | case android.R.id.home: 91 | finishAfterTransition(); 92 | break; 93 | default: 94 | break; 95 | } 96 | return super.onOptionsItemSelected(item); 97 | } 98 | 99 | @Override 100 | public void showError(String message) { 101 | super.showError(message); 102 | } 103 | 104 | @Override 105 | protected void onResume() { 106 | super.onResume(); 107 | execAnim(); 108 | } 109 | 110 | @Override 111 | protected void onDestroy() { 112 | super.onDestroy(); 113 | integralPresenter.detachView(); 114 | } 115 | 116 | @Override 117 | public void showMyIntegral(MyIntegral myIntegral) { 118 | tvIntegral.setText(String.valueOf(myIntegral.getCoinCount())); 119 | tvRank.setText(String.valueOf(myIntegral.getRank())); 120 | } 121 | 122 | private void execAnim() { 123 | List views = animViewList(); 124 | 125 | for (int i = 0; i < views.size(); i++) { 126 | View view = views.get(i); 127 | view.setTranslationY(DensityUtil.dip2px(IntegralActivity.this,20)); 128 | view.setAlpha(0); 129 | } 130 | 131 | for (int i = 0; i < views.size(); i++) { 132 | final View view = views.get(i); 133 | view.animate().translationY(0).alpha(1).setStartDelay(50 + (i * 100)).setDuration(500).setInterpolator(new AccelerateDecelerateInterpolator()).start(); 134 | } 135 | } 136 | 137 | private List animViewList() { 138 | List views = new ArrayList<>(); 139 | views.add(ivIntegral); 140 | views.add(tvIntegral); 141 | views.add(ivRank); 142 | views.add(tvRank); 143 | return views; 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/ui/activity/SplashActivity.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.ui.activity; 2 | 3 | import android.animation.Animator; 4 | import android.animation.AnimatorListenerAdapter; 5 | import android.app.ActivityOptions; 6 | import android.content.Intent; 7 | import android.support.annotation.Nullable; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.os.Bundle; 10 | import android.transition.Fade; 11 | import android.widget.TextView; 12 | 13 | import com.cwd.wandroid.R; 14 | import com.cwd.wandroid.app.ActivityCollector; 15 | import com.cwd.wandroid.base.BaseActivity; 16 | import com.cwd.wandroid.ui.widget.SplashLogo; 17 | import com.cwd.wandroid.utils.DensityUtil; 18 | 19 | import butterknife.BindView; 20 | 21 | public class SplashActivity extends BaseActivity { 22 | 23 | @BindView(R.id.tv_logo) 24 | TextView tvLogo; 25 | 26 | @Override 27 | public int getLayoutId() { 28 | return R.layout.activity_splash; 29 | } 30 | 31 | @Override 32 | public void createPresenter() { 33 | 34 | } 35 | 36 | @Override 37 | public void init() { 38 | ActivityCollector.getInstance().addActivity(this); 39 | tvLogo.animate().scaleX(0.5f).scaleY(0.5f).translationY(-DensityUtil.dip2px(this,150)).setStartDelay(1000) 40 | .setDuration(600) 41 | .setListener(new AnimatorListenerAdapter() { 42 | @Override 43 | public void onAnimationEnd(Animator animation) { 44 | Intent intent = new Intent(SplashActivity.this,MainActivity.class); 45 | startActivity(intent, ActivityOptions.makeSceneTransitionAnimation(SplashActivity.this,tvLogo,"logo").toBundle()); 46 | // finish(); 47 | } 48 | }).start(); 49 | } 50 | } -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/ui/activity/SystemDetailActivity.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.ui.activity; 2 | 3 | import android.support.design.widget.TabLayout; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentActivity; 6 | import android.support.v4.app.FragmentManager; 7 | import android.support.v4.view.ViewPager; 8 | import android.support.v7.app.AppCompatActivity; 9 | import android.os.Bundle; 10 | import android.support.v7.widget.Toolbar; 11 | import android.view.MenuItem; 12 | import android.widget.ImageView; 13 | import android.widget.PopupWindow; 14 | 15 | import com.cwd.wandroid.R; 16 | import com.cwd.wandroid.adapter.ProjectFragmentAdapter; 17 | import com.cwd.wandroid.adapter.SystemDetailFragmentAdapter; 18 | import com.cwd.wandroid.base.BaseActivity; 19 | import com.cwd.wandroid.entity.ProjectCategory; 20 | import com.cwd.wandroid.entity.System; 21 | import com.cwd.wandroid.entity.SystemDetail; 22 | import com.cwd.wandroid.ui.fragment.ProjectFragment; 23 | import com.cwd.wandroid.ui.widget.ProjectCategoryPop; 24 | 25 | import java.util.List; 26 | 27 | import butterknife.BindView; 28 | import butterknife.OnClick; 29 | 30 | public class SystemDetailActivity extends BaseActivity { 31 | 32 | @BindView(R.id.tool_bar) 33 | Toolbar toolbar; 34 | @BindView(R.id.tab_layout) 35 | TabLayout tabLayout; 36 | @BindView(R.id.vp_project) 37 | ViewPager vpProject; 38 | @BindView(R.id.iv_expand) 39 | ImageView ivExpand; 40 | 41 | public static final String SYSTEM = "system"; 42 | private System system; 43 | 44 | private ProjectCategoryPop categoryPop; 45 | 46 | private List systemDetailList; 47 | 48 | @Override 49 | protected void onCreate(Bundle savedInstanceState) { 50 | super.onCreate(savedInstanceState); 51 | } 52 | 53 | @Override 54 | public int getLayoutId() { 55 | return R.layout.activity_system_detail; 56 | } 57 | 58 | @Override 59 | public void createPresenter() { 60 | 61 | } 62 | 63 | @Override 64 | public void init() { 65 | system = (System) getIntent().getSerializableExtra(SYSTEM); 66 | setSupportActionBar(toolbar); 67 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 68 | toolbar.setTitle(system.getName()); 69 | this.systemDetailList = system.getChildren(); 70 | initTab(system.getChildren()); 71 | initViewPager(system.getChildren()); 72 | tabLayout.setupWithViewPager(vpProject); 73 | } 74 | 75 | @Override 76 | protected void onDestroy() { 77 | super.onDestroy(); 78 | if(tabLayout != null){ 79 | tabLayout.removeOnTabSelectedListener(tabListener); 80 | } 81 | } 82 | 83 | private void addFragment(Fragment fragment){ 84 | FragmentManager fm = getSupportFragmentManager(); 85 | if(!fragment.isAdded()){ 86 | fm.beginTransaction().add(R.id.fragment_container,fragment).commit(); 87 | fm.beginTransaction().show(fragment).commit(); 88 | } 89 | } 90 | 91 | private void initTab(List systemDetailList){ 92 | for (ProjectCategory systemDetail : systemDetailList){ 93 | tabLayout.addTab(tabLayout.newTab().setText(systemDetail.getName())); 94 | } 95 | tabLayout.addOnTabSelectedListener(tabListener); 96 | } 97 | 98 | private void initViewPager(List systemDetailList){ 99 | vpProject.setAdapter(new SystemDetailFragmentAdapter(getSupportFragmentManager(),systemDetailList)); 100 | } 101 | 102 | private TabLayout.OnTabSelectedListener tabListener = new TabLayout.OnTabSelectedListener() { 103 | @Override 104 | public void onTabSelected(TabLayout.Tab tab) { 105 | vpProject.setCurrentItem(tab.getPosition(),true); 106 | } 107 | 108 | @Override 109 | public void onTabUnselected(TabLayout.Tab tab) { 110 | 111 | } 112 | 113 | @Override 114 | public void onTabReselected(TabLayout.Tab tab) { 115 | 116 | } 117 | }; 118 | 119 | @Override 120 | public boolean onOptionsItemSelected(MenuItem item) { 121 | switch (item.getItemId()) { 122 | case android.R.id.home: 123 | finish(); 124 | break; 125 | default: 126 | break; 127 | } 128 | return super.onOptionsItemSelected(item); 129 | } 130 | 131 | @OnClick(R.id.iv_expand) 132 | public void expand(){ 133 | if(systemDetailList != null && !systemDetailList.isEmpty()){ 134 | if(categoryPop == null){ 135 | categoryPop = new ProjectCategoryPop(this,systemDetailList); 136 | categoryPop.setOnCategoryClickListener(new ProjectCategoryPop.OnCategoryClickListener() { 137 | @Override 138 | public void onCategoryClick(ProjectCategory category,int position) { 139 | categoryPop.dismiss(); 140 | vpProject.setCurrentItem(position,true); 141 | } 142 | }); 143 | } 144 | categoryPop.showAsDropDown(tabLayout); 145 | ivExpand.animate().rotation(180).setDuration(200).start(); 146 | categoryPop.setOnDismissListener(new PopupWindow.OnDismissListener() { 147 | @Override 148 | public void onDismiss() { 149 | ivExpand.animate().rotation(0).setDuration(200).start(); 150 | } 151 | }); 152 | } 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/ui/fragment/SystemFragment.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.ui.fragment; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.support.v4.widget.SwipeRefreshLayout; 7 | import android.support.v7.widget.LinearLayoutManager; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.view.View; 10 | 11 | import com.chad.library.adapter.base.BaseQuickAdapter; 12 | import com.cwd.wandroid.R; 13 | import com.cwd.wandroid.adapter.SystemAdapter; 14 | import com.cwd.wandroid.api.ApiService; 15 | import com.cwd.wandroid.api.RetrofitUtils; 16 | import com.cwd.wandroid.base.BaseFragment; 17 | import com.cwd.wandroid.contract.SystemContract; 18 | import com.cwd.wandroid.entity.System; 19 | import com.cwd.wandroid.presenter.SystemPresenter; 20 | import com.cwd.wandroid.source.DataManager; 21 | import com.cwd.wandroid.ui.activity.SystemDetailActivity; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | 26 | import butterknife.BindView; 27 | 28 | public class SystemFragment extends BaseFragment implements SystemContract.View, SwipeRefreshLayout.OnRefreshListener { 29 | 30 | @BindView(R.id.rv_system) 31 | RecyclerView rvSystem; 32 | @BindView(R.id.refreshLayout) 33 | SwipeRefreshLayout refreshLayout; 34 | 35 | 36 | private boolean isRefresh; 37 | 38 | private SystemPresenter systemPresenter; 39 | private DataManager dataManager; 40 | private SystemAdapter systemAdapter; 41 | private List systemList = new ArrayList<>(); 42 | 43 | public SystemFragment() { 44 | 45 | } 46 | 47 | public static SystemFragment newInstance() { 48 | return new SystemFragment(); 49 | } 50 | 51 | @Override 52 | public void onCreate(Bundle savedInstanceState) { 53 | super.onCreate(savedInstanceState); 54 | } 55 | 56 | @Override 57 | public void onAttach(Context context) { 58 | super.onAttach(context); 59 | } 60 | 61 | @Override 62 | public int getLayoutId() { 63 | return R.layout.fragment_system; 64 | } 65 | 66 | @Override 67 | public void createPresenter() { 68 | dataManager = new DataManager(RetrofitUtils.get().retrofit().create(ApiService.class)); 69 | systemPresenter = new SystemPresenter(dataManager); 70 | systemPresenter.attachView(this); 71 | } 72 | 73 | @Override 74 | public void init() { 75 | refreshLayout.setColorSchemeResources(R.color.colorAccent); 76 | refreshLayout.setOnRefreshListener(this); 77 | rvSystem.setLayoutManager(new LinearLayoutManager(getContext())); 78 | systemAdapter = new SystemAdapter(R.layout.item_system, systemList); 79 | systemAdapter.openLoadAnimation(BaseQuickAdapter.ALPHAIN); 80 | systemAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { 81 | @Override 82 | public void onItemClick(BaseQuickAdapter adapter, View view, int position) { 83 | Intent intent = new Intent(getContext(), SystemDetailActivity.class); 84 | intent.putExtra(SystemDetailActivity.SYSTEM, systemList.get(position)); 85 | startActivity(intent); 86 | } 87 | }); 88 | rvSystem.setAdapter(systemAdapter); 89 | refreshLayout.setRefreshing(true); 90 | systemPresenter.getSystemList(); 91 | } 92 | 93 | @Override 94 | public void onDetach() { 95 | super.onDetach(); 96 | } 97 | 98 | @Override 99 | public void showError(String message) { 100 | super.showError(message); 101 | refreshLayout.setRefreshing(false); 102 | } 103 | 104 | @Override 105 | public void onRefresh() { 106 | refreshLayout.setRefreshing(true); 107 | isRefresh = true; 108 | systemPresenter.getSystemList(); 109 | } 110 | 111 | @Override 112 | public void showSystemList(List systemList) { 113 | refreshLayout.setRefreshing(false); 114 | if(isRefresh){ 115 | this.systemList.clear(); 116 | }else{ 117 | systemAdapter.loadMoreComplete(); 118 | } 119 | this.systemList.addAll(systemList); 120 | systemAdapter.notifyDataSetChanged(); 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/ui/widget/HotKeyPop.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.ui.widget; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.ColorDrawable; 5 | import android.support.v4.content.ContextCompat; 6 | import android.view.Gravity; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | import android.widget.LinearLayout; 11 | import android.widget.PopupWindow; 12 | import android.widget.TextView; 13 | 14 | import com.cwd.wandroid.R; 15 | import com.cwd.wandroid.entity.ArticleInfo; 16 | import com.cwd.wandroid.entity.HotKey; 17 | import com.cwd.wandroid.entity.NavInfo; 18 | import com.cwd.wandroid.ui.activity.WebViewActivity; 19 | import com.cwd.wandroid.utils.DensityUtil; 20 | import com.paulyung.laybellayout.LaybelLayout; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | public class HotKeyPop extends PopupWindow { 26 | 27 | private Context context; 28 | private LaybelLayout flowLayout; 29 | 30 | private OnHotKeyClickListener listener; 31 | public interface OnHotKeyClickListener{ 32 | void onHotKeyClick(String key); 33 | } 34 | 35 | public void setOnHotKeyClickListener(OnHotKeyClickListener listener){ 36 | this.listener = listener; 37 | } 38 | 39 | public HotKeyPop(Context context, final List hotKeyList){ 40 | this.context = context; 41 | View window = LayoutInflater.from(context).inflate(R.layout.hot_key_layout,null); 42 | flowLayout = window.findViewById(R.id.fl_nav); 43 | flowLayout.setAdapter(new LaybelLayout.Adapter(handleTag(hotKeyList))); 44 | flowLayout.setOnItemClickListener(new LaybelLayout.OnItemClickListener() { 45 | @Override 46 | public void onItemClick(int p) { 47 | if(listener != null){ 48 | listener.onHotKeyClick(hotKeyList.get(p).getName()); 49 | dismiss(); 50 | }else{ 51 | throw new IllegalStateException("OnHotKeyClickListener must not be null"); 52 | } 53 | } 54 | }); 55 | setContentView(window); 56 | setWidth(ViewGroup.LayoutParams.MATCH_PARENT); 57 | setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); 58 | setFocusable(true); 59 | setOutsideTouchable(true); 60 | setAnimationStyle(R.style.PopupAnimation); 61 | ColorDrawable dw = new ColorDrawable(0x00000000); 62 | setBackgroundDrawable(dw); 63 | } 64 | 65 | private List handleTag(List hotKeyList){ 66 | List keys = new ArrayList<>(); 67 | for (HotKey hotKey : hotKeyList){ 68 | keys.add(hotKey.getName()); 69 | } 70 | return keys; 71 | } 72 | 73 | private void initTab(FlowLayout flowLayout, final List tags) { 74 | flowLayout.removeAllViews(); 75 | LinearLayout.MarginLayoutParams layoutParams = new LinearLayout.MarginLayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); 76 | // 设置边距 77 | // layoutParams.setMargins(30, 30, 10, 10); 78 | for (int i = 0; i < tags.size(); i++) { 79 | final HotKey hotKey = tags.get(i); 80 | final TextView textView = new TextView(context); 81 | textView.setTag(i); 82 | textView.setTextSize(15); 83 | textView.setText(hotKey.getName()); 84 | textView.setGravity(Gravity.CENTER); 85 | textView.setPadding(DensityUtil.dip2px(context, 18), DensityUtil.dip2px(context, 5), DensityUtil.dip2px(context, 18), DensityUtil.dip2px(context, 5)); 86 | textView.setTextColor(ContextCompat.getColor(context, R.color.textColor)); 87 | textView.setBackgroundResource(R.drawable.flow_tab_bg); 88 | flowLayout.addView(textView, layoutParams); 89 | // 标签点击事件 90 | textView.setOnClickListener(new View.OnClickListener() { 91 | @Override 92 | public void onClick(View v) { 93 | if(listener != null){ 94 | listener.onHotKeyClick(hotKey.getName()); 95 | dismiss(); 96 | }else{ 97 | throw new IllegalStateException("OnHotKeyClickListener must not be null"); 98 | } 99 | } 100 | }); 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/ui/widget/ProjectCategoryPop.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.ui.widget; 2 | 3 | import android.animation.Animator; 4 | import android.content.Context; 5 | import android.graphics.drawable.ColorDrawable; 6 | import android.support.v4.content.ContextCompat; 7 | import android.support.v7.widget.LinearLayoutManager; 8 | import android.support.v7.widget.RecyclerView; 9 | import android.view.Gravity; 10 | import android.view.LayoutInflater; 11 | import android.view.View; 12 | import android.view.ViewAnimationUtils; 13 | import android.view.ViewGroup; 14 | import android.view.animation.AccelerateDecelerateInterpolator; 15 | import android.widget.LinearLayout; 16 | import android.widget.PopupWindow; 17 | import android.widget.TextView; 18 | 19 | import com.chad.library.adapter.base.BaseQuickAdapter; 20 | import com.cwd.wandroid.R; 21 | import com.cwd.wandroid.adapter.ProjectCategoryAdapter; 22 | import com.cwd.wandroid.entity.HotKey; 23 | import com.cwd.wandroid.entity.ProjectCategory; 24 | import com.cwd.wandroid.utils.DensityUtil; 25 | import com.paulyung.laybellayout.LaybelLayout; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | public class ProjectCategoryPop extends PopupWindow { 31 | 32 | private RecyclerView rvCategory; 33 | private ProjectCategoryAdapter categoryAdapter; 34 | 35 | private OnCategoryClickListener listener; 36 | public interface OnCategoryClickListener{ 37 | void onCategoryClick(ProjectCategory category,int position); 38 | } 39 | 40 | public void setOnCategoryClickListener(OnCategoryClickListener listener){ 41 | this.listener = listener; 42 | } 43 | 44 | public ProjectCategoryPop(Context context, final List categoryList){ 45 | View window = LayoutInflater.from(context).inflate(R.layout.project_category_list_layout,null); 46 | rvCategory = window.findViewById(R.id.rv_category); 47 | rvCategory.setLayoutManager(new LinearLayoutManager(context)); 48 | categoryAdapter = new ProjectCategoryAdapter(R.layout.item_project_category,categoryList); 49 | rvCategory.setAdapter(categoryAdapter); 50 | setContentView(window); 51 | setWidth(ViewGroup.LayoutParams.MATCH_PARENT); 52 | setHeight(ViewGroup.LayoutParams.WRAP_CONTENT); 53 | setFocusable(true); 54 | setOutsideTouchable(true); 55 | setAnimationStyle(R.style.PopupAnimation); 56 | ColorDrawable dw = new ColorDrawable(0x4D000000); 57 | setBackgroundDrawable(dw); 58 | 59 | categoryAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() { 60 | @Override 61 | public void onItemClick(BaseQuickAdapter adapter, View view, int position) { 62 | if(listener != null){ 63 | ProjectCategory projectCategory = (ProjectCategory) adapter.getData().get(position); 64 | listener.onCategoryClick(projectCategory,position); 65 | } 66 | } 67 | }); 68 | 69 | } 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/ui/widget/SplashLogo.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.ui.widget; 2 | 3 | import android.animation.Animator; 4 | import android.animation.AnimatorListenerAdapter; 5 | import android.animation.ValueAnimator; 6 | import android.content.Context; 7 | import android.graphics.Canvas; 8 | import android.graphics.Paint; 9 | import android.graphics.Rect; 10 | import android.graphics.RectF; 11 | import android.os.Handler; 12 | import android.os.Looper; 13 | import android.os.Message; 14 | import android.support.annotation.Nullable; 15 | import android.util.AttributeSet; 16 | import android.view.View; 17 | import android.view.animation.OvershootInterpolator; 18 | 19 | import com.cwd.wandroid.R; 20 | import com.cwd.wandroid.utils.DensityUtil; 21 | 22 | public class SplashLogo extends View implements Runnable{ 23 | 24 | private static final int UPDATE_UI = 1; 25 | 26 | private Context context; 27 | 28 | private Paint textPaint; 29 | private Paint circlePaint; 30 | 31 | private String text = "悟"; 32 | 33 | private int arcAngle = 0; 34 | 35 | private boolean isAnimFinish; 36 | 37 | private UIHandler uiHandler; 38 | 39 | public OnAnimationFinishedListener listener; 40 | 41 | public interface OnAnimationFinishedListener { 42 | void onAnimationFinished(); 43 | } 44 | 45 | public void setOnAnimationFinishedListener(OnAnimationFinishedListener listener) { 46 | this.listener = listener; 47 | } 48 | 49 | public SplashLogo(Context context) { 50 | super(context); 51 | initPaint(context); 52 | } 53 | 54 | public SplashLogo(Context context, @Nullable AttributeSet attrs) { 55 | super(context, attrs); 56 | initPaint(context); 57 | } 58 | 59 | public SplashLogo(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 60 | super(context, attrs, defStyleAttr); 61 | initPaint(context); 62 | } 63 | 64 | private void initPaint(Context context) { 65 | this.context = context; 66 | textPaint = new Paint(Paint.ANTI_ALIAS_FLAG); 67 | circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG); 68 | textPaint.setColor(context.getResources().getColor(R.color.textColor)); 69 | circlePaint.setColor(context.getResources().getColor(R.color.textColor)); 70 | circlePaint.setStyle(Paint.Style.STROKE); 71 | textPaint.setTextSize(DensityUtil.sp2px(context,80)); 72 | circlePaint.setStrokeWidth(10); 73 | new Thread(this).start(); 74 | } 75 | 76 | @Override 77 | protected void onDraw(Canvas canvas) { 78 | super.onDraw(canvas); 79 | float x = (float) (getMeasuredWidth() - getTextWidthHeight().width()) / 2; 80 | float y = (float) (getMeasuredHeight() - getTextWidthHeight().height()) / 2 + getTextWidthHeight().height(); 81 | canvas.drawText(text,x,y,textPaint); 82 | RectF rect = new RectF(DensityUtil.dip2px(context,5),DensityUtil.dip2px(context,5),getMeasuredWidth() - DensityUtil.dip2px(context,5),getMeasuredHeight() - DensityUtil.dip2px(context,5)); 83 | canvas.drawArc(rect,0,arcAngle,false,circlePaint); 84 | canvas.drawArc(rect,90,arcAngle,false,circlePaint); 85 | canvas.drawArc(rect,180,arcAngle,false,circlePaint); 86 | canvas.drawArc(rect,270,arcAngle,false,circlePaint); 87 | } 88 | 89 | @Override 90 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 91 | setMeasuredDimension(resolveSize(getTextWidthHeight().width() + DensityUtil.dip2px(context,60),widthMeasureSpec), 92 | resolveSize(getTextWidthHeight().height() + DensityUtil.dip2px(context,60),heightMeasureSpec)); 93 | } 94 | 95 | private Rect getTextWidthHeight() { 96 | Rect rect = new Rect(); 97 | textPaint.getTextBounds(text,0,text.length(),rect); 98 | return rect; 99 | } 100 | 101 | @Override 102 | public void run() { 103 | Looper.prepare(); 104 | if (uiHandler == null) { 105 | uiHandler = new UIHandler(Looper.getMainLooper()); 106 | } 107 | while (!isAnimFinish) { 108 | if (arcAngle < 90) { 109 | arcAngle++; 110 | } else { 111 | isAnimFinish = true; 112 | uiHandler.sendEmptyMessage(UPDATE_UI); 113 | } 114 | postInvalidate(); 115 | try { 116 | Thread.sleep(10); 117 | } catch (InterruptedException e) { 118 | e.printStackTrace(); 119 | } 120 | } 121 | Looper.loop(); 122 | } 123 | 124 | private class UIHandler extends Handler { 125 | 126 | public UIHandler(Looper looper) { 127 | super(looper); 128 | } 129 | 130 | @Override 131 | public void handleMessage(Message msg) { 132 | if (msg.what == UPDATE_UI) { 133 | animate().scaleX(2f).scaleY(2f).alpha(0).setListener(new AnimatorListenerAdapter() { 134 | @Override 135 | public void onAnimationEnd(Animator animation) { 136 | if (listener != null) { 137 | listener.onAnimationFinished(); 138 | } 139 | } 140 | }).setStartDelay(800).setDuration(800).start(); 141 | } 142 | } 143 | } 144 | 145 | @Override 146 | protected void onDetachedFromWindow() { 147 | super.onDetachedFromWindow(); 148 | if (uiHandler != null) { 149 | uiHandler.removeCallbacksAndMessages(null); 150 | uiHandler = null; 151 | } 152 | isAnimFinish = true; 153 | context = null; 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/utils/BottomNavigationViewHelper.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.utils; 2 | 3 | import android.support.design.internal.BottomNavigationItemView; 4 | import android.support.design.internal.BottomNavigationMenuView; 5 | import android.support.design.widget.BottomNavigationView; 6 | import android.util.Log; 7 | 8 | import java.lang.reflect.Field; 9 | 10 | public class BottomNavigationViewHelper { 11 | 12 | public static void disableShiftMode(BottomNavigationView view) { 13 | BottomNavigationMenuView menuView = (BottomNavigationMenuView) view.getChildAt(0); 14 | try { 15 | Field shiftingMode = menuView.getClass().getDeclaredField("mShiftingMode"); 16 | shiftingMode.setAccessible(true); 17 | shiftingMode.setBoolean(menuView, false); 18 | shiftingMode.setAccessible(false); 19 | for (int i = 0; i < menuView.getChildCount(); i++) { 20 | BottomNavigationItemView item = (BottomNavigationItemView) menuView.getChildAt(i); 21 | //noinspection RestrictedApi 22 | item.setShiftingMode(false); 23 | // set once again checked value, so view will be updated 24 | //noinspection RestrictedApi 25 | item.setChecked(item.getItemData().isChecked()); 26 | } 27 | } catch (NoSuchFieldException e) { 28 | Log.e("BNVHelper", "Unable to get shift mode field", e); 29 | } catch (IllegalAccessException e) { 30 | Log.e("BNVHelper", "Unable to change value of shift mode", e); 31 | } 32 | } 33 | 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/utils/CommonUtils.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.utils; 2 | 3 | import android.annotation.SuppressLint; 4 | import android.app.Activity; 5 | import android.content.Context; 6 | import android.content.pm.PackageInfo; 7 | import android.content.pm.PackageManager; 8 | import android.content.res.Resources; 9 | import android.graphics.Bitmap; 10 | import android.net.ConnectivityManager; 11 | import android.net.NetworkInfo; 12 | import android.util.DisplayMetrics; 13 | import android.view.View; 14 | 15 | public class CommonUtils { 16 | 17 | @SuppressLint("NewApi") 18 | public static Bitmap captureScreen(Activity context) { 19 | View cv = context.getWindow().getDecorView(); 20 | cv.setDrawingCacheEnabled(true); 21 | cv.buildDrawingCache(); 22 | Bitmap bmp = cv.getDrawingCache(); 23 | if (bmp == null) { 24 | return null; 25 | } 26 | bmp.setHasAlpha(false); 27 | bmp.prepareToDraw(); 28 | return bmp; 29 | } 30 | 31 | public static int getScreenWidth(Context context){ 32 | Resources resources = context.getResources(); 33 | DisplayMetrics dm = resources.getDisplayMetrics(); 34 | return dm.widthPixels; 35 | } 36 | 37 | public static int getScreenHeight(Context context){ 38 | Resources resources = context.getResources(); 39 | DisplayMetrics dm = resources.getDisplayMetrics(); 40 | return dm.heightPixels; 41 | } 42 | 43 | public static int getScreenDensityDpi(Context context){ 44 | Resources resources = context.getResources(); 45 | DisplayMetrics dm = resources.getDisplayMetrics(); 46 | return dm.densityDpi; 47 | } 48 | 49 | public static DisplayMetrics getDisplayMetrics(Context context){ 50 | Resources resources = context.getResources(); 51 | DisplayMetrics dm = resources.getDisplayMetrics(); 52 | return dm; 53 | } 54 | 55 | /** 56 | * 检查包是否存在 57 | * 58 | * @param packageName 59 | * @return 60 | */ 61 | public static boolean checkPackInfo(Context context, String packageName) { 62 | PackageInfo packageInfo = null; 63 | try { 64 | packageInfo = context.getPackageManager().getPackageInfo(packageName, 0); 65 | } catch (PackageManager.NameNotFoundException e) { 66 | e.printStackTrace(); 67 | } 68 | return packageInfo != null; 69 | } 70 | 71 | public static boolean isNetWorkConnected(Context context) { 72 | if (context != null) { 73 | ConnectivityManager mConnectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 74 | NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo(); 75 | if (mNetworkInfo != null) { 76 | return mNetworkInfo.isAvailable(); 77 | } 78 | } 79 | 80 | return false; 81 | } 82 | 83 | public static String getVerName(Context context) { 84 | String verName = ""; 85 | try { 86 | verName = context.getPackageManager(). 87 | getPackageInfo(context.getPackageName(), 0).versionName; 88 | } catch (PackageManager.NameNotFoundException e) { 89 | e.printStackTrace(); 90 | } 91 | return verName; 92 | } 93 | 94 | public static int getVersionCode(Context context) { 95 | int versionCode = 0; 96 | try { 97 | versionCode = context.getPackageManager(). 98 | getPackageInfo(context.getPackageName(), 0).versionCode; 99 | } catch (PackageManager.NameNotFoundException e) { 100 | e.printStackTrace(); 101 | } 102 | return versionCode; 103 | } 104 | 105 | } 106 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/utils/DensityUtil.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.utils; 2 | 3 | import android.content.Context; 4 | 5 | /** 6 | * Created by Administrator on 2016/1/25. 7 | */ 8 | public class DensityUtil { 9 | 10 | public static DensityUtil densityUtil ; 11 | 12 | public synchronized static DensityUtil getInstance(){ 13 | if (densityUtil==null){ 14 | densityUtil = new DensityUtil(); 15 | } 16 | return densityUtil; 17 | } 18 | 19 | /** 20 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素) 21 | */ 22 | public static int dip2px(Context context, float dpValue) { 23 | final float scale = context.getResources().getDisplayMetrics().density; 24 | return (int) (dpValue * scale + 0.5f); 25 | } 26 | 27 | /** 28 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp 29 | */ 30 | public static int px2dip(Context context, float pxValue) { 31 | final float scale = context.getResources().getDisplayMetrics().density; 32 | return (int) (pxValue / scale + 0.5f); 33 | } 34 | 35 | /** 36 | * convert px to its equivalent sp 37 | * 38 | * 将px转换为sp 39 | */ 40 | public static int px2sp(Context context, float pxValue) { 41 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; 42 | return (int) (pxValue / fontScale + 0.5f); 43 | } 44 | 45 | 46 | /** 47 | * convert sp to its equivalent px 48 | * 49 | * 将sp转换为px 50 | */ 51 | public static int sp2px(Context context, float spValue) { 52 | final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; 53 | return (int) (spValue * fontScale + 0.5f); 54 | } 55 | 56 | 57 | private static final double EARTH_RADIUS = 6378137.0; 58 | 59 | private static double rad(double d) { 60 | return d * Math.PI / 180.0; 61 | } 62 | 63 | /** 64 | * 根据两点间经纬度坐标(double值),计算两点间距离, 65 | * 66 | * @param lat1 经度 67 | * @param lng1 维度 68 | * @param lat2 经度 69 | * @param lng2 维度 70 | * @return 距离:单位为米 71 | */ 72 | public static String DistanceOfTwoPoints(double lat1, double lng1, 73 | double lat2, double lng2) { 74 | 75 | double radLat1 = rad(lat1); 76 | double radLat2 = rad(lat2); 77 | double a = radLat1 - radLat2; 78 | double b = rad(lng1) - rad(lng2); 79 | double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) 80 | + Math.cos(radLat1) * Math.cos(radLat2) 81 | * Math.pow(Math.sin(b / 2), 2))); 82 | s = s * EARTH_RADIUS; 83 | s = Math.round(s * 10000) / 10000; 84 | String result; 85 | if(s > 1000.0){ 86 | if(Math.floor(s / 1000) > 500){ 87 | result = ">" + 500 + "km"; 88 | }else{ 89 | result = Math.floor(s / 1000) + "km"; 90 | } 91 | }else{ 92 | result = s + "m"; 93 | } 94 | return result; 95 | } 96 | //转换成金钱格式 97 | public static String alterMoney(String money_s) { 98 | if (!money_s.equals("0")) { 99 | StringBuffer money = new StringBuffer(); 100 | String money_1 = Float.parseFloat(money_s) / 100 + "" ; 101 | String money_ary[] =money_1.split("\\."); 102 | String int_money = money_ary[0]; 103 | money.append(int_money + ""); 104 | for (int i = money.length() - 3; i > 0; i = i - 3) { 105 | money.insert(i, ","); 106 | } 107 | return "" + money + "." + (money_ary[1].length() >= 2 ? money_ary[1] : (money_ary[1] + 0)) ; 108 | }else { 109 | return "0.00"; 110 | } 111 | } 112 | 113 | /** 114 | * 根据两点间经纬度坐标(double值),计算两点间距离, 115 | * 116 | * @param lat1 经度 117 | * @param lng1 维度 118 | * @param lat2 经度 119 | * @param lng2 维度 120 | * @return 距离:单位为米 121 | */ 122 | public static double DistanceOfTwoPoints1(double lat1, double lng1, 123 | double lat2, double lng2) { 124 | 125 | double radLat1 = rad(lat1); 126 | double radLat2 = rad(lat2); 127 | double a = radLat1 - radLat2; 128 | double b = rad(lng1) - rad(lng2); 129 | double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) 130 | + Math.cos(radLat1) * Math.cos(radLat2) 131 | * Math.pow(Math.sin(b / 2), 2))); 132 | s = s * EARTH_RADIUS; 133 | s = Math.round(s * 10000) / 10000; 134 | 135 | return s; 136 | } 137 | 138 | } 139 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/utils/GlideImageLoader.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.utils; 2 | 3 | import android.content.Context; 4 | import android.widget.ImageView; 5 | 6 | import com.bumptech.glide.Glide; 7 | import com.youth.banner.loader.ImageLoader; 8 | 9 | /** 10 | * Created by thepl on 2017/11/9. 11 | */ 12 | 13 | public class GlideImageLoader extends ImageLoader { 14 | @Override 15 | public void displayImage(Context context, Object path, final ImageView imageView) { 16 | imageView.setAlpha(0f); 17 | imageView.animate().alpha(1.0f).setDuration(500).start(); 18 | Glide.with(context).load(path).into(imageView); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/utils/LogUtils.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.utils; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * Created by Wade on 2016/3/31. 7 | * Log统一管理类 8 | */ 9 | public class LogUtils { 10 | 11 | public static boolean isDebug = true; // 是否需要打印bug,可以在application的onCreate函数里面初始化 12 | private static final String TAG = "cwd"; 13 | 14 | private LogUtils() 15 | { 16 | /* cannot be instantiated */ 17 | throw new UnsupportedOperationException("cannot be instantiated"); 18 | } 19 | 20 | 21 | // 下面四个是默认tag的函数 22 | public static void i(String msg) 23 | { 24 | if (isDebug) 25 | Log.i(TAG, msg); 26 | } 27 | 28 | public static void d(String msg) 29 | { 30 | if (isDebug) 31 | Log.d(TAG, msg); 32 | } 33 | 34 | public static void e(String msg) 35 | { 36 | if (isDebug) 37 | Log.e(TAG, msg); 38 | } 39 | 40 | public static void v(String msg) 41 | { 42 | if (isDebug) 43 | Log.v(TAG, msg); 44 | } 45 | 46 | // 下面是传入自定义tag的函数 47 | public static void i(String tag, String msg) 48 | { 49 | if (isDebug) 50 | Log.i(tag, msg); 51 | } 52 | 53 | public static void d(String tag, String msg) 54 | { 55 | if (isDebug) 56 | Log.d(tag, msg); 57 | } 58 | 59 | public static void e(String tag, String msg) 60 | { 61 | if (isDebug) 62 | Log.e(tag, msg); 63 | } 64 | 65 | public static void v(String tag, String msg) 66 | { 67 | if (isDebug) 68 | Log.v(tag, msg); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/cwd/wandroid/utils/ToastUtils.java: -------------------------------------------------------------------------------- 1 | package com.cwd.wandroid.utils; 2 | 3 | import android.text.TextUtils; 4 | import android.widget.Toast; 5 | 6 | import com.cwd.wandroid.app.App; 7 | 8 | 9 | /** 10 | * Created by drakeet on 9/27/14. 11 | */ 12 | public class ToastUtils { 13 | 14 | private ToastUtils() { 15 | } 16 | 17 | 18 | public static void showShort(int resId) { 19 | Toast.makeText(App.getContext(), resId, Toast.LENGTH_SHORT).show(); 20 | } 21 | 22 | public static void showShort(String message) { 23 | if(!TextUtils.isEmpty(message)){ 24 | Toast.makeText(App.getContext(), message, Toast.LENGTH_SHORT).show(); 25 | } 26 | 27 | } 28 | 29 | public static void showLong(int resId) { 30 | Toast.makeText(App.getContext(), resId, Toast.LENGTH_LONG).show(); 31 | } 32 | 33 | public static void showLong(String message) { 34 | if(!TextUtils.isEmpty(message)){ 35 | Toast.makeText(App.getContext(), message, Toast.LENGTH_LONG).show(); 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/res/anim/alpha_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/alpha_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_left_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_left_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/anim/push_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/anim/stop_anim.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/color/navigation_menu_item_color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/about.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/girl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/girl.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/girl_tint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/girl_tint.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/home.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/home_tint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/home_tint.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_integral.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/ic_integral.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_rank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/ic_rank.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icon_default.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/icon_default.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icon_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/icon_down.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/icon_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/icon_up.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/logo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/logo.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/mine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/mine.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/mine_tint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/mine_tint.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/nav.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/nav.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/nav_tint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/nav_tint.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/project.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/project.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/project_tint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/project_tint.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/search_tint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/search_tint.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/system.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/system.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/system_tint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/system_tint.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable-xxhdpi/update.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_login_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/btn_register_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/flow_search_hotkey_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/flow_tab_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_arrow_back_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_arrow_upward_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_baseline_search_24.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_dashboard_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_home_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_level.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chenweide/wanAndroid/249c98c6fa889a0d7e4619499716f09f997135dd/app/src/main/res/drawable/ic_level.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_notifications_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_system_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/main_tb_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/nav_girl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/nav_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/nav_mine.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/nav_nav.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/nav_project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/nav_system.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_btn_register.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_btn_register_press.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_more_tab_shadow.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/shape_stroke_radius_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 18 | 24 | 30 | 35 | 39 | 45 | 49 | 50 | 51 | 57 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_collect.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 12 | 13 | 18 | 19 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_myintegral.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 18 | 19 | 20 | 27 | 28 | 34 | 35 | 41 | 42 | 43 | 50 | 51 | 56 | 57 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 11 | 12 | 18 | 25 | 34 | 35 | 36 | 40 | 43 | 47 | 52 | 58 | 61 | 67 | 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_system_detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 14 | 22 | 29 | 32 | 39 | 40 | 41 | 42 | 43 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_web_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 11 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/banner_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/empty_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_article.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 14 | 18 | 19 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_nav.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 17 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_project.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 13 | 21 | 28 | 31 | 38 | 39 | 40 | 41 | 42 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_system.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/hot_key_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_article.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 18 | 24 | 30 | 31 | 39 | 40 | 49 | 50 | 58 | 59 | 63 | 64 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_nav.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_project_category.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 12 | 13 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_system.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 15 | 21 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/login_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 12 | 17 | 18 | 23 | 29 | 30 | 34 | 40 |