├── .gitignore ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ └── tbs_sdk_thirdapp_v2.2.0.1096_36549_sharewithdownload_withoutGame_obfs_20160830_211645.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── codeest │ │ └── geeknews │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── codeest │ │ │ └── geeknews │ │ │ ├── app │ │ │ ├── App.java │ │ │ └── Constants.java │ │ │ ├── base │ │ │ ├── BaseActivity.java │ │ │ ├── BaseFragment.java │ │ │ ├── BasePresenter.java │ │ │ ├── BaseView.java │ │ │ ├── RootActivity.java │ │ │ ├── RootFragment.java │ │ │ ├── RxPresenter.java │ │ │ ├── SimpleActivity.java │ │ │ ├── SimpleFragment.java │ │ │ └── contract │ │ │ │ ├── gank │ │ │ │ ├── GirlContract.java │ │ │ │ └── TechContract.java │ │ │ │ ├── gold │ │ │ │ ├── GoldContract.java │ │ │ │ └── GoldMainContract.java │ │ │ │ ├── main │ │ │ │ ├── LikeContract.java │ │ │ │ ├── MainContract.java │ │ │ │ ├── SettingContract.java │ │ │ │ └── WelcomeContract.java │ │ │ │ ├── vtex │ │ │ │ ├── NodeContract.java │ │ │ │ ├── RepliesContract.java │ │ │ │ └── VtexContract.java │ │ │ │ ├── wechat │ │ │ │ └── WechatContract.java │ │ │ │ └── zhihu │ │ │ │ ├── CommentContract.java │ │ │ │ ├── DailyContract.java │ │ │ │ ├── HotContract.java │ │ │ │ ├── SectionChildContract.java │ │ │ │ ├── SectionContract.java │ │ │ │ ├── ThemeChildContract.java │ │ │ │ ├── ThemeContract.java │ │ │ │ └── ZhihuDetailContract.java │ │ │ ├── component │ │ │ ├── ACache.java │ │ │ ├── CrashHandler.java │ │ │ ├── ImageLoader.java │ │ │ ├── InitializeService.java │ │ │ ├── RxBus.java │ │ │ └── UpdateService.java │ │ │ ├── di │ │ │ ├── component │ │ │ │ ├── ActivityComponent.java │ │ │ │ ├── AppComponent.java │ │ │ │ └── FragmentComponent.java │ │ │ ├── module │ │ │ │ ├── ActivityModule.java │ │ │ │ ├── AppModule.java │ │ │ │ ├── FragmentModule.java │ │ │ │ └── HttpModule.java │ │ │ ├── qualifier │ │ │ │ ├── GankUrl.java │ │ │ │ ├── GoldUrl.java │ │ │ │ ├── MyUrl.java │ │ │ │ ├── VtexUrl.java │ │ │ │ ├── WechatUrl.java │ │ │ │ └── ZhihuUrl.java │ │ │ └── scope │ │ │ │ ├── ActivityScope.java │ │ │ │ └── FragmentScope.java │ │ │ ├── model │ │ │ ├── DataManager.java │ │ │ ├── bean │ │ │ │ ├── CalendarBean.java │ │ │ │ ├── CommentBean.java │ │ │ │ ├── DailyBeforeListBean.java │ │ │ │ ├── DailyListBean.java │ │ │ │ ├── DetailExtraBean.java │ │ │ │ ├── GankItemBean.java │ │ │ │ ├── GankSearchItemBean.java │ │ │ │ ├── GoldListBean.java │ │ │ │ ├── GoldManagerBean.java │ │ │ │ ├── GoldManagerItemBean.java │ │ │ │ ├── HotListBean.java │ │ │ │ ├── NodeBean.java │ │ │ │ ├── NodeListBean.java │ │ │ │ ├── ReadStateBean.java │ │ │ │ ├── RealmLikeBean.java │ │ │ │ ├── RepliesListBean.java │ │ │ │ ├── SectionChildListBean.java │ │ │ │ ├── SectionListBean.java │ │ │ │ ├── ThemeChildListBean.java │ │ │ │ ├── ThemeListBean.java │ │ │ │ ├── TopicListBean.java │ │ │ │ ├── VersionBean.java │ │ │ │ ├── WXItemBean.java │ │ │ │ ├── WelcomeBean.java │ │ │ │ └── ZhihuDetailBean.java │ │ │ ├── db │ │ │ │ ├── DBHelper.java │ │ │ │ └── RealmHelper.java │ │ │ ├── event │ │ │ │ ├── NightModeEvent.java │ │ │ │ └── SearchEvent.java │ │ │ ├── http │ │ │ │ ├── HttpHelper.java │ │ │ │ ├── RetrofitHelper.java │ │ │ │ ├── api │ │ │ │ │ ├── GankApis.java │ │ │ │ │ ├── GoldApis.java │ │ │ │ │ ├── MyApis.java │ │ │ │ │ ├── VtexApis.java │ │ │ │ │ ├── WeChatApis.java │ │ │ │ │ └── ZhihuApis.java │ │ │ │ ├── exception │ │ │ │ │ └── ApiException.java │ │ │ │ └── response │ │ │ │ │ ├── GankHttpResponse.java │ │ │ │ │ ├── GoldHttpResponse.java │ │ │ │ │ ├── MyHttpResponse.java │ │ │ │ │ └── WXHttpResponse.java │ │ │ └── prefs │ │ │ │ ├── ImplPreferencesHelper.java │ │ │ │ └── PreferencesHelper.java │ │ │ ├── presenter │ │ │ ├── gank │ │ │ │ ├── GirlPresenter.java │ │ │ │ └── TechPresenter.java │ │ │ ├── gold │ │ │ │ ├── GoldMainPresenter.java │ │ │ │ └── GoldPresenter.java │ │ │ ├── main │ │ │ │ ├── LikePresenter.java │ │ │ │ ├── MainPresenter.java │ │ │ │ ├── SettingPresenter.java │ │ │ │ └── WelcomePresenter.java │ │ │ ├── vtex │ │ │ │ ├── NodePresenter.java │ │ │ │ ├── RepliesPresenter.java │ │ │ │ └── VtexPresenter.java │ │ │ ├── wechat │ │ │ │ └── WechatPresenter.java │ │ │ └── zhihu │ │ │ │ ├── CommentPresenter.java │ │ │ │ ├── DailyPresenter.java │ │ │ │ ├── HotPresenter.java │ │ │ │ ├── SectionChildPresenter.java │ │ │ │ ├── SectionPresenter.java │ │ │ │ ├── ThemeChildPresenter.java │ │ │ │ ├── ThemePresenter.java │ │ │ │ └── ZhihuDetailPresenter.java │ │ │ ├── ui │ │ │ ├── gank │ │ │ │ ├── activity │ │ │ │ │ ├── GirlDetailActivity.java │ │ │ │ │ └── TechDetailActivity.java │ │ │ │ ├── adapter │ │ │ │ │ ├── GankMainAdapter.java │ │ │ │ │ ├── GirlAdapter.java │ │ │ │ │ └── TechAdapter.java │ │ │ │ └── fragment │ │ │ │ │ ├── GankMainFragment.java │ │ │ │ │ ├── GirlFragment.java │ │ │ │ │ └── TechFragment.java │ │ │ ├── gold │ │ │ │ ├── activity │ │ │ │ │ └── GoldManagerActivity.java │ │ │ │ ├── adapter │ │ │ │ │ ├── GoldListAdapter.java │ │ │ │ │ ├── GoldManagerAdapter.java │ │ │ │ │ └── GoldPagerAdapter.java │ │ │ │ └── fragment │ │ │ │ │ ├── GoldMainFragment.java │ │ │ │ │ └── GoldPagerFragment.java │ │ │ ├── main │ │ │ │ ├── activity │ │ │ │ │ ├── MainActivity.java │ │ │ │ │ └── WelcomeActivity.java │ │ │ │ ├── adapter │ │ │ │ │ └── LikeAdapter.java │ │ │ │ └── fragment │ │ │ │ │ ├── AboutFragment.java │ │ │ │ │ ├── LikeFragment.java │ │ │ │ │ └── SettingFragment.java │ │ │ ├── vtex │ │ │ │ ├── activity │ │ │ │ │ ├── NodeActivity.java │ │ │ │ │ ├── NodeListActivity.java │ │ │ │ │ └── RepliesActivity.java │ │ │ │ ├── adapter │ │ │ │ │ ├── NodeAdapter.java │ │ │ │ │ ├── NodeListAdapter.java │ │ │ │ │ ├── RepliesAdapter.java │ │ │ │ │ ├── TopicAdapter.java │ │ │ │ │ └── VtexPagerAdapter.java │ │ │ │ └── fragment │ │ │ │ │ ├── VtexMainFragment.java │ │ │ │ │ └── VtexPagerFragment.java │ │ │ ├── wechat │ │ │ │ ├── adapter │ │ │ │ │ └── WechatAdapter.java │ │ │ │ └── fragment │ │ │ │ │ └── WechatMainFragment.java │ │ │ └── zhihu │ │ │ │ ├── activity │ │ │ │ ├── CalendarActivity.java │ │ │ │ ├── CommentActivity.java │ │ │ │ ├── SectionActivity.java │ │ │ │ ├── ThemeActivity.java │ │ │ │ └── ZhihuDetailActivity.java │ │ │ │ ├── adapter │ │ │ │ ├── CommentAdapter.java │ │ │ │ ├── CommentMainAdapter.java │ │ │ │ ├── DailyAdapter.java │ │ │ │ ├── HotAdapter.java │ │ │ │ ├── SectionAdapter.java │ │ │ │ ├── SectionChildAdapter.java │ │ │ │ ├── ThemeAdapter.java │ │ │ │ ├── ThemeChildAdapter.java │ │ │ │ ├── TopPagerAdapter.java │ │ │ │ └── ZhihuMainAdapter.java │ │ │ │ └── fragment │ │ │ │ ├── CommentFragment.java │ │ │ │ ├── DailyFragment.java │ │ │ │ ├── HotFragment.java │ │ │ │ ├── SectionFragment.java │ │ │ │ ├── ThemeFragment.java │ │ │ │ └── ZhihuMainFragment.java │ │ │ ├── util │ │ │ ├── AlipayUtil.java │ │ │ ├── CircularAnimUtil.java │ │ │ ├── DateUtil.java │ │ │ ├── HtmlUtil.java │ │ │ ├── LogUtil.java │ │ │ ├── RxUtil.java │ │ │ ├── ShareUtil.java │ │ │ ├── SnackbarUtil.java │ │ │ ├── SystemUtil.java │ │ │ ├── ToastUtil.java │ │ │ └── XmlUtil.java │ │ │ └── widget │ │ │ ├── AppBlockCanaryContext.java │ │ │ ├── CircleImageView.java │ │ │ ├── CommonItemDecoration.java │ │ │ ├── CommonSubscriber.java │ │ │ ├── DefaultItemTouchHelpCallback.java │ │ │ ├── FlowLayout.java │ │ │ ├── GoldItemDecoration.java │ │ │ ├── ProgressImageView.java │ │ │ ├── SquareImageView.java │ │ │ ├── TouchSwipeRefreshLayout.java │ │ │ └── ZhihuDiffCallback.java │ └── res │ │ ├── animator │ │ ├── color.xml │ │ ├── lightning.xml │ │ ├── star_first.xml │ │ ├── star_second.xml │ │ └── star_third.xml │ │ ├── drawable │ │ ├── bottom_black_bg.xml │ │ ├── bottom_shadow_bg.xml │ │ ├── dialog_toast_bg.xml │ │ ├── drawer_item_bg.xml │ │ ├── reply_bg.xml │ │ ├── round_face_bg.xml │ │ ├── selector_like.xml │ │ ├── selector_toolbar_like.xml │ │ ├── splash_bg.xml │ │ ├── svg_anim_logo.xml │ │ └── svg_logo.xml │ │ ├── layout │ │ ├── activity_calender.xml │ │ ├── activity_comment.xml │ │ ├── activity_girl_detail.xml │ │ ├── activity_gold_manager.xml │ │ ├── activity_main.xml │ │ ├── activity_node.xml │ │ ├── activity_replies.xml │ │ ├── activity_section.xml │ │ ├── activity_tech_detail.xml │ │ ├── activity_theme.xml │ │ ├── activity_welcome.xml │ │ ├── activity_zhihu_detail.xml │ │ ├── dialog_toast.xml │ │ ├── fragment_about.xml │ │ ├── fragment_comment.xml │ │ ├── fragment_daily.xml │ │ ├── fragment_gank_main.xml │ │ ├── fragment_gold_main.xml │ │ ├── fragment_gold_page.xml │ │ ├── fragment_like.xml │ │ ├── fragment_setting.xml │ │ ├── fragment_tech.xml │ │ ├── fragment_vtex_main.xml │ │ ├── fragment_zhihu_main.xml │ │ ├── item_comment.xml │ │ ├── item_daily.xml │ │ ├── item_date.xml │ │ ├── item_girl.xml │ │ ├── item_gold.xml │ │ ├── item_gold_hot.xml │ │ ├── item_gold_manager.xml │ │ ├── item_gold_title.xml │ │ ├── item_like_article.xml │ │ ├── item_like_girl.xml │ │ ├── item_node.xml │ │ ├── item_node_top.xml │ │ ├── item_replies.xml │ │ ├── item_replies_top.xml │ │ ├── item_section.xml │ │ ├── item_tech.xml │ │ ├── item_theme.xml │ │ ├── item_top.xml │ │ ├── item_top_pager.xml │ │ ├── item_vtex.xml │ │ ├── item_wechat.xml │ │ ├── view_common_list.xml │ │ ├── view_drawer_header.xml │ │ ├── view_error.xml │ │ ├── view_line_05.xml │ │ ├── view_node_title.xml │ │ ├── view_progress.xml │ │ ├── view_tech_head.xml │ │ └── view_toolbar.xml │ │ ├── menu │ │ ├── drawer_menu.xml │ │ ├── girl_menu.xml │ │ ├── main_menu.xml │ │ └── tech_meun.xml │ │ ├── mipmap-night-xxhdpi │ │ ├── bg_drawer.jpg │ │ ├── ic_cache.webp │ │ ├── ic_clear.webp │ │ ├── ic_feedback.webp │ │ ├── ic_hot.webp │ │ ├── ic_image.webp │ │ ├── ic_night.webp │ │ └── ic_update.webp │ │ ├── mipmap-xhdpi │ │ ├── bg_error.png │ │ └── bg_splash.webp │ │ ├── mipmap-xxhdpi │ │ ├── bg_about.webp │ │ ├── bg_drawer.jpg │ │ ├── ic_alipay.jpg │ │ ├── ic_android.webp │ │ ├── ic_author.webp │ │ ├── ic_cache.webp │ │ ├── ic_clear.webp │ │ ├── ic_close.webp │ │ ├── ic_comment.webp │ │ ├── ic_daily_comment.webp │ │ ├── ic_daily_like.webp │ │ ├── ic_daily_share.webp │ │ ├── ic_drag.webp │ │ ├── ic_drawer_about.webp │ │ ├── ic_drawer_gank.webp │ │ ├── ic_drawer_gold.webp │ │ ├── ic_drawer_like.webp │ │ ├── ic_drawer_setting.webp │ │ ├── ic_drawer_vtex.webp │ │ ├── ic_drawer_wechat.webp │ │ ├── ic_drawer_zhihu.webp │ │ ├── ic_fab_calendar.webp │ │ ├── ic_feedback.webp │ │ ├── ic_gold_author.webp │ │ ├── ic_gold_like.webp │ │ ├── ic_gold_time.webp │ │ ├── ic_hot.webp │ │ ├── ic_image.webp │ │ ├── ic_ios.webp │ │ ├── ic_launcher.png │ │ ├── ic_menu.webp │ │ ├── ic_night.webp │ │ ├── ic_time.webp │ │ ├── ic_toolbar_copy.webp │ │ ├── ic_toolbar_like_n.webp │ │ ├── ic_toolbar_like_p.webp │ │ ├── ic_toolbar_save.webp │ │ ├── ic_toolbar_share.webp │ │ ├── ic_update.webp │ │ └── ic_web.webp │ │ ├── values-night │ │ └── colors.xml │ │ ├── values-w820dp │ │ └── dimens.xml │ │ ├── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ ├── fileprovidepaths.xml │ │ ├── nodes.xml │ │ └── preferences.xml │ └── test │ └── java │ └── com │ └── codeest │ └── geeknews │ └── ExampleUnitTest.java ├── build.gradle ├── config.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screenshots ├── GIF1.gif ├── GIF2.gif ├── GIF3.gif ├── PNG1.png ├── PNG2.png ├── PNG3.png ├── PNG4.png ├── PNG5.png └── download.png └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/libs/tbs_sdk_thirdapp_v2.2.0.1096_36549_sharewithdownload_withoutGame_obfs_20160830_211645.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/libs/tbs_sdk_thirdapp_v2.2.0.1096_36549_sharewithdownload_withoutGame_obfs_20160830_211645.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /Users/codeest/Library/Android/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/codeest/geeknews/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static junit.framework.Assert.assertEquals; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.codeest.geeknews", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/BasePresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base; 2 | 3 | /** 4 | * Created by codeest on 2016/8/2. 5 | * Presenter基类 6 | */ 7 | public interface BasePresenter{ 8 | 9 | void attachView(T view); 10 | 11 | void detachView(); 12 | } 13 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/BaseView.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base; 2 | 3 | /** 4 | * Created by codeest on 2016/8/2. 5 | * View基类 6 | */ 7 | public interface BaseView { 8 | 9 | void showErrorMsg(String msg); 10 | 11 | void useNightMode(boolean isNight); 12 | 13 | //======= State ======= 14 | void stateError(); 15 | 16 | void stateEmpty(); 17 | 18 | void stateLoading(); 19 | 20 | void stateMain(); 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/RxPresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base; 2 | 3 | import com.codeest.geeknews.component.RxBus; 4 | 5 | import io.reactivex.disposables.CompositeDisposable; 6 | import io.reactivex.disposables.Disposable; 7 | import io.reactivex.functions.Consumer; 8 | 9 | /** 10 | * Created by codeest on 2016/8/2. 11 | * 基于Rx的Presenter封装,控制订阅的生命周期 12 | */ 13 | public class RxPresenter implements BasePresenter { 14 | 15 | protected T mView; 16 | protected CompositeDisposable mCompositeDisposable; 17 | 18 | protected void unSubscribe() { 19 | if (mCompositeDisposable != null) { 20 | mCompositeDisposable.clear(); 21 | } 22 | } 23 | 24 | protected void addSubscribe(Disposable subscription) { 25 | if (mCompositeDisposable == null) { 26 | mCompositeDisposable = new CompositeDisposable(); 27 | } 28 | mCompositeDisposable.add(subscription); 29 | } 30 | 31 | protected void addRxBusSubscribe(Class eventType, Consumer act) { 32 | if (mCompositeDisposable == null) { 33 | mCompositeDisposable = new CompositeDisposable(); 34 | } 35 | mCompositeDisposable.add(RxBus.getDefault().toDefaultFlowable(eventType, act)); 36 | } 37 | 38 | @Override 39 | public void attachView(T view) { 40 | this.mView = view; 41 | } 42 | 43 | @Override 44 | public void detachView() { 45 | this.mView = null; 46 | unSubscribe(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/SimpleActivity.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.support.annotation.Nullable; 6 | import android.support.v7.widget.Toolbar; 7 | import android.view.View; 8 | 9 | import com.codeest.geeknews.app.App; 10 | 11 | import butterknife.ButterKnife; 12 | import butterknife.Unbinder; 13 | import me.yokeyword.fragmentation.SupportActivity; 14 | 15 | /** 16 | * Created by codeest on 16/8/11. 17 | * 无MVP的activity基类 18 | */ 19 | 20 | public abstract class SimpleActivity extends SupportActivity { 21 | 22 | protected Activity mContext; 23 | private Unbinder mUnBinder; 24 | 25 | @Override 26 | protected void onCreate(@Nullable Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(getLayout()); 29 | mUnBinder = ButterKnife.bind(this); 30 | mContext = this; 31 | onViewCreated(); 32 | App.getInstance().addActivity(this); 33 | initEventAndData(); 34 | } 35 | 36 | protected void setToolBar(Toolbar toolbar, String title) { 37 | toolbar.setTitle(title); 38 | setSupportActionBar(toolbar); 39 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 40 | getSupportActionBar().setDisplayShowHomeEnabled(true); 41 | toolbar.setNavigationOnClickListener(new View.OnClickListener() { 42 | @Override 43 | public void onClick(View view) { 44 | onBackPressedSupport(); 45 | } 46 | }); 47 | } 48 | 49 | protected void onViewCreated() { 50 | 51 | } 52 | 53 | @Override 54 | protected void onDestroy() { 55 | super.onDestroy(); 56 | App.getInstance().removeActivity(this); 57 | mUnBinder.unbind(); 58 | } 59 | 60 | protected abstract int getLayout(); 61 | protected abstract void initEventAndData(); 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/SimpleFragment.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.os.Bundle; 6 | import android.support.annotation.Nullable; 7 | import android.view.LayoutInflater; 8 | import android.view.View; 9 | import android.view.ViewGroup; 10 | 11 | import butterknife.ButterKnife; 12 | import butterknife.Unbinder; 13 | import me.yokeyword.fragmentation.SupportFragment; 14 | 15 | /** 16 | * Created by codeest on 16/8/11. 17 | * 无MVP的Fragment基类 18 | */ 19 | 20 | public abstract class SimpleFragment extends SupportFragment { 21 | 22 | protected View mView; 23 | protected Activity mActivity; 24 | protected Context mContext; 25 | private Unbinder mUnBinder; 26 | protected boolean isInited = false; 27 | 28 | @Override 29 | public void onAttach(Context context) { 30 | mActivity = (Activity) context; 31 | mContext = context; 32 | super.onAttach(context); 33 | } 34 | 35 | @Nullable 36 | @Override 37 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 38 | mView = inflater.inflate(getLayoutId(), null); 39 | return mView; 40 | } 41 | 42 | @Override 43 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 44 | super.onViewCreated(view, savedInstanceState); 45 | mUnBinder = ButterKnife.bind(this, view); 46 | } 47 | 48 | @Override 49 | public void onLazyInitView(@Nullable Bundle savedInstanceState) { 50 | super.onLazyInitView(savedInstanceState); 51 | isInited = true; 52 | initEventAndData(); 53 | } 54 | 55 | @Override 56 | public void onDestroyView() { 57 | super.onDestroyView(); 58 | mUnBinder.unbind(); 59 | } 60 | 61 | protected abstract int getLayoutId(); 62 | protected abstract void initEventAndData(); 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/gank/GirlContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.gank; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.GankItemBean; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by codeest on 16/8/19. 11 | */ 12 | 13 | public interface GirlContract { 14 | 15 | interface View extends BaseView { 16 | 17 | void showContent(List list); 18 | 19 | void showMoreContent(List list); 20 | } 21 | 22 | interface Presenter extends BasePresenter { 23 | 24 | void getGirlData(); 25 | 26 | void getMoreGirlData(); 27 | 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/gank/TechContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.gank; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.GankItemBean; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by codeest on 16/8/20. 11 | */ 12 | 13 | public interface TechContract { 14 | 15 | interface View extends BaseView { 16 | 17 | void showContent(List mList); 18 | 19 | void showMoreContent(List mList); 20 | 21 | void showGirlImage(String url, String copyright); 22 | } 23 | 24 | interface Presenter extends BasePresenter { 25 | 26 | void getGankData(String tech, int type); 27 | 28 | void getMoreGankData(String tech); 29 | 30 | void getGirlImage(); 31 | 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/gold/GoldContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.gold; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.GoldListBean; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by codeest on 16/11/27. 11 | */ 12 | 13 | public interface GoldContract { 14 | 15 | interface View extends BaseView { 16 | 17 | void showContent(List goldListBean); 18 | 19 | void showMoreContent(List goldMoreListBean, int start, int end); 20 | } 21 | 22 | interface Presenter extends BasePresenter { 23 | 24 | void getGoldData(String type); 25 | 26 | void getMoreGoldData(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/gold/GoldMainContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.gold; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.GoldManagerBean; 6 | import com.codeest.geeknews.model.bean.GoldManagerItemBean; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by codeest on 16/11/28. 12 | */ 13 | 14 | public interface GoldMainContract { 15 | 16 | interface View extends BaseView { 17 | 18 | void updateTab(List mList); 19 | 20 | void jumpToManager(GoldManagerBean mBean); 21 | } 22 | 23 | interface Presenter extends BasePresenter { 24 | 25 | void initManagerList(); 26 | 27 | void setManagerList(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/main/LikeContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.main; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.RealmLikeBean; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by codeest on 2016/8/23. 11 | */ 12 | public interface LikeContract { 13 | 14 | interface View extends BaseView { 15 | 16 | void showContent(List mList); 17 | } 18 | 19 | interface Presenter extends BasePresenter { 20 | 21 | void getLikeData(); 22 | 23 | void deleteLikeData(String id); 24 | 25 | void changeLikeTime(String id,long time,boolean isPlus); 26 | 27 | boolean getLikePoint(); 28 | 29 | void setLikePoint(boolean b); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/main/MainContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.main; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.tbruyelle.rxpermissions2.RxPermissions; 6 | 7 | /** 8 | * Created by codeest on 16/8/9. 9 | */ 10 | 11 | public interface MainContract { 12 | 13 | interface View extends BaseView{ 14 | 15 | void showUpdateDialog(String versionContent); 16 | 17 | void startDownloadService(); 18 | } 19 | 20 | interface Presenter extends BasePresenter { 21 | 22 | void checkVersion(String currentVersion); 23 | 24 | void checkPermissions(RxPermissions rxPermissions); 25 | 26 | void setNightModeState(boolean b); 27 | 28 | void setCurrentItem(int index); 29 | 30 | int getCurrentItem(); 31 | 32 | void setVersionPoint(boolean b); 33 | 34 | boolean getVersionPoint(); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/main/SettingContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.main; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.VersionBean; 6 | 7 | /** 8 | * Created by codeest on 16/10/17. 9 | */ 10 | 11 | public interface SettingContract { 12 | 13 | interface View extends BaseView { 14 | 15 | void showUpdateDialog(VersionBean bean); 16 | 17 | } 18 | 19 | interface Presenter extends BasePresenter { 20 | 21 | void checkVersion(String currentVersion); 22 | 23 | void setNightModeState(boolean b); 24 | 25 | void setNoImageState(boolean b); 26 | 27 | void setAutoCacheState(boolean b); 28 | 29 | boolean getNightModeState(); 30 | 31 | boolean getNoImageState(); 32 | 33 | boolean getAutoCacheState(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/main/WelcomeContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.main; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.WelcomeBean; 6 | 7 | /** 8 | * Created by codeest on 16/8/15. 9 | */ 10 | 11 | public interface WelcomeContract { 12 | 13 | interface View extends BaseView { 14 | 15 | void showContent(WelcomeBean welcomeBean); 16 | 17 | void jumpToMain(); 18 | 19 | } 20 | 21 | interface Presenter extends BasePresenter { 22 | 23 | void getWelcomeData(); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/vtex/NodeContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.vtex; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.NodeBean; 6 | import com.codeest.geeknews.model.bean.NodeListBean; 7 | 8 | import java.util.List; 9 | 10 | /** 11 | * Created by codeest on 16/12/23. 12 | */ 13 | 14 | public interface NodeContract { 15 | 16 | interface View extends BaseView { 17 | 18 | void showContent(List mList); 19 | 20 | void showTopInfo(NodeBean mTopInfo); 21 | } 22 | 23 | interface Presenter extends BasePresenter { 24 | 25 | void getContent(String node_name); 26 | 27 | void getTopInfo(String node_name); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/vtex/RepliesContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.vtex; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.NodeListBean; 6 | import com.codeest.geeknews.model.bean.RealmLikeBean; 7 | import com.codeest.geeknews.model.bean.RepliesListBean; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by codeest on 16/12/23. 13 | */ 14 | 15 | public interface RepliesContract { 16 | 17 | interface View extends BaseView { 18 | 19 | void showContent(List mList); 20 | 21 | void showTopInfo(NodeListBean mTopInfo); 22 | } 23 | 24 | interface Presenter extends BasePresenter { 25 | 26 | void getContent(String topic_id); 27 | 28 | void getTopInfo(String topic_id); 29 | 30 | void insert(RealmLikeBean bean); 31 | 32 | void delete(String id); 33 | 34 | boolean query(String id); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/vtex/VtexContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.vtex; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.TopicListBean; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by codeest on 16/12/23. 11 | */ 12 | 13 | public interface VtexContract { 14 | 15 | interface View extends BaseView { 16 | 17 | void showContent(List mList); 18 | 19 | } 20 | 21 | interface Presenter extends BasePresenter { 22 | 23 | void getContent(String type); 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/wechat/WechatContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.wechat; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.WXItemBean; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by codeest on 16/8/29. 11 | */ 12 | 13 | public interface WechatContract { 14 | 15 | interface View extends BaseView { 16 | 17 | void showContent(List mList); 18 | 19 | void showMoreContent(List mList); 20 | } 21 | 22 | interface Presenter extends BasePresenter { 23 | 24 | void getWechatData(); 25 | 26 | void getMoreWechatData(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/zhihu/CommentContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.zhihu; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.CommentBean; 6 | 7 | /** 8 | * Created by codeest on 16/8/18. 9 | */ 10 | 11 | public interface CommentContract { 12 | 13 | interface View extends BaseView { 14 | 15 | void showContent(CommentBean commentBean); 16 | 17 | } 18 | 19 | interface Presenter extends BasePresenter { 20 | 21 | void getCommentData(int id,int commentKind); 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/zhihu/DailyContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.zhihu; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.DailyBeforeListBean; 6 | import com.codeest.geeknews.model.bean.DailyListBean; 7 | 8 | /** 9 | * Created by codeest on 16/8/11. 10 | */ 11 | 12 | public interface DailyContract { 13 | 14 | interface View extends BaseView { 15 | 16 | void showContent(DailyListBean info); 17 | 18 | void showMoreContent(String date,DailyBeforeListBean info); 19 | 20 | void doInterval(int currentCount); 21 | } 22 | 23 | interface Presenter extends BasePresenter { 24 | 25 | void getDailyData(); 26 | 27 | void getBeforeData(String date); 28 | 29 | void startInterval(); 30 | 31 | void stopInterval(); 32 | 33 | void insertReadToDB(int id); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/zhihu/HotContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.zhihu; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.HotListBean; 6 | 7 | /** 8 | * Created by codeest on 16/8/12. 9 | */ 10 | 11 | public interface HotContract { 12 | 13 | interface View extends BaseView { 14 | 15 | void showContent(HotListBean hotListBean); 16 | } 17 | 18 | interface Presenter extends BasePresenter { 19 | 20 | void getHotData(); 21 | 22 | void insertReadToDB(int id); 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/zhihu/SectionChildContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.zhihu; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.SectionChildListBean; 6 | 7 | /** 8 | * Created by codeest on 16/8/28. 9 | */ 10 | 11 | public interface SectionChildContract { 12 | 13 | interface View extends BaseView { 14 | 15 | void showContent(SectionChildListBean sectionChildListBean); 16 | } 17 | 18 | interface Presenter extends BasePresenter { 19 | 20 | void getThemeChildData(int id); 21 | 22 | void insertReadToDB(int id); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/zhihu/SectionContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.zhihu; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.SectionListBean; 6 | 7 | /** 8 | * Created by codeest on 16/8/12. 9 | */ 10 | 11 | public interface SectionContract { 12 | 13 | interface View extends BaseView { 14 | 15 | void showContent(SectionListBean sectionListBean); 16 | 17 | } 18 | 19 | interface Presenter extends BasePresenter { 20 | 21 | void getSectionData(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/zhihu/ThemeChildContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.zhihu; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.ThemeChildListBean; 6 | 7 | /** 8 | * Created by codeest on 16/8/24. 9 | */ 10 | 11 | public interface ThemeChildContract { 12 | 13 | interface View extends BaseView { 14 | 15 | void showContent(ThemeChildListBean themeChildListBean); 16 | 17 | } 18 | 19 | interface Presenter extends BasePresenter { 20 | 21 | void getThemeChildData(int id); 22 | 23 | void insertReadToDB(int id); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/zhihu/ThemeContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.zhihu; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.ThemeListBean; 6 | 7 | /** 8 | * Created by codeest on 16/8/12. 9 | */ 10 | 11 | public interface ThemeContract { 12 | 13 | interface View extends BaseView { 14 | 15 | void showContent(ThemeListBean themeListBean); 16 | } 17 | 18 | interface Presenter extends BasePresenter { 19 | 20 | void getThemeData(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/base/contract/zhihu/ZhihuDetailContract.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.base.contract.zhihu; 2 | 3 | import com.codeest.geeknews.base.BasePresenter; 4 | import com.codeest.geeknews.base.BaseView; 5 | import com.codeest.geeknews.model.bean.DetailExtraBean; 6 | import com.codeest.geeknews.model.bean.ZhihuDetailBean; 7 | 8 | /** 9 | * Created by codeest on 16/8/13. 10 | */ 11 | 12 | public interface ZhihuDetailContract { 13 | 14 | interface View extends BaseView { 15 | 16 | void showContent(ZhihuDetailBean zhihuDetailBean); 17 | 18 | void showExtraInfo(DetailExtraBean detailExtraBean); 19 | 20 | void setLikeButtonState(boolean isLiked); 21 | } 22 | 23 | interface Presenter extends BasePresenter { 24 | 25 | void getDetailData(int id); 26 | 27 | void getExtraData(int id); 28 | 29 | void insertLikeData(); 30 | 31 | void deleteLikeData(); 32 | 33 | void queryLikeData(int id); 34 | 35 | boolean getNoImageState(); 36 | 37 | boolean getAutoCacheState(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/component/ImageLoader.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.component; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.widget.ImageView; 6 | 7 | import com.bumptech.glide.Glide; 8 | import com.bumptech.glide.load.engine.DiskCacheStrategy; 9 | import com.codeest.geeknews.app.App; 10 | 11 | /** 12 | * Created by codeest on 2016/8/2. 13 | */ 14 | public class ImageLoader { 15 | 16 | public static void load(Context context, String url, ImageView iv) { //使用Glide加载圆形ImageView(如头像)时,不要使用占位图 17 | if (!App.getAppComponent().preferencesHelper().getNoImageState()) { 18 | Glide.with(context).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(iv); 19 | } 20 | } 21 | 22 | public static void load(Activity activity, String url, ImageView iv) { //使用Glide加载圆形ImageView(如头像)时,不要使用占位图 23 | if(!activity.isDestroyed()) { 24 | Glide.with(activity).load(url).crossFade().diskCacheStrategy(DiskCacheStrategy.SOURCE).into(iv); 25 | } 26 | } 27 | 28 | public static void loadAll(Context context, String url, ImageView iv) { //不缓存,全部从网络加载 29 | Glide.with(context).load(url).crossFade().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(iv); 30 | } 31 | 32 | public static void loadAll(Activity activity, String url, ImageView iv) { //不缓存,全部从网络加载 33 | if(!activity.isDestroyed()) { 34 | Glide.with(activity).load(url).crossFade().skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(iv); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/component/RxBus.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.component; 2 | 3 | import com.codeest.geeknews.util.RxUtil; 4 | 5 | import io.reactivex.Flowable; 6 | import io.reactivex.disposables.Disposable; 7 | import io.reactivex.functions.Consumer; 8 | import io.reactivex.processors.FlowableProcessor; 9 | import io.reactivex.processors.PublishProcessor; 10 | 11 | /** 12 | * Created by codeest on 2016/8/2. 13 | */ 14 | public class RxBus { 15 | // 主题 16 | private final FlowableProcessor bus; 17 | // PublishSubject只会把在订阅发生的时间点之后来自原始Flowable的数据发射给观察者 18 | private RxBus() { 19 | bus = PublishProcessor.create().toSerialized(); 20 | } 21 | 22 | public static RxBus getDefault() { 23 | return RxBusHolder.sInstance; 24 | } 25 | 26 | private static class RxBusHolder { 27 | private static final RxBus sInstance = new RxBus(); 28 | } 29 | 30 | 31 | // 提供了一个新的事件 32 | public void post(Object o) { 33 | bus.onNext(o); 34 | } 35 | 36 | // 根据传递的 eventType 类型返回特定类型(eventType)的 被观察者 37 | public Flowable toFlowable(Class eventType) { 38 | return bus.ofType(eventType); 39 | } 40 | 41 | // 封装默认订阅 42 | public Disposable toDefaultFlowable(Class eventType, Consumer act) { 43 | return bus.ofType(eventType).compose(RxUtil.rxSchedulerHelper()).subscribe(act); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/component/ActivityComponent.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.component; 2 | 3 | import android.app.Activity; 4 | 5 | import com.codeest.geeknews.di.scope.ActivityScope; 6 | import com.codeest.geeknews.di.module.ActivityModule; 7 | import com.codeest.geeknews.ui.main.activity.MainActivity; 8 | import com.codeest.geeknews.ui.main.activity.WelcomeActivity; 9 | import com.codeest.geeknews.ui.vtex.activity.NodeListActivity; 10 | import com.codeest.geeknews.ui.vtex.activity.RepliesActivity; 11 | import com.codeest.geeknews.ui.zhihu.activity.SectionActivity; 12 | import com.codeest.geeknews.ui.zhihu.activity.ThemeActivity; 13 | import com.codeest.geeknews.ui.zhihu.activity.ZhihuDetailActivity; 14 | 15 | import dagger.Component; 16 | 17 | /** 18 | * Created by codeest on 16/8/7. 19 | */ 20 | 21 | @ActivityScope 22 | @Component(dependencies = AppComponent.class, modules = ActivityModule.class) 23 | public interface ActivityComponent { 24 | 25 | Activity getActivity(); 26 | 27 | void inject(WelcomeActivity welcomeActivity); 28 | 29 | void inject(MainActivity mainActivity); 30 | 31 | void inject(ZhihuDetailActivity zhihuDetailActivity); 32 | 33 | void inject(ThemeActivity themeActivity); 34 | 35 | void inject(SectionActivity sectionActivity); 36 | 37 | void inject(RepliesActivity repliesActivity); 38 | 39 | void inject(NodeListActivity nodeListActivity); 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/component/AppComponent.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.component; 2 | 3 | import com.codeest.geeknews.app.App; 4 | import com.codeest.geeknews.di.module.AppModule; 5 | import com.codeest.geeknews.di.module.HttpModule; 6 | import com.codeest.geeknews.model.DataManager; 7 | import com.codeest.geeknews.model.db.RealmHelper; 8 | import com.codeest.geeknews.model.http.RetrofitHelper; 9 | import com.codeest.geeknews.model.prefs.ImplPreferencesHelper; 10 | 11 | import javax.inject.Singleton; 12 | 13 | import dagger.Component; 14 | 15 | /** 16 | * Created by codeest on 16/8/7. 17 | */ 18 | 19 | @Singleton 20 | @Component(modules = {AppModule.class, HttpModule.class}) 21 | public interface AppComponent { 22 | 23 | App getContext(); // 提供App的Context 24 | 25 | DataManager getDataManager(); //数据中心 26 | 27 | RetrofitHelper retrofitHelper(); //提供http的帮助类 28 | 29 | RealmHelper realmHelper(); //提供数据库帮助类 30 | 31 | ImplPreferencesHelper preferencesHelper(); //提供sp帮助类 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/component/FragmentComponent.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.component; 2 | 3 | import android.app.Activity; 4 | 5 | import com.codeest.geeknews.di.scope.FragmentScope; 6 | import com.codeest.geeknews.di.module.FragmentModule; 7 | import com.codeest.geeknews.ui.gank.fragment.GirlFragment; 8 | import com.codeest.geeknews.ui.gank.fragment.TechFragment; 9 | import com.codeest.geeknews.ui.gold.fragment.GoldMainFragment; 10 | import com.codeest.geeknews.ui.gold.fragment.GoldPagerFragment; 11 | import com.codeest.geeknews.ui.main.fragment.LikeFragment; 12 | import com.codeest.geeknews.ui.main.fragment.SettingFragment; 13 | import com.codeest.geeknews.ui.vtex.fragment.VtexPagerFragment; 14 | import com.codeest.geeknews.ui.wechat.fragment.WechatMainFragment; 15 | import com.codeest.geeknews.ui.zhihu.fragment.CommentFragment; 16 | import com.codeest.geeknews.ui.zhihu.fragment.DailyFragment; 17 | import com.codeest.geeknews.ui.zhihu.fragment.HotFragment; 18 | import com.codeest.geeknews.ui.zhihu.fragment.SectionFragment; 19 | import com.codeest.geeknews.ui.zhihu.fragment.ThemeFragment; 20 | 21 | import dagger.Component; 22 | 23 | /** 24 | * Created by codeest on 16/8/7. 25 | */ 26 | 27 | @FragmentScope 28 | @Component(dependencies = AppComponent.class, modules = FragmentModule.class) 29 | public interface FragmentComponent { 30 | 31 | Activity getActivity(); 32 | 33 | void inject(DailyFragment dailyFragment); 34 | 35 | void inject(ThemeFragment themeFragment); 36 | 37 | void inject(SectionFragment sectionFragment); 38 | 39 | void inject(HotFragment hotFragment); 40 | 41 | void inject(CommentFragment longCommentFragment); 42 | 43 | void inject(TechFragment techFragment); 44 | 45 | void inject(GirlFragment girlFragment); 46 | 47 | void inject(LikeFragment likeFragment); 48 | 49 | void inject(WechatMainFragment wechatMainFragment); 50 | 51 | void inject(SettingFragment settingFragment); 52 | 53 | void inject(GoldMainFragment goldMainFragment); 54 | 55 | void inject(GoldPagerFragment goldPagerFragment); 56 | 57 | void inject(VtexPagerFragment vtexPagerFragment); 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/module/ActivityModule.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.module; 2 | 3 | import android.app.Activity; 4 | 5 | import com.codeest.geeknews.di.scope.ActivityScope; 6 | 7 | import dagger.Module; 8 | import dagger.Provides; 9 | 10 | /** 11 | * Created by codeest on 16/8/7. 12 | */ 13 | 14 | @Module 15 | public class ActivityModule { 16 | private Activity mActivity; 17 | 18 | public ActivityModule(Activity activity) { 19 | this.mActivity = activity; 20 | } 21 | 22 | @Provides 23 | @ActivityScope 24 | public Activity provideActivity() { 25 | return mActivity; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/module/AppModule.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.module; 2 | 3 | import com.codeest.geeknews.app.App; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.model.db.DBHelper; 6 | import com.codeest.geeknews.model.db.RealmHelper; 7 | import com.codeest.geeknews.model.http.HttpHelper; 8 | import com.codeest.geeknews.model.http.RetrofitHelper; 9 | import com.codeest.geeknews.model.prefs.ImplPreferencesHelper; 10 | import com.codeest.geeknews.model.prefs.PreferencesHelper; 11 | 12 | import javax.inject.Singleton; 13 | 14 | import dagger.Module; 15 | import dagger.Provides; 16 | 17 | /** 18 | * Created by codeest on 16/8/7. 19 | */ 20 | 21 | @Module 22 | public class AppModule { 23 | private final App application; 24 | 25 | public AppModule(App application) { 26 | this.application = application; 27 | } 28 | 29 | @Provides 30 | @Singleton 31 | App provideApplicationContext() { 32 | return application; 33 | } 34 | 35 | @Provides 36 | @Singleton 37 | HttpHelper provideHttpHelper(RetrofitHelper retrofitHelper) { 38 | return retrofitHelper; 39 | } 40 | 41 | @Provides 42 | @Singleton 43 | DBHelper provideDBHelper(RealmHelper realmHelper) { 44 | return realmHelper; 45 | } 46 | 47 | @Provides 48 | @Singleton 49 | PreferencesHelper providePreferencesHelper(ImplPreferencesHelper implPreferencesHelper) { 50 | return implPreferencesHelper; 51 | } 52 | 53 | @Provides 54 | @Singleton 55 | DataManager provideDataManager(HttpHelper httpHelper, DBHelper DBHelper, PreferencesHelper preferencesHelper) { 56 | return new DataManager(httpHelper, DBHelper, preferencesHelper); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/module/FragmentModule.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.module; 2 | 3 | import android.app.Activity; 4 | import android.support.v4.app.Fragment; 5 | 6 | import com.codeest.geeknews.di.scope.FragmentScope; 7 | 8 | import dagger.Module; 9 | import dagger.Provides; 10 | 11 | /** 12 | * Created by codeest on 16/8/7. 13 | */ 14 | 15 | @Module 16 | public class FragmentModule { 17 | 18 | private Fragment fragment; 19 | 20 | public FragmentModule(Fragment fragment) { 21 | this.fragment = fragment; 22 | } 23 | 24 | @Provides 25 | @FragmentScope 26 | public Activity provideActivity() { 27 | return fragment.getActivity(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/qualifier/GankUrl.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.qualifier; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.Retention; 5 | 6 | import javax.inject.Qualifier; 7 | 8 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 9 | 10 | /** 11 | * Created by codeest on 2017/2/26. 12 | */ 13 | 14 | @Qualifier 15 | @Documented 16 | @Retention(RUNTIME) 17 | public @interface GankUrl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/qualifier/GoldUrl.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.qualifier; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.Retention; 5 | 6 | import javax.inject.Qualifier; 7 | 8 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 9 | 10 | /** 11 | * Created by codeest on 2017/2/26. 12 | */ 13 | 14 | @Qualifier 15 | @Documented 16 | @Retention(RUNTIME) 17 | public @interface GoldUrl { 18 | 19 | } -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/qualifier/MyUrl.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.qualifier; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.Retention; 5 | 6 | import javax.inject.Qualifier; 7 | 8 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 9 | 10 | /** 11 | * Created by codeest on 2017/2/26. 12 | */ 13 | 14 | @Qualifier 15 | @Documented 16 | @Retention(RUNTIME) 17 | public @interface MyUrl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/qualifier/VtexUrl.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.qualifier; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.Retention; 5 | 6 | import javax.inject.Qualifier; 7 | 8 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 9 | 10 | /** 11 | * Created by codeest on 2017/2/26. 12 | */ 13 | 14 | @Qualifier 15 | @Documented 16 | @Retention(RUNTIME) 17 | public @interface VtexUrl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/qualifier/WechatUrl.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.qualifier; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.Retention; 5 | 6 | import javax.inject.Qualifier; 7 | 8 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 9 | 10 | /** 11 | * Created by codeest on 2017/2/26. 12 | */ 13 | 14 | @Qualifier 15 | @Documented 16 | @Retention(RUNTIME) 17 | public @interface WechatUrl { 18 | 19 | } -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/qualifier/ZhihuUrl.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.qualifier; 2 | 3 | import java.lang.annotation.Documented; 4 | import java.lang.annotation.Retention; 5 | 6 | import javax.inject.Qualifier; 7 | 8 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 9 | 10 | /** 11 | * Created by codeest on 2017/2/26. 12 | */ 13 | 14 | @Qualifier 15 | @Documented 16 | @Retention(RUNTIME) 17 | public @interface ZhihuUrl { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/scope/ActivityScope.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.scope; 2 | 3 | import java.lang.annotation.Retention; 4 | 5 | import javax.inject.Scope; 6 | 7 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 8 | 9 | /** 10 | * Created by codeest on 16/8/7. 11 | */ 12 | 13 | @Scope 14 | @Retention(RUNTIME) 15 | public @interface ActivityScope { 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/di/scope/FragmentScope.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.di.scope; 2 | 3 | import java.lang.annotation.Retention; 4 | 5 | import javax.inject.Scope; 6 | 7 | import static java.lang.annotation.RetentionPolicy.RUNTIME; 8 | 9 | /** 10 | * Created by codeest on 16/8/7. 11 | */ 12 | 13 | @Scope 14 | @Retention(RUNTIME) 15 | public @interface FragmentScope { 16 | } 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/CalendarBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | /** 4 | * Created by codeest on 16/8/13. 5 | */ 6 | 7 | public class CalendarBean { 8 | 9 | public CalendarBean(int year, int month, int day) { 10 | this.year = year; 11 | this.month = month; 12 | this.day = day; 13 | } 14 | 15 | private int year; 16 | 17 | private int month; 18 | 19 | private int day; 20 | 21 | public int getDay() { 22 | return day; 23 | } 24 | 25 | public int getMonth() { 26 | return month; 27 | } 28 | 29 | public int getYear() { 30 | return year; 31 | } 32 | 33 | public void setDay(int day) { 34 | this.day = day; 35 | } 36 | 37 | public void setMonth(int month) { 38 | this.month = month; 39 | } 40 | 41 | public void setYear(int year) { 42 | this.year = year; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/DetailExtraBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | /** 4 | * Created by codeest on 16/8/14. 5 | */ 6 | 7 | public class DetailExtraBean { 8 | 9 | /** 10 | * long_comments : 0 11 | * popularity : 161 12 | * short_comments : 19 13 | * comments : 19 14 | */ 15 | 16 | private int long_comments; 17 | private int popularity; 18 | private int short_comments; 19 | private int comments; 20 | 21 | public int getLong_comments() { 22 | return long_comments; 23 | } 24 | 25 | public void setLong_comments(int long_comments) { 26 | this.long_comments = long_comments; 27 | } 28 | 29 | public int getPopularity() { 30 | return popularity; 31 | } 32 | 33 | public void setPopularity(int popularity) { 34 | this.popularity = popularity; 35 | } 36 | 37 | public int getShort_comments() { 38 | return short_comments; 39 | } 40 | 41 | public void setShort_comments(int short_comments) { 42 | this.short_comments = short_comments; 43 | } 44 | 45 | public int getComments() { 46 | return comments; 47 | } 48 | 49 | public void setComments(int comments) { 50 | this.comments = comments; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/GankSearchItemBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | /** 4 | * Created by codeest on 2016/9/1. 5 | */ 6 | public class GankSearchItemBean { 7 | 8 | 9 | /** 10 | * desc : listview的折叠效果 11 | * ganhuo_id : 56cc6d1d421aa95caa7076fa 12 | * publishedAt : 2015-07-17T03:43:22.395000 13 | * readability : 123 14 | * type : Android 15 | * url : https://github.com/dodola/ListItemFold 16 | * who : Jason 17 | */ 18 | 19 | private String desc; 20 | private String ganhuo_id; 21 | private String publishedAt; 22 | private String readability; 23 | private String type; 24 | private String url; 25 | private String who; 26 | 27 | public String getDesc() { 28 | return desc; 29 | } 30 | 31 | public void setDesc(String desc) { 32 | this.desc = desc; 33 | } 34 | 35 | public String getGanhuo_id() { 36 | return ganhuo_id; 37 | } 38 | 39 | public void setGanhuo_id(String ganhuo_id) { 40 | this.ganhuo_id = ganhuo_id; 41 | } 42 | 43 | public String getPublishedAt() { 44 | return publishedAt; 45 | } 46 | 47 | public void setPublishedAt(String publishedAt) { 48 | this.publishedAt = publishedAt; 49 | } 50 | 51 | public String getReadability() { 52 | return readability; 53 | } 54 | 55 | public void setReadability(String readability) { 56 | this.readability = readability; 57 | } 58 | 59 | public String getType() { 60 | return type; 61 | } 62 | 63 | public void setType(String type) { 64 | this.type = type; 65 | } 66 | 67 | public String getUrl() { 68 | return url; 69 | } 70 | 71 | public void setUrl(String url) { 72 | this.url = url; 73 | } 74 | 75 | public String getWho() { 76 | return who; 77 | } 78 | 79 | public void setWho(String who) { 80 | this.who = who; 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/GoldManagerBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | import io.realm.RealmList; 7 | import io.realm.RealmObject; 8 | 9 | /** 10 | * Created by codeest on 16/11/27. 11 | */ 12 | 13 | public class GoldManagerBean extends RealmObject implements Parcelable { 14 | 15 | public GoldManagerBean() { 16 | 17 | } 18 | 19 | private RealmList managerList; 20 | 21 | public RealmList getManagerList() { 22 | return managerList; 23 | } 24 | 25 | public void setManagerList(RealmList managerList) { 26 | this.managerList = managerList; 27 | } 28 | 29 | @Override 30 | public int describeContents() { 31 | return 0; 32 | } 33 | 34 | @Override 35 | public void writeToParcel(Parcel dest, int flags) { 36 | dest.writeList(this.managerList); 37 | } 38 | 39 | protected GoldManagerBean(Parcel in) { 40 | this.managerList = new RealmList<>(); 41 | in.readList(this.managerList, GoldManagerItemBean.class.getClassLoader()); 42 | } 43 | 44 | public GoldManagerBean(RealmList mList) { 45 | this.managerList = mList; 46 | } 47 | 48 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { 49 | @Override 50 | public GoldManagerBean createFromParcel(Parcel source) { 51 | return new GoldManagerBean(source); 52 | } 53 | 54 | @Override 55 | public GoldManagerBean[] newArray(int size) { 56 | return new GoldManagerBean[size]; 57 | } 58 | }; 59 | } 60 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/GoldManagerItemBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | import android.os.Parcel; 4 | import android.os.Parcelable; 5 | 6 | import io.realm.RealmObject; 7 | 8 | /** 9 | * Created by codeest on 16/12/1. 10 | */ 11 | 12 | public class GoldManagerItemBean extends RealmObject implements Parcelable { 13 | 14 | private int index; 15 | 16 | private boolean isSelect; 17 | 18 | public GoldManagerItemBean () { 19 | 20 | } 21 | 22 | public GoldManagerItemBean (int index, boolean isSelect) { 23 | this.index = index; 24 | this.isSelect = isSelect; 25 | } 26 | 27 | public int getIndex() { 28 | return index; 29 | } 30 | 31 | public void setIndex(int index) { 32 | this.index = index; 33 | } 34 | 35 | public boolean getIsSelect() { 36 | return isSelect; 37 | } 38 | 39 | public void setSelect(boolean select) { 40 | isSelect = select; 41 | } 42 | 43 | @Override 44 | public int describeContents() { 45 | return 0; 46 | } 47 | 48 | @Override 49 | public void writeToParcel(Parcel dest, int flags) { 50 | dest.writeInt(this.index); 51 | dest.writeByte(this.isSelect ? (byte) 1 : (byte) 0); 52 | } 53 | 54 | protected GoldManagerItemBean(Parcel in) { 55 | this.index = in.readInt(); 56 | this.isSelect = in.readByte() != 0; 57 | } 58 | 59 | public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { 60 | @Override 61 | public GoldManagerItemBean createFromParcel(Parcel source) { 62 | return new GoldManagerItemBean(source); 63 | } 64 | 65 | @Override 66 | public GoldManagerItemBean[] newArray(int size) { 67 | return new GoldManagerItemBean[size]; 68 | } 69 | }; 70 | } 71 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/HotListBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by codeest on 16/8/21. 7 | */ 8 | 9 | public class HotListBean { 10 | 11 | /** 12 | * news_id : 8701066 13 | * url : http://news-at.zhihu.com/api/2/news/8701066 14 | * thumbnail : http://pic1.zhimg.com/f5169eb70e3a6823737dc55fbab051c0.jpg 15 | * title : 瞎扯 · 如何正确地吐槽 16 | */ 17 | 18 | private List recent; 19 | 20 | public List getRecent() { 21 | return recent; 22 | } 23 | 24 | public void setRecent(List recent) { 25 | this.recent = recent; 26 | } 27 | 28 | public static class RecentBean { 29 | private int news_id; 30 | private String url; 31 | private String thumbnail; 32 | private String title; 33 | private boolean readState; 34 | 35 | public boolean getReadState() { 36 | return readState; 37 | } 38 | 39 | public void setReadState(boolean readState) { 40 | this.readState = readState; 41 | } 42 | 43 | public int getNews_id() { 44 | return news_id; 45 | } 46 | 47 | public void setNews_id(int news_id) { 48 | this.news_id = news_id; 49 | } 50 | 51 | public String getUrl() { 52 | return url; 53 | } 54 | 55 | public void setUrl(String url) { 56 | this.url = url; 57 | } 58 | 59 | public String getThumbnail() { 60 | return thumbnail; 61 | } 62 | 63 | public void setThumbnail(String thumbnail) { 64 | this.thumbnail = thumbnail; 65 | } 66 | 67 | public String getTitle() { 68 | return title; 69 | } 70 | 71 | public void setTitle(String title) { 72 | this.title = title; 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/NodeBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | /** 4 | * Created by codeest on 16/12/22. 5 | */ 6 | 7 | public class NodeBean { 8 | 9 | 10 | /** 11 | * id : 300 12 | * name : programmer 13 | * url : http://www.v2ex.com/go/programmer 14 | * title : 程序员 15 | * title_alternative : Programmer 16 | * topics : 14214 17 | * stars : 2806 18 | * header : While code monkeys are not eating bananas, they're coding. 19 | * footer : null 20 | * created : 1293396163 21 | * avatar_normal : //cdn.v2ex.co/navatar/94f6/d7e0/300_mini.png?m=1482295939 22 | * avatar_normal : //cdn.v2ex.co/navatar/94f6/d7e0/300_normal.png?m=1482295939 23 | * avatar_large : //cdn.v2ex.co/navatar/94f6/d7e0/300_large.png?m=1482295939 24 | */ 25 | 26 | private String title; 27 | private int topics; 28 | private int stars; 29 | private String header; 30 | private String avatar_normal; 31 | 32 | public String getTitle() { 33 | return title; 34 | } 35 | 36 | public void setTitle(String title) { 37 | this.title = title; 38 | } 39 | 40 | public int getTopics() { 41 | return topics; 42 | } 43 | 44 | public void setTopics(int topics) { 45 | this.topics = topics; 46 | } 47 | 48 | public int getStars() { 49 | return stars; 50 | } 51 | 52 | public void setStars(int stars) { 53 | this.stars = stars; 54 | } 55 | 56 | public String getHeader() { 57 | return header; 58 | } 59 | 60 | public void setHeader(String header) { 61 | this.header = header; 62 | } 63 | 64 | public String getavatar_normal() { 65 | return avatar_normal; 66 | } 67 | 68 | public void setavatar_normal(String avatar_normal) { 69 | this.avatar_normal = avatar_normal; 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/ReadStateBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | import io.realm.RealmObject; 4 | import io.realm.annotations.PrimaryKey; 5 | 6 | /** 7 | * Created by codeest on 16/8/17. 8 | */ 9 | 10 | public class ReadStateBean extends RealmObject{ 11 | 12 | @PrimaryKey 13 | private int id; 14 | 15 | public ReadStateBean() { } 16 | 17 | public int getId() { 18 | return id; 19 | } 20 | 21 | public void setId(int id) { 22 | this.id = id; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/RealmLikeBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | import java.io.Serializable; 4 | 5 | import io.realm.RealmObject; 6 | import io.realm.annotations.PrimaryKey; 7 | 8 | /** 9 | * Created by codeest on 16/8/23. 10 | * 用于数据库的bean 种类包括 新闻、技术、福利 11 | */ 12 | 13 | public class RealmLikeBean extends RealmObject implements Serializable{ 14 | 15 | public RealmLikeBean() { } 16 | 17 | @PrimaryKey 18 | private String id; 19 | 20 | private String image; 21 | 22 | private String title; 23 | 24 | private String url; 25 | 26 | private int type; 27 | 28 | private long time; 29 | 30 | public String getId() { 31 | return id; 32 | } 33 | 34 | public void setId(String id) { 35 | this.id = id; 36 | } 37 | 38 | public String getTitle() { 39 | return title; 40 | } 41 | 42 | public void setType(int type) { 43 | this.type = type; 44 | } 45 | 46 | public int getType() { 47 | return type; 48 | } 49 | 50 | public void setImage(String image) { 51 | this.image = image; 52 | } 53 | 54 | public String getImage() { 55 | return image; 56 | } 57 | 58 | public void setTitle(String title) { 59 | this.title = title; 60 | } 61 | 62 | public long getTime() { 63 | return time; 64 | } 65 | 66 | public void setTime(long time) { 67 | this.time = time; 68 | } 69 | 70 | public String getUrl() { 71 | return url; 72 | } 73 | 74 | public void setUrl(String url) { 75 | this.url = url; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/SectionListBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by codeest on 16/8/28. 7 | */ 8 | 9 | public class SectionListBean { 10 | 11 | /** 12 | * description : 看别人的经历,理解自己的生活 13 | * id : 1 14 | * name : 深夜惊奇 15 | * thumbnail : http://pic3.zhimg.com/91125c9aebcab1c84f58ce4f8779551e.jpg 16 | */ 17 | 18 | private List data; 19 | 20 | public List getData() { 21 | return data; 22 | } 23 | 24 | public void setData(List data) { 25 | this.data = data; 26 | } 27 | 28 | public static class DataBean { 29 | private String description; 30 | private int id; 31 | private String name; 32 | private String thumbnail; 33 | 34 | public String getDescription() { 35 | return description; 36 | } 37 | 38 | public void setDescription(String description) { 39 | this.description = description; 40 | } 41 | 42 | public int getId() { 43 | return id; 44 | } 45 | 46 | public void setId(int id) { 47 | this.id = id; 48 | } 49 | 50 | public String getName() { 51 | return name; 52 | } 53 | 54 | public void setName(String name) { 55 | this.name = name; 56 | } 57 | 58 | public String getThumbnail() { 59 | return thumbnail; 60 | } 61 | 62 | public void setThumbnail(String thumbnail) { 63 | this.thumbnail = thumbnail; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/TopicListBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | /** 4 | * Created by codeest on 16/12/23. 5 | */ 6 | 7 | public class TopicListBean { 8 | 9 | private String imgUrl; 10 | 11 | private String name; 12 | 13 | private String updateTime; 14 | 15 | private String lastUser; 16 | 17 | private String node; 18 | 19 | private int commentNum; 20 | 21 | private String title; 22 | 23 | private String topicId; 24 | 25 | public int getCommentNum() { 26 | return commentNum; 27 | } 28 | 29 | public String getImgUrl() { 30 | return imgUrl; 31 | } 32 | 33 | public String getLastUser() { 34 | return lastUser; 35 | } 36 | 37 | public String getName() { 38 | return name; 39 | } 40 | 41 | public String getNode() { 42 | return node; 43 | } 44 | 45 | public String getTitle() { 46 | return title; 47 | } 48 | 49 | public String getUpdateTime() { 50 | return updateTime; 51 | } 52 | 53 | public String getTopicId() { 54 | return topicId; 55 | } 56 | 57 | public void setCommentNum(int commentNum) { 58 | this.commentNum = commentNum; 59 | } 60 | 61 | public void setImgUrl(String imgUrl) { 62 | this.imgUrl = imgUrl; 63 | } 64 | 65 | public void setLastUser(String lastUser) { 66 | this.lastUser = lastUser; 67 | } 68 | 69 | public void setName(String name) { 70 | this.name = name; 71 | } 72 | 73 | public void setNode(String node) { 74 | this.node = node; 75 | } 76 | 77 | public void setTitle(String title) { 78 | this.title = title; 79 | } 80 | 81 | public void setUpdateTime(String updateTime) { 82 | this.updateTime = updateTime; 83 | } 84 | 85 | public void setTopicId(String topicId) { 86 | this.topicId = topicId; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/VersionBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | /** 4 | * Created by codeest on 16/10/10. 5 | */ 6 | 7 | public class VersionBean { 8 | 9 | private String code; 10 | 11 | private String size; 12 | 13 | private String des; 14 | 15 | public String getCode() { 16 | return code; 17 | } 18 | 19 | public void setSize(String size) { 20 | this.size = size; 21 | } 22 | 23 | public String getSize() { 24 | return size; 25 | } 26 | 27 | public void setCode(String code) { 28 | this.code = code; 29 | } 30 | 31 | public void setDes(String des) { 32 | this.des = des; 33 | } 34 | 35 | public String getDes() { 36 | return des; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/WXItemBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | /** 4 | * Created by codeest on 16/8/28. 5 | */ 6 | 7 | public class WXItemBean { 8 | 9 | /** 10 | * ctime : 2016-03-31 11 | * title : 小本生意做什么挣钱十七大小本生意推荐 12 | * description : 创业最前线 13 | * picUrl : http://zxpic.gtimg.com/infonew/0/wechat_pics_-4225297.jpg/640 14 | * url : http://mp.weixin.qq.com/s?__biz=MzA3NjgzNDUwMQ==&idx=2&mid=401864059&sn=cfa082e38ba38c7e673b1ce0a075faee 15 | */ 16 | 17 | private String ctime; 18 | private String title; 19 | private String description; 20 | private String picUrl; 21 | private String url; 22 | 23 | public String getCtime() { 24 | return ctime; 25 | } 26 | 27 | public void setCtime(String ctime) { 28 | this.ctime = ctime; 29 | } 30 | 31 | public String getTitle() { 32 | return title; 33 | } 34 | 35 | public void setTitle(String title) { 36 | this.title = title; 37 | } 38 | 39 | public String getDescription() { 40 | return description; 41 | } 42 | 43 | public void setDescription(String description) { 44 | this.description = description; 45 | } 46 | 47 | public String getPicUrl() { 48 | return picUrl; 49 | } 50 | 51 | public void setPicUrl(String picUrl) { 52 | this.picUrl = picUrl; 53 | } 54 | 55 | public String getUrl() { 56 | return url; 57 | } 58 | 59 | public void setUrl(String url) { 60 | this.url = url; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/bean/WelcomeBean.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.bean; 2 | 3 | /** 4 | * Created by codeest on 16/8/15. 5 | */ 6 | 7 | public class WelcomeBean { 8 | 9 | /** 10 | * text : © Fido Dido 11 | * img : http://p2.zhimg.com/10/7b/107bb4894b46d75a892da6fa80ef504a.jpg 12 | */ 13 | 14 | private String text; 15 | private String img; 16 | 17 | public String getText() { 18 | return text; 19 | } 20 | 21 | public void setText(String text) { 22 | this.text = text; 23 | } 24 | 25 | public String getImg() { 26 | return img; 27 | } 28 | 29 | public void setImg(String img) { 30 | this.img = img; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/db/DBHelper.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.db; 2 | 3 | import com.codeest.geeknews.model.bean.GoldManagerBean; 4 | import com.codeest.geeknews.model.bean.RealmLikeBean; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author: Est 10 | * @date: 2017/4/21 11 | * @description: 12 | */ 13 | 14 | public interface DBHelper { 15 | 16 | void insertNewsId(int id); 17 | 18 | /** 19 | * 查询 阅读记录 20 | * @param id 21 | * @return 22 | */ 23 | boolean queryNewsId(int id); 24 | 25 | /** 26 | * 增加 收藏记录 27 | * @param bean 28 | */ 29 | void insertLikeBean(RealmLikeBean bean); 30 | 31 | /** 32 | * 删除 收藏记录 33 | * @param id 34 | */ 35 | void deleteLikeBean(String id); 36 | 37 | /** 38 | * 查询 收藏记录 39 | * @param id 40 | * @return 41 | */ 42 | boolean queryLikeId(String id); 43 | 44 | List getLikeList(); 45 | 46 | /** 47 | * 修改 收藏记录 时间戳以重新排序 48 | * @param id 49 | * @param time 50 | * @param isPlus 51 | */ 52 | void changeLikeTime(String id ,long time, boolean isPlus); 53 | 54 | /** 55 | * 更新 掘金首页管理列表 56 | * @param bean 57 | */ 58 | void updateGoldManagerList(GoldManagerBean bean); 59 | 60 | /** 61 | * 获取 掘金首页管理列表 62 | * @return 63 | */ 64 | GoldManagerBean getGoldManagerList(); 65 | } 66 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/event/NightModeEvent.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.event; 2 | 3 | /** 4 | * Created by codeest on 16/8/27. 5 | */ 6 | 7 | public class NightModeEvent { 8 | 9 | private boolean isNightMode; 10 | 11 | public void setNightMode(boolean nightMode) { 12 | isNightMode = nightMode; 13 | } 14 | 15 | public boolean getNightMode() { 16 | return isNightMode; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/event/SearchEvent.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.event; 2 | 3 | /** 4 | * Created by codeest on 16/8/31. 5 | */ 6 | 7 | public class SearchEvent { 8 | 9 | public SearchEvent(String query, int type) { 10 | this.query = query; 11 | this.type = type; 12 | } 13 | 14 | private String query; 15 | 16 | private int type; 17 | 18 | public String getQuery() { 19 | return query; 20 | } 21 | 22 | public void setQuery(String query) { 23 | this.query = query; 24 | } 25 | 26 | public int getType() { 27 | return type; 28 | } 29 | 30 | public void setType(int type) { 31 | this.type = type; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/api/GankApis.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.api; 2 | 3 | import com.codeest.geeknews.model.bean.GankItemBean; 4 | import com.codeest.geeknews.model.bean.GankSearchItemBean; 5 | import com.codeest.geeknews.model.http.response.GankHttpResponse; 6 | 7 | import java.util.List; 8 | 9 | import io.reactivex.Flowable; 10 | import retrofit2.http.GET; 11 | import retrofit2.http.Path; 12 | 13 | /** 14 | * Created by codeest on 16/8/19. 15 | */ 16 | 17 | public interface GankApis { 18 | 19 | String HOST = "http://gank.io/api/"; 20 | 21 | /** 22 | * 技术文章列表 23 | */ 24 | @GET("data/{tech}/{num}/{page}") 25 | Flowable>> getTechList(@Path("tech") String tech, @Path("num") int num, @Path("page") int page); 26 | 27 | /** 28 | * 妹纸列表 29 | */ 30 | @GET("data/福利/{num}/{page}") 31 | Flowable>> getGirlList(@Path("num") int num, @Path("page") int page); 32 | 33 | /** 34 | * 随机妹纸图 35 | */ 36 | @GET("random/data/福利/{num}") 37 | Flowable>> getRandomGirl(@Path("num") int num); 38 | 39 | /** 40 | * 搜索 41 | */ 42 | @GET("search/query/{query}/category/{type}/count/{count}/page/{page}") 43 | Flowable>> getSearchList(@Path("query") String query,@Path("type") String type,@Path("count") int num,@Path("page") int page); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/api/GoldApis.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.api; 2 | 3 | import com.codeest.geeknews.model.bean.GoldListBean; 4 | import com.codeest.geeknews.model.http.response.GoldHttpResponse; 5 | 6 | import java.util.List; 7 | 8 | import io.reactivex.Flowable; 9 | import retrofit2.http.GET; 10 | import retrofit2.http.Header; 11 | import retrofit2.http.Query; 12 | 13 | /** 14 | * Created by codeest on 16/11/27. 15 | */ 16 | 17 | public interface GoldApis { 18 | 19 | String HOST = "https://api.leancloud.cn/"; 20 | 21 | /** 22 | * 文章列表 23 | */ 24 | @GET("1.1/classes/Entry") 25 | Flowable>> getGoldList(@Header("X-LC-Id") String id, 26 | @Header("X-LC-Sign") String sign, 27 | @Query("where") String where, 28 | @Query("order") String order, 29 | @Query("include") String include, 30 | @Query("limit") int limit, 31 | @Query("skip") int skip); 32 | 33 | /** 34 | * 热门推荐 35 | */ 36 | @GET("1.1/classes/Entry") 37 | Flowable>> getGoldHot(@Header("X-LC-Id") String id, 38 | @Header("X-LC-Sign") String sign, 39 | @Query("where") String where, 40 | @Query("order") String order, 41 | @Query("include") String include, 42 | @Query("limit") int limit); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/api/MyApis.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.api; 2 | 3 | import com.codeest.geeknews.model.bean.VersionBean; 4 | import com.codeest.geeknews.model.http.response.MyHttpResponse; 5 | 6 | import io.reactivex.Flowable; 7 | import retrofit2.http.GET; 8 | 9 | /** 10 | * Created by codeest on 16/10/10. 11 | * https://github.com/codeestX/my-restful-api 12 | */ 13 | 14 | public interface MyApis { 15 | 16 | String HOST = "http://codeest.me/api/geeknews/"; 17 | 18 | String APK_DOWNLOAD_URL = "http://codeest.me/apk/geeknews.apk"; 19 | 20 | /** 21 | * 获取最新版本信息 22 | * @return 23 | */ 24 | @GET("version") 25 | Flowable> getVersionInfo(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/api/VtexApis.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.api; 2 | 3 | import com.codeest.geeknews.model.bean.NodeBean; 4 | import com.codeest.geeknews.model.bean.NodeListBean; 5 | import com.codeest.geeknews.model.bean.RepliesListBean; 6 | 7 | import java.util.List; 8 | 9 | import io.reactivex.Flowable; 10 | import retrofit2.http.GET; 11 | import retrofit2.http.Query; 12 | 13 | /** 14 | * Created by codeest on 16/12/22. 15 | */ 16 | 17 | public interface VtexApis { 18 | 19 | String HOST = "https://www.v2ex.com/"; 20 | 21 | String TAB_HOST = "https://www.v2ex.com/?tab="; 22 | 23 | String REPLIES_URL = "https://www.v2ex.com/t/"; 24 | 25 | /** 26 | * 获取节点信息 27 | * @return 28 | */ 29 | @GET("/api/nodes/show.json") 30 | Flowable getNodeInfo(@Query("name") String name); 31 | 32 | /** 33 | * 获取主题列表 34 | * @return 35 | */ 36 | @GET("/api/topics/show.json") 37 | Flowable> getTopicList(@Query("node_name") String name); 38 | 39 | /** 40 | * 获取主题信息 41 | * @return 42 | */ 43 | @GET("/api/topics/show.json") 44 | Flowable> getTopicInfo(@Query("id") String id); 45 | 46 | /** 47 | * 获取主题回复 48 | * @return 49 | */ 50 | @GET("/api/replies/show.json") 51 | Flowable> getRepliesList(@Query("topic_id") String id); 52 | } 53 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/api/WeChatApis.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.api; 2 | 3 | import com.codeest.geeknews.model.bean.WXItemBean; 4 | import com.codeest.geeknews.model.http.response.WXHttpResponse; 5 | 6 | import java.util.List; 7 | 8 | import io.reactivex.Flowable; 9 | import retrofit2.http.GET; 10 | import retrofit2.http.Query; 11 | 12 | /** 13 | * Created by codeest on 16/8/28. 14 | */ 15 | 16 | public interface WeChatApis { 17 | 18 | // String HOST = "http://apis.baidu.com/txapi/weixin/"; 19 | String HOST = "http://api.tianapi.com/"; 20 | 21 | /** 22 | * 微信精选列表 23 | */ 24 | @GET("wxnew") 25 | Flowable>> getWXHot(@Query("key") String key, @Query("num") int num, @Query("page") int page); 26 | 27 | /** 28 | * 微信精选列表 29 | */ 30 | @GET("wxnew") 31 | Flowable>> getWXHotSearch(@Query("key") String key, @Query("num") int num, @Query("page") int page, @Query("word") String word); 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/exception/ApiException.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.exception; 2 | 3 | /** 4 | * Created by codeest on 2016/8/4. 5 | */ 6 | public class ApiException extends Exception{ 7 | 8 | private int code; 9 | 10 | public ApiException(String msg) { 11 | super(msg); 12 | } 13 | 14 | public ApiException(String msg, int code) { 15 | super(msg); 16 | this.code = code; 17 | } 18 | 19 | public int getCode() { 20 | return code; 21 | } 22 | 23 | public void setCode(int code) { 24 | this.code = code; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/response/GankHttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.response; 2 | 3 | /** 4 | * Created by codeest on 2016/8/3. 5 | */ 6 | public class GankHttpResponse { 7 | 8 | private boolean error; 9 | private T results; 10 | 11 | public T getResults() { 12 | return results; 13 | } 14 | 15 | public void setResults(T results) { 16 | this.results = results; 17 | } 18 | 19 | public boolean getError() { 20 | return error; 21 | } 22 | 23 | public void setError(boolean error) { 24 | this.error = error; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/response/GoldHttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.response; 2 | 3 | /** 4 | * Created by codeest on 16/11/27. 5 | */ 6 | 7 | public class GoldHttpResponse { 8 | 9 | private T results; 10 | 11 | public T getResults() { 12 | return results; 13 | } 14 | 15 | public void setResults(T results) { 16 | this.results = results; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/response/MyHttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.response; 2 | 3 | /** 4 | * Created by codeest on 16/10/10. 5 | */ 6 | 7 | public class MyHttpResponse { 8 | 9 | private int code; 10 | private String message; 11 | private T data; 12 | 13 | public int getCode() { 14 | return code; 15 | } 16 | 17 | public void setCode(int code) { 18 | this.code = code; 19 | } 20 | 21 | public String getMessage() { 22 | return message; 23 | } 24 | 25 | public void setData(T data) { 26 | this.data = data; 27 | } 28 | 29 | public T getData() { 30 | return data; 31 | } 32 | 33 | public void setMessage(String message) { 34 | this.message = message; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/http/response/WXHttpResponse.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.http.response; 2 | 3 | /** 4 | * Created by codeest on 16/8/28. 5 | */ 6 | 7 | public class WXHttpResponse { 8 | 9 | private int code; 10 | private String msg; 11 | private T newslist; 12 | 13 | public int getCode() { 14 | return code; 15 | } 16 | 17 | public void setCode(int code) { 18 | this.code = code; 19 | } 20 | 21 | public String getMsg() { 22 | return msg; 23 | } 24 | 25 | public void setMsg(String msg) { 26 | this.msg = msg; 27 | } 28 | 29 | public T getNewslist() { 30 | return newslist; 31 | } 32 | 33 | public void setNewslist(T newslist) { 34 | this.newslist = newslist; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/model/prefs/PreferencesHelper.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.model.prefs; 2 | 3 | /** 4 | * @author: Est 5 | * @date: 2017/4/21 6 | * @description: 7 | */ 8 | 9 | public interface PreferencesHelper { 10 | 11 | boolean getNightModeState(); 12 | 13 | void setNightModeState(boolean state); 14 | 15 | boolean getNoImageState(); 16 | 17 | void setNoImageState(boolean state); 18 | 19 | boolean getAutoCacheState(); 20 | 21 | void setAutoCacheState(boolean state); 22 | 23 | int getCurrentItem(); 24 | 25 | void setCurrentItem(int item); 26 | 27 | boolean getLikePoint(); 28 | 29 | void setLikePoint(boolean isFirst); 30 | 31 | boolean getVersionPoint(); 32 | 33 | void setVersionPoint(boolean isFirst); 34 | 35 | boolean getManagerPoint(); 36 | 37 | void setManagerPoint(boolean isFirst); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/presenter/main/LikePresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.presenter.main; 2 | 3 | import com.codeest.geeknews.base.RxPresenter; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.base.contract.main.LikeContract; 6 | 7 | import javax.inject.Inject; 8 | 9 | /** 10 | * Created by codeest on 2016/8/23. 11 | */ 12 | public class LikePresenter extends RxPresenter implements LikeContract.Presenter{ 13 | 14 | private DataManager mDataManager; 15 | 16 | @Inject 17 | public LikePresenter(DataManager mDataManager) { 18 | this.mDataManager = mDataManager; 19 | } 20 | 21 | @Override 22 | public void getLikeData() { 23 | mView.showContent(mDataManager.getLikeList()); 24 | } 25 | 26 | @Override 27 | public void deleteLikeData(String id) { 28 | mDataManager.deleteLikeBean(id); 29 | } 30 | 31 | @Override 32 | public void changeLikeTime(String id, long time, boolean isPlus) { 33 | mDataManager.changeLikeTime(id,time,isPlus); 34 | } 35 | 36 | @Override 37 | public boolean getLikePoint() { 38 | return mDataManager.getLikePoint(); 39 | } 40 | 41 | @Override 42 | public void setLikePoint(boolean b) { 43 | mDataManager.setLikePoint(b); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/presenter/main/WelcomePresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.presenter.main; 2 | 3 | import com.codeest.geeknews.base.RxPresenter; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.model.bean.WelcomeBean; 6 | import com.codeest.geeknews.base.contract.main.WelcomeContract; 7 | import com.codeest.geeknews.util.RxUtil; 8 | 9 | import java.util.concurrent.TimeUnit; 10 | 11 | import javax.inject.Inject; 12 | 13 | import io.reactivex.Flowable; 14 | import io.reactivex.functions.Consumer; 15 | 16 | /** 17 | * Created by codeest on 16/8/15. 18 | */ 19 | 20 | public class WelcomePresenter extends RxPresenter implements WelcomeContract.Presenter{ 21 | 22 | private static final String RES = "1080*1776"; 23 | 24 | private static final int COUNT_DOWN_TIME = 2200; 25 | 26 | private DataManager mDataManager; 27 | 28 | @Inject 29 | public WelcomePresenter(DataManager mDataManager) { 30 | this.mDataManager = mDataManager; 31 | } 32 | 33 | @Override 34 | public void getWelcomeData() { 35 | addSubscribe(mDataManager.fetchWelcomeInfo(RES) 36 | .compose(RxUtil.rxSchedulerHelper()) 37 | .subscribe(new Consumer() { 38 | @Override 39 | public void accept(WelcomeBean welcomeBean) { 40 | mView.showContent(welcomeBean); 41 | startCountDown(); 42 | } 43 | }, new Consumer() { 44 | @Override 45 | public void accept(Throwable throwable) { 46 | mView.jumpToMain(); 47 | } 48 | }) 49 | ); 50 | } 51 | 52 | private void startCountDown() { 53 | addSubscribe(Flowable.timer(COUNT_DOWN_TIME, TimeUnit.MILLISECONDS) 54 | .compose(RxUtil.rxSchedulerHelper()) 55 | .subscribe(new Consumer() { 56 | @Override 57 | public void accept(Long aLong) { 58 | mView.jumpToMain(); 59 | } 60 | }) 61 | ); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/presenter/vtex/NodePresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.presenter.vtex; 2 | 3 | import com.codeest.geeknews.base.RxPresenter; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.model.bean.NodeBean; 6 | import com.codeest.geeknews.model.bean.NodeListBean; 7 | import com.codeest.geeknews.base.contract.vtex.NodeContract; 8 | import com.codeest.geeknews.util.RxUtil; 9 | import com.codeest.geeknews.widget.CommonSubscriber; 10 | 11 | import java.util.List; 12 | 13 | import javax.inject.Inject; 14 | 15 | /** 16 | * Created by codeest on 16/12/23. 17 | */ 18 | 19 | public class NodePresenter extends RxPresenter implements NodeContract.Presenter{ 20 | 21 | private DataManager mDataManager; 22 | 23 | @Inject 24 | public NodePresenter(DataManager mDataManager) { 25 | this.mDataManager = mDataManager; 26 | } 27 | 28 | @Override 29 | public void getContent(String node_name) { 30 | addSubscribe(mDataManager.fetchTopicList(node_name) 31 | .compose(RxUtil.>rxSchedulerHelper()) 32 | .subscribeWith(new CommonSubscriber>(mView) { 33 | @Override 34 | public void onNext(List nodeListBeen) { 35 | mView.showContent(nodeListBeen); 36 | } 37 | }) 38 | ); 39 | } 40 | 41 | @Override 42 | public void getTopInfo(String node_name) { 43 | addSubscribe(mDataManager.fetchNodeInfo(node_name) 44 | .compose(RxUtil.rxSchedulerHelper()) 45 | .subscribeWith(new CommonSubscriber(mView, false) { 46 | @Override 47 | public void onNext(NodeBean nodeBean) { 48 | mView.showTopInfo(nodeBean); 49 | } 50 | }) 51 | ); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/presenter/zhihu/CommentPresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.presenter.zhihu; 2 | 3 | import com.codeest.geeknews.base.RxPresenter; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.model.bean.CommentBean; 6 | import com.codeest.geeknews.base.contract.zhihu.CommentContract; 7 | import com.codeest.geeknews.util.RxUtil; 8 | import com.codeest.geeknews.widget.CommonSubscriber; 9 | 10 | import javax.inject.Inject; 11 | 12 | /** 13 | * Created by codeest on 16/8/18. 14 | */ 15 | 16 | public class CommentPresenter extends RxPresenter implements CommentContract.Presenter{ 17 | 18 | public static final int SHORT_COMMENT = 0; 19 | 20 | public static final int LONG_COMMENT = 1; 21 | 22 | private DataManager mDataManager; 23 | 24 | @Inject 25 | public CommentPresenter(DataManager mDataManager) { 26 | this.mDataManager = mDataManager; 27 | } 28 | 29 | @Override 30 | public void getCommentData(int id, int commentKind) { 31 | if(commentKind == SHORT_COMMENT) { 32 | addSubscribe(mDataManager.fetchShortCommentInfo(id) 33 | .compose(RxUtil.rxSchedulerHelper()) 34 | .subscribeWith(new CommonSubscriber(mView) { 35 | @Override 36 | public void onNext(CommentBean commentBean) { 37 | mView.stateMain(); 38 | mView.showContent(commentBean); 39 | } 40 | }) 41 | ); 42 | } else { 43 | addSubscribe(mDataManager.fetchLongCommentInfo(id) 44 | .compose(RxUtil.rxSchedulerHelper()) 45 | .subscribeWith(new CommonSubscriber(mView) { 46 | @Override 47 | public void onNext(CommentBean commentBean) { 48 | mView.stateMain(); 49 | mView.showContent(commentBean); 50 | } 51 | }) 52 | ); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/presenter/zhihu/HotPresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.presenter.zhihu; 2 | 3 | import com.codeest.geeknews.base.RxPresenter; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.model.bean.HotListBean; 6 | import com.codeest.geeknews.base.contract.zhihu.HotContract; 7 | import com.codeest.geeknews.util.RxUtil; 8 | import com.codeest.geeknews.widget.CommonSubscriber; 9 | 10 | import java.util.List; 11 | 12 | import javax.inject.Inject; 13 | 14 | import io.reactivex.functions.Function; 15 | 16 | /** 17 | * Created by codeest on 16/8/12. 18 | */ 19 | 20 | public class HotPresenter extends RxPresenter implements HotContract.Presenter{ 21 | 22 | private DataManager mDataManager; 23 | 24 | @Inject 25 | public HotPresenter(DataManager mDataManager) { 26 | this.mDataManager = mDataManager; 27 | } 28 | 29 | @Override 30 | public void getHotData() { 31 | addSubscribe(mDataManager.fetchHotListInfo() 32 | .compose(RxUtil.rxSchedulerHelper()) 33 | .map(new Function() { 34 | @Override 35 | public HotListBean apply(HotListBean hotListBean) { 36 | List list = hotListBean.getRecent(); 37 | for(HotListBean.RecentBean item : list) { 38 | item.setReadState(mDataManager.queryNewsId(item.getNews_id())); 39 | } 40 | return hotListBean; 41 | } 42 | }) 43 | .subscribeWith(new CommonSubscriber(mView) { 44 | @Override 45 | public void onNext(HotListBean hotListBean) { 46 | mView.showContent(hotListBean); 47 | } 48 | }) 49 | ); 50 | } 51 | 52 | @Override 53 | public void insertReadToDB(int id) { 54 | mDataManager.insertNewsId(id); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/presenter/zhihu/SectionChildPresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.presenter.zhihu; 2 | 3 | import com.codeest.geeknews.base.RxPresenter; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.model.bean.SectionChildListBean; 6 | import com.codeest.geeknews.base.contract.zhihu.SectionChildContract; 7 | import com.codeest.geeknews.util.RxUtil; 8 | import com.codeest.geeknews.widget.CommonSubscriber; 9 | 10 | import java.util.List; 11 | 12 | import javax.inject.Inject; 13 | 14 | import io.reactivex.functions.Function; 15 | 16 | /** 17 | * Created by codeest on 16/8/28. 18 | */ 19 | 20 | public class SectionChildPresenter extends RxPresenter implements SectionChildContract.Presenter{ 21 | 22 | private DataManager mDataManager; 23 | 24 | @Inject 25 | public SectionChildPresenter(DataManager mDataManager) { 26 | this.mDataManager = mDataManager; 27 | } 28 | 29 | @Override 30 | public void getThemeChildData(int id) { 31 | addSubscribe(mDataManager.fetchSectionChildListInfo(id) 32 | .compose(RxUtil.rxSchedulerHelper()) 33 | .map(new Function() { 34 | @Override 35 | public SectionChildListBean apply(SectionChildListBean sectionChildListBean) { 36 | List list = sectionChildListBean.getStories(); 37 | for(SectionChildListBean.StoriesBean item : list) { 38 | item.setReadState(mDataManager.queryNewsId(item.getId())); 39 | } 40 | return sectionChildListBean; 41 | } 42 | }) 43 | .subscribeWith(new CommonSubscriber(mView) { 44 | @Override 45 | public void onNext(SectionChildListBean sectionChildListBean) { 46 | mView.showContent(sectionChildListBean); 47 | } 48 | }) 49 | ); 50 | } 51 | 52 | @Override 53 | public void insertReadToDB(int id) { 54 | mDataManager.insertNewsId(id); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/presenter/zhihu/SectionPresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.presenter.zhihu; 2 | 3 | import com.codeest.geeknews.base.RxPresenter; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.model.bean.SectionListBean; 6 | import com.codeest.geeknews.base.contract.zhihu.SectionContract; 7 | import com.codeest.geeknews.util.RxUtil; 8 | import com.codeest.geeknews.widget.CommonSubscriber; 9 | 10 | import javax.inject.Inject; 11 | 12 | /** 13 | * Created by codeest on 16/8/12. 14 | */ 15 | 16 | public class SectionPresenter extends RxPresenter implements SectionContract.Presenter{ 17 | 18 | private DataManager mDataManager; 19 | 20 | @Inject 21 | public SectionPresenter(DataManager mDataManager) { 22 | this.mDataManager = mDataManager; 23 | } 24 | 25 | @Override 26 | public void getSectionData() { 27 | addSubscribe(mDataManager.fetchSectionListInfo() 28 | .compose(RxUtil.rxSchedulerHelper()) 29 | .subscribeWith(new CommonSubscriber(mView) { 30 | @Override 31 | public void onNext(SectionListBean sectionListBean) { 32 | mView.showContent(sectionListBean); 33 | } 34 | }) 35 | ); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/presenter/zhihu/ThemeChildPresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.presenter.zhihu; 2 | 3 | import com.codeest.geeknews.base.RxPresenter; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.model.bean.ThemeChildListBean; 6 | import com.codeest.geeknews.base.contract.zhihu.ThemeChildContract; 7 | import com.codeest.geeknews.util.RxUtil; 8 | import com.codeest.geeknews.widget.CommonSubscriber; 9 | 10 | import java.util.List; 11 | 12 | import javax.inject.Inject; 13 | 14 | import io.reactivex.functions.Function; 15 | 16 | /** 17 | * Created by codeest on 16/8/24. 18 | */ 19 | 20 | public class ThemeChildPresenter extends RxPresenter implements ThemeChildContract.Presenter{ 21 | 22 | private DataManager mDataManager; 23 | 24 | @Inject 25 | public ThemeChildPresenter(DataManager mDataManager) { 26 | this.mDataManager = mDataManager; 27 | } 28 | 29 | @Override 30 | public void getThemeChildData(int id) { 31 | addSubscribe(mDataManager.fetchThemeChildListInfo(id) 32 | .compose(RxUtil.rxSchedulerHelper()) 33 | .map(new Function() { 34 | @Override 35 | public ThemeChildListBean apply(ThemeChildListBean themeChildListBean) { 36 | List list = themeChildListBean.getStories(); 37 | for(ThemeChildListBean.StoriesBean item : list) { 38 | item.setReadState(mDataManager.queryNewsId(item.getId())); 39 | } 40 | return themeChildListBean; 41 | } 42 | }) 43 | .subscribeWith(new CommonSubscriber(mView) { 44 | @Override 45 | public void onNext(ThemeChildListBean themeChildListBean) { 46 | mView.showContent(themeChildListBean); 47 | } 48 | }) 49 | ); 50 | } 51 | 52 | @Override 53 | public void insertReadToDB(int id) { 54 | mDataManager.insertNewsId(id); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/presenter/zhihu/ThemePresenter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.presenter.zhihu; 2 | 3 | import com.codeest.geeknews.base.RxPresenter; 4 | import com.codeest.geeknews.model.DataManager; 5 | import com.codeest.geeknews.model.bean.ThemeListBean; 6 | import com.codeest.geeknews.base.contract.zhihu.ThemeContract; 7 | import com.codeest.geeknews.util.RxUtil; 8 | import com.codeest.geeknews.widget.CommonSubscriber; 9 | 10 | import javax.inject.Inject; 11 | 12 | /** 13 | * Created by codeest on 16/8/12. 14 | */ 15 | 16 | public class ThemePresenter extends RxPresenter implements ThemeContract.Presenter{ 17 | 18 | private DataManager mDataManager; 19 | 20 | @Inject 21 | public ThemePresenter(DataManager mDataManager) { 22 | this.mDataManager = mDataManager; 23 | } 24 | 25 | @Override 26 | public void getThemeData() { 27 | mDataManager.fetchDailyThemeListInfo() 28 | .compose(RxUtil.rxSchedulerHelper()) 29 | .subscribe(new CommonSubscriber(mView) { 30 | @Override 31 | public void onNext(ThemeListBean themeListBean) { 32 | mView.showContent(themeListBean); 33 | } 34 | }); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/gank/adapter/GankMainAdapter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.gank.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import android.support.v4.view.PagerAdapter; 7 | import android.view.ViewGroup; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by codeest on 16/8/19. 13 | */ 14 | 15 | public class GankMainAdapter extends FragmentPagerAdapter{ 16 | 17 | private List fragments; 18 | 19 | public GankMainAdapter(FragmentManager fm,List fragments) { 20 | super(fm); 21 | this.fragments = fragments; 22 | } 23 | 24 | @Override 25 | public Fragment getItem(int position) { 26 | return fragments.get(position); 27 | } 28 | 29 | @Override 30 | public int getCount() { 31 | return fragments.size(); 32 | } 33 | 34 | public int getItemPosition(Object object) { 35 | return PagerAdapter.POSITION_NONE; 36 | } 37 | 38 | @Override 39 | public void destroyItem(ViewGroup container, int position, Object object) { 40 | // super.destroyItem(container, position, object); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/gold/adapter/GoldPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.gold.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentStatePagerAdapter; 6 | 7 | import com.codeest.geeknews.ui.gold.fragment.GoldPagerFragment; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by codeest on 16/11/28. 13 | */ 14 | 15 | public class GoldPagerAdapter extends FragmentStatePagerAdapter { 16 | 17 | private List fragments; 18 | 19 | public GoldPagerAdapter(FragmentManager fm, List fragments) { 20 | super(fm); 21 | this.fragments = fragments; 22 | } 23 | 24 | @Override 25 | public Fragment getItem(int position) { 26 | return fragments.get(position); 27 | } 28 | 29 | @Override 30 | public int getCount() { 31 | return fragments.size(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/main/activity/WelcomeActivity.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.main.activity; 2 | 3 | import android.content.Intent; 4 | import android.widget.ImageView; 5 | import android.widget.TextView; 6 | 7 | import com.bumptech.glide.Glide; 8 | import com.codeest.geeknews.R; 9 | import com.codeest.geeknews.base.BaseActivity; 10 | import com.codeest.geeknews.component.ImageLoader; 11 | import com.codeest.geeknews.model.bean.WelcomeBean; 12 | import com.codeest.geeknews.presenter.main.WelcomePresenter; 13 | import com.codeest.geeknews.base.contract.main.WelcomeContract; 14 | 15 | import butterknife.BindView; 16 | 17 | /** 18 | * Created by codeest on 16/8/15. 19 | */ 20 | 21 | public class WelcomeActivity extends BaseActivity implements WelcomeContract.View { 22 | 23 | @BindView(R.id.iv_welcome_bg) 24 | ImageView ivWelcomeBg; 25 | @BindView(R.id.tv_welcome_author) 26 | TextView tvWelcomeAuthor; 27 | 28 | @Override 29 | protected void initInject() { 30 | getActivityComponent().inject(this); 31 | } 32 | 33 | @Override 34 | protected int getLayout() { 35 | return R.layout.activity_welcome; 36 | } 37 | 38 | @Override 39 | protected void initEventAndData() { 40 | mPresenter.getWelcomeData(); 41 | } 42 | 43 | @Override 44 | public void showContent(WelcomeBean welcomeBean) { 45 | ImageLoader.load(this, welcomeBean.getImg(), ivWelcomeBg); 46 | ivWelcomeBg.animate().scaleX(1.12f).scaleY(1.12f).setDuration(2000).setStartDelay(100).start(); 47 | tvWelcomeAuthor.setText(welcomeBean.getText()); 48 | } 49 | 50 | @Override 51 | public void jumpToMain() { 52 | Intent intent = new Intent(); 53 | intent.setClass(this,MainActivity.class); 54 | startActivity(intent); 55 | finish(); 56 | overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); 57 | } 58 | 59 | @Override 60 | protected void onDestroy() { 61 | Glide.clear(ivWelcomeBg); 62 | super.onDestroy(); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/main/fragment/AboutFragment.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.main.fragment; 2 | 3 | import com.codeest.geeknews.R; 4 | import com.codeest.geeknews.app.Constants; 5 | import com.codeest.geeknews.base.SimpleFragment; 6 | import com.codeest.geeknews.util.AlipayUtil; 7 | import com.codeest.geeknews.util.SnackbarUtil; 8 | 9 | import butterknife.OnClick; 10 | 11 | /** 12 | * Created by codeest on 16/8/23. 13 | */ 14 | 15 | public class AboutFragment extends SimpleFragment { 16 | 17 | @Override 18 | protected int getLayoutId() { 19 | return R.layout.fragment_about; 20 | } 21 | 22 | @Override 23 | protected void initEventAndData() { 24 | } 25 | 26 | @OnClick(R.id.cv_about_award) 27 | void awardAuthor() { 28 | if (AlipayUtil.hasInstalledAlipayClient(mContext)) { 29 | AlipayUtil.startAlipayClient(getActivity(), Constants.KEY_ALIPAY); 30 | } else { 31 | SnackbarUtil.showShort(getActivity().getWindow().getDecorView(), "木有检测到支付宝客户端 T T"); 32 | } 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/vtex/adapter/VtexPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.vtex.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import android.support.v4.view.PagerAdapter; 7 | import android.view.ViewGroup; 8 | 9 | import com.codeest.geeknews.ui.vtex.fragment.VtexMainFragment; 10 | import com.codeest.geeknews.ui.vtex.fragment.VtexPagerFragment; 11 | 12 | import java.util.List; 13 | 14 | /** 15 | * Created by codeest on 16/12/22. 16 | */ 17 | 18 | public class VtexPagerAdapter extends FragmentPagerAdapter{ 19 | 20 | private List fragments; 21 | 22 | public VtexPagerAdapter(FragmentManager fm, List fragments) { 23 | super(fm); 24 | this.fragments = fragments; 25 | } 26 | 27 | @Override 28 | public Fragment getItem(int position) { 29 | return fragments.get(position); 30 | } 31 | 32 | @Override 33 | public CharSequence getPageTitle(int position) { 34 | return VtexMainFragment.typeStr[position]; 35 | } 36 | 37 | @Override 38 | public int getCount() { 39 | return fragments.size(); 40 | } 41 | 42 | public int getItemPosition(Object object) { 43 | return PagerAdapter.POSITION_NONE; 44 | } 45 | 46 | @Override 47 | public void destroyItem(ViewGroup container, int position, Object object) { 48 | // super.destroyItem(container, position, object); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/vtex/fragment/VtexMainFragment.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.vtex.fragment; 2 | 3 | import android.content.Intent; 4 | import android.os.Bundle; 5 | import android.support.design.widget.TabLayout; 6 | import android.support.v4.view.ViewPager; 7 | 8 | import com.codeest.geeknews.R; 9 | import com.codeest.geeknews.app.Constants; 10 | import com.codeest.geeknews.base.SimpleFragment; 11 | import com.codeest.geeknews.ui.vtex.activity.NodeActivity; 12 | import com.codeest.geeknews.ui.vtex.adapter.VtexPagerAdapter; 13 | 14 | import java.util.ArrayList; 15 | import java.util.List; 16 | 17 | import butterknife.BindView; 18 | import butterknife.OnClick; 19 | 20 | /** 21 | * Created by codeest on 16/12/19. 22 | */ 23 | 24 | public class VtexMainFragment extends SimpleFragment { 25 | 26 | @BindView(R.id.tab_vtex_main) 27 | TabLayout mTabLayout; 28 | @BindView(R.id.vp_vtex_main) 29 | ViewPager mViewPager; 30 | 31 | public static String[] typeStr = {"技术", "创意", "好玩", "Apple", "酷工作", "交易", "城市", "问与答", "最热", "全部", "R2"}; 32 | public static String[] type = {"tech", "creative", "play", "apple", "jobs", "deals", "city", "qna", "hot", "all", "r2"}; 33 | 34 | List fragments = new ArrayList<>(); 35 | 36 | @Override 37 | protected int getLayoutId() { 38 | return R.layout.fragment_vtex_main; 39 | } 40 | 41 | @Override 42 | protected void initEventAndData() { 43 | mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE); 44 | mTabLayout.setupWithViewPager(mViewPager); 45 | for (int i = 0; i < type.length; i++) { 46 | VtexPagerFragment fragment = new VtexPagerFragment(); 47 | Bundle bundle = new Bundle(); 48 | bundle.putString(Constants.IT_VTEX_TYPE, type[i]); 49 | fragment.setArguments(bundle); 50 | mTabLayout.addTab(mTabLayout.newTab()); 51 | fragments.add(fragment); 52 | } 53 | VtexPagerAdapter mAdapter = new VtexPagerAdapter(getChildFragmentManager(), fragments); 54 | mViewPager.setAdapter(mAdapter); 55 | } 56 | 57 | @OnClick(R.id.iv_vtex_menu) 58 | void gotoNode() { 59 | Intent intent = new Intent(getActivity(), NodeActivity.class); 60 | mContext.startActivity(intent); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/zhihu/activity/CalendarActivity.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.zhihu.activity; 2 | 3 | import android.support.annotation.NonNull; 4 | import android.support.v7.widget.Toolbar; 5 | 6 | import com.codeest.geeknews.R; 7 | import com.codeest.geeknews.base.SimpleActivity; 8 | import com.codeest.geeknews.component.RxBus; 9 | import com.codeest.geeknews.util.DateUtil; 10 | import com.prolificinteractive.materialcalendarview.CalendarDay; 11 | import com.prolificinteractive.materialcalendarview.CalendarMode; 12 | import com.prolificinteractive.materialcalendarview.MaterialCalendarView; 13 | import com.prolificinteractive.materialcalendarview.OnDateSelectedListener; 14 | 15 | import java.util.Calendar; 16 | 17 | import butterknife.BindView; 18 | import butterknife.OnClick; 19 | 20 | /** 21 | * Created by codeest on 16/8/13. 22 | */ 23 | 24 | public class CalendarActivity extends SimpleActivity { 25 | @BindView(R.id.view_calender) 26 | MaterialCalendarView mCalender; 27 | @BindView(R.id.toolbar) 28 | Toolbar mToolbar; 29 | 30 | CalendarDay mDate; 31 | 32 | @Override 33 | protected int getLayout() { 34 | return R.layout.activity_calender; 35 | } 36 | 37 | @Override 38 | protected void initEventAndData() { 39 | setToolBar(mToolbar, "选择日期"); 40 | mCalender.state().edit() 41 | .setFirstDayOfWeek(Calendar.WEDNESDAY) 42 | .setMinimumDate(CalendarDay.from(2013, 5, 20)) 43 | .setMaximumDate(CalendarDay.from(DateUtil.getCurrentYear(), DateUtil.getCurrentMonth(), DateUtil.getCurrentDay())) 44 | .setCalendarDisplayMode(CalendarMode.MONTHS) 45 | .commit(); 46 | mCalender.setOnDateChangedListener(new OnDateSelectedListener() { 47 | @Override 48 | public void onDateSelected(@NonNull MaterialCalendarView widget, @NonNull CalendarDay date, boolean selected) { 49 | mDate = date; 50 | } 51 | }); 52 | } 53 | 54 | @OnClick(R.id.tv_calender_enter) 55 | void chooseDate() { 56 | if (mDate != null) { 57 | RxBus.getDefault().post(mDate); 58 | } 59 | finish(); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/zhihu/adapter/CommentMainAdapter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.zhihu.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | 7 | import com.codeest.geeknews.ui.zhihu.fragment.CommentFragment; 8 | 9 | import java.util.List; 10 | 11 | /** 12 | * Created by codeest on 16/8/19. 13 | */ 14 | 15 | public class CommentMainAdapter extends FragmentPagerAdapter{ 16 | 17 | private List fragments; 18 | 19 | public CommentMainAdapter(FragmentManager fm,List fragments) { 20 | super(fm); 21 | this.fragments = fragments; 22 | } 23 | 24 | @Override 25 | public Fragment getItem(int position) { 26 | return fragments.get(position); 27 | } 28 | 29 | @Override 30 | public int getCount() { 31 | return fragments.size(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/zhihu/adapter/ZhihuMainAdapter.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.zhihu.adapter; 2 | 3 | import android.support.v4.app.Fragment; 4 | import android.support.v4.app.FragmentManager; 5 | import android.support.v4.app.FragmentPagerAdapter; 6 | import android.support.v4.view.PagerAdapter; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | import com.codeest.geeknews.ui.zhihu.fragment.DailyFragment; 11 | import com.codeest.geeknews.ui.zhihu.fragment.ThemeFragment; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * Created by codeest on 16/8/11. 17 | */ 18 | 19 | public class ZhihuMainAdapter extends FragmentPagerAdapter{ 20 | 21 | private List fragments; 22 | 23 | public ZhihuMainAdapter(FragmentManager fm,List fragments) { 24 | super(fm); 25 | this.fragments = fragments; 26 | } 27 | 28 | @Override 29 | public Fragment getItem(int position) { 30 | return fragments.get(position); 31 | } 32 | 33 | @Override 34 | public int getCount() { 35 | return fragments.size(); 36 | } 37 | 38 | public int getItemPosition(Object object) { 39 | return PagerAdapter.POSITION_NONE; 40 | } 41 | 42 | @Override 43 | public void destroyItem(ViewGroup container, int position, Object object) { 44 | // super.destroyItem(container, position, object); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/zhihu/fragment/CommentFragment.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.zhihu.fragment; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.widget.LinearLayoutManager; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.View; 7 | 8 | import com.codeest.geeknews.R; 9 | import com.codeest.geeknews.base.RootFragment; 10 | import com.codeest.geeknews.model.bean.CommentBean; 11 | import com.codeest.geeknews.presenter.zhihu.CommentPresenter; 12 | import com.codeest.geeknews.base.contract.zhihu.CommentContract; 13 | import com.codeest.geeknews.ui.zhihu.adapter.CommentAdapter; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | import butterknife.BindView; 19 | 20 | /** 21 | * Created by codeest on 16/8/18. 22 | */ 23 | 24 | public class CommentFragment extends RootFragment implements CommentContract.View { 25 | 26 | @BindView(R.id.view_main) 27 | RecyclerView rvCommentList; 28 | 29 | CommentAdapter mAdapter; 30 | List mList; 31 | 32 | @Override 33 | protected void initInject() { 34 | getFragmentComponent().inject(this); 35 | } 36 | 37 | @Override 38 | protected int getLayoutId() { 39 | return R.layout.fragment_comment; 40 | } 41 | 42 | @Override 43 | protected void initEventAndData() { 44 | super.initEventAndData(); 45 | Bundle bundle = getArguments(); 46 | stateLoading(); 47 | mPresenter.getCommentData(bundle.getInt("id"),bundle.getInt("kind")); 48 | rvCommentList.setVisibility(View.INVISIBLE); 49 | mList = new ArrayList<>(); 50 | mAdapter = new CommentAdapter(mContext,mList); 51 | rvCommentList.setLayoutManager(new LinearLayoutManager(mContext)); 52 | rvCommentList.setAdapter(mAdapter); 53 | } 54 | 55 | @Override 56 | public void showContent(CommentBean commentBean) { 57 | rvCommentList.setVisibility(View.VISIBLE); 58 | mList.clear(); 59 | mList.addAll(commentBean.getComments()); 60 | mAdapter.notifyDataSetChanged(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/ui/zhihu/fragment/ZhihuMainFragment.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.ui.zhihu.fragment; 2 | 3 | import android.support.design.widget.TabLayout; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.view.ViewPager; 6 | 7 | import com.codeest.geeknews.R; 8 | import com.codeest.geeknews.base.SimpleFragment; 9 | import com.codeest.geeknews.ui.zhihu.adapter.ZhihuMainAdapter; 10 | 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | 14 | import butterknife.BindView; 15 | 16 | /** 17 | * Created by codeest on 16/8/11. 18 | */ 19 | 20 | public class ZhihuMainFragment extends SimpleFragment{ 21 | 22 | @BindView(R.id.tab_zhihu_main) 23 | TabLayout mTabLayout; 24 | @BindView(R.id.vp_zhihu_main) 25 | ViewPager mViewPager; 26 | 27 | String[] tabTitle = new String[]{"日报","主题","专栏","热门"}; 28 | List fragments = new ArrayList(); 29 | 30 | ZhihuMainAdapter mAdapter; 31 | 32 | @Override 33 | protected int getLayoutId() { 34 | return R.layout.fragment_zhihu_main; 35 | } 36 | 37 | @Override 38 | protected void initEventAndData() { 39 | fragments.add(new DailyFragment()); 40 | fragments.add(new ThemeFragment()); 41 | fragments.add(new SectionFragment()); 42 | fragments.add(new HotFragment()); 43 | mAdapter = new ZhihuMainAdapter(getChildFragmentManager(),fragments); 44 | mViewPager.setAdapter(mAdapter); 45 | 46 | //TabLayout配合ViewPager有时会出现不显示Tab文字的Bug,需要按如下顺序 47 | mTabLayout.addTab(mTabLayout.newTab().setText(tabTitle[0])); 48 | mTabLayout.addTab(mTabLayout.newTab().setText(tabTitle[1])); 49 | mTabLayout.addTab(mTabLayout.newTab().setText(tabTitle[2])); 50 | mTabLayout.addTab(mTabLayout.newTab().setText(tabTitle[3])); 51 | mTabLayout.setupWithViewPager(mViewPager); 52 | mTabLayout.getTabAt(0).setText(tabTitle[0]); 53 | mTabLayout.getTabAt(1).setText(tabTitle[1]); 54 | mTabLayout.getTabAt(2).setText(tabTitle[2]); 55 | mTabLayout.getTabAt(3).setText(tabTitle[3]); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/util/LogUtil.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.util; 2 | 3 | import com.orhanobut.logger.Logger; 4 | import com.codeest.geeknews.BuildConfig; 5 | 6 | /** 7 | * Created by codeest on 2016/8/3. 8 | */ 9 | public class LogUtil { 10 | 11 | public static boolean isDebug = BuildConfig.DEBUG; 12 | private static final String TAG = "com.codeest.geeknews"; 13 | 14 | public static void e(String tag,Object o) { 15 | if(isDebug) { 16 | Logger.e(tag, o); 17 | } 18 | } 19 | 20 | public static void e(Object o) { 21 | LogUtil.e(TAG,o); 22 | } 23 | 24 | public static void w(String tag,Object o) { 25 | if(isDebug) { 26 | Logger.w(tag, o); 27 | } 28 | } 29 | 30 | public static void w(Object o) { 31 | LogUtil.w(TAG,o); 32 | } 33 | 34 | public static void d(String msg) { 35 | if(isDebug) { 36 | Logger.d(msg); 37 | } 38 | } 39 | 40 | public static void i(String msg) { 41 | if(isDebug) { 42 | Logger.i(msg); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/util/ShareUtil.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.util; 2 | 3 | import android.content.Context; 4 | import android.content.Intent; 5 | import android.net.Uri; 6 | 7 | /** 8 | * Created by codeest on 2016/8/22. 9 | */ 10 | public class ShareUtil { 11 | 12 | private static final String EMAIL_ADDRESS = "codeest.dev@gmail.com"; 13 | 14 | public static void shareText(Context context,String text,String title){ 15 | Intent intent = new Intent(Intent.ACTION_SEND); 16 | intent.setType("text/plain"); 17 | intent.putExtra(Intent.EXTRA_TEXT,text); 18 | context.startActivity(Intent.createChooser(intent,title)); 19 | } 20 | 21 | public static void shareImage(Context context, Uri uri, String title){ 22 | Intent intent = new Intent(Intent.ACTION_SEND); 23 | intent.setType("image/png"); 24 | intent.putExtra(Intent.EXTRA_STREAM, uri); 25 | context.startActivity(Intent.createChooser(intent,title)); 26 | } 27 | 28 | public static void sendEmail(Context context, String title) { 29 | Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse( 30 | "mailto:" + EMAIL_ADDRESS)); 31 | context.startActivity(Intent.createChooser(intent, title)); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/util/SnackbarUtil.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.util; 2 | 3 | import android.support.design.widget.Snackbar; 4 | import android.view.View; 5 | 6 | /** 7 | * Created by codeest on 16/9/3. 8 | */ 9 | 10 | public class SnackbarUtil { 11 | 12 | public static void show(View view, String msg) { 13 | Snackbar.make(view, msg, Snackbar.LENGTH_LONG).show(); 14 | } 15 | 16 | public static void showShort(View view, String msg) { 17 | Snackbar.make(view, msg, Snackbar.LENGTH_SHORT).show(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/util/XmlUtil.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.util; 2 | 3 | import android.content.res.XmlResourceParser; 4 | import android.support.v4.util.ArrayMap; 5 | 6 | /** 7 | * Created by codeest on 16/12/30. 8 | */ 9 | 10 | public class XmlUtil { 11 | 12 | public static ArrayMap> parseNodes(XmlResourceParser xmlResourceParser) throws Exception{ 13 | if (xmlResourceParser==null) 14 | return null; 15 | ArrayMap> map = null; 16 | ArrayMap nodeMap = null; 17 | int root=xmlResourceParser.getEventType(); 18 | while (root!= XmlResourceParser.END_DOCUMENT){ 19 | switch (root){ 20 | case XmlResourceParser.START_DOCUMENT: 21 | map = new ArrayMap<>(); 22 | break; 23 | case XmlResourceParser.START_TAG: 24 | if("index".equals(xmlResourceParser.getName())){ 25 | String nodeName = xmlResourceParser.getAttributeValue(0); 26 | nodeMap = new ArrayMap<>(); 27 | if (map != null) { 28 | map.put(nodeName, nodeMap); 29 | } 30 | } 31 | else if ("node".equals(xmlResourceParser.getName())){ 32 | String node = xmlResourceParser.getAttributeValue(0); 33 | String nodeName = xmlResourceParser.nextText(); 34 | if (nodeMap != null) { 35 | nodeMap.put(node, nodeName); 36 | } 37 | } 38 | break; 39 | case XmlResourceParser.END_TAG: 40 | if("index".equals(xmlResourceParser.getName())){ 41 | nodeMap = null; 42 | } 43 | break; 44 | } 45 | root=xmlResourceParser.next(); 46 | } 47 | return map; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/widget/CommonItemDecoration.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.widget; 2 | 3 | import android.graphics.Rect; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | import com.codeest.geeknews.util.SystemUtil; 8 | 9 | /** 10 | * Created by codeest on 16/12/24. 11 | */ 12 | 13 | public class CommonItemDecoration extends RecyclerView.ItemDecoration{ 14 | 15 | private int distance; 16 | private int unit; 17 | 18 | public static final int UNIT_DP = 0; 19 | public static final int UNIT_PX = 1; 20 | 21 | public CommonItemDecoration(int distance, int unit) { 22 | this.distance = distance; 23 | this.unit = unit; 24 | } 25 | 26 | @Override 27 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 28 | super.getItemOffsets(outRect, view, parent, state); 29 | int position = ((RecyclerView.LayoutParams) view.getLayoutParams()).getViewLayoutPosition(); 30 | if (position > -1) { 31 | if (unit == UNIT_DP) { 32 | outRect.set(0, SystemUtil.dp2px(distance), 0, 0); 33 | } else { 34 | outRect.set(0, distance, 0, 0); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/widget/CommonSubscriber.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.widget; 2 | 3 | import android.text.TextUtils; 4 | import android.util.Log; 5 | 6 | import com.codeest.geeknews.base.BaseView; 7 | import com.codeest.geeknews.model.http.exception.ApiException; 8 | import com.codeest.geeknews.util.LogUtil; 9 | 10 | import io.reactivex.subscribers.ResourceSubscriber; 11 | import retrofit2.HttpException; 12 | 13 | /** 14 | * Created by codeest on 2017/2/23. 15 | */ 16 | 17 | public abstract class CommonSubscriber extends ResourceSubscriber { 18 | private BaseView mView; 19 | private String mErrorMsg; 20 | private boolean isShowErrorState = true; 21 | 22 | protected CommonSubscriber(BaseView view){ 23 | this.mView = view; 24 | } 25 | 26 | protected CommonSubscriber(BaseView view, String errorMsg){ 27 | this.mView = view; 28 | this.mErrorMsg = errorMsg; 29 | } 30 | 31 | protected CommonSubscriber(BaseView view, boolean isShowErrorState){ 32 | this.mView = view; 33 | this.isShowErrorState = isShowErrorState; 34 | } 35 | 36 | protected CommonSubscriber(BaseView view, String errorMsg, boolean isShowErrorState){ 37 | this.mView = view; 38 | this.mErrorMsg = errorMsg; 39 | this.isShowErrorState = isShowErrorState; 40 | } 41 | 42 | @Override 43 | public void onComplete() { 44 | 45 | } 46 | 47 | @Override 48 | public void onError(Throwable e) { 49 | if (mView == null) { 50 | return; 51 | } 52 | if (mErrorMsg != null && !TextUtils.isEmpty(mErrorMsg)) { 53 | mView.showErrorMsg(mErrorMsg); 54 | } else if (e instanceof ApiException) { 55 | mView.showErrorMsg(e.toString()); 56 | } else if (e instanceof HttpException) { 57 | mView.showErrorMsg("数据加载失败ヽ(≧Д≦)ノ"); 58 | } else { 59 | mView.showErrorMsg("未知错误ヽ(≧Д≦)ノ"); 60 | LogUtil.d(e.toString()); 61 | } 62 | if (isShowErrorState) { 63 | mView.stateError(); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/widget/GoldItemDecoration.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.widget; 2 | 3 | import android.graphics.Rect; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | import com.codeest.geeknews.app.App; 8 | import com.codeest.geeknews.util.SystemUtil; 9 | 10 | /** 11 | * Created by codeest on 16/11/30. 12 | */ 13 | 14 | public class GoldItemDecoration extends RecyclerView.ItemDecoration{ 15 | 16 | @Override 17 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 18 | super.getItemOffsets(outRect, view, parent, state); 19 | int position = ((RecyclerView.LayoutParams) view.getLayoutParams()).getViewLayoutPosition(); 20 | if (position > -1) { 21 | if (position == 0) { 22 | outRect.set(0, SystemUtil.dp2px(App.getInstance(), 15), 0, 0); 23 | } else if (position == 3) { 24 | outRect.set(0, SystemUtil.dp2px(App.getInstance(), 0.5f), 0, SystemUtil.dp2px(App.getInstance(), 15)); 25 | } else { 26 | outRect.set(0, SystemUtil.dp2px(App.getInstance(), 0.5f), 0, 0); 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/widget/ProgressImageView.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.widget; 2 | 3 | import android.content.Context; 4 | import android.graphics.drawable.Animatable; 5 | import android.support.v7.widget.AppCompatImageView; 6 | import android.util.AttributeSet; 7 | import android.view.View; 8 | 9 | /** 10 | * Created by codeest on 16/9/27. 11 | */ 12 | 13 | public class ProgressImageView extends AppCompatImageView{ 14 | 15 | 16 | public ProgressImageView(Context context) { 17 | super(context); 18 | } 19 | 20 | public ProgressImageView(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public ProgressImageView(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | } 27 | 28 | public void start() { 29 | setVisibility(View.VISIBLE); 30 | Animatable animatable = (Animatable) getDrawable(); 31 | if (!animatable.isRunning()) { 32 | animatable.start(); 33 | } 34 | } 35 | 36 | public void stop() { 37 | Animatable animatable = (Animatable) getDrawable(); 38 | if (animatable.isRunning()) { 39 | animatable.stop(); 40 | } 41 | setVisibility(View.GONE); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/widget/SquareImageView.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.widget; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.widget.ImageView; 6 | 7 | /** 8 | * Created by codeest on 16/8/13. 9 | */ 10 | 11 | public class SquareImageView extends ImageView { 12 | 13 | public SquareImageView(Context context) { 14 | super(context); 15 | } 16 | 17 | public SquareImageView(Context context, AttributeSet attrs) { 18 | this(context, attrs, 0); 19 | } 20 | 21 | public SquareImageView(Context context, AttributeSet attrs, int defStyle) { 22 | super(context, attrs, defStyle); 23 | 24 | } 25 | 26 | @Override 27 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 28 | super.onMeasure(widthMeasureSpec, widthMeasureSpec); 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/widget/TouchSwipeRefreshLayout.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.widget; 2 | 3 | import android.content.Context; 4 | import android.support.v4.widget.SwipeRefreshLayout; 5 | import android.util.AttributeSet; 6 | import android.view.MotionEvent; 7 | 8 | /** 9 | * Created by codeest on 2017/3/20. 10 | * 11 | * deal with issue #68 12 | * a bug of RecyclerView 13 | * Ref: https://code.google.com/p/android/issues/detail?id=231717 14 | */ 15 | 16 | public class TouchSwipeRefreshLayout extends SwipeRefreshLayout { 17 | 18 | public TouchSwipeRefreshLayout(Context context) { 19 | super(context); 20 | } 21 | 22 | public TouchSwipeRefreshLayout(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | } 25 | 26 | @Override 27 | public boolean dispatchTouchEvent(MotionEvent ev) { 28 | return isRefreshing() || super.dispatchTouchEvent(ev); 29 | } 30 | 31 | @Override 32 | public boolean onTouchEvent(MotionEvent ev) { 33 | return isRefreshing() || super.onTouchEvent(ev); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/codeest/geeknews/widget/ZhihuDiffCallback.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews.widget; 2 | 3 | import android.support.v7.util.DiffUtil; 4 | 5 | import com.codeest.geeknews.model.bean.DailyListBean; 6 | 7 | import java.util.List; 8 | 9 | /** 10 | * Created by codeest on 17/1/2. 11 | */ 12 | 13 | public class ZhihuDiffCallback extends DiffUtil.Callback{ 14 | 15 | private List mOldDatas, mNewDatas; 16 | 17 | public ZhihuDiffCallback(List mOldDatas, List mNewDatas) { 18 | this.mOldDatas = mOldDatas; 19 | this.mNewDatas = mNewDatas; 20 | } 21 | 22 | @Override 23 | public int getOldListSize() { 24 | return mOldDatas != null ? mOldDatas.size() : 0; 25 | } 26 | 27 | @Override 28 | public int getNewListSize() { 29 | return mNewDatas != null ? mNewDatas.size() : 0; 30 | } 31 | 32 | @Override 33 | public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) { 34 | return mOldDatas.get(oldItemPosition).getId() == mNewDatas.get(newItemPosition).getId(); 35 | } 36 | 37 | @Override 38 | public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) { 39 | DailyListBean.StoriesBean beanOld = mOldDatas.get(oldItemPosition); 40 | DailyListBean.StoriesBean beanNew = mNewDatas.get(newItemPosition); 41 | if (!beanOld.getTitle().equals(beanNew.getTitle())) { 42 | return false; 43 | } 44 | if (beanOld.getReadState() != beanNew.getReadState()) { 45 | return false; 46 | } 47 | if (beanOld.getImages().size() > 0 && beanNew.getImages().size() > 0) { 48 | if (!beanOld.getImages().get(0).equals(beanNew.getImages().get(0))) { 49 | return false; 50 | } 51 | } 52 | return true; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/res/animator/color.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/animator/lightning.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/animator/star_first.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/animator/star_second.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/animator/star_third.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bottom_black_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bottom_shadow_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/dialog_toast_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 15 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/drawer_item_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/reply_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/round_face_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_like.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selector_toolbar_like.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/splash_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/svg_anim_logo.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 8 | 10 | 12 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/svg_logo.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 21 | 22 | 28 | 29 | 32 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_calender.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 9 | 17 | 18 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_comment.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 19 | 20 | 30 | 31 | 32 | 33 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_girl_detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_gold_manager.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_node.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 11 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_replies.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_section.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 15 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_tech_detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 13 | 17 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_welcome.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 10 | 11 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/dialog_toast.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_comment.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_daily.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 11 | 12 | 18 | 19 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_gank_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_gold_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 21 | 27 | 28 | 29 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_gold_page.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_like.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_vtex_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 12 | 21 | 27 | 28 | 29 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_zhihu_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 17 | 18 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_daily.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 20 | 24 | 30 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_date.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_girl.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 15 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_gold.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 15 | 26 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_gold_manager.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 18 | 19 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_gold_title.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 23 | 24 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_like_girl.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 19 | 23 | 28 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_node.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_replies.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 11 | 14 | 20 | 29 | 39 | 40 | 41 | 49 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_section.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 16 | 21 | 29 | 37 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_theme.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 15 | 20 | 28 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_top.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 11 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_top_pager.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_common_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 10 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_drawer_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 11 | 20 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_error.xml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 15 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_line_05.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_node_title.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 10 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_tech_head.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 10 | 15 | 20 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/layout/view_toolbar.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /app/src/main/res/menu/drawer_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 16 | 21 | 26 | 31 | 32 | 33 | 34 | 35 | 40 | 46 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/menu/girl_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main_menu.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/menu/tech_meun.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 11 | 16 | 17 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-night-xxhdpi/bg_drawer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-night-xxhdpi/bg_drawer.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-night-xxhdpi/ic_cache.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-night-xxhdpi/ic_cache.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-night-xxhdpi/ic_clear.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-night-xxhdpi/ic_clear.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-night-xxhdpi/ic_feedback.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-night-xxhdpi/ic_feedback.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-night-xxhdpi/ic_hot.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-night-xxhdpi/ic_hot.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-night-xxhdpi/ic_image.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-night-xxhdpi/ic_image.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-night-xxhdpi/ic_night.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-night-xxhdpi/ic_night.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-night-xxhdpi/ic_update.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-night-xxhdpi/ic_update.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/bg_error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xhdpi/bg_error.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/bg_splash.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xhdpi/bg_splash.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/bg_about.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/bg_about.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/bg_drawer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/bg_drawer.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_alipay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_alipay.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_android.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_android.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_author.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_author.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_cache.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_cache.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_clear.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_clear.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_close.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_close.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_comment.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_comment.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_daily_comment.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_daily_comment.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_daily_like.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_daily_like.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_daily_share.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_daily_share.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drag.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_drag.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_about.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_drawer_about.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_gank.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_drawer_gank.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_gold.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_drawer_gold.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_like.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_drawer_like.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_setting.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_drawer_setting.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_vtex.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_drawer_vtex.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_wechat.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_drawer_wechat.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_drawer_zhihu.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_drawer_zhihu.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_fab_calendar.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_fab_calendar.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_feedback.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_feedback.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_gold_author.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_gold_author.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_gold_like.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_gold_like.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_gold_time.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_gold_time.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_hot.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_hot.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_image.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_image.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_ios.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_ios.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_menu.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_menu.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_night.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_night.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_time.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_time.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_toolbar_copy.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_toolbar_copy.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_toolbar_like_n.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_toolbar_like_n.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_toolbar_like_p.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_toolbar_like_p.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_toolbar_save.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_toolbar_save.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_toolbar_share.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_toolbar_share.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_update.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_update.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_web.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/app/src/main/res/mipmap-xxhdpi/ic_web.webp -------------------------------------------------------------------------------- /app/src/main/res/values-night/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #0F1010 4 | #0F1010 5 | #181921 6 | #0F1010 7 | #202124 8 | #6B6D72 9 | 10 | #6b6d72 11 | #6b6d72 12 | #303030 13 | #999999 14 | #6b6d72 15 | 16 | #bdb4b3 17 | #606266 18 | #606266 19 | #222222 20 | #3289b3 21 | #6B6D72 22 | #0F1010 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | #EEEEEE 7 | #FFFFFF 8 | #2C2C2C 9 | #FED530 10 | 11 | #FF4081 12 | #6e000000 13 | #e8e8e8 14 | #fffff9 15 | #2c2c2c 16 | #dddfe0 17 | #d0000000 18 | #a9a9a9 19 | #000000 20 | #898989 21 | #5b5d5c 22 | #9ba4a3 23 | #bfbfbf 24 | #dddddd 25 | #5d8698 26 | #00618c 27 | #3F51B5 28 | #f2f3f5 29 | #afafaf 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 8dp 6 | 16dp 7 | 8 | 42dp 9 | 80dp 10 | 200dp 11 | 180dp 12 | 260dp 13 | 56dp 14 | 300dp 15 | 32dp 16 | 120dp 17 | 140dp 18 | 60dp 19 | 16dp 20 | 36dp 21 | 20dp 22 | 60dp 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GeekNews 3 | A pure reading App for you 4 | 5 | //main drawer 6 | 知乎日报 7 | 微信精选 8 | 干货集中营 9 | 稀土掘金 10 | V2EX 11 | 关于 12 | 收藏 13 | 设置 14 | 打开 15 | 关闭 16 | 资讯 17 | 选项 18 | 19 | 分享 20 | 点赞 21 | 评论 22 | 收起 23 | 24 | 复制链接到剪贴板 25 | 保存到本地 26 | 分享链接 27 | 收藏 28 | 搜索 29 | 30 | 自动缓存 31 | 无图模式 32 | 夜间模式 33 | 意见反馈 34 | 清除缓存 35 | 检查更新 36 | 常规 37 | 其他 38 | 39 | 项目地址:\nhttps://github.com/codeestX/GeekNews 40 | 作者:Est\t\t(codeest.dev@gmail.com) 41 | 项目简介:\n极客日报,一个纯粹的阅读App\n为了熟悉当前Android端主流框架的使用,也为了能有一款将新闻、技术文章、福利一网打尽的简洁的阅读应用,利用闲暇时间做了这个项目n(*≧▽≦*)n\n 42 | 本着学习的目的,该项目会持续迭代与优化,加入更丰富的阅读内容与功能,并不断尝试最新的技术,欢迎star、fork、issue、email 43 | 请作者吃糖( ̄▽ ̄) 44 | GeekNews\t\t\tV1.3.0 45 | 糟糕!加载失败了ヽ(≧Д≦)ノ\n 偷偷告诉你一些可能的原因:\n1.惨不忍睹的网络环境\n 2.服务器君的不定期抽风\n 3.GeekNews现在心情不好拒绝服务喔~ 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | 23 | 24 | 28 | 29 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/res/xml/fileprovidepaths.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/xml/preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 20 | 21 | 22 | 23 | 26 | 30 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/test/java/com/codeest/geeknews/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.codeest.geeknews; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | apply from: "config.gradle" 3 | 4 | buildscript { 5 | repositories { 6 | jcenter() 7 | } 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:2.3.0' 10 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' 11 | classpath "io.realm:realm-gradle-plugin:3.1.1" 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | jcenter() 21 | maven { url "https://jitpack.io" } 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Mar 12 23:28:39 CST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /screenshots/GIF1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/screenshots/GIF1.gif -------------------------------------------------------------------------------- /screenshots/GIF2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/screenshots/GIF2.gif -------------------------------------------------------------------------------- /screenshots/GIF3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/screenshots/GIF3.gif -------------------------------------------------------------------------------- /screenshots/PNG1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/screenshots/PNG1.png -------------------------------------------------------------------------------- /screenshots/PNG2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/screenshots/PNG2.png -------------------------------------------------------------------------------- /screenshots/PNG3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/screenshots/PNG3.png -------------------------------------------------------------------------------- /screenshots/PNG4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/screenshots/PNG4.png -------------------------------------------------------------------------------- /screenshots/PNG5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/screenshots/PNG5.png -------------------------------------------------------------------------------- /screenshots/download.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeestX/GeekNews/4e761b6be2991e0f99a22b6c121caf021bb09b16/screenshots/download.png -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------