├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── inspectionProfiles │ ├── Project_Default.xml │ └── profiles_settings.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ └── tbs_sdk_thirdapp_v3.1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── dom │ │ └── red │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── dom │ │ │ └── red │ │ │ ├── animation │ │ │ └── AnimPath.java │ │ │ ├── app │ │ │ └── App.java │ │ │ ├── base │ │ │ ├── BaseActivity.java │ │ │ ├── BaseFragment.java │ │ │ ├── BasePresenter.java │ │ │ ├── BaseView.java │ │ │ ├── RxPresenter.java │ │ │ ├── SimpleActivity.java │ │ │ └── SimpleFragment.java │ │ │ ├── di │ │ │ ├── ActivityScope.java │ │ │ ├── FragmentScope.java │ │ │ ├── component │ │ │ │ ├── ActivityComponent.java │ │ │ │ ├── AppComponent.java │ │ │ │ └── FragmentComponent.java │ │ │ └── module │ │ │ │ ├── ActivityModule.java │ │ │ │ ├── AppModule.java │ │ │ │ └── FragmentModule.java │ │ │ ├── model │ │ │ ├── bean │ │ │ │ ├── gank │ │ │ │ │ ├── ClassifyList.java │ │ │ │ │ └── MeiziBean.java │ │ │ │ └── zhihu │ │ │ │ │ ├── BeforeBean.java │ │ │ │ │ ├── DetailBean.java │ │ │ │ │ ├── ExtraInfo.java │ │ │ │ │ ├── HomeBean.java │ │ │ │ │ ├── HomeListBean.java │ │ │ │ │ ├── HotListBean.java │ │ │ │ │ ├── LongCommentBean.java │ │ │ │ │ ├── SectionBean.java │ │ │ │ │ ├── SectionChildListBean.java │ │ │ │ │ ├── ShortCommentBean.java │ │ │ │ │ ├── ThemeList.java │ │ │ │ │ ├── ThemeListBean.java │ │ │ │ │ └── WelcomeBean.java │ │ │ └── http │ │ │ │ ├── api │ │ │ │ ├── GankApi.java │ │ │ │ └── ZhiHuApi.java │ │ │ │ ├── help │ │ │ │ ├── ApiExcpetion.java │ │ │ │ ├── RetrofitHelper.java │ │ │ │ ├── RxHelper.java │ │ │ │ └── Subscribe2Help.java │ │ │ │ └── response │ │ │ │ └── GankHttpResult.java │ │ │ ├── presenter │ │ │ ├── CommentPresenter.java │ │ │ ├── ContentPresenter.java │ │ │ ├── DailyPresenter.java │ │ │ ├── FuliPresenter.java │ │ │ ├── HomeFragmentPresenter.java │ │ │ ├── HomePresenter.java │ │ │ ├── HotPresenter.java │ │ │ ├── SectionChildPresenter.java │ │ │ ├── SectionPresenter.java │ │ │ ├── ThemeFragmentPresenter.java │ │ │ ├── ThemePresenter.java │ │ │ └── contract │ │ │ │ ├── CommentContract.java │ │ │ │ ├── ContentContract.java │ │ │ │ ├── FuliContract.java │ │ │ │ ├── HomeContract.java │ │ │ │ ├── HomeFragmentContract.java │ │ │ │ ├── SectionChildContract.java │ │ │ │ ├── ThemeContract.java │ │ │ │ ├── ThemeFragmentContract.java │ │ │ │ ├── ZhiDailyContract.java │ │ │ │ ├── ZhiHotContract.java │ │ │ │ ├── ZhiSectionContract.java │ │ │ │ └── ZhiThemeContract.java │ │ │ ├── ui │ │ │ ├── gank │ │ │ │ ├── activity │ │ │ │ │ ├── FuliActivity.java │ │ │ │ │ ├── HomeActivity.java │ │ │ │ │ ├── MeiZiActivity.java │ │ │ │ │ └── WebVideoActivity.java │ │ │ │ └── fragment │ │ │ │ │ └── HomeFragment.java │ │ │ ├── main │ │ │ │ ├── activity │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ ├── TimeActivity.java │ │ │ │ │ └── WelComeActivity.java │ │ │ │ ├── adapter │ │ │ │ │ ├── CommonAdapter.java │ │ │ │ │ ├── HeaderAndFooterSupport.java │ │ │ │ │ ├── HomeTopViewPager.java │ │ │ │ │ ├── HomeViewPager.java │ │ │ │ │ ├── MainAdapter.java │ │ │ │ │ ├── MulitItemTypeSupport.java │ │ │ │ │ ├── MulitItemTypeaAdapter.java │ │ │ │ │ ├── ThemeDownVp.java │ │ │ │ │ ├── ThemeTopViewPager.java │ │ │ │ │ └── ViewHolder.java │ │ │ │ └── widget │ │ │ │ │ ├── BanRecyclerView.java │ │ │ │ │ ├── ContentBehavior.java │ │ │ │ │ ├── CusNestedScrollView.java │ │ │ │ │ ├── DividerItemDecoration.java │ │ │ │ │ ├── FullyLinearLayoutManager.java │ │ │ │ │ ├── GlideImageLoader.java │ │ │ │ │ ├── ImageAndText2.java │ │ │ │ │ ├── ImageViewAndText.java │ │ │ │ │ ├── RefreshRecyclerView.java │ │ │ │ │ └── TextViewSpan.java │ │ │ └── zhihu │ │ │ │ ├── activity │ │ │ │ ├── AboutRedActivity.java │ │ │ │ ├── CommentActivity.java │ │ │ │ ├── ContentActivity.java │ │ │ │ ├── SectionActivity.java │ │ │ │ ├── ThemeActivity.java │ │ │ │ └── WebViewActivity.java │ │ │ │ └── fragment │ │ │ │ ├── ThemeFragment.java │ │ │ │ ├── ZhihuDaily.java │ │ │ │ ├── ZhihuHot.java │ │ │ │ └── ZhihuSection.java │ │ │ └── util │ │ │ ├── CircularAnimUtil.java │ │ │ ├── Constants.java │ │ │ ├── FileUtil.java │ │ │ ├── HtmlUtil.java │ │ │ ├── LogUtil.java │ │ │ ├── NewWorkUtil.java │ │ │ ├── PxUtil.java │ │ │ ├── ShareUtil.java │ │ │ ├── SharedPreferenceUtil.java │ │ │ ├── SnakerbarUtil.java │ │ │ ├── TimeUtil.java │ │ │ └── ToastUtil.java │ └── res │ │ ├── animator │ │ ├── color.xml │ │ ├── lightning.xml │ │ ├── star_first.xml │ │ ├── star_second.xml │ │ └── star_third.xml │ │ ├── color │ │ └── seleter.xml │ │ ├── drawable │ │ ├── bottom_shadow_bg.xml │ │ ├── cpb_background.xml │ │ ├── dialog_toast_bg.xml │ │ ├── drawer_item_bg.xml │ │ ├── like_seleter.xml │ │ ├── pg.xml │ │ ├── rotate_pro.xml │ │ ├── seleter.xml │ │ ├── toast_image.xml │ │ └── top_background.xml │ │ ├── layout │ │ ├── activity_about.xml │ │ ├── activity_comment.xml │ │ ├── activity_content.xml │ │ ├── activity_fuli.xml │ │ ├── activity_home.xml │ │ ├── activity_main.xml │ │ ├── activity_meizi.xml │ │ ├── activity_section.xml │ │ ├── activity_time.xml │ │ ├── activity_topic.xml │ │ ├── activity_webvideo.xml │ │ ├── activity_webview.xml │ │ ├── activity_welcome.xml │ │ ├── avtivity_theme.xml │ │ ├── fragment_daily.xml │ │ ├── fragment_home.xml │ │ ├── fragment_hot.xml │ │ ├── fragment_section.xml │ │ ├── fragment_theme.xml │ │ ├── fragmnt_section.xml │ │ ├── item_about.xml │ │ ├── item_fuli.xml │ │ ├── item_home.xml │ │ ├── item_home_gank.xml │ │ ├── item_imageatext.xml │ │ ├── item_imageatext2.xml │ │ ├── item_long_connment.xml │ │ ├── item_longcomment.xml │ │ ├── item_main_left.xml │ │ ├── item_menu_like.xml │ │ ├── item_menu_message.xml │ │ ├── item_section.xml │ │ ├── item_sectionchild.xml │ │ ├── item_text.xml │ │ ├── item_theme.xml │ │ ├── toast_image.xml │ │ ├── toast_white.xml │ │ ├── view_dialog.xml │ │ ├── view_refreshview.xml │ │ └── view_toolbar.xml │ │ ├── menu │ │ ├── comment_write.xml │ │ ├── content_top.xml │ │ ├── home_menu.xml │ │ ├── meizi_top.xml │ │ └── menu_left.xml │ │ ├── mipmap-hdpi │ │ ├── comment_icon_fold.png │ │ ├── ic_fab_calendar.png │ │ ├── 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 │ │ ├── background.png │ │ ├── comment.png │ │ ├── comment_empty.png │ │ ├── comment_vote.png │ │ ├── comment_voted.png │ │ ├── comment_write.png │ │ ├── ic_android.png │ │ ├── ic_author.png │ │ ├── ic_daily_share.png │ │ ├── ic_drawer_about.png │ │ ├── ic_drawer_gank.png │ │ ├── ic_drawer_zhihu.png │ │ ├── ic_fuli.png │ │ ├── ic_ios.png │ │ ├── ic_launcher.png │ │ ├── ic_launcher_round.png │ │ ├── ic_time.png │ │ ├── ic_toolbar_save.png │ │ ├── ic_toolbar_share.png │ │ ├── ic_video.png │ │ ├── ic_web.png │ │ ├── load_error.png │ │ ├── loading.png │ │ ├── logo.png │ │ ├── praise.png │ │ └── praised.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values-1024x600 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-1024x768 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-1184x720 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-1196x720 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-1280x720 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-1280x800 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-1812x1080 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-1920x1080 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-2560x1440 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-400x320 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-480x320 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-800x480 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-854x480 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ ├── values-960x540 │ │ ├── lay_x.xml │ │ └── lay_y.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── com │ └── dom │ └── red │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── showImage ├── 1.jpg ├── 2.jpg ├── 3.jpg ├── 4.jpg ├── 5.jpg ├── gif1.gif ├── gif2.gif └── gif3.gif /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 13 | -------------------------------------------------------------------------------- /.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Red 2 | # 项目简介 3 | 4 |  J.Red 一款纯阅读类的App 基于MVP + Retrofit + RxJava + Dagger2
5 | 出于学习的目的制作了这款阅读类的App
6 | 项目使用了当前Android最流行的MVP框架进行开发,技术点几乎涉及到了目前Android所有的主流开发技术
7 | * 本项目还在测试阶段,发现bug或有好的建议欢迎issue、email(dom4j1464529456@163.com)
8 | * IDE提示缺少Dagger开头的Class直接编译即可,会由Dagger2自动生成
9 | * 本项目仅做学习交流使用,API数据内容所有权归原作公司所有,请勿用于其他用途
10 | # 特别感谢 11 | * [知乎日报API分析](https://github.com/izzyleung/ZhihuDailyPurify/wiki/%E7%9F%A5%E4%B9%8E%E6%97%A5%E6%8A%A5-API-%E5%88%86%E6%9E%90)
12 | 汇集知乎上的热门话题与新鲜事,板块众多
13 | * [代码家/干货集中营](http://gank.io/api)
14 | 国内第三方技术分享平台,内有很多干货
15 | 16 | # 技术要点 17 | * 整体框架使用MVP搭建
18 | * 使用RxJava及Retrofit2做网络请求
19 | * 使用RxPresenter对订阅的生命周期做管理
20 | * 使用OkHttp3拦截器对网络数据进行了缓存,以及超时重连配置等
21 | * 使用Material design风格设计
22 | * 使用Dagger2做依赖注入 将M层注入P层,P层注入V层 无需new
23 | * 使用Fresco+Glide做图片的缓存加载处理
24 | * 使用X5WebView替换原生webView,做数据的展示
25 | * 使用RecyclerView做列表数据展示
26 | * 使用沉浸式布局做阅览,页面更美观 27 | * 使用通用Adapter做RecyclerView适配器,告别创建adapter的痛苦
28 | * 详情请下载源码阅读
29 | 30 | # 项目展示 31 | 32 | ![image](https://github.com/dom4j1/Red/blob/master/showImage/gif1.gif)![image](https://github.com/dom4j1/Red/blob/master/showImage/gif2.gif) 33 | ![image](https://github.com/dom4j1/Red/blob/master/showImage/gif3.gif)![image](https://github.com/dom4j1/Red/blob/master/showImage/1.jpg) 34 | ![image](https://github.com/dom4j1/Red/blob/master/showImage/2.jpg)![image](https://github.com/dom4j1/Red/blob/master/showImage/3.jpg) 35 | ![image](https://github.com/dom4j1/Red/blob/master/showImage/4.jpg)![image](https://github.com/dom4j1/Red/blob/master/showImage/5.jpg) 36 | 37 | # 项目用到的第三方库 38 | * [rxjava](https://github.com/ReactiveX/RxJava) 39 | * [rxandroid](https://github.com/ReactiveX/RxAndroid) 40 | * [retrofit](https://github.com/square/retrofit) 41 | * [okhttp](https://github.com/square/okhttp) 42 | * [glide](https://github.com/bumptech/glide) 43 | * [fresco](https://github.com/facebook/fresco) 44 | * [dagger2](https://github.com/google/dagger) 45 | * [butterknife](https://github.com/JakeWharton/butterknife) 46 | * [fragmentation](https://github.com/YoKeyword/Fragmentation) 47 | * [PhotoView](https://github.com/chrisbanes/PhotoView)
48 | 49 | # [点击我下载App进行体验 (*^__^*)](https://fir.im/Red) 50 | * 最后感谢GitHub上拥有开源精神的大神们,因为有你们才能让我们这些晚辈看的更远 51 | 52 | 53 | 54 | 55 |   56 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.neenbedankt.android-apt' 3 | 4 | android { 5 | compileSdkVersion 25 6 | buildToolsVersion "25.0.2" 7 | aaptOptions { 8 | cruncherEnabled = false 9 | useNewCruncher = false 10 | 11 | } 12 | defaultConfig { 13 | applicationId "com.dom.red" 14 | minSdkVersion 21 15 | targetSdkVersion 25 16 | versionCode 1 17 | versionName "1.0" 18 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 19 | } 20 | buildTypes { 21 | release { 22 | minifyEnabled false 23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 24 | } 25 | } 26 | } 27 | 28 | dependencies { 29 | compile fileTree(include: ['*.jar'], dir: 'libs') 30 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 31 | exclude group: 'com.android.support', module: 'support-annotations' 32 | }) 33 | compile 'com.android.support:appcompat-v7:25.2.0' 34 | compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5' 35 | compile 'com.android.support:design:25.2.0' 36 | testCompile 'junit:junit:4.12' 37 | //retrofit2.0 38 | compile 'com.squareup.retrofit2:retrofit:2.2.0' 39 | compile 'com.squareup.retrofit2:converter-gson:2.2.0' 40 | compile 'com.squareup.retrofit2:adapter-rxjava2:2.2.0' 41 | compile 'com.squareup.okhttp3:logging-interceptor:3.2.0' 42 | //rxJava2.0 43 | compile 'io.reactivex.rxjava2:rxjava:2.x.y' 44 | compile 'io.reactivex.rxjava2:rxandroid:2.0.1' 45 | //dagger2 46 | compile 'com.google.dagger:dagger:2.4' 47 | apt 'com.google.dagger:dagger-compiler:2.4' 48 | provided 'org.glassfish:javax.annotation:10.0-b28' 49 | //butterknife 50 | compile 'com.jakewharton:butterknife:8.2.1' 51 | apt 'com.jakewharton:butterknife-compiler:8.2.1' 52 | //fresco 53 | compile 'com.facebook.fresco:fresco:0.14.1' 54 | compile 'com.facebook.fresco:animated-gif:0.14.1' 55 | compile 'com.facebook.fresco:imagepipeline-okhttp:0.12.0+' 56 | //动画 57 | compile 'com.fancy.library:pathanim:1.0.1' 58 | compile 'com.android.support:cardview-v7:25.2.0' 59 | //glide 60 | compile 'com.github.bumptech.glide:glide:3.7.0' 61 | compile files('libs/tbs_sdk_thirdapp_v3.1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar') 62 | //progressbar 63 | compile 'com.daimajia.numberprogressbar:library:1.2@aar' 64 | //support 65 | compile 'me.yokeyword:fragmentation:0.10.1' 66 | //banner 67 | compile 'com.youth.banner:banner:1.4.9' //最新版本 68 | //搜索 69 | compile 'com.miguelcatalan:materialsearchview:1.4.0' 70 | //time 71 | compile 'com.prolificinteractive:material-calendarview:1.4.3' 72 | //eventbus 73 | compile 'org.greenrobot:eventbus:3.0.0' 74 | //photoview 75 | compile 'com.github.chrisbanes:PhotoView:1.3.0' 76 | //dialog 77 | compile 'com.github.ybq:Android-SpinKit:1.1.0' 78 | } 79 | -------------------------------------------------------------------------------- /app/libs/tbs_sdk_thirdapp_v3.1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/libs/tbs_sdk_thirdapp_v3.1.0.1034_43100_sharewithdownload_obfs_20170301_182143.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Android\StudioSDK/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/dom/red/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.dom.red; 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 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.dom.red", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/animation/AnimPath.java: -------------------------------------------------------------------------------- 1 | 2 | package com.dom.red.animation; 3 | 4 | public class AnimPath { 5 | public static final String[] ANIM_PATH = new String[] { 6 | "M 199.49,106.00\n" + 7 | " C 198.43,109.55 185.58,124.82 182.35,129.00\n" + 8 | " 175.40,137.98 168.51,147.23 160.00,154.83\n" + 9 | " 147.00,166.43 127.43,173.97 110.00,174.00\n" + 10 | " 99.25,174.02 92.58,174.32 82.00,170.97\n" + 11 | " 49.12,160.56 27.60,132.68 28.00,98.00\n" + 12 | " 28.15,85.63 33.15,73.02 40.21,63.00\n" + 13 | " 51.61,46.83 70.49,36.73 90.00,34.93\n" + 14 | " 92.94,34.65 95.00,34.10 98.00,34.32\n" + 15 | " 106.60,34.97 113.90,36.31 122.00,39.32\n" + 16 | " 129.12,41.96 138.64,47.51 143.83,53.04\n" + 17 | " 165.94,76.61 161.58,116.18 130.00,128.54\n" + 18 | " 113.57,134.97 93.25,131.53 80.04,119.70\n" + 19 | " 66.28,107.37 63.94,84.04 78.00,71.00\n" + 20 | " 76.92,76.91 75.50,82.16 78.00,88.00\n" + 21 | " 83.43,100.73 101.13,107.17 113.00,99.39\n" + 22 | " 115.51,97.74 118.23,95.28 120.07,92.91\n" + 23 | " 134.47,74.43 113.18,55.43 95.00,55.01\n" + 24 | " 69.21,54.42 44.57,80.07 47.17,106.00\n" + 25 | " 48.94,123.64 62.95,138.81 79.00,145.17\n" + 26 | " 83.87,147.10 93.85,149.18 99.00,148.82\n" + 27 | " 120.22,147.31 132.64,139.33 146.91,124.00\n" + 28 | " 161.95,107.85 175.10,86.22 200.00,85.00\n" + 29 | " 200.00,88.97 200.35,103.14 199.49,106.00 Z" 30 | }; 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/app/App.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.app; 2 | 3 | import android.app.Activity; 4 | import android.app.Application; 5 | import android.content.SharedPreferences; 6 | 7 | import com.dom.red.di.component.AppComponent; 8 | import com.dom.red.di.component.DaggerAppComponent; 9 | import com.dom.red.di.module.AppModule; 10 | import com.dom.red.util.Constants; 11 | import com.facebook.drawee.backends.pipeline.Fresco; 12 | import com.tencent.smtt.sdk.QbSdk; 13 | 14 | import java.util.HashSet; 15 | import java.util.Set; 16 | 17 | /** 18 | * Created by dom4j on 2017/3/7. 19 | */ 20 | 21 | public class App extends Application{ 22 | 23 | private static App instance; 24 | 25 | private Set allActivities; 26 | private static AppComponent appComponent; 27 | private static SharedPreferences mSp; 28 | 29 | 30 | public static synchronized App getInstance(){return instance;} 31 | 32 | @Override 33 | public void onCreate() { 34 | super.onCreate(); 35 | Fresco.initialize(this);//初始化框架 36 | instance = this; 37 | mSp = App.getInstance().getSharedPreferences(Constants.SP, Activity.MODE_PRIVATE); 38 | QbSdk.initX5Environment(instance,null); 39 | 40 | } 41 | 42 | public void addActivity(Activity act){ 43 | if(allActivities == null){ 44 | allActivities = new HashSet<>(); 45 | } 46 | allActivities.add(act); 47 | } 48 | 49 | public void removeActivity(Activity act){ 50 | if(allActivities != null){ 51 | allActivities.remove(act); 52 | } 53 | } 54 | 55 | public void exitApp(){ 56 | if(allActivities != null){ 57 | synchronized (allActivities){ 58 | for(Activity act : allActivities){ 59 | act.finish(); 60 | } 61 | } 62 | } 63 | /** 64 | * 绕过Activity 生命周期 强制关闭 65 | */ 66 | //android.os.Process.killProcess(android.os.Process.myPid()); 67 | System.exit(0); 68 | } 69 | 70 | public static AppComponent getAppComponent(){ 71 | if(appComponent == null){ 72 | appComponent = DaggerAppComponent.builder() 73 | .appModule(new AppModule(instance)) 74 | .build(); 75 | } 76 | return appComponent; 77 | } 78 | 79 | public static SharedPreferences getSp(){ 80 | return mSp; 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/base/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.base; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.support.v4.app.Fragment; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.dom.red.app.App; 13 | import com.dom.red.di.component.DaggerFragmentComponent; 14 | import com.dom.red.di.component.FragmentComponent; 15 | import com.dom.red.di.module.FragmentModule; 16 | 17 | import org.greenrobot.eventbus.EventBus; 18 | 19 | import javax.inject.Inject; 20 | 21 | import butterknife.ButterKnife; 22 | import butterknife.Unbinder; 23 | import me.yokeyword.fragmentation.SupportFragment; 24 | 25 | /** 26 | * Created by dom4j on 2017/3/7. 27 | */ 28 | 29 | public abstract class BaseFragment extends SupportFragment implements BaseView{ 30 | @Inject 31 | protected T mPresenter; 32 | protected View mView; 33 | protected Activity mActivity; 34 | protected Context mContext; 35 | private Unbinder mUnBinder; 36 | 37 | @Override 38 | public void onAttach(Context context) { 39 | mActivity = (Activity) context; 40 | mContext = context; 41 | super.onAttach(context); 42 | } 43 | 44 | public FragmentComponent getFragmentComponent(){ 45 | return DaggerFragmentComponent.builder() 46 | .appComponent(App.getAppComponent()) 47 | .fragmentModule(getFragmentModule()) 48 | .build(); 49 | } 50 | 51 | public FragmentModule getFragmentModule() { 52 | return new FragmentModule(this); 53 | } 54 | 55 | @Nullable 56 | @Override 57 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 58 | mView = inflater.inflate(getLayoutId(),null); 59 | initInject(); 60 | return mView; 61 | } 62 | 63 | 64 | @Override 65 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 66 | super.onViewCreated(view, savedInstanceState); 67 | mPresenter.attachView(this); 68 | mUnBinder = ButterKnife.bind(this,view); 69 | initEventAndData(); 70 | } 71 | 72 | 73 | @Override 74 | public void onDestroyView() { 75 | super.onDestroyView(); 76 | mUnBinder.unbind(); 77 | } 78 | 79 | @Override 80 | public void onDestroy() { 81 | super.onDestroy(); 82 | if(mPresenter != null){ 83 | mPresenter.detachView(); 84 | } 85 | } 86 | protected abstract void initInject(); 87 | protected abstract int getLayoutId(); 88 | protected abstract void initEventAndData(); 89 | } 90 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/base/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.base; 2 | 3 | /** 4 | * Created by dom4j on 2017/3/7. 5 | */ 6 | 7 | public interface BasePresenter{ 8 | 9 | /** 10 | * 订阅 11 | */ 12 | void attachView(T view); 13 | 14 | /** 15 | * 注销 16 | */ 17 | void detachView(); 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/base/BaseView.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.base; 2 | 3 | /** 4 | * Created by dom4j on 2017/3/7. 5 | */ 6 | 7 | public interface BaseView { 8 | void showError(String msg); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/base/RxPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.base; 2 | 3 | import android.util.Log; 4 | 5 | import com.dom.red.util.LogUtil; 6 | 7 | import io.reactivex.disposables.CompositeDisposable; 8 | import io.reactivex.disposables.Disposable; 9 | 10 | /** 11 | * Created by dom4j on 2017/3/7. 12 | * 基于Rx的Presenter封装 更好的控制订阅的声明周期 13 | */ 14 | 15 | public class RxPresenter implements BasePresenter{ 16 | 17 | protected T mView; 18 | protected CompositeDisposable mCompositeDisposable; 19 | 20 | protected void unSubScribe(){ 21 | if(mCompositeDisposable != null){ 22 | mCompositeDisposable.clear(); 23 | } 24 | Log.d("TAG","停止所有的请求"); 25 | } 26 | 27 | public void addSubscribe(Disposable disposable){ 28 | if(mCompositeDisposable == null){ 29 | mCompositeDisposable = new CompositeDisposable(); 30 | } 31 | Log.e("TAG","请求入列"); 32 | mCompositeDisposable.add(disposable); 33 | } 34 | 35 | @Override 36 | public void attachView(T view) { 37 | this.mView = view; 38 | } 39 | 40 | @Override 41 | public void detachView() { 42 | this.mView = null; 43 | unSubScribe(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/base/SimpleActivity.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.base; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v4.app.FragmentManager; 8 | import android.support.v4.app.FragmentTransaction; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.support.v7.widget.Toolbar; 11 | import android.view.View; 12 | 13 | import com.dom.red.app.App; 14 | 15 | import butterknife.ButterKnife; 16 | import butterknife.Unbinder; 17 | import me.yokeyword.fragmentation.SupportActivity; 18 | 19 | /** 20 | * Created by dom4j on 2017/3/7. 21 | * 无MVP的Activity的基类 22 | */ 23 | 24 | public abstract class SimpleActivity extends SupportActivity{ 25 | 26 | protected Activity mContext; 27 | protected Unbinder mUnBinder; 28 | protected FragmentManager mFragmentManager; 29 | 30 | @Override 31 | public void onCreate(@Nullable Bundle savedInstanceState) { 32 | super.onCreate(savedInstanceState); 33 | setContentView(getLayout()); 34 | mContext = this; 35 | mUnBinder = ButterKnife.bind(this); 36 | App.getInstance().addActivity(this); 37 | mFragmentManager = getSupportFragmentManager(); 38 | initEventAndData(); 39 | } 40 | 41 | public void setToolBar(Toolbar toolBar, String title){ 42 | toolBar.setTitle(title); 43 | setSupportActionBar(toolBar); 44 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 45 | getSupportActionBar().setDisplayShowHomeEnabled(true); 46 | toolBar.setNavigationOnClickListener(new View.OnClickListener() { 47 | @Override 48 | public void onClick(View v) { 49 | onBackPressed(); 50 | } 51 | }); 52 | } 53 | 54 | public FragmentTransaction fragmentReplace(int layoutID, Fragment fragment){ 55 | return mFragmentManager.beginTransaction().replace(layoutID,fragment); 56 | } 57 | 58 | public FragmentTransaction fragmentAdd(int layoutID, Fragment fragment){ 59 | return mFragmentManager.beginTransaction().add(layoutID,fragment); 60 | } 61 | 62 | @Override 63 | protected void onDestroy() { 64 | super.onDestroy(); 65 | App.getInstance().removeActivity(this); 66 | mUnBinder.unbind(); 67 | } 68 | protected abstract int getLayout(); 69 | protected abstract void initEventAndData(); 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/base/SimpleFragment.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.base; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.support.v4.app.Fragment; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import butterknife.ButterKnife; 13 | import butterknife.Unbinder; 14 | import me.yokeyword.fragmentation.SupportFragment; 15 | 16 | /** 17 | * Created by dom4j on 2017/3/7. 18 | * 无MVP的Fragment的基类 19 | */ 20 | 21 | public abstract class SimpleFragment extends SupportFragment{ 22 | 23 | protected View mView; 24 | protected Activity mActivity; 25 | protected Context mContext; 26 | protected Unbinder mUnBinder; 27 | 28 | @Override 29 | public void onAttach(Context context) { 30 | mActivity = (Activity) context; 31 | mContext = context; 32 | super.onAttach(context); 33 | } 34 | 35 | @Nullable 36 | @Override 37 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 38 | mView = inflater.inflate(getLayoutId(),null); 39 | return super.onCreateView(inflater, container, savedInstanceState); 40 | } 41 | 42 | @Override 43 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 44 | super.onViewCreated(view, savedInstanceState); 45 | mUnBinder = ButterKnife.bind(this,view); 46 | initEventAndData(); 47 | } 48 | 49 | @Override 50 | public void onDestroy() { 51 | super.onDestroy(); 52 | mUnBinder.unbind(); 53 | } 54 | 55 | protected abstract void initEventAndData(); 56 | protected abstract int getLayoutId(); 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/di/ActivityScope.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.di; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | import javax.inject.Scope; 7 | 8 | /** 9 | * Created by dom4j on 2017/3/7. 10 | */ 11 | @Scope 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface ActivityScope { 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/di/FragmentScope.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.di; 2 | 3 | import java.lang.annotation.Retention; 4 | import java.lang.annotation.RetentionPolicy; 5 | 6 | import javax.inject.Scope; 7 | 8 | /** 9 | * Created by dom4j on 2017/3/7. 10 | */ 11 | @Scope 12 | @Retention(RetentionPolicy.RUNTIME) 13 | public @interface FragmentScope { 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/di/component/ActivityComponent.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.di.component; 2 | 3 | import android.app.Activity; 4 | 5 | import com.dom.red.di.ActivityScope; 6 | import com.dom.red.di.module.ActivityModule; 7 | import com.dom.red.ui.gank.activity.FuliActivity; 8 | import com.dom.red.ui.gank.activity.HomeActivity; 9 | import com.dom.red.ui.zhihu.activity.CommentActivity; 10 | import com.dom.red.ui.zhihu.activity.ContentActivity; 11 | import com.dom.red.ui.main.activity.MainActivity; 12 | import com.dom.red.ui.zhihu.activity.SectionActivity; 13 | import com.dom.red.ui.zhihu.activity.ThemeActivity; 14 | 15 | import dagger.Component; 16 | 17 | /** 18 | * Created by dom4j on 2017/3/7. 19 | */ 20 | 21 | @ActivityScope 22 | @Component(dependencies = AppComponent.class,modules = ActivityModule.class) 23 | public interface ActivityComponent { 24 | 25 | Activity getActivity(); 26 | 27 | void inject(ContentActivity mainActivity); 28 | 29 | void inject(CommentActivity commentActivity); 30 | 31 | void inject(ThemeActivity themeActivity); 32 | 33 | void inject(HomeActivity homeActivity); 34 | 35 | void inject(FuliActivity fuliActivity); 36 | 37 | void inject(SectionActivity sectionActivity); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/di/component/AppComponent.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.di.component; 2 | 3 | import com.dom.red.app.App; 4 | import com.dom.red.di.module.AppModule; 5 | import com.dom.red.model.http.help.RetrofitHelper; 6 | 7 | import javax.inject.Singleton; 8 | 9 | import dagger.Component; 10 | 11 | /** 12 | * Created by dom4j on 2017/3/7. 13 | */ 14 | 15 | @Singleton 16 | @Component(modules = AppModule.class) 17 | public interface AppComponent { 18 | 19 | App getContext(); //全局上下文 20 | 21 | RetrofitHelper retrofitHelper(); //Http 帮助类 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/di/component/FragmentComponent.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.di.component; 2 | 3 | import android.app.Activity; 4 | 5 | import com.dom.red.di.FragmentScope; 6 | import com.dom.red.di.module.FragmentModule; 7 | import com.dom.red.presenter.contract.ZhiDailyContract; 8 | import com.dom.red.presenter.contract.ZhiSectionContract; 9 | import com.dom.red.ui.gank.fragment.HomeFragment; 10 | import com.dom.red.ui.zhihu.fragment.ThemeFragment; 11 | import com.dom.red.ui.zhihu.fragment.ZhihuDaily; 12 | import com.dom.red.ui.zhihu.fragment.ZhihuHot; 13 | import com.dom.red.ui.zhihu.fragment.ZhihuSection; 14 | 15 | import dagger.Component; 16 | 17 | /** 18 | * Created by dom4j on 2017/3/7. 19 | */ 20 | @FragmentScope 21 | @Component(modules = FragmentModule.class,dependencies = AppComponent.class) 22 | public interface FragmentComponent { 23 | Activity getActivity(); 24 | 25 | void inject(ThemeFragment themeFragment); 26 | 27 | void inject(HomeFragment homeFragment); 28 | 29 | void inject(ZhihuDaily homeFragment); 30 | 31 | void inject(ZhihuHot homeFragment); 32 | 33 | void inject(ZhihuSection homeFragment); 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/di/module/ActivityModule.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.di.module; 2 | 3 | import android.app.Activity; 4 | 5 | import com.dom.red.di.ActivityScope; 6 | 7 | import dagger.Module; 8 | import dagger.Provides; 9 | 10 | /** 11 | * Created by dom4j on 2017/3/7. 12 | */ 13 | @Module 14 | public class ActivityModule { 15 | private Activity mActivity; 16 | 17 | public ActivityModule(Activity activity){ 18 | this.mActivity = activity; 19 | } 20 | 21 | @Provides 22 | @ActivityScope 23 | public Activity providerActivity(){ 24 | return mActivity; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/di/module/AppModule.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.di.module; 2 | 3 | import com.dom.red.app.App; 4 | import com.dom.red.model.http.help.RetrofitHelper; 5 | 6 | import javax.inject.Singleton; 7 | 8 | import dagger.Module; 9 | import dagger.Provides; 10 | 11 | /** 12 | * Created by dom4j on 2017/3/7. 13 | */ 14 | 15 | @Module 16 | public class AppModule { 17 | private final App application; 18 | 19 | public AppModule(App application) { 20 | this.application = application; 21 | } 22 | 23 | @Provides 24 | @Singleton 25 | App provideApplicationContext(){ 26 | return application; 27 | } 28 | 29 | @Provides 30 | @Singleton 31 | RetrofitHelper provideRetrofitHelper(){ 32 | return new RetrofitHelper(); 33 | } 34 | 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/di/module/FragmentModule.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.di.module; 2 | 3 | import android.app.Activity; 4 | import android.support.v4.app.Fragment; 5 | 6 | import com.dom.red.di.FragmentScope; 7 | 8 | import dagger.Module; 9 | import dagger.Provides; 10 | 11 | /** 12 | * Created by dom4j on 2017/3/7. 13 | */ 14 | @Module 15 | public class FragmentModule { 16 | 17 | private Fragment fragment; 18 | 19 | public FragmentModule(Fragment fragment){ 20 | this.fragment = fragment; 21 | } 22 | 23 | @Provides 24 | @FragmentScope 25 | public Activity provideActivity(){ 26 | return fragment.getActivity(); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/bean/gank/ClassifyList.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.bean.gank; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by dom4j on 2017/3/24. 7 | */ 8 | 9 | public class ClassifyList { 10 | 11 | /** 12 | * _id : 58d49a42421aa93abf5d3b73 13 | * createdAt : 2017-03-24T12:02:10.180Z 14 | * desc : 一款很漂亮的 iOS Alert 通知框 15 | * images : ["http://img.gank.io/94d93222-bf12-4979-a0f0-867328a152c0"] 16 | * publishedAt : 2017-03-24T12:12:34.753Z 17 | * source : chrome 18 | * type : iOS 19 | * url : https://github.com/Codigami/CFAlertViewController 20 | * used : true 21 | * who : CG 22 | */ 23 | 24 | private String _id; 25 | private String createdAt; 26 | private String desc; 27 | private String publishedAt; 28 | private String source; 29 | private String type; 30 | private String url; 31 | private boolean used; 32 | private String who; 33 | private List images; 34 | 35 | public String get_id() { 36 | return _id; 37 | } 38 | 39 | public void set_id(String _id) { 40 | this._id = _id; 41 | } 42 | 43 | public String getCreatedAt() { 44 | return createdAt; 45 | } 46 | 47 | public void setCreatedAt(String createdAt) { 48 | this.createdAt = createdAt; 49 | } 50 | 51 | public String getDesc() { 52 | return desc; 53 | } 54 | 55 | public void setDesc(String desc) { 56 | this.desc = desc; 57 | } 58 | 59 | public String getPublishedAt() { 60 | return publishedAt; 61 | } 62 | 63 | public void setPublishedAt(String publishedAt) { 64 | this.publishedAt = publishedAt; 65 | } 66 | 67 | public String getSource() { 68 | return source; 69 | } 70 | 71 | public void setSource(String source) { 72 | this.source = source; 73 | } 74 | 75 | public String getType() { 76 | return type; 77 | } 78 | 79 | public void setType(String type) { 80 | this.type = type; 81 | } 82 | 83 | public String getUrl() { 84 | return url; 85 | } 86 | 87 | public void setUrl(String url) { 88 | this.url = url; 89 | } 90 | 91 | public boolean isUsed() { 92 | return used; 93 | } 94 | 95 | public void setUsed(boolean used) { 96 | this.used = used; 97 | } 98 | 99 | public String getWho() { 100 | return who; 101 | } 102 | 103 | public void setWho(String who) { 104 | this.who = who; 105 | } 106 | 107 | public List getImages() { 108 | return images; 109 | } 110 | 111 | public void setImages(List images) { 112 | this.images = images; 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/bean/gank/MeiziBean.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.bean.gank; 2 | 3 | /** 4 | * Created by dom4j on 2017/3/24. 5 | */ 6 | 7 | public class MeiziBean { 8 | 9 | /** 10 | * _id : 58d49bad421aa93abf5d3b76 11 | * createdAt : 2017-03-24T12:08:13.590Z 12 | * desc : 3-24 13 | * publishedAt : 2017-03-24T12:12:34.753Z 14 | * source : chrome 15 | * type : 福利 16 | * url : http://7xi8d6.com1.z0.glb.clouddn.com/2017-03-24-17438359_1470934682925012_1066984844010979328_n.jpg 17 | * used : true 18 | * who : dmj 19 | */ 20 | 21 | private String _id; 22 | private String createdAt; 23 | private String desc; 24 | private String publishedAt; 25 | private String source; 26 | private String type; 27 | private String url; 28 | private boolean used; 29 | private String who; 30 | private int height; 31 | 32 | public void setHeight(int height) { 33 | this.height = height; 34 | } 35 | 36 | public int getHeight() { 37 | 38 | return height; 39 | } 40 | 41 | public String get_id() { 42 | return _id; 43 | } 44 | 45 | public void set_id(String _id) { 46 | this._id = _id; 47 | } 48 | 49 | public String getCreatedAt() { 50 | return createdAt; 51 | } 52 | 53 | public void setCreatedAt(String createdAt) { 54 | this.createdAt = createdAt; 55 | } 56 | 57 | public String getDesc() { 58 | return desc; 59 | } 60 | 61 | public void setDesc(String desc) { 62 | this.desc = desc; 63 | } 64 | 65 | public String getPublishedAt() { 66 | return publishedAt; 67 | } 68 | 69 | public void setPublishedAt(String publishedAt) { 70 | this.publishedAt = publishedAt; 71 | } 72 | 73 | public String getSource() { 74 | return source; 75 | } 76 | 77 | public void setSource(String source) { 78 | this.source = source; 79 | } 80 | 81 | public String getType() { 82 | return type; 83 | } 84 | 85 | public void setType(String type) { 86 | this.type = type; 87 | } 88 | 89 | public String getUrl() { 90 | return url; 91 | } 92 | 93 | public void setUrl(String url) { 94 | this.url = url; 95 | } 96 | 97 | public boolean isUsed() { 98 | return used; 99 | } 100 | 101 | public void setUsed(boolean used) { 102 | this.used = used; 103 | } 104 | 105 | public String getWho() { 106 | return who; 107 | } 108 | 109 | public void setWho(String who) { 110 | this.who = who; 111 | } 112 | 113 | 114 | } 115 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/bean/zhihu/ExtraInfo.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.bean.zhihu; 2 | 3 | /** 4 | * Created by dom4j on 2017/3/13. 5 | */ 6 | 7 | public class ExtraInfo { 8 | 9 | /** 10 | * long_comments : 0 11 | * popularity : 161 12 | * short_comments : 19 13 | * comments : 19 14 | */ 15 | 16 | private int long_comments; 17 | private int popularity; 18 | private int short_comments; 19 | private int comments; 20 | 21 | public int getLong_comments() { 22 | return long_comments; 23 | } 24 | 25 | public void setLong_comments(int long_comments) { 26 | this.long_comments = long_comments; 27 | } 28 | 29 | public int getPopularity() { 30 | return popularity; 31 | } 32 | 33 | public void setPopularity(int popularity) { 34 | this.popularity = popularity; 35 | } 36 | 37 | public int getShort_comments() { 38 | return short_comments; 39 | } 40 | 41 | public void setShort_comments(int short_comments) { 42 | this.short_comments = short_comments; 43 | } 44 | 45 | public int getComments() { 46 | return comments; 47 | } 48 | 49 | public void setComments(int comments) { 50 | this.comments = comments; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/bean/zhihu/HotListBean.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.bean.zhihu; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by dom4j on 2017/3/26. 7 | */ 8 | 9 | public class HotListBean { 10 | 11 | private List recent; 12 | 13 | public List getRecent() { 14 | return recent; 15 | } 16 | 17 | public void setRecent(List recent) { 18 | this.recent = recent; 19 | } 20 | 21 | public static class RecentBean { 22 | /** 23 | * news_id : 9309520 24 | * url : http://news-at.zhihu.com/api/2/news/9309520 25 | * thumbnail : https://pic3.zhimg.com/v2-0d2905f2604314784376dbf06cea883e.jpg 26 | * title : 瞎扯 · 如何正确地吐槽 27 | */ 28 | 29 | private int news_id; 30 | private String url; 31 | private String thumbnail; 32 | private String title; 33 | 34 | public int getNews_id() { 35 | return news_id; 36 | } 37 | 38 | public void setNews_id(int news_id) { 39 | this.news_id = news_id; 40 | } 41 | 42 | public String getUrl() { 43 | return url; 44 | } 45 | 46 | public void setUrl(String url) { 47 | this.url = url; 48 | } 49 | 50 | public String getThumbnail() { 51 | return thumbnail; 52 | } 53 | 54 | public void setThumbnail(String thumbnail) { 55 | this.thumbnail = thumbnail; 56 | } 57 | 58 | public String getTitle() { 59 | return title; 60 | } 61 | 62 | public void setTitle(String title) { 63 | this.title = title; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/bean/zhihu/SectionBean.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.bean.zhihu; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by dom4j on 2017/3/25. 7 | */ 8 | 9 | public class SectionBean { 10 | private List data; 11 | 12 | public List getData() { 13 | return data; 14 | } 15 | 16 | public void setData(List data) { 17 | this.data = data; 18 | } 19 | 20 | public static class DataBean { 21 | /** 22 | * description : 看别人的经历,理解自己的生活 23 | * id : 1 24 | * name : 深夜惊奇 25 | * thumbnail : http://pic3.zhimg.com/91125c9aebcab1c84f58ce4f8779551e.jpg 26 | */ 27 | 28 | private String description; 29 | private int id; 30 | private String name; 31 | private String thumbnail; 32 | 33 | public String getDescription() { 34 | return description; 35 | } 36 | 37 | public void setDescription(String description) { 38 | this.description = description; 39 | } 40 | 41 | public int getId() { 42 | return id; 43 | } 44 | 45 | public void setId(int id) { 46 | this.id = id; 47 | } 48 | 49 | public String getName() { 50 | return name; 51 | } 52 | 53 | public void setName(String name) { 54 | this.name = name; 55 | } 56 | 57 | public String getThumbnail() { 58 | return thumbnail; 59 | } 60 | 61 | public void setThumbnail(String thumbnail) { 62 | this.thumbnail = thumbnail; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/bean/zhihu/ShortCommentBean.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.bean.zhihu; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by dom4j on 2017/3/14. 7 | */ 8 | 9 | public class ShortCommentBean { 10 | 11 | private List comments; 12 | 13 | public List getComments() { 14 | return comments; 15 | } 16 | 17 | public void setComments(List comments) { 18 | this.comments = comments; 19 | } 20 | 21 | public static class CommentsBean { 22 | /** 23 | * author : Xiaole说 24 | * id : 545721 25 | * content : 就吃了个花生米,呵呵 26 | * likes : 0 27 | * time : 1413600071 28 | * avatar : http://pic1.zhimg.com/c41f035ab_im.jpg 29 | */ 30 | 31 | private String author; 32 | private int id; 33 | private String content; 34 | private int likes; 35 | private int time; 36 | private String avatar; 37 | 38 | public String getAuthor() { 39 | return author; 40 | } 41 | 42 | public void setAuthor(String author) { 43 | this.author = author; 44 | } 45 | 46 | public int getId() { 47 | return id; 48 | } 49 | 50 | public void setId(int id) { 51 | this.id = id; 52 | } 53 | 54 | public String getContent() { 55 | return content; 56 | } 57 | 58 | public void setContent(String content) { 59 | this.content = content; 60 | } 61 | 62 | public int getLikes() { 63 | return likes; 64 | } 65 | 66 | public void setLikes(int likes) { 67 | this.likes = likes; 68 | } 69 | 70 | public int getTime() { 71 | return time; 72 | } 73 | 74 | public void setTime(int time) { 75 | this.time = time; 76 | } 77 | 78 | public String getAvatar() { 79 | return avatar; 80 | } 81 | 82 | public void setAvatar(String avatar) { 83 | this.avatar = avatar; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/bean/zhihu/ThemeListBean.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.bean.zhihu; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by dom4j on 2017/3/8. 7 | */ 8 | 9 | public class ThemeListBean { 10 | 11 | /** 12 | * limit : 1000 13 | * subscribed : [] 14 | * others : [{"color":8307764,"thumbnail":"http://pic4.zhimg.com/2c38a96e84b5cc8331a901920a87ea71.jpg","description":"内容由知乎用户推荐,海纳主题百万,趣味上天入地","id":12,"name":"用户推荐日报"},"..."] 15 | */ 16 | 17 | private int limit; 18 | private List subscribed; 19 | private List others; 20 | 21 | public int getLimit() { 22 | return limit; 23 | } 24 | 25 | public void setLimit(int limit) { 26 | this.limit = limit; 27 | } 28 | 29 | public List getSubscribed() { 30 | return subscribed; 31 | } 32 | 33 | public void setSubscribed(List subscribed) { 34 | this.subscribed = subscribed; 35 | } 36 | 37 | public List getOthers() { 38 | return others; 39 | } 40 | 41 | public void setOthers(List others) { 42 | this.others = others; 43 | } 44 | 45 | public static class OthersBean { 46 | /** 47 | * color : 8307764 48 | * thumbnail : http://pic4.zhimg.com/2c38a96e84b5cc8331a901920a87ea71.jpg 49 | * description : 内容由知乎用户推荐,海纳主题百万,趣味上天入地 50 | * id : 12 51 | * name : 用户推荐日报 52 | */ 53 | 54 | private int color; 55 | private String thumbnail; 56 | private String description; 57 | private int id; 58 | private String name; 59 | 60 | public int getColor() { 61 | return color; 62 | } 63 | 64 | public void setColor(int color) { 65 | this.color = color; 66 | } 67 | 68 | public String getThumbnail() { 69 | return thumbnail; 70 | } 71 | 72 | public void setThumbnail(String thumbnail) { 73 | this.thumbnail = thumbnail; 74 | } 75 | 76 | public String getDescription() { 77 | return description; 78 | } 79 | 80 | public void setDescription(String description) { 81 | this.description = description; 82 | } 83 | 84 | public int getId() { 85 | return id; 86 | } 87 | 88 | public void setId(int id) { 89 | this.id = id; 90 | } 91 | 92 | public String getName() { 93 | return name; 94 | } 95 | 96 | public void setName(String name) { 97 | this.name = name; 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/bean/zhihu/WelcomeBean.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.bean.zhihu; 2 | 3 | /** 4 | * Created by dom4j on 2017/3/8. 5 | */ 6 | 7 | public class WelcomeBean { 8 | 9 | /** 10 | * text : © Fido Dido 11 | * img : http://p2.zhimg.com/10/7b/107bb4894b46d75a892da6fa80ef504a.jpg 12 | */ 13 | 14 | private String text; 15 | private String img; 16 | 17 | public String getText() { 18 | return text; 19 | } 20 | 21 | public void setText(String text) { 22 | this.text = text; 23 | } 24 | 25 | public String getImg() { 26 | return img; 27 | } 28 | 29 | public void setImg(String img) { 30 | this.img = img; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/http/api/GankApi.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.http.api; 2 | 3 | import com.dom.red.model.bean.gank.ClassifyList; 4 | import com.dom.red.model.bean.gank.MeiziBean; 5 | import com.dom.red.model.http.response.GankHttpResult; 6 | 7 | import java.util.List; 8 | 9 | import io.reactivex.Observable; 10 | import retrofit2.http.GET; 11 | import retrofit2.http.Path; 12 | 13 | /** 14 | * Created by dom4j on 2017/3/24. 15 | */ 16 | 17 | public interface GankApi { 18 | 19 | String Host = "http://gank.io/api/"; 20 | 21 | // http://gank.io/api/data/Android/10/1 22 | @GET("data/{mode}/{num}/{page}") 23 | Observable>> getClassList(@Path("mode") String mode,@Path("num") int num,@Path("page") int page); 24 | 25 | @GET("data/{mode}/{num}/{page}") 26 | Observable>> getMeiziList(@Path("mode") String mode, @Path("num") int num, @Path("page") int page); 27 | 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/http/api/ZhiHuApi.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.http.api; 2 | 3 | import com.dom.red.model.bean.zhihu.HotListBean; 4 | import com.dom.red.model.bean.zhihu.SectionChildListBean; 5 | import com.dom.red.model.bean.zhihu.LongCommentBean; 6 | import com.dom.red.model.bean.zhihu.DetailBean; 7 | import com.dom.red.model.bean.zhihu.ExtraInfo; 8 | import com.dom.red.model.bean.zhihu.HomeListBean; 9 | import com.dom.red.model.bean.zhihu.SectionBean; 10 | import com.dom.red.model.bean.zhihu.ShortCommentBean; 11 | import com.dom.red.model.bean.zhihu.ThemeList; 12 | import com.dom.red.model.bean.zhihu.ThemeListBean; 13 | import com.dom.red.model.bean.zhihu.WelcomeBean; 14 | 15 | import io.reactivex.Observable; 16 | import retrofit2.http.GET; 17 | import retrofit2.http.Path; 18 | 19 | /** 20 | * Created by dom4j on 2017/3/7. 21 | */ 22 | 23 | public interface ZhiHuApi { 24 | String HOST = "http://news-at.zhihu.com/api/"; 25 | 26 | //http://news-at.zhihu.com/api/4/start-image/1080*1776 27 | @GET("4/start-image/{res}") 28 | Observable getWelComeImage(@Path("res") String res); 29 | 30 | //http://news-at.zhihu.com/api/4/themes 主题列表 31 | @GET("4/themes") 32 | Observable getThemeList(); 33 | 34 | //http://news-at.zhihu.com/api/4/news/latest 主页最新数据 35 | @GET("4/news/latest") 36 | Observable getHomeList(); 37 | 38 | //http://news-at.zhihu.com/api/4/news/before/20131119 39 | @GET("4/news/before/{date}") 40 | Observable getBeforeList(@Path("date") String date); 41 | 42 | //http://news-at.zhihu.com/api/4/news/3892357 43 | @GET("4/news/{id}") 44 | Observable getContent(@Path("id") int id); 45 | 46 | //http://news-at.zhihu.com/api/4/story-extra/#{id} 额外信息 47 | @GET("4/story-extra/{id}") 48 | Observable getNewsInfo(@Path("id") int id); 49 | 50 | //http://news-at.zhihu.com/api/4/story/#{id}/long-comments 51 | @GET("4/story/{id}/long-comments") 52 | Observable getLongComment(@Path("id") int id); 53 | 54 | //http://news-at.zhihu.com/api/4/story/#{id}/short-comments 55 | @GET("4/story/{id}/short-comments") 56 | Observable getShortComment(@Path("id") int id); 57 | 58 | //http://news-at.zhihu.com/api/4/theme/11 59 | @GET("4/theme/{id}") 60 | Observable getThemeList(@Path("id") int id); 61 | 62 | //http://news-at.zhihu.com/api/3/sections 专栏信息 63 | @GET("3/sections") 64 | Observable getSectionList(); 65 | 66 | //http://news-at.zhihu.com/api/3/section/1 67 | @GET("3/section/{id}") 68 | Observable getSectionChildList(@Path("id") int id); 69 | 70 | //http://news-at.zhihu.com/api/3/news/hot 71 | @GET("3/news/hot") 72 | Observable getHotList(); 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/http/help/ApiExcpetion.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.http.help; 2 | 3 | /** 4 | * Created by dom4j on 2017/3/9. 5 | */ 6 | 7 | public class ApiExcpetion extends RuntimeException{ 8 | public ApiExcpetion(String msg) 9 | { 10 | super(msg); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/http/help/RxHelper.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.http.help; 2 | 3 | 4 | import com.dom.red.model.http.response.GankHttpResult; 5 | 6 | import java.util.List; 7 | 8 | import io.reactivex.Observable; 9 | import io.reactivex.ObservableEmitter; 10 | import io.reactivex.ObservableOnSubscribe; 11 | import io.reactivex.ObservableSource; 12 | import io.reactivex.ObservableTransformer; 13 | import io.reactivex.android.schedulers.AndroidSchedulers; 14 | import io.reactivex.functions.Function; 15 | import io.reactivex.schedulers.Schedulers; 16 | 17 | 18 | /** 19 | * Created by dom4j on 2017/3/7. 20 | */ 21 | 22 | public class RxHelper { 23 | 24 | 25 | /** 26 | * 统一线程处理 27 | * @param 28 | * @return 29 | */ 30 | public static ObservableTransformer rxSchedulerHelper(){ 31 | return new ObservableTransformer() { 32 | @Override 33 | public ObservableSource apply(Observable upstream) { 34 | return upstream.subscribeOn(Schedulers.io()) 35 | .observeOn(AndroidSchedulers.mainThread()); 36 | } 37 | }; 38 | } 39 | 40 | /** 41 | * 统一结果处理 42 | * @param 43 | * @return 44 | */ 45 | public static ObservableTransformer,T> handleResult(){ 46 | return new ObservableTransformer, T>() { 47 | @Override 48 | public Observable apply(Observable> upstream) { 49 | return upstream.flatMap(new Function, Observable>() { 50 | @Override 51 | public Observable apply(GankHttpResult tGankHttpResult) throws Exception { 52 | if(!tGankHttpResult.getError()){ 53 | return createData(tGankHttpResult.getResults()); 54 | }else{ 55 | throw new ApiExcpetion("服务器异常"); 56 | } 57 | } 58 | }); 59 | } 60 | }; 61 | } 62 | 63 | 64 | /** 65 | * 生成Observable 66 | * @param data 67 | * @param 68 | * @return 69 | */ 70 | public static Observable createData(final T data){ 71 | return Observable.create(new ObservableOnSubscribe() { 72 | @Override 73 | public void subscribe(ObservableEmitter emitter) throws Exception { 74 | try { 75 | emitter.onNext(data); 76 | emitter.onComplete(); 77 | }catch (Exception error){ 78 | emitter.onError(error); 79 | } 80 | } 81 | }); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/http/help/Subscribe2Help.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.http.help; 2 | 3 | import android.util.Log; 4 | 5 | import com.dom.red.base.RxPresenter; 6 | import com.dom.red.ui.zhihu.fragment.ZhihuDaily; 7 | import com.dom.red.util.SnakerbarUtil; 8 | import com.dom.red.util.ToastUtil; 9 | 10 | import org.greenrobot.eventbus.EventBus; 11 | 12 | import java.net.ConnectException; 13 | import java.net.SocketException; 14 | 15 | import javax.inject.Inject; 16 | 17 | import io.reactivex.Observer; 18 | import io.reactivex.disposables.Disposable; 19 | import retrofit2.HttpException; 20 | 21 | /** 22 | * Created by dom4j on 2017/3/8. 23 | */ 24 | 25 | public abstract class Subscribe2Help implements Observer { 26 | 27 | RxPresenter mPresenter; 28 | public Subscribe2Help(RxPresenter presenter){ 29 | this.mPresenter = presenter; 30 | } 31 | 32 | @Override 33 | public void onSubscribe(Disposable d) { 34 | mPresenter.addSubscribe(d); 35 | } 36 | 37 | @Override 38 | public void onComplete() {} 39 | 40 | @Override 41 | public void onError(Throwable throwable) { 42 | if(throwable instanceof ApiExcpetion){ 43 | ToastUtil.showError("服务器异常"); 44 | }else if(throwable instanceof ConnectException){ 45 | ToastUtil.showError("连接超时"); 46 | }else if(throwable instanceof SocketException){ 47 | ToastUtil.showError("连接超时"); 48 | }else if(throwable instanceof HttpException){ 49 | ToastUtil.showError("请检查您的网络连接 稍后重试" + " = ̄ω ̄="); 50 | ZhihuDaily.getInstance().onStopDialog(false); 51 | } 52 | Log.d("TAG"," exception : " +throwable); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/model/http/response/GankHttpResult.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.model.http.response; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by dom4j on 2017/3/24. 7 | */ 8 | 9 | public class GankHttpResult { 10 | 11 | private boolean error; 12 | 13 | private T results; 14 | 15 | public boolean getError() { 16 | return error; 17 | } 18 | 19 | public T getResults() { 20 | return results; 21 | } 22 | 23 | public void setError(boolean error) { 24 | this.error = error; 25 | } 26 | 27 | public void setResults(T results) { 28 | this.results = results; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/CommentPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import com.dom.red.base.RxPresenter; 4 | import com.dom.red.model.bean.zhihu.LongCommentBean; 5 | import com.dom.red.model.bean.zhihu.ShortCommentBean; 6 | import com.dom.red.model.http.help.RetrofitHelper; 7 | import com.dom.red.model.http.help.RxHelper; 8 | import com.dom.red.model.http.help.Subscribe2Help; 9 | import com.dom.red.presenter.contract.CommentContract; 10 | 11 | import javax.inject.Inject; 12 | 13 | import io.reactivex.Observable; 14 | 15 | /** 16 | * Created by dom4j on 2017/3/13. 17 | */ 18 | 19 | public class CommentPresenter extends RxPresenter implements CommentContract.Presenter{ 20 | private RetrofitHelper mRetrofitHelp; 21 | @Inject 22 | public CommentPresenter(RetrofitHelper retrofitHelper){ 23 | this.mRetrofitHelp = retrofitHelper; 24 | } 25 | 26 | @Override 27 | public void getLongComment(int id) { 28 | Observable longComment = mRetrofitHelp.getLongComment(id); 29 | longComment.compose(RxHelper.rxSchedulerHelper()) 30 | .subscribe(new Subscribe2Help(this) { 31 | @Override 32 | public void onNext(LongCommentBean longComment) { 33 | mView.showLongComment(longComment); 34 | } 35 | }); 36 | } 37 | 38 | @Override 39 | public void getShortComment(int id) { 40 | Observable shortComment = mRetrofitHelp.getShortComment(id); 41 | shortComment.compose(RxHelper.rxSchedulerHelper()) 42 | .subscribe(new Subscribe2Help(this) { 43 | @Override 44 | public void onNext(ShortCommentBean shortComment) { 45 | mView.showShortComment(shortComment); 46 | } 47 | }); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/ContentPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import com.dom.red.base.RxPresenter; 4 | import com.dom.red.model.bean.zhihu.DetailBean; 5 | import com.dom.red.model.bean.zhihu.ExtraInfo; 6 | import com.dom.red.model.http.help.RetrofitHelper; 7 | import com.dom.red.model.http.help.RxHelper; 8 | import com.dom.red.model.http.help.Subscribe2Help; 9 | import com.dom.red.presenter.contract.ContentContract; 10 | 11 | import javax.inject.Inject; 12 | 13 | import io.reactivex.Observable; 14 | 15 | /** 16 | * Created by dom4j on 2017/3/10. 17 | */ 18 | 19 | public class ContentPresenter extends RxPresenter implements ContentContract.Presenter{ 20 | 21 | private RetrofitHelper mRetrofitHelp; 22 | @Inject 23 | public ContentPresenter(RetrofitHelper retrofitHelper){ 24 | this.mRetrofitHelp = retrofitHelper; 25 | } 26 | 27 | @Override 28 | public void getContent(int id) { 29 | Observable detailList = mRetrofitHelp.getDetailList(id); 30 | detailList.compose(RxHelper.rxSchedulerHelper()) 31 | .subscribe(new Subscribe2Help(this) { 32 | @Override 33 | public void onNext(DetailBean value) { 34 | mView.showContent(value); 35 | } 36 | }); 37 | } 38 | 39 | @Override 40 | public void getNewsInfo(int id) { 41 | Observable edtraInfo = mRetrofitHelp.getNewsInfo(id); 42 | edtraInfo.compose(RxHelper.rxSchedulerHelper()) 43 | .subscribe(new Subscribe2Help(this) { 44 | @Override 45 | public void onNext(ExtraInfo extraInfo) { 46 | mView.showNewsInfo(extraInfo); 47 | } 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/DailyPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import com.dom.red.base.RxPresenter; 4 | import com.dom.red.model.bean.zhihu.HomeListBean; 5 | import com.dom.red.model.http.help.RetrofitHelper; 6 | import com.dom.red.model.http.help.RxHelper; 7 | import com.dom.red.model.http.help.Subscribe2Help; 8 | import com.dom.red.presenter.contract.ZhiDailyContract; 9 | 10 | import java.util.List; 11 | import java.util.concurrent.TimeUnit; 12 | 13 | import javax.inject.Inject; 14 | 15 | import io.reactivex.Observable; 16 | 17 | /** 18 | * Created by dom4j on 2017/3/25. 19 | */ 20 | 21 | public class DailyPresenter extends RxPresenter implements ZhiDailyContract.Presenter{ 22 | private RetrofitHelper mRetrofitHelper; 23 | @Inject 24 | public DailyPresenter(RetrofitHelper mRetrofitHelper) { 25 | this.mRetrofitHelper = mRetrofitHelper; 26 | } 27 | 28 | @Override 29 | public void getDailyList() { 30 | Observable homeList = mRetrofitHelper.getHomeList(); 31 | homeList.compose(RxHelper.rxSchedulerHelper()) 32 | .subscribe(new Subscribe2Help(this) { 33 | @Override 34 | public void onNext(HomeListBean value) { 35 | mView.showDailyList(value); 36 | } 37 | }); 38 | } 39 | 40 | @Override 41 | public void getBeforeList(String date) { 42 | Observable beforeList = mRetrofitHelper.getBeforeList(date); 43 | beforeList.compose(RxHelper.rxSchedulerHelper()) 44 | .subscribe(new Subscribe2Help(this) { 45 | @Override 46 | public void onNext(HomeListBean value) { 47 | mView.showBeforeList(value); 48 | } 49 | }); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/FuliPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import com.dom.red.base.RxPresenter; 4 | import com.dom.red.model.bean.gank.MeiziBean; 5 | import com.dom.red.model.http.help.RetrofitHelper; 6 | import com.dom.red.model.http.help.RxHelper; 7 | import com.dom.red.model.http.help.Subscribe2Help; 8 | import com.dom.red.model.http.response.GankHttpResult; 9 | import com.dom.red.presenter.contract.FuliContract; 10 | import com.dom.red.ui.gank.activity.FuliActivity; 11 | 12 | import java.util.List; 13 | 14 | import javax.inject.Inject; 15 | 16 | import io.reactivex.Observable; 17 | 18 | import static com.dom.red.model.http.help.RxHelper.rxSchedulerHelper; 19 | 20 | /** 21 | * Created by dom4j on 2017/3/24. 22 | */ 23 | 24 | public class FuliPresenter extends RxPresenter implements FuliContract.Presenter{ 25 | private RetrofitHelper mRetrofitHelper; 26 | 27 | @Inject 28 | public FuliPresenter(RetrofitHelper mRetrofitHelper) { 29 | this.mRetrofitHelper = mRetrofitHelper; 30 | } 31 | 32 | @Override 33 | public void getMeiziList(String type, int num, int page) { 34 | Observable>> meiziList = mRetrofitHelper.getMeiziList(type, num, page); 35 | meiziList.compose(RxHelper.>>rxSchedulerHelper()) 36 | .compose(RxHelper.>handleResult()) 37 | .subscribe(new Subscribe2Help>(this) { 38 | @Override 39 | public void onNext(List value) { 40 | mView.showMeiziList(value); 41 | } 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/HomeFragmentPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import com.dom.red.base.RxPresenter; 4 | import com.dom.red.model.bean.gank.ClassifyList; 5 | import com.dom.red.model.bean.gank.MeiziBean; 6 | import com.dom.red.model.http.help.RetrofitHelper; 7 | import com.dom.red.model.http.help.RxHelper; 8 | import com.dom.red.model.http.help.Subscribe2Help; 9 | import com.dom.red.model.http.response.GankHttpResult; 10 | import com.dom.red.presenter.contract.HomeFragmentContract; 11 | 12 | import java.util.List; 13 | 14 | import javax.inject.Inject; 15 | 16 | import io.reactivex.Observable; 17 | import io.reactivex.functions.Consumer; 18 | 19 | /** 20 | * Created by dom4j on 2017/3/24. 21 | */ 22 | 23 | public class HomeFragmentPresenter extends RxPresenter implements HomeFragmentContract.Presenter{ 24 | 25 | private RetrofitHelper mRetrofitHelper; 26 | 27 | @Inject 28 | public HomeFragmentPresenter(RetrofitHelper mRetrofitHelper) { 29 | this.mRetrofitHelper = mRetrofitHelper; 30 | } 31 | 32 | @Override 33 | public void getDataList(String type, int num, int page) { 34 | Observable>> classList = mRetrofitHelper.getClassList(type, num, page); 35 | classList.compose(RxHelper.>>rxSchedulerHelper()) 36 | .compose(RxHelper.>handleResult()) 37 | .subscribe(new Subscribe2Help>(this) { 38 | @Override 39 | public void onNext(List value) { 40 | mView.showDataList(value); 41 | } 42 | }); 43 | } 44 | 45 | @Override 46 | public void getGirlList(int num) { 47 | Observable>> girlList = mRetrofitHelper.getMeiziList("福利", num, 1); 48 | girlList.compose(RxHelper.>>rxSchedulerHelper()) 49 | .compose(RxHelper.>handleResult()) 50 | .subscribe(new Subscribe2Help>(this) { 51 | @Override 52 | public void onNext(List value) { 53 | mView.showGrilList(value); 54 | } 55 | }); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/HomePresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | 6 | import com.dom.red.base.RxPresenter; 7 | import com.dom.red.model.http.help.RetrofitHelper; 8 | import com.dom.red.presenter.contract.HomeContract; 9 | import com.dom.red.ui.main.adapter.HomeViewPager; 10 | import com.dom.red.ui.gank.activity.HomeActivity; 11 | import com.dom.red.ui.gank.fragment.HomeFragment; 12 | import com.dom.red.util.Constants; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import javax.inject.Inject; 18 | 19 | /** 20 | * Created by dom4j on 2017/3/24. 21 | */ 22 | 23 | public class HomePresenter extends RxPresenter implements HomeContract.Presenter{ 24 | 25 | private RetrofitHelper mRetrofitHelper; 26 | 27 | @Inject 28 | public HomePresenter(RetrofitHelper mRetrofitHelper) { 29 | this.mRetrofitHelper = mRetrofitHelper; 30 | } 31 | 32 | @Override 33 | public void createHomeList() { 34 | String[] response = new String[]{"Android","iOS","前端"}; 35 | List fragments = new ArrayList<>(); 36 | //福利 | Android | iOS | 休息视频 | 拓展资源 | 前端 | all 37 | for(int i = 0 ; i < response.length ; i++){ 38 | HomeFragment fragment = new HomeFragment(); 39 | Bundle bundle = new Bundle(); 40 | bundle.putString(Constants.URL, response[i]); 41 | fragment.setArguments(bundle); 42 | fragments.add(fragment); 43 | } 44 | HomeViewPager adapter = new HomeViewPager(((HomeActivity)mView).getSupportFragmentManager()); 45 | adapter.setDataList(fragments); 46 | adapter.setTitleList(response); 47 | mView.showHomeList(adapter); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/HotPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import com.dom.red.base.RxPresenter; 4 | import com.dom.red.model.bean.zhihu.HotListBean; 5 | import com.dom.red.model.http.help.RetrofitHelper; 6 | import com.dom.red.model.http.help.RxHelper; 7 | import com.dom.red.model.http.help.Subscribe2Help; 8 | import com.dom.red.presenter.contract.ZhiHotContract; 9 | 10 | import javax.inject.Inject; 11 | 12 | import io.reactivex.Observable; 13 | 14 | /** 15 | * Created by dom4j on 2017/3/25. 16 | */ 17 | 18 | public class HotPresenter extends RxPresenterimplements ZhiHotContract.Presenter{ 19 | private RetrofitHelper mRetrofitHelper; 20 | 21 | @Inject 22 | public HotPresenter(RetrofitHelper mRetrofitHelper) { 23 | this.mRetrofitHelper = mRetrofitHelper; 24 | } 25 | 26 | 27 | @Override 28 | public void getHotListData() { 29 | Observable hotList = mRetrofitHelper.getHotList(); 30 | hotList.compose(RxHelper.rxSchedulerHelper()) 31 | .subscribe(new Subscribe2Help(this) { 32 | @Override 33 | public void onNext(HotListBean value) { 34 | mView.showHotListData(value); 35 | } 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/SectionChildPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import com.dom.red.base.RxPresenter; 4 | import com.dom.red.model.bean.zhihu.SectionChildListBean; 5 | import com.dom.red.model.http.help.RetrofitHelper; 6 | import com.dom.red.model.http.help.RxHelper; 7 | import com.dom.red.model.http.help.Subscribe2Help; 8 | import com.dom.red.presenter.contract.SectionChildContract; 9 | 10 | import javax.inject.Inject; 11 | 12 | import io.reactivex.Observable; 13 | 14 | /** 15 | * Created by dom4j on 2017/3/26. 16 | */ 17 | 18 | public class SectionChildPresenter extends RxPresenter implements SectionChildContract.Presenter{ 19 | private RetrofitHelper mRetrofitHelper; 20 | 21 | @Inject 22 | public SectionChildPresenter(RetrofitHelper mRetrofitHelper) { 23 | this.mRetrofitHelper = mRetrofitHelper; 24 | } 25 | 26 | @Override 27 | public void getSectionChildList(int id) { 28 | Observable sectionChildList = mRetrofitHelper.getSectionChildList(id); 29 | sectionChildList.compose(RxHelper.rxSchedulerHelper()) 30 | .subscribe(new Subscribe2Help(this) { 31 | @Override 32 | public void onNext(SectionChildListBean value) { 33 | mView.showSectionChildList(value); 34 | } 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/SectionPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import com.dom.red.base.RxPresenter; 4 | import com.dom.red.model.bean.zhihu.SectionBean; 5 | import com.dom.red.model.http.help.RetrofitHelper; 6 | import com.dom.red.model.http.help.RxHelper; 7 | import com.dom.red.model.http.help.Subscribe2Help; 8 | import com.dom.red.presenter.contract.ZhiDailyContract; 9 | import com.dom.red.presenter.contract.ZhiSectionContract; 10 | 11 | import javax.inject.Inject; 12 | 13 | import io.reactivex.Observable; 14 | 15 | /** 16 | * Created by dom4j on 2017/3/25. 17 | */ 18 | 19 | public class SectionPresenter extends RxPresenter implements ZhiSectionContract.Presenter{ 20 | private RetrofitHelper mRetrofitHelper; 21 | @Inject 22 | public SectionPresenter(RetrofitHelper mRetrofitHelper) { 23 | this.mRetrofitHelper = mRetrofitHelper; 24 | } 25 | 26 | @Override 27 | public void getSectionList() { 28 | Observable sectionList = mRetrofitHelper.getSectionList(); 29 | sectionList.compose(RxHelper.rxSchedulerHelper()) 30 | .subscribe(new Subscribe2Help(this) { 31 | @Override 32 | public void onNext(SectionBean value) { 33 | mView.showSectionList(value); 34 | } 35 | }); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/ThemeFragmentPresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import com.dom.red.base.RxPresenter; 4 | import com.dom.red.model.bean.zhihu.ThemeList; 5 | import com.dom.red.model.http.help.RetrofitHelper; 6 | import com.dom.red.model.http.help.RxHelper; 7 | import com.dom.red.model.http.help.Subscribe2Help; 8 | import com.dom.red.presenter.contract.ThemeFragmentContract; 9 | 10 | import javax.inject.Inject; 11 | 12 | import io.reactivex.Observable; 13 | 14 | /** 15 | * Created by dom4j on 2017/3/23. 16 | */ 17 | 18 | public class ThemeFragmentPresenter extends RxPresenter implements ThemeFragmentContract.Presenter{ 19 | 20 | private RetrofitHelper mRetrofitHelper; 21 | 22 | @Inject 23 | public ThemeFragmentPresenter(RetrofitHelper mRetrofitHelper) { 24 | this.mRetrofitHelper = mRetrofitHelper; 25 | } 26 | 27 | 28 | @Override 29 | public void getThemeList(int id) { 30 | Observable themeList = mRetrofitHelper.getThemeList(id); 31 | themeList.compose(RxHelper.rxSchedulerHelper()) 32 | .subscribe(new Subscribe2Help(this) { 33 | @Override 34 | public void onNext(ThemeList value) { 35 | mView.showThemeList(value); 36 | } 37 | }); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/ThemePresenter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.view.View; 5 | 6 | import com.dom.red.app.App; 7 | import com.dom.red.base.RxPresenter; 8 | import com.dom.red.model.bean.zhihu.ThemeListBean; 9 | import com.dom.red.model.http.help.RetrofitHelper; 10 | import com.dom.red.model.http.help.RxHelper; 11 | import com.dom.red.model.http.help.Subscribe2Help; 12 | import com.dom.red.presenter.contract.ThemeContract; 13 | import com.dom.red.ui.main.adapter.ThemeDownVp; 14 | import com.dom.red.ui.main.adapter.ThemeTopViewPager; 15 | import com.dom.red.ui.zhihu.activity.ThemeActivity; 16 | import com.dom.red.ui.zhihu.fragment.ThemeFragment; 17 | import com.dom.red.ui.main.widget.ImageViewAndText; 18 | 19 | import java.util.ArrayList; 20 | import java.util.List; 21 | 22 | import javax.inject.Inject; 23 | 24 | import io.reactivex.Observable; 25 | 26 | /** 27 | * Created by dom4j on 2017/3/23. 28 | */ 29 | 30 | public class ThemePresenter extends RxPresenter implements ThemeContract.Presenter{ 31 | 32 | private RetrofitHelper mRetrofitHelper; 33 | 34 | @Inject 35 | public ThemePresenter(RetrofitHelper mRetrofitHelper) { 36 | this.mRetrofitHelper = mRetrofitHelper; 37 | } 38 | 39 | @Override 40 | public void getThemeList() { 41 | Observable themeList = mRetrofitHelper.getThemeList(); 42 | themeList.compose(RxHelper.rxSchedulerHelper()) 43 | .subscribe(new Subscribe2Help(this) { 44 | @Override 45 | public void onNext(ThemeListBean value) { 46 | mView.showThemeList(value); 47 | } 48 | }); 49 | } 50 | 51 | @Override 52 | public void createTopAdapter(List list) { 53 | List viewList = new ArrayList<>(); 54 | for(ThemeListBean.OthersBean bean : list){ 55 | ImageViewAndText ivt = new ImageViewAndText(App.getInstance()); 56 | ivt.setImageUrl(bean.getThumbnail()); 57 | // ivt.setText(bean.getName()); 58 | viewList.add(ivt); 59 | } 60 | ThemeTopViewPager adapter = new ThemeTopViewPager(); 61 | adapter.setDataList(viewList); 62 | mView.showTopViewPager(adapter); 63 | } 64 | 65 | @Override 66 | public void createDownAdapter(List list) { 67 | List fragmentList = new ArrayList<>(); 68 | List strList = new ArrayList<>(); 69 | for(ThemeListBean.OthersBean bean : list){ 70 | ThemeFragment tf = new ThemeFragment(); 71 | tf.setId(bean.getId()); 72 | strList.add(bean.getName()); 73 | fragmentList.add(tf); 74 | } 75 | ThemeDownVp tdv = new ThemeDownVp(((ThemeActivity)mView).getSupportFragmentManager()); 76 | tdv.setDateList(fragmentList); 77 | tdv.setStringList(strList); 78 | mView.showDownViewPager(tdv); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/CommentContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.zhihu.LongCommentBean; 6 | import com.dom.red.model.bean.zhihu.ShortCommentBean; 7 | 8 | /** 9 | * Created by dom4j on 2017/3/13. 10 | */ 11 | 12 | public interface CommentContract { 13 | interface View extends BaseView{ 14 | void showLongComment(LongCommentBean longBean); 15 | 16 | void showShortComment(ShortCommentBean shortBean); 17 | } 18 | interface Presenter extends BasePresenter{ 19 | void getLongComment(int id); 20 | 21 | void getShortComment(int id); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/ContentContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.zhihu.DetailBean; 6 | import com.dom.red.model.bean.zhihu.ExtraInfo; 7 | 8 | /** 9 | * Created by dom4j on 2017/3/10. 10 | */ 11 | 12 | public interface ContentContract { 13 | interface View extends BaseView{ 14 | void showContent(DetailBean detailBean); 15 | void showNewsInfo(ExtraInfo extraInfo); 16 | } 17 | interface Presenter extends BasePresenter{ 18 | void getContent(int id); 19 | void getNewsInfo(int id); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/FuliContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.gank.MeiziBean; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by dom4j on 2017/3/24. 11 | */ 12 | 13 | public interface FuliContract { 14 | interface View extends BaseView{ 15 | void showMeiziList(List list); 16 | 17 | } 18 | interface Presenter extends BasePresenter{ 19 | void getMeiziList(String type,int num,int page); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/HomeContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.ui.main.adapter.HomeViewPager; 6 | 7 | /** 8 | * Created by dom4j on 2017/3/24. 9 | */ 10 | 11 | public interface HomeContract { 12 | interface View extends BaseView{ 13 | void showHomeList(HomeViewPager adapter); 14 | } 15 | 16 | interface Presenter extends BasePresenter{ 17 | void createHomeList(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/HomeFragmentContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.gank.ClassifyList; 6 | import com.dom.red.model.bean.gank.MeiziBean; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by dom4j on 2017/3/24. 12 | */ 13 | 14 | public interface HomeFragmentContract { 15 | 16 | interface View extends BaseView{ 17 | void showDataList(List list); 18 | 19 | void showGrilList(List data); 20 | } 21 | interface Presenter extends BasePresenter{ 22 | void getDataList(String type,int num,int page); 23 | 24 | void getGirlList(int num); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/SectionChildContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.zhihu.SectionChildListBean; 6 | 7 | /** 8 | * Created by dom4j on 2017/3/26. 9 | */ 10 | 11 | public interface SectionChildContract { 12 | interface View extends BaseView{ 13 | void showSectionChildList(SectionChildListBean list); 14 | } 15 | interface Presenter extends BasePresenter{ 16 | void getSectionChildList(int id); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/ThemeContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.zhihu.ThemeListBean; 6 | import com.dom.red.ui.main.adapter.ThemeDownVp; 7 | import com.dom.red.ui.main.adapter.ThemeTopViewPager; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by dom4j on 2017/3/23. 13 | */ 14 | 15 | public interface ThemeContract { 16 | interface View extends BaseView{ 17 | void showThemeList(ThemeListBean themeListBean); 18 | 19 | void showTopViewPager(ThemeTopViewPager adapter); 20 | 21 | void showDownViewPager(ThemeDownVp tdv); 22 | } 23 | 24 | interface Presenter extends BasePresenter{ 25 | void getThemeList(); 26 | 27 | void createTopAdapter(List list); 28 | 29 | void createDownAdapter(List list); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/ThemeFragmentContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.zhihu.ThemeList; 6 | 7 | /** 8 | * Created by dom4j on 2017/3/23. 9 | */ 10 | 11 | public interface ThemeFragmentContract { 12 | 13 | interface View extends BaseView{ 14 | void showThemeList(ThemeList themeList); 15 | } 16 | 17 | interface Presenter extends BasePresenter{ 18 | 19 | void getThemeList(int id); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/ZhiDailyContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.zhihu.HomeListBean; 6 | 7 | import java.util.List; 8 | 9 | 10 | /** 11 | * Created by dom4j on 2017/3/25. 12 | */ 13 | 14 | public interface ZhiDailyContract { 15 | interface View extends BaseView { 16 | void showDailyList(HomeListBean data); 17 | 18 | void showBeforeList(HomeListBean data); 19 | } 20 | interface Presenter extends BasePresenter { 21 | 22 | void getDailyList(); 23 | 24 | void getBeforeList(String date); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/ZhiHotContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.zhihu.HotListBean; 6 | 7 | 8 | /** 9 | * Created by dom4j on 2017/3/25. 10 | */ 11 | 12 | public interface ZhiHotContract { 13 | interface View extends BaseView { 14 | void showHotListData(HotListBean data); 15 | } 16 | interface Presenter extends BasePresenter { 17 | void getHotListData(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/ZhiSectionContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | import com.dom.red.model.bean.zhihu.SectionBean; 6 | 7 | 8 | /** 9 | * Created by dom4j on 2017/3/25. 10 | */ 11 | 12 | public interface ZhiSectionContract { 13 | interface View extends BaseView { 14 | void showSectionList(SectionBean list); 15 | } 16 | interface Presenter extends BasePresenter { 17 | void getSectionList(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/presenter/contract/ZhiThemeContract.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.presenter.contract; 2 | 3 | import com.dom.red.base.BasePresenter; 4 | import com.dom.red.base.BaseView; 5 | 6 | 7 | /** 8 | * Created by dom4j on 2017/3/25. 9 | */ 10 | 11 | public interface ZhiThemeContract { 12 | interface View extends BaseView { 13 | 14 | } 15 | interface Presenter extends BasePresenter { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/gank/activity/HomeActivity.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.gank.activity; 2 | 3 | import android.support.design.widget.TabLayout; 4 | import android.support.v4.view.ViewPager; 5 | import android.support.v7.widget.Toolbar; 6 | 7 | import com.dom.red.R; 8 | import com.dom.red.base.BaseActivity; 9 | import com.dom.red.presenter.HomePresenter; 10 | import com.dom.red.presenter.contract.HomeContract; 11 | import com.dom.red.ui.main.adapter.HomeViewPager; 12 | 13 | import butterknife.BindView; 14 | 15 | /** 16 | * Created by dom4j on 2017/3/24. 17 | */ 18 | 19 | public class HomeActivity extends BaseActivity implements HomeContract.View { 20 | 21 | @BindView(R.id.gank_home_toolbar) 22 | Toolbar mToolbar; 23 | @BindView(R.id.tl_gank_home) 24 | TabLayout mTabLayout; 25 | @BindView(R.id.vp_gank_home) 26 | ViewPager mViewPager; 27 | 28 | @Override 29 | protected int getLayout() { 30 | return R.layout.activity_home; 31 | } 32 | 33 | @Override 34 | protected void initInject() { 35 | getActivityComponent().inject(this); 36 | } 37 | 38 | @Override 39 | protected void initEventAndData() { 40 | setToolBar(mToolbar,"Gank"); 41 | mViewPager.setOffscreenPageLimit(3); 42 | mPresenter.createHomeList(); 43 | } 44 | 45 | @Override 46 | public void showHomeList(HomeViewPager adapter) { 47 | mViewPager.setAdapter(adapter); 48 | mTabLayout.setupWithViewPager(mViewPager); 49 | } 50 | @Override 51 | public void showError(String msg) { 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/gank/activity/MeiZiActivity.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.gank.activity; 2 | 3 | import android.content.Intent; 4 | import android.graphics.Bitmap; 5 | import android.os.Bundle; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.Menu; 8 | import android.view.MenuItem; 9 | import android.widget.ImageView; 10 | 11 | import com.bumptech.glide.Glide; 12 | import com.bumptech.glide.request.animation.GlideAnimation; 13 | import com.bumptech.glide.request.target.SimpleTarget; 14 | import com.dom.red.R; 15 | import com.dom.red.base.SimpleActivity; 16 | import com.dom.red.util.Constants; 17 | import com.dom.red.util.FileUtil; 18 | import com.dom.red.util.ShareUtil; 19 | 20 | import java.io.File; 21 | 22 | import butterknife.BindView; 23 | import butterknife.ButterKnife; 24 | import uk.co.senab.photoview.PhotoViewAttacher; 25 | 26 | /** 27 | * Created by dom4j on 2017/3/27. 28 | */ 29 | 30 | public class MeiZiActivity extends SimpleActivity { 31 | @BindView(R.id.tool_bar) 32 | Toolbar mToolbar; 33 | @BindView(R.id.iv_meizi) 34 | ImageView mImageView; 35 | 36 | PhotoViewAttacher mAttacher; 37 | Bitmap bitmap; 38 | private String url; 39 | 40 | @Override 41 | protected int getLayout() { 42 | return R.layout.activity_meizi; 43 | } 44 | 45 | @Override 46 | protected void initEventAndData() { 47 | setToolBar(mToolbar,""); 48 | Intent intent = getIntent(); 49 | url = intent.getStringExtra(Constants.URL); 50 | Glide.with(mContext).load(url).asBitmap().into(new SimpleTarget() { 51 | @Override 52 | public void onResourceReady(Bitmap resource, GlideAnimation glideAnimation) { 53 | bitmap = resource; 54 | mImageView.setImageBitmap(resource); 55 | mAttacher = new PhotoViewAttacher(mImageView); 56 | } 57 | }); 58 | 59 | } 60 | 61 | @Override 62 | public boolean onCreateOptionsMenu(Menu menu) { 63 | getMenuInflater().inflate(R.menu.meizi_top, menu); 64 | return super.onCreateOptionsMenu(menu); 65 | } 66 | 67 | @Override 68 | public boolean onOptionsItemSelected(MenuItem item) { 69 | switch (item.getItemId()){ 70 | case R.id.meizi_save: 71 | saveImageToBitmap(); 72 | break; 73 | case R.id.meizi_share: 74 | shareImageToFriend(); 75 | break; 76 | } 77 | return true; 78 | } 79 | 80 | private void shareImageToFriend() { 81 | ShareUtil.shareImage(this,FileUtil.saveBitmapToFile(url,bitmap,mImageView),getResources().getString(R.string.image_share)); 82 | } 83 | 84 | private void saveImageToBitmap() { 85 | FileUtil.saveBitmapToFile(url,bitmap,mImageView); 86 | } 87 | 88 | @Override 89 | public void onBackPressedSupport() { 90 | if (getSupportFragmentManager().getBackStackEntryCount() > 1) { 91 | pop(); 92 | } else { 93 | finishAfterTransition(); 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/gank/activity/WebVideoActivity.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.gank.activity; 2 | 3 | import android.graphics.PixelFormat; 4 | import android.os.Bundle; 5 | import android.support.v7.widget.Toolbar; 6 | 7 | import com.dom.red.R; 8 | import com.dom.red.base.SimpleActivity; 9 | import com.tencent.smtt.sdk.WebView; 10 | 11 | import butterknife.BindView; 12 | import butterknife.ButterKnife; 13 | 14 | /** 15 | * Created by dom4j on 2017/3/27. 16 | */ 17 | 18 | public class WebVideoActivity extends SimpleActivity { 19 | @BindView(R.id.tool_bar) 20 | Toolbar mToolbar; 21 | @BindView(R.id.video_webView) 22 | WebView mVdeoView; 23 | 24 | @Override 25 | protected int getLayout() { 26 | return R.layout.activity_webvideo; 27 | } 28 | 29 | @Override 30 | protected void initEventAndData() { 31 | getWindow().setFormat(PixelFormat.TRANSLUCENT); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/activity/TimeActivity.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.activity; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.annotation.NonNull; 6 | import android.support.v7.widget.Toolbar; 7 | import android.util.Log; 8 | import android.view.View; 9 | import android.widget.TextView; 10 | 11 | import com.dom.red.R; 12 | import com.dom.red.base.SimpleActivity; 13 | import com.dom.red.ui.zhihu.fragment.ZhihuDaily; 14 | import com.dom.red.util.Constants; 15 | import com.dom.red.util.TimeUtil; 16 | import com.prolificinteractive.materialcalendarview.CalendarDay; 17 | import com.prolificinteractive.materialcalendarview.CalendarMode; 18 | import com.prolificinteractive.materialcalendarview.MaterialCalendarView; 19 | import com.prolificinteractive.materialcalendarview.OnDateSelectedListener; 20 | 21 | import org.greenrobot.eventbus.EventBus; 22 | 23 | import java.util.Calendar; 24 | 25 | import butterknife.BindView; 26 | import butterknife.ButterKnife; 27 | 28 | /** 29 | * Created by dom4j on 2017/3/25. 30 | */ 31 | 32 | public class TimeActivity extends SimpleActivity { 33 | 34 | @BindView(R.id.calendarView) 35 | MaterialCalendarView mTimer; 36 | @BindView(R.id.time_tv) 37 | TextView mConfirm; 38 | @BindView(R.id.tool_bar) 39 | Toolbar mToolbar; 40 | 41 | private String mTime; 42 | 43 | @Override 44 | protected int getLayout() { 45 | return R.layout.activity_time; 46 | } 47 | 48 | @Override 49 | protected void initEventAndData() { 50 | setToolBar(mToolbar, "选择日期"); 51 | mTimer.state().edit() 52 | .setFirstDayOfWeek(Calendar.WEDNESDAY) 53 | .setMinimumDate(CalendarDay.from(2013, 5, 20)) 54 | .setMaximumDate(CalendarDay.from(TimeUtil.getCurrentYear(), TimeUtil.getCurrentMonth(), TimeUtil.getCurrentDay())) 55 | .setCalendarDisplayMode(CalendarMode.MONTHS) 56 | .commit(); 57 | mTimer.setOnDateChangedListener(new OnDateSelectedListener() { 58 | @Override 59 | public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) { 60 | String year = String.valueOf(date.getYear()); 61 | String month = String.valueOf(date.getMonth()+1); 62 | if(month.length()<2) month = "0"+String.valueOf(date.getMonth()+1); 63 | String day = String.valueOf(date.getDay()+1); 64 | if(day.length()<2) day = "0"+String.valueOf(date.getDay()+1); 65 | mTime = year+month+day; 66 | } 67 | }); 68 | mConfirm.setOnClickListener(new View.OnClickListener() { 69 | @Override 70 | public void onClick(View v) { 71 | EventBus.getDefault().post(mTime); 72 | //ZhihuDaily.getInstance().onMessageEvent(mTime); 73 | finish(); 74 | } 75 | }); 76 | } 77 | 78 | } 79 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/adapter/CommonAdapter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.adapter; 2 | 3 | import android.content.Context; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.util.Log; 6 | import android.view.ViewGroup; 7 | 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by dom4j on 2017/3/8. 13 | */ 14 | 15 | public abstract class CommonAdapter extends RecyclerView.Adapter { 16 | /** 17 | * 上下文 18 | */ 19 | protected Context mContext; 20 | /** 21 | * 布局id 22 | */ 23 | protected int mLayoutID; 24 | 25 | /** 26 | * 数据集合 27 | */ 28 | protected List mData; 29 | 30 | /** 31 | * 当前Adapter所关联的Adapter 32 | */ 33 | private ViewHolder mViewHolder; 34 | 35 | 36 | public CommonAdapter(Context context, int layoutID,List data){ 37 | this.mData = data; 38 | this.mContext = context; 39 | this.mLayoutID = layoutID; 40 | } 41 | 42 | @Override 43 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 44 | //实例化ViewHolder 45 | mViewHolder = ViewHolder.getViewHolder(mContext,mLayoutID,parent); 46 | return mViewHolder; 47 | } 48 | 49 | @Override 50 | public void onBindViewHolder(ViewHolder holder, final int position) { 51 | //具体赋值逻辑留给用户处理 52 | conver(holder,mData.get(position)); 53 | } 54 | 55 | public abstract void conver(ViewHolder viewHodler,T o); 56 | 57 | @Override 58 | public int getItemCount() { 59 | return mData.size(); 60 | } 61 | 62 | public void setDataList(List list){ 63 | this.mData = list; 64 | this.notifyDataSetChanged(); 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/adapter/HomeTopViewPager.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.adapter; 2 | 3 | import android.support.v4.view.PagerAdapter; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by dom4j on 2017/3/8. 11 | */ 12 | 13 | public class HomeTopViewPager extends PagerAdapter{ 14 | 15 | List mList; 16 | 17 | @Override 18 | public int getCount() { 19 | return mList.size(); 20 | } 21 | 22 | @Override 23 | public boolean isViewFromObject(View view, Object object) { 24 | return view == object; 25 | } 26 | 27 | @Override 28 | public Object instantiateItem(ViewGroup container, int position) { 29 | View simpleDraweeView = mList.get(position); 30 | container.addView(simpleDraweeView); 31 | return simpleDraweeView; 32 | } 33 | 34 | @Override 35 | public void destroyItem(ViewGroup container, int position, Object object) { 36 | container.removeView(mList.get(position)); 37 | } 38 | 39 | public void setDataList(List list){ 40 | this.mList = list; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/adapter/HomeViewPager.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by dom4j on 2017/3/24. 11 | */ 12 | 13 | public class HomeViewPager extends FragmentPagerAdapter{ 14 | 15 | private List dataList; 16 | private String[] titleList; 17 | 18 | public HomeViewPager(FragmentManager fm) { 19 | super(fm); 20 | } 21 | 22 | @Override 23 | public Fragment getItem(int position) { 24 | return dataList.get(position); 25 | } 26 | 27 | @Override 28 | public int getCount() { 29 | return dataList.size(); 30 | } 31 | 32 | public void setDataList(List dataList) { 33 | this.dataList = dataList; 34 | } 35 | 36 | @Override 37 | public CharSequence getPageTitle(int position) { 38 | return titleList[position]; 39 | } 40 | 41 | public void setTitleList(String[] titleList) { 42 | this.titleList = titleList; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/adapter/MainAdapter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by dom4j on 2017/3/25. 11 | */ 12 | 13 | public class MainAdapter extends FragmentPagerAdapter{ 14 | 15 | private List mList; 16 | private String[] pageTitle = new String[]{"日报","专栏","热门"}; 17 | 18 | public MainAdapter(FragmentManager fm) { 19 | super(fm); 20 | } 21 | 22 | @Override 23 | public Fragment getItem(int position) { 24 | return mList.get(position); 25 | } 26 | 27 | @Override 28 | public int getCount() { 29 | return mList.size(); 30 | } 31 | 32 | public void setDataList(List mList) { 33 | this.mList = mList; 34 | } 35 | 36 | @Override 37 | public CharSequence getPageTitle(int position) { 38 | return pageTitle[position]; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/adapter/MulitItemTypeSupport.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.adapter; 2 | 3 | /** 4 | * Created by dom4j on 2017/3/8. 5 | */ 6 | 7 | public interface MulitItemTypeSupport { 8 | 9 | int getLayoutID(int ItemType); 10 | 11 | int getItemViewType(int position, T o); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/adapter/MulitItemTypeaAdapter.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.adapter; 2 | 3 | import android.content.Context; 4 | import android.view.ViewGroup; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * Created by dom4j on 2017/3/8. 10 | */ 11 | 12 | public abstract class MulitItemTypeaAdapter extends CommonAdapter { 13 | 14 | private MulitItemTypeSupport mulitItemTypeSupport; 15 | 16 | public MulitItemTypeaAdapter(Context context,List data, 17 | MulitItemTypeSupport mulitItemTypeSupport) { 18 | super(context, -1, data); 19 | this.mulitItemTypeSupport = mulitItemTypeSupport; 20 | } 21 | 22 | @Override 23 | public int getItemViewType(int position) { 24 | return mulitItemTypeSupport.getItemViewType(position,mData.get(position)); 25 | } 26 | 27 | @Override 28 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 29 | int layoutID = mulitItemTypeSupport.getLayoutID(viewType); 30 | ViewHolder viewHolder = ViewHolder.getViewHolder(mContext,layoutID,parent); 31 | return viewHolder; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/adapter/ThemeDownVp.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by dom4j on 2017/3/23. 11 | */ 12 | 13 | public class ThemeDownVp extends FragmentPagerAdapter{ 14 | 15 | private List stringList; 16 | private List dateList; 17 | 18 | public ThemeDownVp(FragmentManager fm) { 19 | super(fm); 20 | } 21 | 22 | @Override 23 | public Fragment getItem(int position) { 24 | return dateList.get(position); 25 | } 26 | 27 | @Override 28 | public int getCount() { 29 | return dateList.size(); 30 | } 31 | 32 | public void setStringList(List stringList) { 33 | this.stringList = stringList; 34 | } 35 | 36 | @Override 37 | public CharSequence getPageTitle(int position) { 38 | return stringList.get(position); 39 | } 40 | 41 | public void setDateList(List dateList) { 42 | this.dateList = dateList; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/adapter/ThemeTopViewPager.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.adapter; 2 | 3 | import android.support.v4.view.PagerAdapter; 4 | import android.view.View; 5 | import android.view.ViewGroup; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by dom4j on 2017/3/23. 11 | */ 12 | 13 | public class ThemeTopViewPager extends PagerAdapter{ 14 | 15 | private List mList; 16 | private List stringList; 17 | 18 | public void setDataList(List list){ 19 | mList = list; 20 | } 21 | 22 | public void setStringList(List stringList) { 23 | this.stringList = stringList; 24 | } 25 | 26 | @Override 27 | public int getCount() { 28 | return mList.size(); 29 | } 30 | 31 | @Override 32 | public boolean isViewFromObject(View view, Object object) { 33 | return view == object; 34 | } 35 | 36 | @Override 37 | public Object instantiateItem(ViewGroup container, int position) { 38 | View view = mList.get(position); 39 | container.addView(view); 40 | return view; 41 | } 42 | 43 | @Override 44 | public void destroyItem(ViewGroup container, int position, Object object) { 45 | container.removeView(mList.get(position)); 46 | } 47 | 48 | @Override 49 | public CharSequence getPageTitle(int position) { 50 | return stringList.get(position); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/widget/BanRecyclerView.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.widget; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.util.AttributeSet; 7 | import android.view.MotionEvent; 8 | 9 | /** 10 | * Created by dom4j on 2017/3/14. 11 | */ 12 | 13 | public class BanRecyclerView extends RecyclerView{ 14 | public BanRecyclerView(Context context) { 15 | super(context); 16 | } 17 | 18 | public BanRecyclerView(Context context, @Nullable AttributeSet attrs) { 19 | super(context, attrs); 20 | } 21 | 22 | public BanRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) { 23 | super(context, attrs, defStyle); 24 | } 25 | 26 | @Override 27 | public boolean dispatchTouchEvent(MotionEvent ev) { 28 | return false; 29 | } 30 | 31 | @Override 32 | public boolean onInterceptTouchEvent(MotionEvent e) { 33 | return false; 34 | } 35 | 36 | @Override 37 | public boolean onTouchEvent(MotionEvent e) { 38 | return false; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/widget/CusNestedScrollView.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.widget; 2 | 3 | import android.content.Context; 4 | import android.support.v4.widget.NestedScrollView; 5 | import android.util.AttributeSet; 6 | 7 | /** 8 | * Created by dom4j on 2017/3/10. 9 | */ 10 | 11 | public class CusNestedScrollView extends NestedScrollView{ 12 | ScrollInterface web; 13 | 14 | public CusNestedScrollView(Context context) { 15 | super(context); 16 | } 17 | 18 | public CusNestedScrollView(Context context, AttributeSet attrs, int defStyle) { 19 | super(context, attrs, defStyle); 20 | } 21 | 22 | public CusNestedScrollView(Context context, AttributeSet attrs) { 23 | 24 | super(context, attrs); 25 | } 26 | 27 | @Override 28 | protected void onScrollChanged(int l, int t, int oldl, int oldt) { 29 | super.onScrollChanged(l, t, oldl, oldt); 30 | web.onSChanged(l, t, oldl, oldt); 31 | } 32 | 33 | public void setOnCusScroolChangeListener(ScrollInterface t) { 34 | this.web = t; 35 | } 36 | 37 | /** 38 | * 定义滑动接口 39 | * @param 40 | */ 41 | public interface ScrollInterface { 42 | public void onSChanged(int l, int t, int oldl, int oldt); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/widget/GlideImageLoader.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.widget; 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 dom4j on 2017/3/25. 11 | */ 12 | 13 | public class GlideImageLoader extends ImageLoader { 14 | @Override 15 | public void displayImage(Context context, Object path, ImageView imageView) { 16 | Glide.with(context).load(path).centerCrop().into(imageView); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/widget/ImageAndText2.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.widget.ImageView; 7 | import android.widget.RelativeLayout; 8 | import android.widget.TextView; 9 | 10 | import com.bumptech.glide.Glide; 11 | import com.bumptech.glide.load.engine.DiskCacheStrategy; 12 | import com.dom.red.R; 13 | import com.facebook.drawee.view.SimpleDraweeView; 14 | 15 | /** 16 | * Created by dom4j on 2017/3/10. 17 | */ 18 | 19 | public class ImageAndText2 extends RelativeLayout { 20 | private ImageView sdv; 21 | private TextView tv; 22 | private TextView tv2; 23 | 24 | public ImageAndText2(Context context) { 25 | this(context,null); 26 | } 27 | 28 | public ImageAndText2(Context context, AttributeSet attrs) { 29 | this(context, attrs ,0); 30 | } 31 | 32 | public ImageAndText2(Context context, AttributeSet attrs, int defStyleAttr) { 33 | super(context, attrs, defStyleAttr); 34 | init(); 35 | } 36 | 37 | private void init() { 38 | View view = View.inflate(getContext(), R.layout.item_imageatext2,this); 39 | sdv = (ImageView) view.findViewById(R.id.sdv_content_top); 40 | tv = (TextView) view.findViewById(R.id.tv_content_top); 41 | tv2 = (TextView) view.findViewById(R.id.tv_content_top_2); 42 | 43 | } 44 | 45 | public void setImageUrl(String url){ 46 | Glide.with(getContext()) 47 | .load(url) 48 | .diskCacheStrategy(DiskCacheStrategy.SOURCE) 49 | .crossFade() 50 | .into(sdv); 51 | } 52 | 53 | public void setText(String text){ 54 | tv.setText(text); 55 | } 56 | 57 | public void setText2(String text){ 58 | tv2.setText(text); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/widget/ImageViewAndText.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.widget.RelativeLayout; 7 | import android.widget.TextView; 8 | 9 | import com.dom.red.R; 10 | import com.facebook.drawee.view.SimpleDraweeView; 11 | 12 | /** 13 | * Created by dom4j on 2017/3/8. 14 | */ 15 | 16 | public class ImageViewAndText extends RelativeLayout { 17 | 18 | private SimpleDraweeView sdv; 19 | private TextView tv; 20 | 21 | public ImageViewAndText(Context context) { 22 | this(context,null); 23 | } 24 | 25 | public ImageViewAndText(Context context, AttributeSet attrs) { 26 | this(context, attrs ,0); 27 | } 28 | 29 | public ImageViewAndText(Context context, AttributeSet attrs, int defStyleAttr) { 30 | super(context, attrs, defStyleAttr); 31 | init(); 32 | } 33 | 34 | private void init() { 35 | View view = View.inflate(getContext(), R.layout.item_imageatext,this); 36 | sdv = (SimpleDraweeView) view.findViewById(R.id.sdv_home_top); 37 | tv = (TextView) view.findViewById(R.id.tv_home_top); 38 | } 39 | 40 | public void setImageUrl(String url){ 41 | sdv.setImageURI(url); 42 | } 43 | 44 | public void setText(String text){ 45 | tv.setText(text); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/main/widget/TextViewSpan.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.main.widget; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.graphics.Color; 6 | import android.text.TextPaint; 7 | import android.text.style.ClickableSpan; 8 | import android.view.View; 9 | 10 | import com.dom.red.ui.zhihu.activity.WebViewActivity; 11 | import com.dom.red.util.Constants; 12 | 13 | /** 14 | * Created by dom4j on 2017/3/23. 15 | */ 16 | 17 | public class TextViewSpan extends ClickableSpan { 18 | 19 | private final String url; 20 | private Context mContext; 21 | public TextViewSpan(Context context,String str){ 22 | this.mContext = context; 23 | this.url = str; 24 | } 25 | 26 | 27 | @Override 28 | public void updateDrawState(TextPaint ds) { 29 | ds.setColor(Color.BLUE); 30 | } 31 | 32 | @Override 33 | public void onClick(View widget) { 34 | Intent intent = new Intent(mContext, WebViewActivity.class); 35 | intent.putExtra(Constants.URL,url); 36 | mContext.startActivity(intent); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/ui/zhihu/activity/AboutRedActivity.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.ui.zhihu.activity; 2 | 3 | import android.graphics.Color; 4 | import android.support.design.widget.CollapsingToolbarLayout; 5 | import android.support.design.widget.FloatingActionButton; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.support.v7.widget.Toolbar; 9 | import android.text.Spannable; 10 | import android.text.SpannableStringBuilder; 11 | import android.text.method.LinkMovementMethod; 12 | import android.util.Log; 13 | import android.widget.TextView; 14 | 15 | import com.dom.red.R; 16 | import com.dom.red.base.SimpleActivity; 17 | import com.dom.red.ui.main.adapter.CommonAdapter; 18 | import com.dom.red.ui.main.adapter.ViewHolder; 19 | import com.dom.red.ui.main.widget.TextViewSpan; 20 | 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | import butterknife.BindView; 25 | 26 | /** 27 | * Created by dom4j on 2017/3/23. 28 | */ 29 | 30 | public class AboutRedActivity extends SimpleActivity { 31 | @BindView(R.id.toolBar1) 32 | Toolbar mToolbar; 33 | @BindView(R.id.collapsingToolbarLayout) 34 | CollapsingToolbarLayout mColl; 35 | @BindView(R.id.RecyclerView) 36 | RecyclerView mRecyclerView; 37 | @BindView(R.id.btn) 38 | FloatingActionButton mFAB; 39 | 40 | private int index = 0; 41 | 42 | @Override 43 | protected int getLayout() { 44 | return R.layout.activity_about; 45 | } 46 | 47 | @Override 48 | protected void initEventAndData() { 49 | String appName = (String) getResources().getText(R.string.app_name); 50 | setToolBar(mToolbar,""); 51 | mColl.setTitle(appName); 52 | mColl.setExpandedTitleColor(Color.WHITE); 53 | mColl.setCollapsedTitleTextColor(Color.WHITE); 54 | List list = new ArrayList<>(); 55 | String str1 = (String) getResources().getText(R.string.s1); 56 | String str2 = (String) getResources().getText(R.string.s2); 57 | String str3 = (String) getResources().getText(R.string.s3); 58 | String str4 = (String) getResources().getText(R.string.s4); 59 | String str5 = (String) getResources().getText(R.string.s5); 60 | String str6 = (String) getResources().getText(R.string.s6); 61 | String str7 = (String) getResources().getText(R.string.s7); 62 | list.add(str1); 63 | list.add(str2); 64 | list.add(str3); 65 | list.add(str4); 66 | list.add(str5); 67 | list.add(str6); 68 | list.add(str7); 69 | 70 | CommonAdapter adapter = new CommonAdapter(this,R.layout.item_about,list) { 71 | @Override 72 | public void conver(ViewHolder viewHodler, String str) { 73 | TextView textView = viewHodler.getView(R.id.about_tv); 74 | textView.setText(str); 75 | } 76 | }; 77 | 78 | mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); 79 | mRecyclerView.setAdapter(adapter); 80 | 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/Constants.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import com.dom.red.app.App; 4 | 5 | import java.io.File; 6 | 7 | /** 8 | * Created by dom4j on 2017/3/10. 9 | */ 10 | 11 | public class Constants { 12 | 13 | public static final String ID = "id"; 14 | 15 | public static final String SP = "sp"; 16 | 17 | public static final String ISFIRSTJOIN = "isFirstJoin"; 18 | 19 | public static final String NUM = "num"; 20 | 21 | public static final String ISIMAGE = "isImage"; 22 | 23 | public static final String URL = "url"; 24 | 25 | public static final String TIME ="time"; 26 | 27 | public static final String TITLE = "title"; 28 | 29 | public static final String PATH_DATA = App.getInstance().getExternalFilesDir("ImageDownload").getPath(); 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.graphics.Bitmap; 6 | import android.net.Uri; 7 | import android.provider.MediaStore; 8 | import android.util.Log; 9 | import android.view.View; 10 | 11 | import java.io.File; 12 | import java.io.FileOutputStream; 13 | import java.io.IOException; 14 | 15 | /** 16 | * Created by dom4j on 2017/3/27. 17 | */ 18 | 19 | public class FileUtil { 20 | public static Uri saveBitmapToFile(String url,Bitmap bitmap, View container){ 21 | String fileName = url.substring(url.lastIndexOf("/"),url.lastIndexOf(".")) + ".png"; 22 | File fileDir = new File(Constants.PATH_DATA); 23 | if (!fileDir.exists()){ 24 | fileDir.mkdir(); 25 | } 26 | File imageFile = new File(fileDir,fileName); 27 | Uri uri = Uri.fromFile(imageFile); 28 | if (imageFile.exists()) { 29 | return uri; 30 | } 31 | try { 32 | FileOutputStream fos = new FileOutputStream(imageFile); 33 | boolean isCompress = bitmap.compress(Bitmap.CompressFormat.PNG, 90, fos); 34 | if (isCompress) { 35 | SnakerbarUtil.showShort(container,"保存妹纸成功n(*≧▽≦*)n"); 36 | } else { 37 | SnakerbarUtil.showShort(container,"保存妹纸失败ヽ(≧Д≦)ノ"); 38 | } 39 | fos.flush(); 40 | fos.close(); 41 | } catch (IOException e) { 42 | e.printStackTrace(); 43 | SnakerbarUtil.showShort(container,"保存妹纸失败ヽ(≧Д≦)ノ"); 44 | } 45 | return uri; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/HtmlUtil.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by dom4j on 2017/3/10. 7 | */ 8 | 9 | public class HtmlUtil { 10 | //css样式,隐藏header 11 | private static final String HIDE_HEADER_STYLE = ""; 12 | 13 | //css style tag,需要格式化 14 | private static final String NEEDED_FORMAT_CSS_TAG = ""; 15 | 16 | // js script tag,需要格式化 17 | private static final String NEEDED_FORMAT_JS_TAG = ""; 18 | 19 | public static final String MIME_TYPE = "text/html; charset=utf-8"; 20 | 21 | public static final String ENCODING = "utf-8"; 22 | 23 | private HtmlUtil() 24 | { 25 | 26 | } 27 | 28 | /** 29 | * 根据css链接生成Link标签 30 | * 31 | * @param url String 32 | * @return String 33 | */ 34 | public static String createCssTag(String url) 35 | { 36 | 37 | return String.format(NEEDED_FORMAT_CSS_TAG, url); 38 | } 39 | 40 | /** 41 | * 根据多个css链接生成Link标签 42 | * 43 | * @param urls List 44 | * @return String 45 | */ 46 | public static String createCssTag(List urls) 47 | { 48 | 49 | final StringBuilder sb = new StringBuilder(); 50 | for (String url : urls) 51 | { 52 | sb.append(createCssTag(url)); 53 | } 54 | return sb.toString(); 55 | } 56 | 57 | /** 58 | * 根据js链接生成Script标签 59 | * 60 | * @param url String 61 | * @return String 62 | */ 63 | public static String createJsTag(String url) 64 | { 65 | 66 | return String.format(NEEDED_FORMAT_JS_TAG, url); 67 | } 68 | 69 | /** 70 | * 根据多个js链接生成Script标签 71 | * 72 | * @param urls List 73 | * @return String 74 | */ 75 | public static String createJsTag(List urls) 76 | { 77 | 78 | final StringBuilder sb = new StringBuilder(); 79 | for (String url : urls) 80 | { 81 | sb.append(createJsTag(url)); 82 | } 83 | return sb.toString(); 84 | } 85 | 86 | /** 87 | * 根据样式标签,html字符串,js标签 88 | * 生成完整的HTML文档 89 | */ 90 | 91 | public static String createHtmlData(String html, List cssList, List jsList) 92 | { 93 | final String css = HtmlUtil.createCssTag(cssList); 94 | final String js = HtmlUtil.createJsTag(jsList); 95 | return css.concat(HIDE_HEADER_STYLE).concat(html).concat(js); 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/LogUtil.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import android.util.Log; 4 | 5 | /** 6 | * Created by dom4j on 2017/3/9. 7 | */ 8 | 9 | public class LogUtil { 10 | public static void log(String msg){ 11 | Log.d("TAG",msg); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/NewWorkUtil.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | import com.dom.red.app.App; 8 | 9 | import static android.content.Context.CONNECTIVITY_SERVICE; 10 | 11 | /** 12 | * Created by dom4j on 2017/3/7. 13 | */ 14 | 15 | public class NewWorkUtil { 16 | /** 17 | * 检查WIFI是否连接 18 | */ 19 | public static boolean isWifiConnected() { 20 | ConnectivityManager connectivityManager = (ConnectivityManager) App.getInstance().getApplicationContext().getSystemService(CONNECTIVITY_SERVICE); 21 | NetworkInfo wifiInfo = connectivityManager 22 | .getNetworkInfo(ConnectivityManager.TYPE_WIFI); 23 | return wifiInfo != null; 24 | } 25 | /** 26 | * 检查手机网络(4G/3G/2G)是否连接 27 | */ 28 | public static boolean isMobileNetworkConnected() { 29 | ConnectivityManager connectivityManager = (ConnectivityManager) App.getInstance().getApplicationContext().getSystemService(CONNECTIVITY_SERVICE); 30 | NetworkInfo mobileNetworkInfo = connectivityManager 31 | .getNetworkInfo(ConnectivityManager.TYPE_MOBILE); 32 | return mobileNetworkInfo != null; 33 | } 34 | /** 35 | * 检查是否有可用网络 36 | */ 37 | public static boolean isNetworkConnected() { 38 | ConnectivityManager manager = (ConnectivityManager) App.getInstance().getSystemService(CONNECTIVITY_SERVICE); 39 | // 检查网络连接,如果无网络可用,就不需要进行连网操作等 40 | NetworkInfo info = manager.getActiveNetworkInfo(); 41 | if (info == null || !manager.getBackgroundDataSetting()) { 42 | return false; 43 | } 44 | return true; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/PxUtil.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import android.content.Context; 4 | 5 | import com.dom.red.app.App; 6 | 7 | /** 8 | * Created by dom4j on 2017/3/8. 9 | */ 10 | 11 | public class PxUtil { 12 | /** 13 | * 根据手机的分辨率从 dp 的单位 转成为 px(像素) 14 | */ 15 | public static int dp2px(Context context, float dpValue) { 16 | final float scale = context.getResources().getDisplayMetrics().density; 17 | return (int) (dpValue * scale + 0.5f); 18 | } 19 | 20 | public static int dp2px(float dpValue) { 21 | final float scale = App.getInstance().getResources().getDisplayMetrics().density; 22 | return (int) (dpValue * scale + 0.5f); 23 | } 24 | 25 | /** 26 | * 根据手机的分辨率从 px(像素) 的单位 转成为 dp 27 | */ 28 | public static int px2dp(Context context, float pxValue) { 29 | final float scale = context.getResources().getDisplayMetrics().density; 30 | return (int) (pxValue / scale + 0.5f); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/ShareUtil.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | 7 | import com.dom.red.R; 8 | 9 | 10 | /** 11 | * Created by dom4j on 2017/3/24. 12 | */ 13 | public class ShareUtil { 14 | 15 | public static void shareImage(Context context, Uri uri, String title) { 16 | Intent shareIntent = new Intent(); 17 | shareIntent.setAction(Intent.ACTION_SEND); 18 | shareIntent.putExtra(Intent.EXTRA_STREAM, uri); 19 | shareIntent.setType("image/jpeg"); 20 | shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 21 | context.startActivity(Intent.createChooser(shareIntent, title)); 22 | } 23 | 24 | public static void shareApp(Context context) { 25 | Intent shareIntent = new Intent(); 26 | shareIntent.setAction(Intent.ACTION_SEND); 27 | shareIntent.putExtra(Intent.EXTRA_TEXT, context.getResources().getString(R.string.share_app)); 28 | shareIntent.setType("text/plain"); 29 | shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 30 | context.startActivity(Intent.createChooser(shareIntent, context.getString(R.string.share_app_to_friend))); 31 | } 32 | 33 | public static void shareEssay(Context context,String url) { 34 | Intent shareIntent = new Intent(); 35 | shareIntent.setAction(Intent.ACTION_SEND); 36 | shareIntent.putExtra(Intent.EXTRA_TEXT, context.getResources().getString(R.string.share_essay) + url); 37 | shareIntent.setType("text/plain"); 38 | shareIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 39 | context.startActivity(Intent.createChooser(shareIntent, context.getString(R.string.share_essay_to_friend))); 40 | } 41 | 42 | // public static void shareGank(Context context, Gank gank) { 43 | // Intent intent = new Intent(); 44 | // intent.setAction(Intent.ACTION_SEND); 45 | // intent.putExtra(Intent.EXTRA_TEXT, gank.desc + gank.url + context.getString(R.string.download_gank)); 46 | // intent.setType("text/plain"); 47 | // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 48 | // context.startActivity(Intent.createChooser(intent, context.getString(R.string.share_gank_to))); 49 | // } 50 | // 51 | // public static void shareVideo(Context context, Gank gank) { 52 | // Intent intent = new Intent(); 53 | // intent.setAction(Intent.ACTION_SEND); 54 | // intent.putExtra(Intent.EXTRA_TEXT, gank.desc + gank.url + context.getString(R.string.download_gank)); 55 | // intent.setType("text/plain"); 56 | // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 57 | // context.startActivity(Intent.createChooser(intent, context.getString(R.string.share_video_to))); 58 | // } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/SharedPreferenceUtil.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.content.SharedPreferences; 6 | 7 | import com.dom.red.app.App; 8 | 9 | /** 10 | * Created by dom4j on 2017/3/10. 11 | */ 12 | 13 | public class SharedPreferenceUtil { 14 | 15 | private static final String SHAREDPREFERENCES_NAME = "red"; 16 | 17 | public static SharedPreferences getAppSp() { 18 | return App.getInstance().getSharedPreferences(SHAREDPREFERENCES_NAME, Context.MODE_PRIVATE); 19 | } 20 | 21 | public static boolean getBoolean(String key,boolean defValue){ 22 | return App.getSp().getBoolean(key,defValue); 23 | } 24 | 25 | public static void putBoolean(String key,boolean value){ 26 | App.getSp().edit().putBoolean(key,value).commit(); 27 | } 28 | 29 | 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/SnakerbarUtil.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import android.support.design.widget.Snackbar; 4 | import android.view.View; 5 | 6 | /** 7 | * Created by dom4j on 2017/3/26. 8 | */ 9 | 10 | public class SnakerbarUtil { 11 | 12 | public static void showShort(View parentView,String message){ 13 | Snackbar.make(parentView, message, Snackbar.LENGTH_SHORT).setAction("DONE", new View.OnClickListener() { 14 | @Override 15 | public void onClick(View v) { 16 | } 17 | }).show(); 18 | } 19 | 20 | public static void showShort(View parentView,String message, View.OnClickListener lisenter){ 21 | Snackbar.make(parentView, message, Snackbar.LENGTH_SHORT).setAction("DONE",lisenter).show(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/dom/red/util/ToastUtil.java: -------------------------------------------------------------------------------- 1 | package com.dom.red.util; 2 | 3 | import android.view.Gravity; 4 | import android.view.View; 5 | import android.widget.TextView; 6 | import android.widget.Toast; 7 | 8 | import com.dom.red.R; 9 | import com.dom.red.app.App; 10 | 11 | 12 | /** 13 | * Created by dom4j on 2017/3/7. 14 | */ 15 | public class ToastUtil { 16 | 17 | private static Toast mToast; 18 | private static TextView mText; 19 | private static Toast mToast_image; 20 | private static TextView mImage; 21 | 22 | public static void init(){ 23 | if(mToast == null){ 24 | View view = View.inflate(App.getInstance(),R.layout.toast_white,null); 25 | mText = (TextView) view.findViewById(R.id.tv_toast_msg); 26 | mToast = new Toast(App.getInstance()); 27 | mToast.setView(view); 28 | mToast.setGravity(Gravity.BOTTOM,0,50); 29 | mToast.setDuration(Toast.LENGTH_SHORT); 30 | } 31 | } 32 | 33 | public static void shortToast(String msg){ 34 | init(); 35 | mText.setText(msg); 36 | mToast.show(); 37 | } 38 | 39 | public static void showImageToast(int msg){ 40 | if(mToast_image == null){ 41 | View view = View.inflate(App.getInstance(),R.layout.toast_image,null); 42 | mImage = (TextView) view.findViewById(R.id.tv_toast_image); 43 | mToast_image = new Toast(App.getInstance()); 44 | mImage.setText(" " + msg +" + 1"); 45 | mToast_image.setView(view); 46 | mToast_image.setGravity(Gravity.BOTTOM,0,200); 47 | mToast_image.setDuration(Toast.LENGTH_SHORT); 48 | } 49 | mToast_image.show(); 50 | } 51 | 52 | public static void showError(String str) { 53 | if(mToast_image == null){ 54 | View view = View.inflate(App.getInstance(),R.layout.toast_image,null); 55 | mImage = (TextView) view.findViewById(R.id.tv_toast_image); 56 | mImage.setCompoundDrawables(null,null,null,null); 57 | mToast_image = new Toast(App.getInstance()); 58 | mImage.setText(" " + str +" + 1"); 59 | mToast_image.setView(view); 60 | mToast_image.setGravity(Gravity.BOTTOM,0,200); 61 | mToast_image.setDuration(Toast.LENGTH_SHORT); 62 | } 63 | mToast_image.show(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/res/animator/color.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/animator/lightning.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/animator/star_first.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/animator/star_second.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/animator/star_third.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/color/seleter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bottom_shadow_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/cpb_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_toast_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/drawer_item_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/like_seleter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/pg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/rotate_pro.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/seleter.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/toast_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/top_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 23 | 33 | 34 | 41 | 42 | 43 | 44 | 45 | 46 | 52 | 53 | 54 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 25 | 32 | 37 | 38 | 44 | 45 | 46 | 47 | 52 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fuli.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 13 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 22 | 23 | 31 | 32 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 20 | 21 | 22 | 27 | 28 | 33 | 34 | 35 | 36 | 37 | 38 | 46 | 47 | 52 | 53 | 54 | 55 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_meizi.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 11 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_section.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_time.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 17 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_topic.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_webvideo.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 11 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 27 | 32 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_welcome.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 15 | 16 | 23 | 34 | 35 | 36 | 48 | 49 | 50 | 61 | 62 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_hot.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_section.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragmnt_section.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_about.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 18 | 19 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_fuli.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 15 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_home.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 18 | 28 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_imageatext.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 11 | 15 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_imageatext2.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 11 | 12 | 16 | 26 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_long_connment.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 15 | 19 | 22 | 28 | 36 | 43 | 44 | 49 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_longcomment.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 12 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_main_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_menu_like.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_menu_message.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_section.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 21 | 22 | 30 | 38 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_sectionchild.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 20 | 24 | 30 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 23 | 24 | 29 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toast_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toast_white.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_refreshview.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/menu/comment_write.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/menu/content_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/menu/home_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/menu/meizi_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 12 | 13 | 14 | 16 | 20 | 21 | 22 | 23 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 36 | 40 | 41 | 42 | 43 | 44 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 60 | 61 | 62 | 64 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/comment_icon_fold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-hdpi/comment_icon_fold.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_fab_calendar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-hdpi/ic_fab_calendar.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/background.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/comment.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/comment_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/comment_empty.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/comment_vote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/comment_vote.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/comment_voted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/comment_voted.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/comment_write.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/comment_write.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_author.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_author.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_daily_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_daily_share.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_drawer_about.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_gank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_drawer_gank.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_zhihu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_drawer_zhihu.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_fuli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_fuli.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_ios.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_ios.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_time.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_toolbar_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_toolbar_save.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_toolbar_share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_toolbar_share.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_video.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/ic_web.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/load_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/load_error.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/loading.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/logo.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/praise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/praise.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/praised.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxhdpi/praised.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom4j1/Red/7a90c6a9c3ebe5b6582b73f8f97d6065e0bc1963/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | 8 | #dddfe0 9 | 10 | #FFF 11 | 12 | #00000000 13 | 14 | #000000 15 | #c1000000 16 | 17 | 18 | #d3d3d3 19 | 20 | #898989 21 | 22 | #808080 23 | 24 | #48aee4 25 | 26 | #F00 27 | 28 | #EEEEEE 29 | #FFFFFF 30 | #2C2C2C 31 | #FED530 32 | 33 | #FF4081 34 | #6e000000 35 | #e8e8e8 36 | #fffff9 37 | #2c2c2c 38 | #d0000000 39 | #a9a9a9 40 | #000000 41 | #898989 42 | #5b5d5c 43 | #9ba4a3 44 | #bfbfbf 45 | #dddddd 46 | #5d8698 47 | #00618c 48 | #3F51B5 49 | #f2f3f5 50 | #afafaf 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | J.Red 3 | 首页 4 | 打开 5 | 关闭 6 | 主题章节 7 | 关于J.Red 8 | 9 | 作者 : dom4j \n Email : dom4j1464529456@163.com 10 | 项目简介 : \n出于学习的目的制作了这款资讯类的App 为了掌握最新的Android技术,如MVP,RxJava等,如果他对你有所帮助 欢迎start 11 | Home : \n主页Api来自于知乎日报 感谢大神们的开源精神 \n(详情请访问我的GitHub,阅读README) 12 | Gank : \n干货Api来自于代码家 感谢大神们的开源精神 \n(详情请访问我的GitHub,阅读README) 13 | 项目UI 借鉴于GeekNews 非常感谢大神的开源精神 让我受益匪浅 \n(详情请访问我的GitHub,阅读README) 14 | 如果发现「J.Red」存在Bug 欢迎访问我的GitHub提Issues 也可以邮箱联系我 15 | 最后感谢您打开「J.Red」(*^__^*) 16 | 17 | https://github.com/dom4j1/Red 18 | https://github.com/izzyleung 19 | mvp + rxjava2.0 + retrofit2.0 + dagger2 20 | dom4j1464529456@163.com 21 | 1464529456 22 | 发现了一款纯阅读的小app「J.Red」, 同时有很多程序员干货哦,^_^ 下载地址: https://fir.im/Red 23 | 分享「Red」给朋友 24 | 我在Red 发现了一篇新闻 很有意思呦 你也来看看 \n 25 | 分享「新闻」给朋友 26 | 暂时没有更多数据了 = ̄ω ̄= 27 | 分享「妹子」给朋友 28 | 我在「J.Red」上发现一只妹子呦 快来看看吧 (*^__^*) 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 21 | 25 | 26 | 27 | 40 | 41 |