├── .gitignore ├── .idea ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── assets │ ├── info.js │ ├── jquery.min.js │ └── news.css │ ├── java │ └── name │ │ └── caiyao │ │ └── microreader │ │ ├── MicroApplication.java │ │ ├── api │ │ ├── guokr │ │ │ ├── GuokrApi.java │ │ │ └── GuokrRequest.java │ │ ├── itHome │ │ │ ├── ItHomeApi.java │ │ │ └── ItHomeRequest.java │ │ ├── util │ │ │ ├── UtilApi.java │ │ │ └── UtilRequest.java │ │ ├── weiboVideo │ │ │ ├── VideoRequest.java │ │ │ └── VideoRequstApi.java │ │ ├── weixin │ │ │ ├── TxApi.java │ │ │ └── TxRequest.java │ │ └── zhihu │ │ │ ├── ZhihuApi.java │ │ │ └── ZhihuRequest.java │ │ ├── bean │ │ ├── UpdateItem.java │ │ ├── guokr │ │ │ ├── GuokrArticle.java │ │ │ ├── GuokrArticleResult.java │ │ │ ├── GuokrHot.java │ │ │ └── GuokrHotItem.java │ │ ├── image │ │ │ ├── ImageData.java │ │ │ ├── ImageItem.java │ │ │ └── ImageResponse.java │ │ ├── itHome │ │ │ ├── ItHomeArticle.java │ │ │ ├── ItHomeChannel.java │ │ │ ├── ItHomeItem.java │ │ │ └── ItHomeResponse.java │ │ ├── weiboVideo │ │ │ ├── WeiboVideoBlog.java │ │ │ ├── WeiboVideoCardsItem.java │ │ │ ├── WeiboVideoMBlog.java │ │ │ ├── WeiboVideoPageInfo.java │ │ │ └── WeiboVideoResponse.java │ │ ├── weixin │ │ │ ├── TxWeixinResponse.java │ │ │ └── WeixinNews.java │ │ └── zhihu │ │ │ ├── ZhihuDaily.java │ │ │ ├── ZhihuDailyItem.java │ │ │ └── ZhihuStory.java │ │ ├── config │ │ └── Config.java │ │ ├── event │ │ └── StatusBarEvent.java │ │ ├── presenter │ │ ├── BasePresenter.java │ │ ├── IChangeChannelPresenter.java │ │ ├── IGuokrPresenter.java │ │ ├── IItHomeArticlePresenter.java │ │ ├── IItHomePresenter.java │ │ ├── IMainPresenter.java │ │ ├── ISettingPresenter.java │ │ ├── IVideoPresenter.java │ │ ├── IWeixinPresenter.java │ │ ├── IWelcomePresenter.java │ │ ├── IZhihuPresenter.java │ │ ├── IZhihuStoryPresenter.java │ │ └── impl │ │ │ ├── BasePresenterImpl.java │ │ │ ├── ChangeChannelPresenterImpl.java │ │ │ ├── GuokrPresenterImpl.java │ │ │ ├── ItHomeArticlePresenterImpl.java │ │ │ ├── ItHomePresenterImpl.java │ │ │ ├── MainPresenterImpl.java │ │ │ ├── SettingPresenterImpl.java │ │ │ ├── VideoPresenterImpl.java │ │ │ ├── WeiXinPresenterImpl.java │ │ │ ├── WelcomePresenterImpl.java │ │ │ ├── ZhihuPresenterImpl.java │ │ │ └── ZhihuStoryPresenterImpl.java │ │ ├── ui │ │ ├── activity │ │ │ ├── BaseActivity.java │ │ │ ├── ChangeChannelActivity.java │ │ │ ├── ItHomeActivity.java │ │ │ ├── MainActivity.java │ │ │ ├── SettingsActivity.java │ │ │ ├── VideoActivity.java │ │ │ ├── VideoWebViewActivity.java │ │ │ ├── WeixinNewsActivity.java │ │ │ ├── WelcomeActivity.java │ │ │ └── ZhihuStoryActivity.java │ │ ├── adapter │ │ │ ├── ChannelAdapter.java │ │ │ ├── GuokrAdapter.java │ │ │ ├── ItAdapter.java │ │ │ ├── VideoAdapter.java │ │ │ ├── WeixinAdapter.java │ │ │ └── ZhihuAdapter.java │ │ ├── fragment │ │ │ ├── BaseFragment.java │ │ │ ├── GuokrFragment.java │ │ │ ├── ItHomeFragment.java │ │ │ ├── SettingsFragment.java │ │ │ ├── VideoFragment.java │ │ │ ├── WeixinFragment.java │ │ │ └── ZhihuFragment.java │ │ ├── helper │ │ │ ├── ItemDragHelperCallback.java │ │ │ └── OnItemMoveListener.java │ │ ├── iView │ │ │ ├── IBaseFragment.java │ │ │ ├── IChangeChannel.java │ │ │ ├── IGuokrFragment.java │ │ │ ├── IItHomeArticle.java │ │ │ ├── IItHomeFragment.java │ │ │ ├── IMain.java │ │ │ ├── ISettingFragment.java │ │ │ ├── IVideoFragment.java │ │ │ ├── IWeixinFragment.java │ │ │ ├── IWelcome.java │ │ │ ├── IZhihuFragment.java │ │ │ └── IZhihuStory.java │ │ └── view │ │ │ ├── DividerItemDecoration.java │ │ │ └── ScrollAwareFABBehavior.java │ │ └── utils │ │ ├── CacheUtil.java │ │ ├── DBUtils.java │ │ ├── ImageLoader.java │ │ ├── ItHomeUtil.java │ │ ├── NetWorkUtil.java │ │ ├── RxBus.java │ │ ├── ScreenUtil.java │ │ ├── SharePreferenceUtil.java │ │ ├── StatusBarUtil.java │ │ └── WebUtil.java │ └── res │ ├── anim │ ├── zoomin.xml │ └── zoomout.xml │ ├── drawable │ ├── bg.png │ ├── ic_arrow_upward_white_24px.xml │ ├── ic_block_black_24dp.xml │ ├── ic_brightness_2_black_24px.xml │ ├── ic_drag_handle_black_24px.xml │ ├── ic_expand_less_black_24px.xml │ ├── ic_expand_more_black_24px.xml │ ├── ic_help_black_24px.xml │ ├── ic_more_vert_black_24px.xml │ ├── ic_open_in_browser_white_24px.xml │ ├── ic_play_arrow_white_24px.xml │ ├── ic_remove_circle_outline_black_24dp.xml │ ├── ic_settings_black_24px.xml │ ├── ic_share_white_24px.xml │ ├── ic_sort_black_24px.xml │ ├── icon.png │ ├── icon_guokr.xml │ ├── icon_it.xml │ ├── icon_video.xml │ ├── icon_weixin.xml │ ├── icon_zhihu.xml │ └── web_view_progress.xml │ ├── layout │ ├── activity_change_channel.xml │ ├── activity_ithome.xml │ ├── activity_main.xml │ ├── activity_settings.xml │ ├── activity_video.xml │ ├── activity_video_webview.xml │ ├── activity_weixin_news.xml │ ├── activity_welcome.xml │ ├── activity_zhihu_story.xml │ ├── app_bar_main.xml │ ├── channel.xml │ ├── channel_header.xml │ ├── content_main.xml │ ├── fragment_common.xml │ ├── ithome_item.xml │ ├── nav_header_main.xml │ ├── share_buttion.xml │ ├── video_item.xml │ ├── weixin_item.xml │ ├── zhihu_daily_card_item.xml │ └── zhihu_daily_item.xml │ ├── menu │ ├── activity_main_drawer.xml │ ├── menu_share.xml │ └── pop_menu.xml │ ├── values-en │ └── strings.xml │ ├── values-v19 │ └── dimens.xml │ ├── values-w820dp │ └── dimens.xml │ ├── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml │ └── xml │ └── preferences.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screenshot ├── Screenshot_20160503-085830.png ├── Screenshot_20160503-085853.png ├── Screenshot_20160503-085902.png └── Screenshot_20160503-085945.png ├── settings.gradle └── swipebackactivity ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src └── main ├── AndroidManifest.xml ├── java └── com │ └── example │ └── swipebackactivity │ ├── SwipeBackLayout.java │ ├── Utils.java │ ├── ViewDragHelper.java │ └── app │ ├── SwipeBackActivity.java │ ├── SwipeBackActivityBase.java │ ├── SwipeBackActivityHelper.java │ └── SwipeBackPreferenceActivity.java └── res ├── drawable ├── shadow_bottom.png ├── shadow_left.png └── shadow_right.png ├── layout └── swipeback_layout.xml └── values ├── attrs.xml └── styles.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | -------------------------------------------------------------------------------- /.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/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2016] [蔡小木] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### 微阅 2 | 一个小而美的阅读客户端,包含微信精选,IT之家(去广告),果壳热门,知乎日报,和视频推荐栏目,每天更换主题。[点击下载APK][5] 3 | 4 | ![首页][1] ![IT][2] ![设置][3] ![视频][4] 5 | #### 涉及到的知识点有: 6 | 1. Retrofit 的使用,包括使用 Http 缓存、converter 的使用等; 7 | 2. RxJava 的使用,包括配合 Retrofit、RxBus 的使用等; 8 | 3. MVP 架构实践,包括 presenter 的生命周期管理; 9 | 4. RecycleView + CardView 的使用; 10 | 5. RecycleView 使用 ItemTouchHelper 实现拖拽移动到不同的列表,下拉刷新,上拉到底自动加载等; 11 | 6. 使用 Palette 从图片中取色; 12 | 7. 主题动态切换; 13 | 8. Android 4.4 及以上版本的状态栏适配; 14 | 9. FloatingActionButton 的自定义动作; 15 | 10. AppCompatActivity 配合 PreferenceFragment 实现 Material Design 的设置界面; 16 | 11. WebView 的使用,包括显示加载进度条、播放视频等; 17 | 12. VideoView 的使用,包括自定义按钮; 18 | 13. 动态切换 NavigationView 的菜单项 19 | 14. Android 抓包及逆向分析 20 | 15. 数据离线缓存 21 | 16. 使用Gradle多渠道打包及自定义编译的APK文件名 22 | 17. Activity滑动返回的实现 23 | 18. 夜间模式实践 24 | 25 | #### 尚未解决的问题(如果你有好的建议,望不吝赐教) 26 | 1. WebView加载微信网页时部分图片无法显示,部分手机播放视频白屏; 27 | 2. 本项目为个人练习作品,还有很多不完善的地方,请多多指教。 28 | 29 | #### 感谢 30 | 1. 感谢[@AndroidJiang][6] 提出的Retrofit离线缓存的问题,已修复 31 | 32 | #### 声明 33 | 本项目所使用除果壳外API均为破解所得,原作公司拥有所有权利。本程序仅供测试学习,用于其他用途所造成的纠纷与本人无关。 34 | 35 | [1]: /screenshot/Screenshot_20160503-085830.png 36 | [2]: /screenshot/Screenshot_20160503-085853.png 37 | [3]: /screenshot/Screenshot_20160503-085902.png 38 | [4]: /screenshot/Screenshot_20160503-085945.png 39 | [5]: http://caiyao.name/releases/microreader_1.3.5.apk 40 | [6]: https://github.com/AndroidJiang -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'com.bugtags.library.plugin' 3 | apply plugin: 'com.neenbedankt.android-apt' 4 | 5 | android { 6 | compileSdkVersion 25 7 | buildToolsVersion '25.0.2' 8 | repositories { 9 | maven { url "https://jitpack.io" } 10 | } 11 | defaultConfig { 12 | applicationId "name.caiyao.microreader" 13 | minSdkVersion 16 14 | targetSdkVersion 25 15 | versionCode 138 16 | versionName '1.3.8' 17 | } 18 | buildTypes { 19 | release { 20 | zipAlignEnabled true 21 | shrinkResources true 22 | minifyEnabled true 23 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 24 | applicationVariants.all { variant -> 25 | variant.outputs.each { output -> 26 | def outputFile = output.outputFile 27 | if (outputFile != null && outputFile.name.endsWith('.apk')) { 28 | // 输出apk名称为XXXX_v1.0_wandoujia.apk 29 | def fileName = "microreader_${defaultConfig.versionName}_${variant.productFlavors[0].name}.apk" 30 | output.outputFile = new File(outputFile.parent, fileName) 31 | } 32 | } 33 | } 34 | } 35 | } 36 | productFlavors { 37 | 38 | caiyao{} 39 | wandoujia {} 40 | baidu {} 41 | c360 {} 42 | bugly {} 43 | xiaomi{} 44 | tencent{} 45 | coolapk{} 46 | 47 | productFlavors.all { flavor -> 48 | flavor.manifestPlaceholders = [UMENG_CHANNEL_VALUE: name] 49 | } 50 | 51 | } 52 | } 53 | 54 | def retrofitVersion = '2.1.0' 55 | dependencies { 56 | compile fileTree(include: ['*.jar'], dir: 'libs') 57 | compile 'com.android.support:appcompat-v7:25.1.0' 58 | compile 'com.android.support:design:25.1.0' 59 | compile 'com.android.support:support-v4:25.1.0' 60 | compile 'com.android.support:palette-v7:25.1.0' 61 | compile 'com.android.support:cardview-v7:25.1.0' 62 | compile 'com.google.code.gson:gson:2.7' 63 | compile 'com.squareup.retrofit2:retrofit:2.0.2' 64 | compile 'io.reactivex:rxjava:1.2.1' 65 | compile 'io.reactivex:rxandroid:1.2.1' 66 | compile 'com.squareup.retrofit2:adapter-rxjava:2.0.2' 67 | compile 'com.squareup.retrofit2:converter-gson:2.0.2' 68 | compile('com.squareup.retrofit2:converter-simplexml:2.0.2') { 69 | exclude module: 'stax' 70 | exclude module: 'stax-api' 71 | exclude module: 'xpp3' 72 | } 73 | compile 'com.jakewharton:butterknife:8.4.0' 74 | apt 'com.jakewharton:butterknife-compiler:8.4.0' 75 | compile 'com.github.bumptech.glide:glide:3.7.0' 76 | compile 'com.bugtags.library:bugtags-lib:latest.integration' 77 | compile 'com.umeng.analytics:analytics:latest.integration' 78 | compile project(':swipebackactivity') 79 | } 80 | 81 | bugtags { 82 | appKey "9c1b1a3234ceeb5b9c531177a93b65ec" 83 | appSecret "74111b89885d79901d577148cfc013d0" 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 26 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 43 | 48 | 54 | 59 | 64 | 70 | 75 | 80 | 81 | 84 | 87 | 88 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /app/src/main/assets/info.js: -------------------------------------------------------------------------------- 1 | //?ж???????????? 2 | function IsImageLoaded() 3 | { 4 | var img=event.srcElement; 5 | 6 | if(img.src.indexOf("picture_place_holder.png") > 0) 7 | { 8 | img.src = img.attributes['loadingsrc'].nodeValue; 9 | } 10 | else if(img.src.indexOf("ruanmei_webview_loadingimage.gif") > 0) 11 | { 12 | } 13 | else 14 | { 15 | if(img.complete) 16 | { 17 | //ios ???????? 18 | var imagesrc = img.attributes['originsrc'].nodeValue; 19 | //document.location = imagesrc.replace("http://","ruanmeipic://"); 20 | ProxyClickPicture.clickImg(imagesrc); 21 | } 22 | else 23 | { 24 | //δ????????????????????????????? 25 | //img.src = img.attributes['originsrc'].nodeValue; 26 | } 27 | } 28 | } 29 | 30 | function imageload() 31 | { 32 | var img=event.srcElement; 33 | 34 | if(img.src.indexOf("ruanmei_webview_loadingimage.gif") > 0) 35 | { 36 | img.src = img.attributes['originsrc'].nodeValue; 37 | } 38 | else 39 | { 40 | } 41 | } 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/MicroApplication.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader; 2 | 3 | import android.app.Application; 4 | import android.content.Context; 5 | 6 | import com.bugtags.library.Bugtags; 7 | import com.bugtags.library.BugtagsOptions; 8 | import com.umeng.analytics.MobclickAgent; 9 | 10 | /** 11 | * Created by 蔡小木 on 2016/3/9 0009. 12 | */ 13 | public class MicroApplication extends Application { 14 | 15 | public static MicroApplication microApplication = null; 16 | 17 | @Override 18 | public void onCreate() { 19 | super.onCreate(); 20 | 21 | BugtagsOptions options = new BugtagsOptions.Builder(). 22 | trackingLocation(true).//是否获取位置 23 | trackingCrashLog(!BuildConfig.DEBUG).//是否收集crash 24 | trackingConsoleLog(true).//是否收集console log 25 | trackingUserSteps(true).//是否收集用户操作步骤 26 | build(); 27 | Bugtags.start("9c1b1a3234ceeb5b9c531177a93b65ec", this, Bugtags.BTGInvocationEventNone, options); 28 | MobclickAgent.setCatchUncaughtExceptions(false); 29 | microApplication = this; 30 | } 31 | 32 | public static Context getContext(){ 33 | return microApplication; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/guokr/GuokrApi.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.guokr; 2 | 3 | import name.caiyao.microreader.bean.guokr.GuokrArticle; 4 | import name.caiyao.microreader.bean.guokr.GuokrHot; 5 | import retrofit2.http.GET; 6 | import retrofit2.http.Path; 7 | import retrofit2.http.Query; 8 | import rx.Observable; 9 | 10 | /** 11 | * Created by 蔡小木 on 2016/3/7 0007. 12 | */ 13 | public interface GuokrApi { 14 | 15 | @GET("http://apis.guokr.com/minisite/article.json?retrieve_type=by_minisite") 16 | Observable getGuokrHot(@Query("offset") int offset); 17 | 18 | @GET("http://apis.guokr.com/minisite/article/{id}.json") 19 | Observable getGuokrArticle(@Path("id") String id); 20 | } 21 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/guokr/GuokrRequest.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.guokr; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import name.caiyao.microreader.MicroApplication; 7 | import name.caiyao.microreader.utils.NetWorkUtil; 8 | import okhttp3.Cache; 9 | import okhttp3.Interceptor; 10 | import okhttp3.OkHttpClient; 11 | import okhttp3.Response; 12 | import retrofit2.Retrofit; 13 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; 14 | import retrofit2.converter.gson.GsonConverterFactory; 15 | 16 | /** 17 | * Created by 蔡小木 on 2016/3/7 0007. 18 | */ 19 | public class GuokrRequest { 20 | 21 | private GuokrRequest() {} 22 | 23 | private static final String CACHE_CONTROL = "Cache-Control"; 24 | private static final Object monitor = new Object(); 25 | private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() { 26 | @Override 27 | public Response intercept(Chain chain) throws IOException { 28 | Response originalResponse = chain.proceed(chain.request()); 29 | if (NetWorkUtil.isNetWorkAvailable(MicroApplication.getContext())) { 30 | int maxAge = 60; // 在线缓存在1分钟内可读取 31 | return originalResponse.newBuilder() 32 | .removeHeader("Pragma") 33 | .removeHeader(CACHE_CONTROL) 34 | .header(CACHE_CONTROL, "public, max-age=" + maxAge) 35 | .build(); 36 | } else { 37 | int maxStale = 60 * 60 * 24 * 28; // 离线时缓存保存4周 38 | return originalResponse.newBuilder() 39 | .removeHeader("Pragma") 40 | .removeHeader(CACHE_CONTROL) 41 | .header(CACHE_CONTROL, "public, only-if-cached, max-stale=" + maxStale) 42 | .build(); 43 | } 44 | } 45 | }; 46 | 47 | private static File httpCacheDirectory = new File(MicroApplication.getContext().getCacheDir(), "guokrCache"); 48 | private static int cacheSize = 10 * 1024 * 1024; // 10 MiB 49 | private static Cache cache = new Cache(httpCacheDirectory, cacheSize); 50 | 51 | private static OkHttpClient client = new OkHttpClient.Builder() 52 | .addNetworkInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR) 53 | .addInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR)//不添加离线缓存无效 54 | .cache(cache) 55 | .build(); 56 | 57 | private static GuokrApi guokrApi = null; 58 | 59 | public static GuokrApi getGuokrApi() { 60 | synchronized (monitor) { 61 | if (guokrApi == null) { 62 | guokrApi = new Retrofit.Builder() 63 | .baseUrl("http://www.guokr.com") 64 | .client(client) 65 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) 66 | .addConverterFactory(GsonConverterFactory.create()) 67 | .build().create(GuokrApi.class); 68 | } 69 | return guokrApi; 70 | } 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/itHome/ItHomeApi.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.itHome; 2 | 3 | import name.caiyao.microreader.bean.itHome.ItHomeArticle; 4 | import name.caiyao.microreader.bean.itHome.ItHomeResponse; 5 | import retrofit2.http.GET; 6 | import retrofit2.http.Path; 7 | import rx.Observable; 8 | 9 | /** 10 | * Created by 蔡小木 on 2016/3/24 0024. 11 | */ 12 | public interface ItHomeApi { 13 | 14 | @GET("/xml/newslist/news.xml") 15 | Observable getItHomeNews(); 16 | 17 | @GET("/xml/newslist/news_{minNewsId}.xml") 18 | Observable getMoreItHomeNews(@Path("minNewsId") String minNewsId); 19 | 20 | @GET("/xml/newscontent/{id}.xml") 21 | Observable getItHomeArticle(@Path("id") String id); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/itHome/ItHomeRequest.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.itHome; 2 | 3 | import android.util.Log; 4 | 5 | import java.io.File; 6 | import java.io.IOException; 7 | 8 | import name.caiyao.microreader.MicroApplication; 9 | import name.caiyao.microreader.utils.NetWorkUtil; 10 | import okhttp3.Cache; 11 | import okhttp3.Interceptor; 12 | import okhttp3.OkHttpClient; 13 | import okhttp3.Response; 14 | import retrofit2.Retrofit; 15 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; 16 | import retrofit2.converter.simplexml.SimpleXmlConverterFactory; 17 | 18 | /** 19 | * Created by 蔡小木 on 2016/3/24 0024. 20 | */ 21 | public class ItHomeRequest { 22 | 23 | private ItHomeRequest() {} 24 | 25 | private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() { 26 | @Override 27 | public Response intercept(Chain chain) throws IOException { 28 | Response originalResponse = chain.proceed(chain.request()); 29 | if (NetWorkUtil.isNetWorkAvailable(MicroApplication.getContext())) { 30 | int maxAge = 60; // 在线缓存在1分钟内可读取 31 | return originalResponse.newBuilder() 32 | .header("Cache-Control", "public, max-age=" + maxAge) 33 | .build(); 34 | } else { 35 | int maxStale = 60 * 60 * 24 * 28; // 离线时缓存保存4周 36 | Log.i("TAG","离线缓存"); 37 | return originalResponse.newBuilder() 38 | .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) 39 | .build(); 40 | } 41 | } 42 | }; 43 | 44 | private static File httpCacheDirectory = new File(MicroApplication.getContext().getCacheDir(), "itCache"); 45 | 46 | private static int cacheSize = 10 * 1024 * 1024; // 10 MiB 47 | private static Cache cache = new Cache(httpCacheDirectory, cacheSize); 48 | private static OkHttpClient client = new OkHttpClient.Builder() 49 | .addNetworkInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR) 50 | .addInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR) 51 | .cache(cache) 52 | .build(); 53 | 54 | private static ItHomeApi itHomeApi = null; 55 | private static final Object monitor = new Object(); 56 | 57 | public static ItHomeApi getItHomeApi() { 58 | synchronized (monitor) { 59 | if (itHomeApi == null) { 60 | itHomeApi = new Retrofit.Builder() 61 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) 62 | .addConverterFactory(SimpleXmlConverterFactory.create()) 63 | .client(client) 64 | .baseUrl("http://api.ithome.com") 65 | .build().create(ItHomeApi.class); 66 | } 67 | return itHomeApi; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/util/UtilApi.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.util; 2 | 3 | import okhttp3.ResponseBody; 4 | import retrofit2.http.Field; 5 | import retrofit2.http.FormUrlEncoded; 6 | import retrofit2.http.POST; 7 | import rx.Observable; 8 | 9 | /** 10 | * Created by 蔡小木 on 2016/3/9 0009. 11 | */ 12 | public interface UtilApi { 13 | 14 | @FormUrlEncoded 15 | @POST("http://www.weibovideo.com/controller.php") 16 | Observable getVideoUrl(@Field("weibourl") String weibourl); 17 | } 18 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/util/UtilRequest.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.util; 2 | 3 | import retrofit2.Retrofit; 4 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; 5 | 6 | /** 7 | * Created by 蔡小木 on 2016/3/9 0009. 8 | */ 9 | public class UtilRequest { 10 | 11 | private UtilRequest() {} 12 | 13 | private static UtilApi utilApi = null; 14 | private static final Object monitor = new Object(); 15 | 16 | public static UtilApi getUtilApi() { 17 | synchronized (monitor) { 18 | if (utilApi == null) { 19 | utilApi = new Retrofit.Builder() 20 | .baseUrl("http://www.baidu.com") 21 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) 22 | .build().create(UtilApi.class); 23 | } 24 | return utilApi; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/weiboVideo/VideoRequest.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.weiboVideo; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import name.caiyao.microreader.MicroApplication; 7 | import name.caiyao.microreader.utils.NetWorkUtil; 8 | import okhttp3.Cache; 9 | import okhttp3.Interceptor; 10 | import okhttp3.OkHttpClient; 11 | import okhttp3.Response; 12 | import retrofit2.Retrofit; 13 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; 14 | import retrofit2.converter.gson.GsonConverterFactory; 15 | 16 | /** 17 | * Created by YiuChoi on 2016/4/12 0012. 18 | */ 19 | public class VideoRequest { 20 | 21 | private VideoRequest() {} 22 | 23 | private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() { 24 | @Override 25 | public Response intercept(Chain chain) throws IOException { 26 | Response originalResponse = chain.proceed(chain.request()); 27 | if (NetWorkUtil.isNetWorkAvailable(MicroApplication.getContext())) { 28 | int maxAge = 60; // 在线缓存在1分钟内可读取 29 | return originalResponse.newBuilder() 30 | .header("Cache-Control", "public, max-age=" + maxAge) 31 | .build(); 32 | } else { 33 | int maxStale = 60 * 60 * 24 * 28; // 离线时缓存保存4周 34 | return originalResponse.newBuilder() 35 | .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) 36 | .build(); 37 | } 38 | } 39 | }; 40 | 41 | private static File httpCacheDirectory = new File(MicroApplication.getContext().getCacheDir(), "videoCache"); 42 | 43 | private static int cacheSize = 10 * 1024 * 1024; // 10 MiB 44 | private static Cache cache = new Cache(httpCacheDirectory, cacheSize); 45 | private static OkHttpClient client = new OkHttpClient.Builder() 46 | .addNetworkInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR) 47 | .addInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR) 48 | .cache(cache) 49 | .build(); 50 | 51 | private static VideoRequstApi sVideoRequstApi = null; 52 | private static final Object monitor = new Object(); 53 | public static VideoRequstApi getVideoRequstApi() { 54 | synchronized (monitor){ 55 | if (sVideoRequstApi == null) { 56 | sVideoRequstApi = new Retrofit.Builder() 57 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) 58 | .addConverterFactory(GsonConverterFactory.create()) 59 | .client(client) 60 | .baseUrl("http://www.baidu.com") 61 | .build().create(VideoRequstApi.class); 62 | } 63 | return sVideoRequstApi; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/weiboVideo/VideoRequstApi.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.weiboVideo; 2 | 3 | import name.caiyao.microreader.bean.weiboVideo.WeiboVideoResponse; 4 | import retrofit2.http.GET; 5 | import retrofit2.http.Query; 6 | import rx.Observable; 7 | 8 | /** 9 | * Created by YiuChoi on 2016/4/12 0012. 10 | */ 11 | public interface VideoRequstApi { 12 | 13 | @GET("http://m.weibo.cn/page/json?containerid=1005051914635823_-_WEIBO_SECOND_PROFILE_WEIBO&") 14 | Observable getWeiboVideo(@Query("page") int page); 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/weixin/TxApi.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.weixin; 2 | 3 | import name.caiyao.microreader.bean.weixin.TxWeixinResponse; 4 | import name.caiyao.microreader.config.Config; 5 | import retrofit2.http.GET; 6 | import retrofit2.http.Query; 7 | import rx.Observable; 8 | 9 | /** 10 | * Created by 蔡小木 on 2016/3/4 0004. 11 | */ 12 | public interface TxApi { 13 | @GET("/wxnew/?key=" + Config.TX_APP_KEY + "&num=20") 14 | Observable getWeixin(@Query("page") int page); 15 | } -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/weixin/TxRequest.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.weixin; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import name.caiyao.microreader.MicroApplication; 7 | import name.caiyao.microreader.utils.NetWorkUtil; 8 | import okhttp3.Cache; 9 | import okhttp3.Interceptor; 10 | import okhttp3.OkHttpClient; 11 | import okhttp3.Response; 12 | import retrofit2.Retrofit; 13 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; 14 | import retrofit2.converter.gson.GsonConverterFactory; 15 | 16 | /** 17 | * Created by 蔡小木 on 2016/3/4 0004. 18 | */ 19 | public class TxRequest { 20 | 21 | private TxRequest() {} 22 | 23 | private static final String CACHE_CONTROL = "Cache-Control"; 24 | private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() { 25 | @Override 26 | public Response intercept(Chain chain) throws IOException { 27 | Response originalResponse = chain.proceed(chain.request()); 28 | if (NetWorkUtil.isNetWorkAvailable(MicroApplication.getContext())) { 29 | int maxAge = 60; // 在线缓存在1分钟内可读取 30 | return originalResponse.newBuilder() 31 | .removeHeader("Pragma") 32 | .removeHeader(CACHE_CONTROL) 33 | .header(CACHE_CONTROL, "public, max-age=" + maxAge) 34 | .build(); 35 | } else { 36 | int maxStale = 60 * 60 * 24 * 28; // 离线时缓存保存4周 37 | return originalResponse.newBuilder() 38 | .removeHeader("Pragma") 39 | .removeHeader(CACHE_CONTROL) 40 | .header(CACHE_CONTROL, "public, only-if-cached, max-stale=" + maxStale) 41 | .build(); 42 | } 43 | } 44 | }; 45 | private static File httpCacheDirectory = new File(MicroApplication.getContext().getCacheDir(), "txCache"); 46 | 47 | private static int cacheSize = 10 * 1024 * 1024; // 10 MiB 48 | private static Cache cache = new Cache(httpCacheDirectory, cacheSize); 49 | private static OkHttpClient client = new OkHttpClient.Builder() 50 | .addNetworkInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR) 51 | .addInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR) 52 | .cache(cache) 53 | .build(); 54 | 55 | private static TxApi txApi = null; 56 | private static final Object monitor = new Object(); 57 | public static TxApi getTxApi() { 58 | synchronized (monitor){ 59 | if (txApi == null) { 60 | txApi = new Retrofit.Builder() 61 | .baseUrl("http://api.huceo.com") 62 | .client(client) 63 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) 64 | .addConverterFactory(GsonConverterFactory.create()) 65 | .build().create(TxApi.class); 66 | } 67 | return txApi; 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/zhihu/ZhihuApi.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.zhihu; 2 | 3 | import name.caiyao.microreader.bean.UpdateItem; 4 | import name.caiyao.microreader.bean.image.ImageResponse; 5 | import name.caiyao.microreader.bean.zhihu.ZhihuDaily; 6 | import name.caiyao.microreader.bean.zhihu.ZhihuStory; 7 | import retrofit2.http.GET; 8 | import retrofit2.http.Path; 9 | import rx.Observable; 10 | 11 | /** 12 | * Created by 蔡小木 on 2016/3/6 0006. 13 | */ 14 | public interface ZhihuApi { 15 | 16 | @GET("/api/4/news/latest") 17 | Observable getLastDaily(); 18 | 19 | @GET("/api/4/news/before/{date}") 20 | Observable getTheDaily(@Path("date") String date); 21 | 22 | @GET("/api/4/news/{id}") 23 | Observable getZhihuStory(@Path("id") String id); 24 | 25 | @GET("http://lab.zuimeia.com/wallpaper/category/1/?page_size=1") 26 | Observable getImage(); 27 | 28 | @GET("http://caiyao.name/releases/MrUpdate.json") 29 | Observable getUpdateInfo(); 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/api/zhihu/ZhihuRequest.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.api.zhihu; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import name.caiyao.microreader.MicroApplication; 7 | import name.caiyao.microreader.utils.NetWorkUtil; 8 | import okhttp3.Cache; 9 | import okhttp3.Interceptor; 10 | import okhttp3.OkHttpClient; 11 | import okhttp3.Response; 12 | import retrofit2.Retrofit; 13 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory; 14 | import retrofit2.converter.gson.GsonConverterFactory; 15 | 16 | /** 17 | * Created by 蔡小木 on 2016/3/6 0006. 18 | */ 19 | public class ZhihuRequest { 20 | 21 | private ZhihuRequest() {} 22 | 23 | private static final Interceptor REWRITE_CACHE_CONTROL_INTERCEPTOR = new Interceptor() { 24 | @Override 25 | public Response intercept(Chain chain) throws IOException { 26 | Response originalResponse = chain.proceed(chain.request()); 27 | if (NetWorkUtil.isNetWorkAvailable(MicroApplication.getContext())) { 28 | int maxAge = 60; // 在线缓存在1分钟内可读取 29 | return originalResponse.newBuilder() 30 | .removeHeader("Pragma") 31 | .removeHeader("Cache-Control") 32 | .header("Cache-Control", "public, max-age=" + maxAge) 33 | .build(); 34 | } else { 35 | int maxStale = 60 * 60 * 24 * 28; // 离线时缓存保存4周 36 | return originalResponse.newBuilder() 37 | .removeHeader("Pragma") 38 | .removeHeader("Cache-Control") 39 | .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) 40 | .build(); 41 | } 42 | } 43 | }; 44 | private static File httpCacheDirectory = new File(MicroApplication.getContext().getCacheDir(), "zhihuCache"); 45 | 46 | private static int cacheSize = 10 * 1024 * 1024; // 10 MiB 47 | private static Cache cache = new Cache(httpCacheDirectory, cacheSize); 48 | private static OkHttpClient client = new OkHttpClient.Builder() 49 | .addNetworkInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR) 50 | .addInterceptor(REWRITE_CACHE_CONTROL_INTERCEPTOR) 51 | .cache(cache) 52 | .build(); 53 | 54 | private static ZhihuApi zhihuApi = null; 55 | private static final Object monitor = new Object(); 56 | public static ZhihuApi getZhihuApi() { 57 | synchronized (monitor){ 58 | if (zhihuApi == null) { 59 | zhihuApi = new Retrofit.Builder() 60 | .baseUrl("http://news-at.zhihu.com") 61 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) 62 | .client(client) 63 | .addConverterFactory(GsonConverterFactory.create()) 64 | .build().create(ZhihuApi.class); 65 | } 66 | return zhihuApi; 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/UpdateItem.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by YiuChoi on 2016/4/7 0007. 7 | */ 8 | public class UpdateItem { 9 | @SerializedName("versionCode") 10 | private int versionCode; 11 | @SerializedName("versionName") 12 | private String versionName; 13 | @SerializedName("downloadUrl") 14 | private String downloadUrl; 15 | @SerializedName("releaseNote") 16 | private String releaseNote; 17 | 18 | public int getVersionCode() { 19 | return versionCode; 20 | } 21 | 22 | public void setVersionCode(int versionCode) { 23 | this.versionCode = versionCode; 24 | } 25 | 26 | public String getVersionName() { 27 | return versionName; 28 | } 29 | 30 | public void setVersionName(String versionName) { 31 | this.versionName = versionName; 32 | } 33 | 34 | public String getDownloadUrl() { 35 | return downloadUrl; 36 | } 37 | 38 | public void setDownloadUrl(String downloadUrl) { 39 | this.downloadUrl = downloadUrl; 40 | } 41 | 42 | public String getReleaseNote() { 43 | return releaseNote; 44 | } 45 | 46 | public void setReleaseNote(String releaseNote) { 47 | this.releaseNote = releaseNote; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/guokr/GuokrArticle.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.guokr; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/3/21 0021. 7 | */ 8 | public class GuokrArticle { 9 | @SerializedName("result") 10 | private GuokrArticleResult result; 11 | 12 | public GuokrArticleResult getResult() { 13 | return result; 14 | } 15 | 16 | public void setResult(GuokrArticleResult result) { 17 | this.result = result; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/guokr/GuokrArticleResult.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.guokr; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/3/21 0021. 7 | * 8 | */ 9 | public class GuokrArticleResult { 10 | @SerializedName("small_image") 11 | private String mSmallImage; 12 | @SerializedName("title") 13 | private String title; 14 | @SerializedName("url") 15 | private String url; 16 | @SerializedName("content") 17 | private String content; 18 | 19 | public String getSmallImage() { 20 | return mSmallImage; 21 | } 22 | 23 | public void setSmallImage(String smallImage) { 24 | this.mSmallImage = smallImage; 25 | } 26 | 27 | public String getTitle() { 28 | return title; 29 | } 30 | 31 | public void setTitle(String title) { 32 | this.title = title; 33 | } 34 | 35 | public String getUrl() { 36 | return url; 37 | } 38 | 39 | public void setUrl(String url) { 40 | this.url = url; 41 | } 42 | 43 | public String getContent() { 44 | return content; 45 | } 46 | 47 | public void setContent(String content) { 48 | this.content = content; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/guokr/GuokrHot.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.guokr; 2 | 3 | 4 | import com.google.gson.annotations.SerializedName; 5 | 6 | import java.util.ArrayList; 7 | 8 | /** 9 | * Created by 蔡小木 on 2016/3/21 0021. 10 | */ 11 | public class GuokrHot { 12 | @SerializedName("result") 13 | private ArrayList result = new ArrayList<>(); 14 | 15 | public void setResult(ArrayList result) { 16 | this.result = result; 17 | } 18 | 19 | public ArrayList getResult() { 20 | return result; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/guokr/GuokrHotItem.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.guokr; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/3/21 0021. 7 | * 8 | */ 9 | public class GuokrHotItem { 10 | @SerializedName("id") 11 | private String id; 12 | @SerializedName("title") 13 | private String title; 14 | @SerializedName("small_image") 15 | private String mSmallImage; 16 | @SerializedName("summary") 17 | private String summary; 18 | @SerializedName("date_published") 19 | private String mTime; 20 | 21 | public String getId() { 22 | return id; 23 | } 24 | 25 | public void setId(String id) { 26 | this.id = id; 27 | } 28 | 29 | public String getTitle() { 30 | return title; 31 | } 32 | 33 | public void setTitle(String title) { 34 | this.title = title; 35 | } 36 | 37 | public String getSmallImage() { 38 | return mSmallImage; 39 | } 40 | 41 | public void setSmallImage(String smallImage) { 42 | this.mSmallImage = smallImage; 43 | } 44 | 45 | public String getSummary() { 46 | return summary; 47 | } 48 | 49 | public void setSummary(String summary) { 50 | this.summary = summary; 51 | } 52 | 53 | public String getTime() { 54 | return mTime.replace("+08:00","").replace("T"," "); 55 | } 56 | 57 | public void setTime(String time) { 58 | mTime = time; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/image/ImageData.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.image; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.ArrayList; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/3/21 0021. 9 | */ 10 | public class ImageData { 11 | @SerializedName("images") 12 | private ArrayList images; 13 | 14 | public ArrayList getImages() { 15 | return images; 16 | } 17 | 18 | public void setImages(ArrayList images) { 19 | this.images = images; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/image/ImageItem.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.image; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/3/21 0021. 7 | */ 8 | public class ImageItem { 9 | @SerializedName("description") 10 | private String description; 11 | @SerializedName("image_url") 12 | private String mImageUrl; 13 | 14 | public String getDescription() { 15 | return description; 16 | } 17 | 18 | public void setDescription(String description) { 19 | this.description = description; 20 | } 21 | 22 | public String getImageUrl() { 23 | return mImageUrl; 24 | } 25 | 26 | public void setImageUrl(String imageUrl) { 27 | this.mImageUrl = imageUrl; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/image/ImageResponse.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.image; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/3/21 0021. 7 | */ 8 | public class ImageResponse { 9 | @SerializedName("data") 10 | private ImageData data; 11 | 12 | public ImageData getData() { 13 | return data; 14 | } 15 | 16 | public void setData(ImageData data) { 17 | this.data = data; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/itHome/ItHomeArticle.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.itHome; 2 | 3 | import org.simpleframework.xml.Element; 4 | import org.simpleframework.xml.Path; 5 | import org.simpleframework.xml.Root; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/3/24 0024. 9 | */ 10 | @Root(name = "rss",strict=false) 11 | public class ItHomeArticle { 12 | @Path("channel/item") 13 | @Element(name = "newssource") 14 | private String newssource; 15 | @Path("channel/item") 16 | @Element(name = "newsauthor") 17 | private String newsauthor; 18 | @Path("channel/item") 19 | @Element(name = "detail") 20 | private String detail; 21 | @Path("channel/item") 22 | 23 | public String getNewssource() { 24 | return newssource; 25 | } 26 | 27 | public void setNewssource(String newssource) { 28 | this.newssource = newssource; 29 | } 30 | 31 | public String getAuthor() { 32 | return newsauthor; 33 | } 34 | 35 | public void setAuthor(String author) { 36 | this.newsauthor = author; 37 | } 38 | 39 | public String getDetail() { 40 | return detail; 41 | } 42 | 43 | public void setDetail(String detail) { 44 | this.detail = detail; 45 | } 46 | 47 | public String getNewsauthor() { 48 | return newsauthor; 49 | } 50 | 51 | public void setNewsauthor(String newsauthor) { 52 | this.newsauthor = newsauthor; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/itHome/ItHomeChannel.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.itHome; 2 | 3 | import org.simpleframework.xml.ElementList; 4 | import org.simpleframework.xml.Root; 5 | 6 | import java.util.ArrayList; 7 | 8 | /** 9 | * Created by 蔡小木 on 2016/3/24 0024. 10 | */ 11 | @Root(name = "channel") 12 | public class ItHomeChannel { 13 | @ElementList(inline = true,name = "items") 14 | ArrayList items; 15 | 16 | public ArrayList getItems() { 17 | return items; 18 | } 19 | 20 | public void setItems(ArrayList items) { 21 | this.items = items; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/itHome/ItHomeResponse.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.itHome; 2 | 3 | import org.simpleframework.xml.Attribute; 4 | import org.simpleframework.xml.Element; 5 | import org.simpleframework.xml.Root; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/3/24 0024. 9 | */ 10 | @Root(name = "rss") 11 | public class ItHomeResponse { 12 | @Element(name = "channel") 13 | ItHomeChannel channel; 14 | 15 | @Attribute(name = "version") 16 | String version; 17 | 18 | public ItHomeChannel getChannel() { 19 | return channel; 20 | } 21 | 22 | public void setChannel(ItHomeChannel channel) { 23 | this.channel = channel; 24 | } 25 | 26 | public String getVersion() { 27 | return version; 28 | } 29 | 30 | public void setVersion(String version) { 31 | this.version = version; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/weiboVideo/WeiboVideoBlog.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.weiboVideo; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * Created by YiuChoi on 2016/4/12 0012. 10 | */ 11 | public class WeiboVideoBlog implements Parcelable { 12 | @SerializedName("mblog") 13 | private WeiboVideoMBlog mBlog; 14 | 15 | protected WeiboVideoBlog(Parcel in) { 16 | in.readParcelable(WeiboVideoMBlog.class.getClassLoader()); 17 | } 18 | 19 | public WeiboVideoMBlog getBlog() { 20 | return mBlog; 21 | } 22 | 23 | public void setBlog(WeiboVideoMBlog blog) { 24 | mBlog = blog; 25 | } 26 | 27 | public static final Creator CREATOR = new Creator() { 28 | @Override 29 | public WeiboVideoBlog createFromParcel(Parcel in) { 30 | return new WeiboVideoBlog(in); 31 | } 32 | 33 | @Override 34 | public WeiboVideoBlog[] newArray(int size) { 35 | return new WeiboVideoBlog[size]; 36 | } 37 | }; 38 | 39 | @Override 40 | public int describeContents() { 41 | return 0; 42 | } 43 | 44 | @Override 45 | public void writeToParcel(Parcel dest, int flags) { 46 | dest.writeParcelable(mBlog, flags); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/weiboVideo/WeiboVideoCardsItem.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.weiboVideo; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.ArrayList; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/4/12 0012. 9 | */ 10 | public class WeiboVideoCardsItem { 11 | //=mod/empty表示没有数据 12 | @SerializedName("mod_type") 13 | private String modType; 14 | @SerializedName("card_group") 15 | private ArrayList mBlogs; 16 | 17 | public String getModType() { 18 | return modType; 19 | } 20 | 21 | public void setModType(String modType) { 22 | this.modType = modType; 23 | } 24 | 25 | 26 | public ArrayList getBlogs() { 27 | return mBlogs; 28 | } 29 | 30 | public void setBlogs(ArrayList blogs) { 31 | mBlogs = blogs; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/weiboVideo/WeiboVideoMBlog.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.weiboVideo; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * Created by YiuChoi on 2016/4/12 0012. 10 | */ 11 | public class WeiboVideoMBlog implements Parcelable{ 12 | @SerializedName("created_at") 13 | private String createTime; 14 | @SerializedName("text") 15 | private String text; 16 | @SerializedName("page_info") 17 | private WeiboVideoPageInfo mPageInfo; 18 | @SerializedName("retweeted_status") 19 | private WeiboVideoMBlog mBlog; 20 | 21 | protected WeiboVideoMBlog(Parcel in) { 22 | createTime = in.readString(); 23 | text = in.readString(); 24 | mPageInfo = in.readParcelable(WeiboVideoPageInfo.class.getClassLoader()); 25 | mBlog = in.readParcelable(WeiboVideoMBlog.class.getClassLoader()); 26 | } 27 | 28 | public static final Creator CREATOR = new Creator() { 29 | @Override 30 | public WeiboVideoMBlog createFromParcel(Parcel in) { 31 | return new WeiboVideoMBlog(in); 32 | } 33 | 34 | @Override 35 | public WeiboVideoMBlog[] newArray(int size) { 36 | return new WeiboVideoMBlog[size]; 37 | } 38 | }; 39 | 40 | public String getCreateTime() { 41 | return createTime; 42 | } 43 | 44 | public void setCreateTime(String createTime) { 45 | this.createTime = createTime; 46 | } 47 | 48 | public String getText() { 49 | return text; 50 | } 51 | 52 | public void setText(String text) { 53 | this.text = text; 54 | } 55 | 56 | public WeiboVideoPageInfo getPageInfo() { 57 | return mPageInfo; 58 | } 59 | 60 | public void setPageInfo(WeiboVideoPageInfo pageInfo) { 61 | mPageInfo = pageInfo; 62 | } 63 | 64 | public WeiboVideoMBlog getmBlog() { 65 | return mBlog; 66 | } 67 | 68 | public void setmBlog(WeiboVideoMBlog mBlog) { 69 | this.mBlog = mBlog; 70 | } 71 | 72 | @Override 73 | public int describeContents() { 74 | return 0; 75 | } 76 | 77 | @Override 78 | public void writeToParcel(Parcel dest, int flags) { 79 | dest.writeString(createTime); 80 | dest.writeString(text); 81 | dest.writeParcelable(mPageInfo,flags); 82 | dest.writeParcelable(mBlog, flags); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/weiboVideo/WeiboVideoPageInfo.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.weiboVideo; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | import com.google.gson.annotations.SerializedName; 7 | 8 | /** 9 | * Created by YiuChoi on 2016/4/12 0012. 10 | */ 11 | public class WeiboVideoPageInfo implements Parcelable{ 12 | @SerializedName("page_pic") 13 | private String videoPic; 14 | @SerializedName("page_url") 15 | private String videoUrl; 16 | 17 | protected WeiboVideoPageInfo(Parcel in) { 18 | videoPic = in.readString(); 19 | videoUrl = in.readString(); 20 | } 21 | 22 | public static final Creator CREATOR = new Creator() { 23 | @Override 24 | public WeiboVideoPageInfo createFromParcel(Parcel in) { 25 | return new WeiboVideoPageInfo(in); 26 | } 27 | 28 | @Override 29 | public WeiboVideoPageInfo[] newArray(int size) { 30 | return new WeiboVideoPageInfo[size]; 31 | } 32 | }; 33 | 34 | public String getVideoPic() { 35 | return videoPic; 36 | } 37 | 38 | public void setVideoPic(String videoPic) { 39 | this.videoPic = videoPic; 40 | } 41 | 42 | public String getVideoUrl() { 43 | if (videoUrl.contains("http://miaopai.com")) 44 | videoUrl = videoUrl.replace("http://miaopai.com", "http://www.miaopai.com"); 45 | return videoUrl; 46 | } 47 | 48 | public void setVideoUrl(String videoUrl) { 49 | this.videoUrl = videoUrl; 50 | } 51 | 52 | @Override 53 | public int describeContents() { 54 | return 0; 55 | } 56 | 57 | @Override 58 | public void writeToParcel(Parcel dest, int flags) { 59 | dest.writeString(videoPic); 60 | dest.writeString(videoUrl); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/weiboVideo/WeiboVideoResponse.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.weiboVideo; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by YiuChoi on 2016/4/12 0012. 7 | */ 8 | public class WeiboVideoResponse { 9 | @SerializedName("cards") 10 | private WeiboVideoCardsItem[] cardsItems; 11 | 12 | public WeiboVideoCardsItem[] getCardsItems() { 13 | return cardsItems; 14 | } 15 | 16 | public void setCardsItems(WeiboVideoCardsItem[] cardsItems) { 17 | this.cardsItems = cardsItems; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/weixin/TxWeixinResponse.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.weixin; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.ArrayList; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/3/4 0004. 9 | */ 10 | public class TxWeixinResponse{ 11 | @SerializedName("code") 12 | private int code; 13 | @SerializedName("msg") 14 | private String msg; 15 | @SerializedName("newslist") 16 | private ArrayList newslist; 17 | 18 | 19 | public int getCode() { 20 | return code; 21 | } 22 | 23 | public void setCode(int code) { 24 | this.code = code; 25 | } 26 | 27 | public String getMsg() { 28 | return msg; 29 | } 30 | 31 | public void setMsg(String msg) { 32 | this.msg = msg; 33 | } 34 | 35 | public ArrayList getNewslist() { 36 | return newslist; 37 | } 38 | 39 | public void setNewslist(ArrayList newslist) { 40 | this.newslist = newslist; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/weixin/WeixinNews.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.weixin; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/3/4 0004. 7 | */ 8 | public class WeixinNews { 9 | @SerializedName("ctime") 10 | private String ctime; 11 | @SerializedName("title") 12 | private String title; 13 | @SerializedName("description") 14 | private String description; 15 | @SerializedName("picUrl") 16 | private String picUrl; 17 | @SerializedName("url") 18 | private String url; 19 | 20 | public String getHottime() { 21 | return ctime; 22 | } 23 | 24 | public void setHottime(String hottime) { 25 | this.ctime = hottime; 26 | } 27 | 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public void setTitle(String title) { 33 | this.title = title; 34 | } 35 | 36 | public String getDescription() { 37 | return description; 38 | } 39 | 40 | public void setDescription(String description) { 41 | this.description = description; 42 | } 43 | 44 | public String getPicUrl() { 45 | return picUrl; 46 | } 47 | 48 | public void setPicUrl(String picUrl) { 49 | this.picUrl = picUrl; 50 | } 51 | 52 | public String getUrl() { 53 | return url; 54 | } 55 | 56 | public void setUrl(String url) { 57 | this.url = url; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/zhihu/ZhihuDaily.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.zhihu; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.ArrayList; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/3/6 0006. 9 | */ 10 | public class ZhihuDaily{ 11 | @SerializedName("date") 12 | private String date; 13 | @SerializedName("top_stories") 14 | private ArrayList mZhihuDailyItems; 15 | @SerializedName("stories") 16 | private ArrayList stories; 17 | 18 | public String getDate() { 19 | return date; 20 | } 21 | 22 | public void setDate(String date) { 23 | this.date = date; 24 | } 25 | 26 | public ArrayList getZhihuDailyItems() { 27 | return mZhihuDailyItems; 28 | } 29 | 30 | public void setZhihuDailyItems(ArrayList zhihuDailyItems) { 31 | this.mZhihuDailyItems = zhihuDailyItems; 32 | } 33 | 34 | public ArrayList getStories() { 35 | return stories; 36 | } 37 | 38 | public void setStories(ArrayList stories) { 39 | this.stories = stories; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/zhihu/ZhihuDailyItem.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.zhihu; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/3/6 0006. 7 | */ 8 | public class ZhihuDailyItem{ 9 | @SerializedName("images") 10 | private String[] images; 11 | @SerializedName("type") 12 | private int type; 13 | @SerializedName("id") 14 | private String id; 15 | @SerializedName("title") 16 | private String title; 17 | private String date; 18 | 19 | public String[] getImages() { 20 | return images; 21 | } 22 | 23 | public void setImages(String[] images) { 24 | this.images = images; 25 | } 26 | 27 | public int getType() { 28 | return type; 29 | } 30 | 31 | public void setType(int type) { 32 | this.type = type; 33 | } 34 | 35 | public String getId() { 36 | return id; 37 | } 38 | 39 | public void setId(String id) { 40 | this.id = id; 41 | } 42 | 43 | public String getTitle() { 44 | return title; 45 | } 46 | 47 | public void setTitle(String title) { 48 | this.title = title; 49 | } 50 | 51 | public String getDate() { 52 | return date; 53 | } 54 | 55 | public void setDate(String date) { 56 | this.date = date; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/bean/zhihu/ZhihuStory.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.bean.zhihu; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/3/7 0007. 7 | */ 8 | public class ZhihuStory { 9 | @SerializedName("body") 10 | private String body; 11 | @SerializedName("title") 12 | private String title; 13 | @SerializedName("image") 14 | private String image; 15 | @SerializedName("share_url") 16 | private String mShareUrl; 17 | @SerializedName("css") 18 | private String[] css; 19 | 20 | public String getBody() { 21 | return body; 22 | } 23 | 24 | public void setBody(String body) { 25 | this.body = body; 26 | } 27 | 28 | public String getTitle() { 29 | return title; 30 | } 31 | 32 | public void setTitle(String title) { 33 | this.title = title; 34 | } 35 | 36 | public String getImage() { 37 | return image; 38 | } 39 | 40 | public void setImage(String image) { 41 | this.image = image; 42 | } 43 | 44 | public String getShareUrl() { 45 | return mShareUrl; 46 | } 47 | 48 | public void setShareUrl(String shareUrl) { 49 | this.mShareUrl = shareUrl; 50 | } 51 | 52 | public String[] getCss() { 53 | return css; 54 | } 55 | 56 | public void setCss(String[] css) { 57 | this.css = css; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/config/Config.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.config; 2 | 3 | import name.caiyao.microreader.R; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/3/4 0004. 7 | */ 8 | public class Config { 9 | public static final String TX_APP_KEY = "1ae28fc9dd5afadc696ad94cd59426d8"; 10 | 11 | public static final String DB__IS_READ_NAME = "IsRead"; 12 | public static final String WEIXIN = "weixin"; 13 | public static final String GUOKR = "guokr"; 14 | public static final String ZHIHU = "zhihu"; 15 | public static final String VIDEO = "video"; 16 | public static final String IT = "it"; 17 | 18 | public static boolean isNight = false; 19 | 20 | public enum Channel { 21 | WEIXIN( R.string.fragment_wexin_title, R.drawable.icon_weixin), 22 | GUOKR(R.string.fragment_guokr_title, R.drawable.icon_guokr), 23 | ZHIHU(R.string.fragment_zhihu_title, R.drawable.icon_zhihu), 24 | VIDEO(R.string.fragment_video_title, R.drawable.icon_video), 25 | IT( R.string.fragment_it_title, R.drawable.icon_it); 26 | 27 | private int title; 28 | private int icon; 29 | 30 | Channel(int title, int icon) { 31 | this.title = title; 32 | this.icon = icon; 33 | } 34 | 35 | public int getTitle() { 36 | return title; 37 | } 38 | 39 | public int getIcon() { 40 | return icon; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/event/StatusBarEvent.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.event; 2 | 3 | /** 4 | * Created by YiuChoi on 2016/4/7 0007. 5 | */ 6 | public class StatusBarEvent { 7 | } 8 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/29 0029. 5 | */ 6 | public interface BasePresenter { 7 | void unsubcrible(); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IChangeChannelPresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | import java.util.ArrayList; 4 | 5 | import name.caiyao.microreader.config.Config; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/4/26 0026. 9 | */ 10 | public interface IChangeChannelPresenter { 11 | 12 | void getChannel(); 13 | 14 | void saveChannel(ArrayList savedChannel); 15 | } 16 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IGuokrPresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/22 0022. 5 | */ 6 | public interface IGuokrPresenter extends BasePresenter { 7 | void getGuokrHot(int offset); 8 | void getGuokrHotFromCache(int offset); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IItHomeArticlePresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/26 0026. 5 | */ 6 | public interface IItHomeArticlePresenter extends BasePresenter{ 7 | void getItHomeArticle(String id); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IItHomePresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/23 0023. 5 | */ 6 | public interface IItHomePresenter extends BasePresenter{ 7 | void getNewItHomeNews(); 8 | 9 | void getMoreItHomeNews(String lastNewsId); 10 | 11 | void getNewsFromCache(); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IMainPresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/26 0026. 5 | */ 6 | public interface IMainPresenter extends BasePresenter{ 7 | void checkUpdate(); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/ISettingPresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/24 0024. 5 | */ 6 | public interface ISettingPresenter extends BasePresenter { 7 | void checkUpdate(); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IVideoPresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/23 0023. 5 | */ 6 | public interface IVideoPresenter extends BasePresenter{ 7 | void getVideo(int page); 8 | 9 | void getVideoFromCache(int page); 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IWeixinPresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/22 0022. 5 | */ 6 | public interface IWeixinPresenter extends BasePresenter{ 7 | void getWeixinNews(int page); 8 | void getWeixinNewsFromCache(int page); 9 | } 10 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IWelcomePresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/24 0024. 5 | */ 6 | public interface IWelcomePresenter { 7 | void getBackground(); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IZhihuPresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/23 0023. 5 | */ 6 | public interface IZhihuPresenter extends BasePresenter{ 7 | void getLastZhihuNews(); 8 | 9 | void getTheDaily(String date); 10 | 11 | void getLastFromCache(); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/IZhihuStoryPresenter.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/26 0026. 5 | */ 6 | public interface IZhihuStoryPresenter extends BasePresenter{ 7 | void getZhihuStory(String id); 8 | 9 | void getGuokrArticle(String id); 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/impl/BasePresenterImpl.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter.impl; 2 | 3 | import name.caiyao.microreader.presenter.BasePresenter; 4 | import rx.Subscription; 5 | import rx.subscriptions.CompositeSubscription; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/4/29 0029. 9 | */ 10 | public class BasePresenterImpl implements BasePresenter { 11 | 12 | private CompositeSubscription mCompositeSubscription; 13 | 14 | protected void addSubscription(Subscription s) { 15 | if (this.mCompositeSubscription == null) { 16 | this.mCompositeSubscription = new CompositeSubscription(); 17 | } 18 | this.mCompositeSubscription.add(s); 19 | } 20 | 21 | @Override 22 | public void unsubcrible() { 23 | if (this.mCompositeSubscription != null) { 24 | this.mCompositeSubscription.unsubscribe(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/impl/ChangeChannelPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter.impl; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.text.TextUtils; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Collections; 9 | 10 | import name.caiyao.microreader.config.Config; 11 | import name.caiyao.microreader.presenter.IChangeChannelPresenter; 12 | import name.caiyao.microreader.ui.iView.IChangeChannel; 13 | import name.caiyao.microreader.utils.SharePreferenceUtil; 14 | 15 | /** 16 | * Created by 蔡小木 on 2016/4/26 0026. 17 | */ 18 | public class ChangeChannelPresenterImpl implements IChangeChannelPresenter { 19 | 20 | private IChangeChannel mIChangeChannel; 21 | private SharedPreferences mSharedPreferences; 22 | private ArrayList savedChannelList; 23 | private ArrayList dismissChannelList; 24 | 25 | public ChangeChannelPresenterImpl(IChangeChannel changeChannel, Context context) { 26 | mIChangeChannel = changeChannel; 27 | mSharedPreferences = context.getSharedPreferences(SharePreferenceUtil.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE); 28 | savedChannelList = new ArrayList<>(); 29 | dismissChannelList = new ArrayList<>(); 30 | } 31 | 32 | @Override 33 | public void getChannel() { 34 | String savedChannel = mSharedPreferences.getString(SharePreferenceUtil.SAVED_CHANNEL, null); 35 | if (TextUtils.isEmpty(savedChannel)) { 36 | Collections.addAll(savedChannelList, Config.Channel.values()); 37 | } else { 38 | for (String s : savedChannel.split(",")) { 39 | savedChannelList.add(Config.Channel.valueOf(s)); 40 | } 41 | } 42 | for (Config.Channel channel : Config.Channel.values()) { 43 | if (!savedChannelList.contains(channel)) { 44 | dismissChannelList.add(channel); 45 | } 46 | } 47 | mIChangeChannel.showChannel(savedChannelList, dismissChannelList); 48 | } 49 | 50 | @Override 51 | public void saveChannel(ArrayList savedChannel) { 52 | StringBuilder stringBuffer = new StringBuilder(); 53 | for (Config.Channel channel : savedChannel) { 54 | stringBuffer.append(channel.name()).append(","); 55 | } 56 | mSharedPreferences.edit().putString(SharePreferenceUtil.SAVED_CHANNEL, stringBuffer.toString()).apply(); 57 | } 58 | 59 | } 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/impl/GuokrPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter.impl; 2 | 3 | import android.content.Context; 4 | 5 | import com.google.gson.Gson; 6 | 7 | import name.caiyao.microreader.api.guokr.GuokrRequest; 8 | import name.caiyao.microreader.bean.guokr.GuokrHot; 9 | import name.caiyao.microreader.config.Config; 10 | import name.caiyao.microreader.presenter.IGuokrPresenter; 11 | import name.caiyao.microreader.ui.iView.IGuokrFragment; 12 | import name.caiyao.microreader.utils.CacheUtil; 13 | import rx.Observer; 14 | import rx.Subscription; 15 | import rx.android.schedulers.AndroidSchedulers; 16 | import rx.schedulers.Schedulers; 17 | 18 | /** 19 | * Created by 蔡小木 on 2016/4/22 0022. 20 | */ 21 | public class GuokrPresenterImpl extends BasePresenterImpl implements IGuokrPresenter { 22 | 23 | private IGuokrFragment mGuokrFragment; 24 | private CacheUtil mCacheUtil; 25 | 26 | public GuokrPresenterImpl(IGuokrFragment guokrFragment, Context context) { 27 | if (guokrFragment==null) 28 | throw new IllegalArgumentException("guokrFragment must not be null"); 29 | this.mGuokrFragment = guokrFragment; 30 | mCacheUtil = CacheUtil.get(context); 31 | } 32 | 33 | @Override 34 | public void getGuokrHot(final int offset) { 35 | mGuokrFragment.showProgressDialog(); 36 | Subscription s = GuokrRequest.getGuokrApi().getGuokrHot(offset) 37 | .subscribeOn(Schedulers.io()) 38 | .observeOn(AndroidSchedulers.mainThread()) 39 | .subscribe(new Observer() { 40 | @Override 41 | public void onCompleted() { 42 | } 43 | 44 | @Override 45 | public void onError(Throwable e) { 46 | mGuokrFragment.hidProgressDialog(); 47 | mGuokrFragment.showError(e.getMessage()); 48 | } 49 | 50 | @Override 51 | public void onNext(GuokrHot guokrHot) { 52 | mGuokrFragment.hidProgressDialog(); 53 | mGuokrFragment.updateList(guokrHot.getResult()); 54 | mCacheUtil.put(Config.GUOKR + offset, new Gson().toJson(guokrHot)); 55 | } 56 | }); 57 | addSubscription(s); 58 | } 59 | 60 | @Override 61 | public void getGuokrHotFromCache(int offset) { 62 | if (mCacheUtil.getAsJSONObject(Config.GUOKR + offset) != null) { 63 | GuokrHot guokrHot = new Gson().fromJson(mCacheUtil.getAsJSONObject(Config.GUOKR + offset).toString(), GuokrHot.class); 64 | mGuokrFragment.updateList(guokrHot.getResult()); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/impl/ItHomeArticlePresenterImpl.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter.impl; 2 | 3 | import name.caiyao.microreader.api.itHome.ItHomeRequest; 4 | import name.caiyao.microreader.bean.itHome.ItHomeArticle; 5 | import name.caiyao.microreader.presenter.IItHomeArticlePresenter; 6 | import name.caiyao.microreader.ui.iView.IItHomeArticle; 7 | import name.caiyao.microreader.utils.ItHomeUtil; 8 | import rx.Observer; 9 | import rx.Subscription; 10 | import rx.android.schedulers.AndroidSchedulers; 11 | import rx.schedulers.Schedulers; 12 | 13 | /** 14 | * Created by 蔡小木 on 2016/4/26 0026. 15 | */ 16 | public class ItHomeArticlePresenterImpl extends BasePresenterImpl implements IItHomeArticlePresenter { 17 | 18 | private IItHomeArticle mIItHomeArticle; 19 | 20 | public ItHomeArticlePresenterImpl(IItHomeArticle iItHomeArticle) { 21 | if (iItHomeArticle == null) 22 | throw new IllegalArgumentException("iItHomeArticle must not be null"); 23 | mIItHomeArticle = iItHomeArticle; 24 | } 25 | 26 | @Override 27 | public void getItHomeArticle(String id) { 28 | Subscription subscription = ItHomeRequest.getItHomeApi().getItHomeArticle(ItHomeUtil.getSplitNewsId(id)) 29 | .subscribeOn(Schedulers.io()) 30 | .observeOn(AndroidSchedulers.mainThread()) 31 | .subscribe(new Observer() { 32 | @Override 33 | public void onCompleted() { 34 | 35 | } 36 | 37 | @Override 38 | public void onError(Throwable e) { 39 | e.printStackTrace(); 40 | mIItHomeArticle.showError(e.getMessage()); 41 | } 42 | 43 | @Override 44 | public void onNext(ItHomeArticle itHomeArticle) { 45 | mIItHomeArticle.showItHomeArticle(itHomeArticle); 46 | } 47 | }); 48 | addSubscription(subscription); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/impl/MainPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter.impl; 2 | 3 | import name.caiyao.microreader.api.zhihu.ZhihuRequest; 4 | import name.caiyao.microreader.bean.UpdateItem; 5 | import name.caiyao.microreader.presenter.IMainPresenter; 6 | import name.caiyao.microreader.ui.iView.IMain; 7 | import rx.Observer; 8 | import rx.Subscription; 9 | import rx.android.schedulers.AndroidSchedulers; 10 | import rx.schedulers.Schedulers; 11 | 12 | /** 13 | * Created by 蔡小木 on 2016/4/26 0026. 14 | */ 15 | public class MainPresenterImpl extends BasePresenterImpl implements IMainPresenter { 16 | 17 | private IMain mIMain; 18 | 19 | public MainPresenterImpl(IMain main) { 20 | if (main == null) 21 | throw new IllegalArgumentException("main must not be null"); 22 | mIMain = main; 23 | } 24 | 25 | @Override 26 | public void checkUpdate() { 27 | Subscription s = ZhihuRequest.getZhihuApi().getUpdateInfo() 28 | .subscribeOn(Schedulers.io()) 29 | .observeOn(AndroidSchedulers.mainThread()) 30 | .subscribe(new Observer() { 31 | @Override 32 | public void onCompleted() { 33 | 34 | } 35 | 36 | @Override 37 | public void onError(Throwable e) { 38 | e.printStackTrace(); 39 | } 40 | 41 | @Override 42 | public void onNext(final UpdateItem updateItem) { 43 | mIMain.showUpdate(updateItem); 44 | } 45 | }); 46 | addSubscription(s); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/impl/SettingPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter.impl; 2 | 3 | import name.caiyao.microreader.BuildConfig; 4 | import name.caiyao.microreader.api.zhihu.ZhihuRequest; 5 | import name.caiyao.microreader.bean.UpdateItem; 6 | import name.caiyao.microreader.presenter.ISettingPresenter; 7 | import name.caiyao.microreader.ui.iView.ISettingFragment; 8 | import rx.Observer; 9 | import rx.Subscription; 10 | import rx.android.schedulers.AndroidSchedulers; 11 | import rx.schedulers.Schedulers; 12 | 13 | /** 14 | * Created by 蔡小木 on 2016/4/24 0024. 15 | */ 16 | public class SettingPresenterImpl extends BasePresenterImpl implements ISettingPresenter { 17 | 18 | private ISettingFragment mSettingFragment; 19 | 20 | public SettingPresenterImpl(ISettingFragment iSettingFragment) { 21 | if (iSettingFragment == null) 22 | throw new IllegalArgumentException("iSettingFragment must not be null"); 23 | mSettingFragment = iSettingFragment; 24 | } 25 | 26 | @Override 27 | public void checkUpdate() { 28 | Subscription subscription = ZhihuRequest.getZhihuApi().getUpdateInfo() 29 | .subscribeOn(Schedulers.io()) 30 | .observeOn(AndroidSchedulers.mainThread()) 31 | .subscribe(new Observer() { 32 | @Override 33 | public void onCompleted() { 34 | } 35 | 36 | @Override 37 | public void onError(Throwable e) { 38 | mSettingFragment.showError(e.getMessage()); 39 | } 40 | 41 | @Override 42 | public void onNext(final UpdateItem updateItem) { 43 | if (updateItem.getVersionCode() > BuildConfig.VERSION_CODE) 44 | mSettingFragment.showUpdateDialog(updateItem); 45 | else 46 | mSettingFragment.showNoUpdate(); 47 | } 48 | }); 49 | addSubscription(subscription); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/impl/WeiXinPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter.impl; 2 | 3 | import android.content.Context; 4 | 5 | import com.google.gson.Gson; 6 | 7 | import name.caiyao.microreader.api.weixin.TxRequest; 8 | import name.caiyao.microreader.bean.weixin.TxWeixinResponse; 9 | import name.caiyao.microreader.config.Config; 10 | import name.caiyao.microreader.presenter.IWeixinPresenter; 11 | import name.caiyao.microreader.ui.iView.IWeixinFragment; 12 | import name.caiyao.microreader.utils.CacheUtil; 13 | import rx.Subscriber; 14 | import rx.Subscription; 15 | import rx.android.schedulers.AndroidSchedulers; 16 | import rx.schedulers.Schedulers; 17 | 18 | /** 19 | * Created by 蔡小木 on 2016/4/22 0022. 20 | */ 21 | public class WeiXinPresenterImpl extends BasePresenterImpl implements IWeixinPresenter { 22 | 23 | private CacheUtil mCacheUtil; 24 | private IWeixinFragment mWeixinFragment; 25 | private Gson mGson = new Gson(); 26 | 27 | public WeiXinPresenterImpl(IWeixinFragment weixinFragment, Context context) { 28 | if (weixinFragment==null) 29 | throw new IllegalArgumentException("weixinFragment must not be null"); 30 | this.mWeixinFragment = weixinFragment; 31 | mCacheUtil = CacheUtil.get(context); 32 | } 33 | 34 | @Override 35 | public void getWeixinNews(final int page) { 36 | mWeixinFragment.showProgressDialog(); 37 | Subscription subscription = TxRequest.getTxApi().getWeixin(page).subscribeOn(Schedulers.io()) 38 | .observeOn(AndroidSchedulers.mainThread()) 39 | .subscribe(new Subscriber() { 40 | @Override 41 | public void onCompleted() { 42 | } 43 | 44 | @Override 45 | public void onError(Throwable e) { 46 | mWeixinFragment.hidProgressDialog(); 47 | mWeixinFragment.showError(e.getMessage()); 48 | } 49 | 50 | @Override 51 | public void onNext(TxWeixinResponse txWeixinResponse) { 52 | mWeixinFragment.hidProgressDialog(); 53 | if (txWeixinResponse.getCode() == 200) { 54 | mWeixinFragment.updateList(txWeixinResponse.getNewslist()); 55 | mCacheUtil.put(Config.WEIXIN + page, mGson.toJson(txWeixinResponse)); 56 | } else { 57 | mWeixinFragment.showError("服务器内部错误!"); 58 | } 59 | } 60 | }); 61 | addSubscription(subscription); 62 | } 63 | 64 | @Override 65 | public void getWeixinNewsFromCache(int page) { 66 | if (mCacheUtil.getAsJSONObject(Config.WEIXIN + page) != null) { 67 | TxWeixinResponse txWeixinResponse = mGson.fromJson(mCacheUtil.getAsJSONObject(Config.WEIXIN + page).toString(), TxWeixinResponse.class); 68 | mWeixinFragment.updateList(txWeixinResponse.getNewslist()); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/presenter/impl/ZhihuStoryPresenterImpl.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.presenter.impl; 2 | 3 | import name.caiyao.microreader.api.guokr.GuokrRequest; 4 | import name.caiyao.microreader.api.zhihu.ZhihuRequest; 5 | import name.caiyao.microreader.bean.guokr.GuokrArticle; 6 | import name.caiyao.microreader.bean.zhihu.ZhihuStory; 7 | import name.caiyao.microreader.presenter.IZhihuStoryPresenter; 8 | import name.caiyao.microreader.ui.iView.IZhihuStory; 9 | import rx.Observer; 10 | import rx.Subscription; 11 | import rx.android.schedulers.AndroidSchedulers; 12 | import rx.schedulers.Schedulers; 13 | 14 | /** 15 | * Created by 蔡小木 on 2016/4/26 0026. 16 | */ 17 | public class ZhihuStoryPresenterImpl extends BasePresenterImpl implements IZhihuStoryPresenter { 18 | 19 | private IZhihuStory mIZhihuStory; 20 | 21 | public ZhihuStoryPresenterImpl(IZhihuStory zhihuStory) { 22 | if (zhihuStory == null) 23 | throw new IllegalArgumentException("zhihuStory must not be null"); 24 | mIZhihuStory = zhihuStory; 25 | } 26 | 27 | @Override 28 | public void getZhihuStory(String id) { 29 | Subscription s = ZhihuRequest.getZhihuApi().getZhihuStory(id) 30 | .subscribeOn(Schedulers.io()) 31 | .observeOn(AndroidSchedulers.mainThread()) 32 | .subscribe(new Observer() { 33 | @Override 34 | public void onCompleted() { 35 | 36 | } 37 | 38 | @Override 39 | public void onError(Throwable e) { 40 | mIZhihuStory.showError(e.getMessage()); 41 | } 42 | 43 | @Override 44 | public void onNext(ZhihuStory zhihuStory) { 45 | mIZhihuStory.showZhihuStory(zhihuStory); 46 | } 47 | }); 48 | addSubscription(s); 49 | } 50 | 51 | @Override 52 | public void getGuokrArticle(String id) { 53 | Subscription s = GuokrRequest.getGuokrApi().getGuokrArticle(id) 54 | .subscribeOn(Schedulers.io()) 55 | .observeOn(AndroidSchedulers.mainThread()) 56 | .subscribe(new Observer() { 57 | @Override 58 | public void onCompleted() { 59 | 60 | } 61 | 62 | @Override 63 | public void onError(Throwable e) { 64 | mIZhihuStory.showError(e.getMessage()); 65 | } 66 | 67 | @Override 68 | public void onNext(GuokrArticle guokrArticle) { 69 | mIZhihuStory.showGuokrArticle(guokrArticle); 70 | } 71 | }); 72 | addSubscription(s); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/activity/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.activity; 2 | 3 | import android.content.Context; 4 | import android.content.res.ColorStateList; 5 | import android.graphics.Color; 6 | import android.os.Build; 7 | import android.support.design.widget.FloatingActionButton; 8 | import android.support.v4.widget.DrawerLayout; 9 | import android.support.v7.widget.Toolbar; 10 | import android.view.MotionEvent; 11 | 12 | import com.bugtags.library.Bugtags; 13 | import com.example.swipebackactivity.app.SwipeBackActivity; 14 | import com.umeng.analytics.MobclickAgent; 15 | 16 | import name.caiyao.microreader.config.Config; 17 | import name.caiyao.microreader.utils.SharePreferenceUtil; 18 | import name.caiyao.microreader.utils.StatusBarUtil; 19 | 20 | public class BaseActivity extends SwipeBackActivity { 21 | 22 | @Override 23 | protected void onResume() { 24 | super.onResume(); 25 | Bugtags.onResume(this); 26 | MobclickAgent.onResume(this); 27 | } 28 | 29 | @Override 30 | protected void onPause() { 31 | super.onPause(); 32 | Bugtags.onPause(this); 33 | MobclickAgent.onPause(this); 34 | } 35 | 36 | @Override 37 | public boolean dispatchTouchEvent(MotionEvent event) { 38 | Bugtags.onDispatchTouchEvent(this, event); 39 | return super.dispatchTouchEvent(event); 40 | } 41 | 42 | public int setToolBar(FloatingActionButton floatingActionButton, Toolbar toolbar, boolean isChangeToolbar, boolean isChangeStatusBar, DrawerLayout drawerLayout) { 43 | int vibrantColor = getSharedPreferences(SharePreferenceUtil.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).getInt(SharePreferenceUtil.VIBRANT, 0); 44 | int mutedColor = getSharedPreferences(SharePreferenceUtil.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).getInt(SharePreferenceUtil.MUTED, 0); 45 | if (Config.isNight) { 46 | vibrantColor = Color.BLACK; 47 | } 48 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 49 | if (SharePreferenceUtil.isChangeNavColor(this)) 50 | getWindow().setNavigationBarColor(vibrantColor); 51 | else 52 | getWindow().setNavigationBarColor(Color.BLACK); 53 | } 54 | if (floatingActionButton != null) 55 | floatingActionButton.setBackgroundTintList(ColorStateList.valueOf(mutedColor)); 56 | if (isChangeToolbar) 57 | toolbar.setBackgroundColor(vibrantColor); 58 | if (isChangeStatusBar) { 59 | if (SharePreferenceUtil.isImmersiveMode(this)) 60 | StatusBarUtil.setColorNoTranslucent(this, vibrantColor); 61 | else 62 | StatusBarUtil.setColor(this, vibrantColor); 63 | } 64 | if (drawerLayout != null) { 65 | if (SharePreferenceUtil.isImmersiveMode(this)) 66 | StatusBarUtil.setColorNoTranslucentForDrawerLayout(this, drawerLayout, vibrantColor); 67 | else 68 | StatusBarUtil.setColorForDrawerLayout(this, drawerLayout, vibrantColor); 69 | } 70 | return vibrantColor; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/activity/ChangeChannelActivity.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.ActionBar; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.support.v7.widget.Toolbar; 9 | import android.support.v7.widget.helper.ItemTouchHelper; 10 | import android.view.View; 11 | 12 | import java.util.ArrayList; 13 | 14 | import butterknife.BindView; 15 | import butterknife.ButterKnife; 16 | import name.caiyao.microreader.R; 17 | import name.caiyao.microreader.config.Config; 18 | import name.caiyao.microreader.event.StatusBarEvent; 19 | import name.caiyao.microreader.presenter.IChangeChannelPresenter; 20 | import name.caiyao.microreader.presenter.impl.ChangeChannelPresenterImpl; 21 | import name.caiyao.microreader.ui.adapter.ChannelAdapter; 22 | import name.caiyao.microreader.ui.helper.ItemDragHelperCallback; 23 | import name.caiyao.microreader.ui.iView.IChangeChannel; 24 | import name.caiyao.microreader.utils.RxBus; 25 | 26 | /** 27 | * Created by 蔡小木 on 2016/4/26 0026. 28 | */ 29 | public class ChangeChannelActivity extends BaseActivity implements IChangeChannel { 30 | 31 | @BindView(R.id.toolbar) 32 | Toolbar mToolbar; 33 | @BindView(R.id.rv_channel) 34 | RecyclerView mRv; 35 | 36 | private ArrayList savedChannel = new ArrayList<>(); 37 | private ArrayList otherChannel = new ArrayList<>(); 38 | private IChangeChannelPresenter mIChangeChannelPresenter; 39 | private ChannelAdapter mChannelAdapter; 40 | 41 | @Override 42 | protected void onCreate(@Nullable Bundle savedInstanceState) { 43 | super.onCreate(savedInstanceState); 44 | setContentView(R.layout.activity_change_channel); 45 | ButterKnife.bind(this); 46 | initData(); 47 | initView(); 48 | } 49 | 50 | private void initData() { 51 | mIChangeChannelPresenter = new ChangeChannelPresenterImpl(this, this); 52 | } 53 | 54 | private void initView() { 55 | mToolbar.setTitle(getString(R.string.activity_change_channel_title)); 56 | setSupportActionBar(mToolbar); 57 | mToolbar.setNavigationOnClickListener(new View.OnClickListener() { 58 | @Override 59 | public void onClick(View v) { 60 | onBackPressed(); 61 | } 62 | }); 63 | ActionBar actionBar = getSupportActionBar(); 64 | if (actionBar != null) { 65 | actionBar.setDisplayHomeAsUpEnabled(true); 66 | } 67 | setToolBar(null, mToolbar, true, true, null); 68 | LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false); 69 | mRv.setLayoutManager(linearLayoutManager); 70 | ItemDragHelperCallback callback = new ItemDragHelperCallback(); 71 | final ItemTouchHelper helper = new ItemTouchHelper(callback); 72 | helper.attachToRecyclerView(mRv); 73 | mRv.setHasFixedSize(true); 74 | mRv.setNestedScrollingEnabled(false); 75 | mChannelAdapter = new ChannelAdapter(this, helper, savedChannel, otherChannel); 76 | mRv.setAdapter(mChannelAdapter); 77 | mIChangeChannelPresenter.getChannel(); 78 | } 79 | 80 | 81 | @Override 82 | public void showChannel(ArrayList savedChannel, ArrayList otherChannel) { 83 | this.savedChannel.addAll(savedChannel); 84 | this.otherChannel.addAll(otherChannel); 85 | mChannelAdapter.notifyDataSetChanged(); 86 | } 87 | 88 | @Override 89 | public void onBackPressed() { 90 | mIChangeChannelPresenter.saveChannel(savedChannel); 91 | RxBus.getDefault().send(new StatusBarEvent()); 92 | super.onBackPressed(); 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/activity/SettingsActivity.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.activity; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.ActionBar; 5 | import android.support.v7.widget.Toolbar; 6 | import android.view.View; 7 | import android.widget.FrameLayout; 8 | 9 | import butterknife.BindView; 10 | import butterknife.ButterKnife; 11 | import name.caiyao.microreader.R; 12 | import name.caiyao.microreader.event.StatusBarEvent; 13 | import name.caiyao.microreader.ui.fragment.SettingsFragment; 14 | import name.caiyao.microreader.utils.RxBus; 15 | import rx.Subscription; 16 | import rx.functions.Action1; 17 | 18 | public class SettingsActivity extends BaseActivity { 19 | 20 | @BindView(R.id.toolbar) 21 | Toolbar toolbar; 22 | @BindView(R.id.fl_preference) 23 | FrameLayout flPreference; 24 | 25 | public Subscription rxSubscription; 26 | 27 | private SettingsFragment settingsFragment = new SettingsFragment(); 28 | 29 | @Override 30 | protected void onCreate(Bundle savedInstanceState) { 31 | super.onCreate(savedInstanceState); 32 | setContentView(R.layout.activity_settings); 33 | ButterKnife.bind(this); 34 | toolbar.setTitle(R.string.activity_setting_title); 35 | setSupportActionBar(toolbar); 36 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 37 | @Override 38 | public void onClick(View v) { 39 | onBackPressed(); 40 | } 41 | }); 42 | ActionBar actionBar = getSupportActionBar(); 43 | if (actionBar != null) { 44 | actionBar.setDisplayHomeAsUpEnabled(true); 45 | } 46 | rxSubscription = RxBus.getDefault().toObservable(StatusBarEvent.class) 47 | .subscribe(new Action1() { 48 | @Override 49 | public void call(StatusBarEvent statusBarEvent) { 50 | recreate(); 51 | } 52 | }); 53 | setToolBar(null,toolbar, true, true, null); 54 | getFragmentManager().beginTransaction().replace(R.id.fl_preference, settingsFragment).commit(); 55 | } 56 | 57 | @Override 58 | protected void onDestroy() { 59 | super.onDestroy(); 60 | if (!rxSubscription.isUnsubscribed()) { 61 | rxSubscription.unsubscribe(); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/fragment/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.fragment; 2 | 3 | 4 | import android.content.Context; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v4.content.ContextCompat; 7 | import android.support.v4.widget.SwipeRefreshLayout; 8 | 9 | import com.umeng.analytics.MobclickAgent; 10 | 11 | import name.caiyao.microreader.R; 12 | import name.caiyao.microreader.utils.SharePreferenceUtil; 13 | 14 | 15 | public class BaseFragment extends Fragment { 16 | 17 | 18 | @Override 19 | public void onResume() { 20 | super.onResume(); 21 | MobclickAgent.onPageStart(getClass().getSimpleName()); 22 | } 23 | 24 | @Override 25 | public void onPause() { 26 | super.onPause(); 27 | MobclickAgent.onPageEnd(getClass().getSimpleName()); 28 | } 29 | 30 | public void setSwipeRefreshLayoutColor(SwipeRefreshLayout swipeRefreshLayout){ 31 | swipeRefreshLayout.setColorSchemeColors(getActivity().getSharedPreferences(SharePreferenceUtil.SHARED_PREFERENCE_NAME, Context.MODE_PRIVATE).getInt(SharePreferenceUtil.VIBRANT, ContextCompat.getColor(getActivity(), R.color.colorAccent))); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/helper/ItemDragHelperCallback.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.helper; 2 | 3 | import android.support.v7.widget.GridLayoutManager; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.support.v7.widget.StaggeredGridLayoutManager; 6 | import android.support.v7.widget.helper.ItemTouchHelper; 7 | 8 | /** 9 | * Created by 蔡小木 on 2016/4/28 0028. 10 | */ 11 | public class ItemDragHelperCallback extends ItemTouchHelper.Callback { 12 | 13 | @Override 14 | public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { 15 | int dragFlags; 16 | RecyclerView.LayoutManager manager = recyclerView.getLayoutManager(); 17 | if (manager instanceof GridLayoutManager || manager instanceof StaggeredGridLayoutManager) { 18 | dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN | ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT; 19 | } else { 20 | dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; 21 | } 22 | // 如果想支持滑动(删除)操作, swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END 23 | int swipeFlags = 0; 24 | return makeMovementFlags(dragFlags, swipeFlags); 25 | } 26 | 27 | @Override 28 | public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { 29 | // 不同Type之间不可移动 30 | if (viewHolder.getItemViewType() != target.getItemViewType()) { 31 | // return false; 32 | } 33 | 34 | if (recyclerView.getAdapter() instanceof OnItemMoveListener) { 35 | OnItemMoveListener listener = ((OnItemMoveListener) recyclerView.getAdapter()); 36 | listener.onItemMove(viewHolder.getAdapterPosition(), target.getAdapterPosition()); 37 | } 38 | return true; 39 | } 40 | 41 | @Override 42 | public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) { 43 | 44 | } 45 | 46 | @Override 47 | public boolean isLongPressDragEnabled() { 48 | // 不支持长按拖拽功能 手动控制 49 | return false; 50 | } 51 | 52 | @Override 53 | public boolean isItemViewSwipeEnabled() { 54 | // 不支持滑动功能 55 | return false; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/helper/OnItemMoveListener.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.helper; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/28 0028. 5 | */ 6 | public interface OnItemMoveListener { 7 | void onItemMove(int fromPosition, int toPosition); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IBaseFragment.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/26 0026. 5 | */ 6 | public interface IBaseFragment { 7 | void showProgressDialog(); 8 | 9 | void hidProgressDialog(); 10 | 11 | void showError(String error); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IChangeChannel.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import java.util.ArrayList; 4 | 5 | import name.caiyao.microreader.config.Config; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/4/26 0026. 9 | */ 10 | public interface IChangeChannel { 11 | 12 | void showChannel(ArrayList savedChannel, ArrayList otherChannel); 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IGuokrFragment.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import java.util.ArrayList; 4 | 5 | import name.caiyao.microreader.bean.guokr.GuokrHotItem; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/4/22 0022. 9 | */ 10 | public interface IGuokrFragment extends IBaseFragment { 11 | void updateList(ArrayList guokrHotItems); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IItHomeArticle.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import name.caiyao.microreader.bean.itHome.ItHomeArticle; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/4/26 0026. 7 | */ 8 | public interface IItHomeArticle { 9 | void showError(String error); 10 | 11 | void showItHomeArticle(ItHomeArticle itHomeArticle); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IItHomeFragment.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import java.util.ArrayList; 4 | 5 | import name.caiyao.microreader.bean.itHome.ItHomeItem; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/4/23 0023. 9 | */ 10 | public interface IItHomeFragment extends IBaseFragment { 11 | void updateList(ArrayList itHomeItems); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IMain.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import name.caiyao.microreader.bean.UpdateItem; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/4/26 0026. 7 | */ 8 | public interface IMain { 9 | void showUpdate(UpdateItem updateItem); 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/ISettingFragment.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import name.caiyao.microreader.bean.UpdateItem; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/4/24 0024. 7 | */ 8 | public interface ISettingFragment { 9 | void showError(String error); 10 | 11 | void showUpdateDialog(UpdateItem updateItem); 12 | 13 | void showNoUpdate(); 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IVideoFragment.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import java.util.ArrayList; 4 | 5 | import name.caiyao.microreader.bean.weiboVideo.WeiboVideoBlog; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/4/23 0023. 9 | */ 10 | public interface IVideoFragment extends IBaseFragment{ 11 | void updateList(ArrayList weiboVideoBlogs); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IWeixinFragment.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import java.util.ArrayList; 4 | 5 | import name.caiyao.microreader.bean.weixin.WeixinNews; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/4/22 0022. 9 | */ 10 | public interface IWeixinFragment extends IBaseFragment{ 11 | void updateList(ArrayList weixinNewses); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IWelcome.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/4/24 0024. 5 | */ 6 | public interface IWelcome { 7 | void hasGetBackground(); 8 | } 9 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IZhihuFragment.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import name.caiyao.microreader.bean.zhihu.ZhihuDaily; 4 | 5 | /** 6 | * Created by 蔡小木 on 2016/4/23 0023. 7 | */ 8 | public interface IZhihuFragment extends IBaseFragment { 9 | void updateList(ZhihuDaily zhihuDaily); 10 | } 11 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/iView/IZhihuStory.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.iView; 2 | 3 | import name.caiyao.microreader.bean.guokr.GuokrArticle; 4 | import name.caiyao.microreader.bean.zhihu.ZhihuStory; 5 | 6 | /** 7 | * Created by 蔡小木 on 2016/4/26 0026. 8 | */ 9 | public interface IZhihuStory { 10 | 11 | void showError(String error); 12 | 13 | void showZhihuStory(ZhihuStory zhihuStory); 14 | 15 | void showGuokrArticle(GuokrArticle guokrArticle); 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/view/DividerItemDecoration.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.view; 2 | 3 | import android.content.Context; 4 | import android.content.res.TypedArray; 5 | import android.graphics.Canvas; 6 | import android.graphics.Rect; 7 | import android.graphics.drawable.Drawable; 8 | import android.support.v7.widget.LinearLayoutManager; 9 | import android.support.v7.widget.RecyclerView; 10 | import android.view.View; 11 | 12 | /** 13 | * Created by 蔡小木 on 2016/6/7 0007. 14 | */ 15 | 16 | public class DividerItemDecoration extends RecyclerView.ItemDecoration { 17 | 18 | public static final int[] ATTRS = new int[]{ 19 | android.R.attr.listDivider 20 | }; 21 | 22 | public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL; 23 | 24 | public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL; 25 | 26 | private Drawable mDivider; 27 | 28 | private int mOrientation; 29 | 30 | public DividerItemDecoration(Context context, int orientation) { 31 | final TypedArray typedArray = context.obtainStyledAttributes(ATTRS); 32 | mDivider = typedArray.getDrawable(0); 33 | typedArray.recycle(); 34 | setOrientation(orientation); 35 | } 36 | 37 | public void setOrientation(int orientation) { 38 | if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST) { 39 | throw new IllegalArgumentException("invalid orientation"); 40 | } 41 | mOrientation = orientation; 42 | } 43 | 44 | @Override 45 | public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) { 46 | if (mOrientation == VERTICAL_LIST) { 47 | drawVertical(c, parent); 48 | } else { 49 | drawHorizontal(c, parent); 50 | } 51 | } 52 | 53 | private void drawVertical(Canvas c, RecyclerView parent) { 54 | final int left = parent.getPaddingLeft(); 55 | final int right = parent.getWidth() - parent.getPaddingRight(); 56 | 57 | final int childCount = parent.getChildCount(); 58 | for (int i = 0; i < childCount; i++) { 59 | final View child = parent.getChildAt(i); 60 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child 61 | .getLayoutParams(); 62 | final int top = child.getBottom() + params.bottomMargin; 63 | final int bottom = top + mDivider.getIntrinsicHeight(); 64 | mDivider.setBounds(left, top, right, bottom); 65 | mDivider.draw(c); 66 | } 67 | } 68 | 69 | private void drawHorizontal(Canvas c, RecyclerView parent) { 70 | final int top = parent.getPaddingTop(); 71 | final int bottom = parent.getHeight() - parent.getPaddingBottom(); 72 | 73 | final int childCount = parent.getChildCount(); 74 | for (int i = 0; i < childCount; i++) { 75 | final View child = parent.getChildAt(i); 76 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child 77 | .getLayoutParams(); 78 | final int left = child.getRight() + params.rightMargin; 79 | final int right = left + mDivider.getIntrinsicHeight(); 80 | mDivider.setBounds(left, top, right, bottom); 81 | mDivider.draw(c); 82 | } 83 | } 84 | 85 | 86 | @Override 87 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 88 | if (mOrientation == VERTICAL_LIST) { 89 | outRect.set(0, 0, 0, mDivider.getIntrinsicHeight()); 90 | } else { 91 | outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0); 92 | } 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/ui/view/ScrollAwareFABBehavior.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.ui.view; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.CoordinatorLayout; 5 | import android.support.design.widget.FloatingActionButton; 6 | import android.support.v4.view.ViewCompat; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | 10 | /** 11 | * Created by 蔡小木 on 2016/4/15 0015. 12 | */ 13 | public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior { 14 | 15 | public ScrollAwareFABBehavior(Context context, AttributeSet attrs) { 16 | super(); 17 | } 18 | 19 | @Override 20 | public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, 21 | final View directTargetChild, final View target, final int nestedScrollAxes) { 22 | // Ensure we react to vertical scrolling 23 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL 24 | || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes); 25 | } 26 | 27 | @Override 28 | public void onNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { 29 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); 30 | if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) { 31 | child.hide(); 32 | } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) { 33 | child.show(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/utils/DBUtils.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.utils; 2 | 3 | import android.content.ContentValues; 4 | import android.content.Context; 5 | import android.database.Cursor; 6 | import android.database.sqlite.SQLiteDatabase; 7 | import android.database.sqlite.SQLiteOpenHelper; 8 | 9 | import java.lang.String; 10 | 11 | import name.caiyao.microreader.config.Config; 12 | 13 | /** 14 | * Created by 蔡小木 on 2016/4/14 0014. 15 | */ 16 | public class DBUtils { 17 | public static final String CREATE_TABLE_IF_NOT_EXISTS = "create table if not exists %s " + 18 | "(id integer primary key autoincrement,key text unique,is_read integer)"; 19 | 20 | private static DBUtils sDBUtis; 21 | private SQLiteDatabase mSQLiteDatabase; 22 | 23 | private DBUtils(Context context) { 24 | mSQLiteDatabase = new DBHelper(context, Config.DB__IS_READ_NAME + ".db").getWritableDatabase(); 25 | } 26 | 27 | public static synchronized DBUtils getDB(Context context) { 28 | if (sDBUtis == null) 29 | sDBUtis = new DBUtils(context); 30 | return sDBUtis; 31 | } 32 | 33 | 34 | public void insertHasRead(String table, String key, int value) { 35 | Cursor cursor = mSQLiteDatabase.query(table, null, null, null, null, null, "id asc"); 36 | if (cursor.getCount() > 200 && cursor.moveToNext()) { 37 | mSQLiteDatabase.delete(table, "id=?", new String[]{String.valueOf(cursor.getInt(cursor.getColumnIndex("id")))}); 38 | } 39 | cursor.close(); 40 | ContentValues contentValues = new ContentValues(); 41 | contentValues.put("key", key); 42 | contentValues.put("is_read", value); 43 | mSQLiteDatabase.insertWithOnConflict(table, null, contentValues, SQLiteDatabase.CONFLICT_REPLACE); 44 | } 45 | 46 | public boolean isRead(String table, String key,int value) { 47 | boolean isRead = false; 48 | Cursor cursor = mSQLiteDatabase.query(table, null, "key=?", new String[]{key}, null, null, null); 49 | if (cursor.moveToNext() && (cursor.getInt(cursor.getColumnIndex("is_read")) == value)) { 50 | isRead = true; 51 | } 52 | cursor.close(); 53 | return isRead; 54 | } 55 | 56 | public class DBHelper extends SQLiteOpenHelper { 57 | 58 | public DBHelper(Context context, String name) { 59 | super(context, name, null, 1); 60 | } 61 | 62 | @Override 63 | public void onCreate(SQLiteDatabase db) { 64 | db.execSQL(String.format(CREATE_TABLE_IF_NOT_EXISTS, Config.GUOKR)); 65 | db.execSQL(String.format(CREATE_TABLE_IF_NOT_EXISTS, Config.IT)); 66 | db.execSQL(String.format(CREATE_TABLE_IF_NOT_EXISTS, Config.VIDEO)); 67 | db.execSQL(String.format(CREATE_TABLE_IF_NOT_EXISTS, Config.ZHIHU)); 68 | db.execSQL(String.format(CREATE_TABLE_IF_NOT_EXISTS, Config.WEIXIN)); 69 | } 70 | 71 | @Override 72 | public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { 73 | 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/utils/ImageLoader.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.utils; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.widget.ImageView; 6 | 7 | import com.bumptech.glide.Glide; 8 | 9 | import name.caiyao.microreader.config.Config; 10 | 11 | /** 12 | * Created by 蔡小木 on 2016/5/23 0023. 13 | */ 14 | 15 | public class ImageLoader { 16 | private ImageLoader() { 17 | } 18 | 19 | public static void loadImage(Context context, String url, ImageView imageView) { 20 | if (Config.isNight) { 21 | imageView.setAlpha(0.2f); 22 | imageView.setBackgroundColor(Color.BLACK); 23 | } 24 | Glide.with(context).load(url).into(imageView); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/utils/ItHomeUtil.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.utils; 2 | 3 | import java.security.InvalidKeyException; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | import javax.crypto.BadPaddingException; 7 | import javax.crypto.Cipher; 8 | import javax.crypto.IllegalBlockSizeException; 9 | import javax.crypto.NoSuchPaddingException; 10 | import javax.crypto.spec.SecretKeySpec; 11 | 12 | /** 13 | * Created by 蔡小木 on 2016/3/24 0024. 14 | */ 15 | public class ItHomeUtil { 16 | 17 | private ItHomeUtil() {} 18 | 19 | public static String getMinNewsId(String id) { 20 | byte[] bytes = new byte[]{-86, -7, -69, -102, -83, -124, -87, -14}; 21 | int i = 0; 22 | while (i < bytes.length) { 23 | bytes[i] = (byte) (-38 ^ bytes[i]); 24 | i++; 25 | } 26 | try { 27 | return des(id, new String(bytes)); 28 | } catch (NoSuchPaddingException | NoSuchAlgorithmException | InvalidKeyException | BadPaddingException | IllegalBlockSizeException e) { 29 | e.printStackTrace(); 30 | } 31 | return null; 32 | } 33 | 34 | private static String des(String id, String key) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidKeyException, BadPaddingException, IllegalBlockSizeException { 35 | int index = 0; 36 | SecretKeySpec secretKeySpec = new SecretKeySpec(key.getBytes(), "DES"); 37 | Cipher cipher = Cipher.getInstance("DES/ECB/NoPadding"); 38 | cipher.init(1, secretKeySpec); 39 | int i = id.length(); 40 | if (i < 8) { 41 | i = 8 - i; 42 | } else { 43 | i %= 8; 44 | i = i != 0 ? 8 - i : 0; 45 | } 46 | while (index < i) { 47 | id = String.valueOf(id) + "\u0000"; 48 | index++; 49 | } 50 | return a(cipher.doFinal(id.getBytes())); 51 | } 52 | 53 | public static String a(byte[] arg5) { 54 | StringBuilder v1 = new StringBuilder(); 55 | int v0; 56 | for (v0 = 0; v0 < arg5.length; ++v0) { 57 | String v2 = Integer.toHexString(arg5[v0] & 255); 58 | if (v2.length() == 1) { 59 | v1.append("0").append(v2); 60 | } else { 61 | v1.append(v2); 62 | } 63 | } 64 | 65 | return v1.toString(); 66 | } 67 | 68 | public static String getSplitNewsId(String newsid) { 69 | String s1 = newsid.substring(0, 3); 70 | String s2 = newsid.substring(3); 71 | return s1 + "/" + s2; 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/utils/NetWorkUtil.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.utils; 2 | 3 | import android.content.Context; 4 | import android.net.ConnectivityManager; 5 | import android.net.NetworkInfo; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/3/16 0016. 9 | */ 10 | public class NetWorkUtil { 11 | 12 | private NetWorkUtil() {} 13 | 14 | /** 15 | * 判断网络是否可用 16 | * 17 | * @param context 18 | * @return 19 | */ 20 | public static boolean isNetWorkAvailable(Context context) { 21 | ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 22 | NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); 23 | return networkInfo != null && networkInfo.isConnected(); 24 | } 25 | 26 | /** 27 | * 检测wifi是否连接 28 | * 29 | * @return 30 | */ 31 | public static boolean isWifiConnected(Context context) { 32 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 33 | NetworkInfo networkInfo = cm.getActiveNetworkInfo(); 34 | return networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_WIFI; 35 | } 36 | 37 | /** 38 | * 检测3G是否连接 39 | * 40 | * @return 41 | */ 42 | public static boolean is3gConnected(Context context) { 43 | ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); 44 | NetworkInfo networkInfo = cm.getActiveNetworkInfo(); 45 | return networkInfo != null && networkInfo.getType() == ConnectivityManager.TYPE_MOBILE; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/utils/RxBus.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.utils; 2 | 3 | import rx.Observable; 4 | import rx.subjects.PublishSubject; 5 | import rx.subjects.SerializedSubject; 6 | import rx.subjects.Subject; 7 | 8 | /** 9 | * Created by YiuChoi on 2016/4/7 0007. 10 | */ 11 | public class RxBus { 12 | private static volatile RxBus defaultInstance; 13 | 14 | private final Subject bus; 15 | 16 | public RxBus() { 17 | bus = new SerializedSubject<>(PublishSubject.create()); 18 | } 19 | 20 | // 单例RxBus 21 | public static RxBus getDefault() { 22 | RxBus rxBus = defaultInstance; 23 | if (defaultInstance == null) { 24 | synchronized (RxBus.class) { 25 | rxBus = defaultInstance; 26 | if (defaultInstance == null) { 27 | rxBus = new RxBus(); 28 | defaultInstance = rxBus; 29 | } 30 | } 31 | } 32 | return rxBus; 33 | } 34 | 35 | public void send(Object o) { 36 | bus.onNext(o); 37 | } 38 | 39 | public Observable toObservable(Class eventClass) { 40 | return bus.ofType(eventClass); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/utils/ScreenUtil.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.utils; 2 | 3 | import android.content.Context; 4 | import android.util.DisplayMetrics; 5 | import android.view.WindowManager; 6 | 7 | /** 8 | * Created by 蔡小木 on 2016/3/8 0008. 9 | */ 10 | public class ScreenUtil { 11 | 12 | private ScreenUtil() {} 13 | 14 | public static int getScreenHight(Context context) { 15 | DisplayMetrics displaymetrics = new DisplayMetrics(); 16 | ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(displaymetrics); 17 | return displaymetrics.heightPixels; 18 | } 19 | 20 | public static int getScreenWidth(Context context) { 21 | DisplayMetrics displaymetrics = new DisplayMetrics(); 22 | ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(displaymetrics); 23 | return displaymetrics.widthPixels; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/utils/SharePreferenceUtil.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.utils; 2 | 3 | import android.content.Context; 4 | import android.content.SharedPreferences; 5 | import android.preference.PreferenceManager; 6 | 7 | import name.caiyao.microreader.R; 8 | 9 | /** 10 | * Created by 蔡小木 on 2016/3/13 0013. 11 | */ 12 | public class SharePreferenceUtil { 13 | 14 | private SharePreferenceUtil() {} 15 | 16 | public static final String SHARED_PREFERENCE_NAME = "micro_reader"; 17 | public static final String IMAGE_DESCRIPTION = "image_description"; 18 | public static final String VIBRANT = "vibrant"; 19 | public static final String MUTED = "muted"; 20 | public static final String IMAGE_GET_TIME = "image_get_time"; 21 | public static final String SAVED_CHANNEL = "saved_channel"; 22 | 23 | public static boolean isRefreshOnlyWifi(Context context) { 24 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); 25 | return sharedPreferences.getBoolean(context.getResources().getString(R.string.pre_refresh_data), false); 26 | } 27 | 28 | public static boolean isChangeThemeAuto(Context context) { 29 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); 30 | return sharedPreferences.getBoolean(context.getResources().getString(R.string.pre_get_image), true); 31 | } 32 | 33 | public static boolean isImmersiveMode(Context context) { 34 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); 35 | return sharedPreferences.getBoolean(context.getString(R.string.pre_status_bar), true); 36 | } 37 | 38 | public static boolean isChangeNavColor(Context context) { 39 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); 40 | return sharedPreferences.getBoolean(context.getString(R.string.pre_nav_color), true); 41 | } 42 | 43 | public static boolean isUseLocalBrowser(Context context) { 44 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); 45 | return sharedPreferences.getBoolean(context.getString(R.string.pre_use_local), false); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /app/src/main/java/name/caiyao/microreader/utils/WebUtil.java: -------------------------------------------------------------------------------- 1 | package name.caiyao.microreader.utils; 2 | 3 | /** 4 | * Created by 蔡小木 on 2016/3/7 0007. 5 | */ 6 | public class WebUtil { 7 | 8 | private WebUtil() { 9 | } 10 | 11 | public static final String BASE_URL = "file:///android_asset/"; 12 | public static final String MIME_TYPE = "text/html"; 13 | public static final String ENCODING = "utf-8"; 14 | public static final String FAIL_URL = "http//:daily.zhihu.com/"; 15 | 16 | private static final String CSS_LINK_PATTERN = " "; 17 | private static final String NIGHT_DIV_TAG_START = "
"; 18 | private static final String NIGHT_DIV_TAG_END = "
"; 19 | 20 | private static final String DIV_IMAGE_PLACE_HOLDER = "class=\"img-place-holder\""; 21 | private static final String DIV_IMAGE_PLACE_HOLDER_IGNORED = "class=\"img-place-holder-ignored\""; 22 | 23 | public static String buildHtmlWithCss(String html, String[] cssUrls, boolean isNightMode) { 24 | StringBuilder result = new StringBuilder(); 25 | for (String cssUrl : cssUrls) { 26 | result.append(String.format(CSS_LINK_PATTERN, cssUrl)); 27 | } 28 | 29 | if (isNightMode) { 30 | result.append(NIGHT_DIV_TAG_START); 31 | } 32 | result.append(html.replace(DIV_IMAGE_PLACE_HOLDER, DIV_IMAGE_PLACE_HOLDER_IGNORED)); 33 | if (isNightMode) { 34 | result.append(NIGHT_DIV_TAG_END); 35 | } 36 | return result.toString(); 37 | } 38 | 39 | public static String buildHtmlForIt(String content, boolean isNightMode) { 40 | StringBuilder modifiedHtml = new StringBuilder(); 41 | modifiedHtml.append("" + "" 42 | + "" + "" + "" 43 | + "" + "" 44 | + "" 45 | + "" + ""); 46 | modifiedHtml.append(""); 51 | modifiedHtml.append(content); 52 | modifiedHtml.append(""); 53 | return modifiedHtml.toString(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/res/anim/zoomin.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/anim/zoomout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 13 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/app/src/main/res/drawable/bg.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_arrow_upward_white_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_block_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_brightness_2_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_drag_handle_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_expand_less_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_expand_more_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_help_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_more_vert_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_open_in_browser_white_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_play_arrow_white_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_remove_circle_outline_black_24dp.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_settings_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_share_white_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_sort_black_24px.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/app/src/main/res/drawable/icon.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_guokr.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_it.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 9 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_video.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_weixin.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 12 | 15 | 18 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon_zhihu.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/web_view_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_change_channel.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_ithome.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 22 | 23 | 30 | 31 | 32 | 37 | 38 | 42 | 43 | 44 | 58 | 59 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_video_webview.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_weixin_news.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 22 | 23 | 30 | 31 | 32 | 33 | 38 | 39 | 43 | 44 | 45 | 59 | 60 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_welcome.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 19 | 20 | 30 | 31 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_zhihu_story.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 15 | 16 | 24 | 25 | 35 | 36 | 42 | 43 | 44 | 45 | 46 | 47 | 52 | 53 | 57 | 58 | 59 | 73 | 74 | -------------------------------------------------------------------------------- /app/src/main/res/layout/app_bar_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 15 | 16 | 20 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/channel.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 15 | 16 | 24 | 25 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/layout/channel_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 13 | 14 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_common.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 15 | 16 | 20 | 21 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/layout/ithome_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 23 | 24 | 29 | 30 | 37 | 38 | 46 | 47 | 48 |