├── .gitignore
├── .idea
├── .name
├── compiler.xml
├── copyright
│ └── profiles_settings.xml
├── encodings.xml
├── gradle.xml
├── misc.xml
├── modules.xml
└── runConfigurations.xml
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── linhao
│ │ └── redridinghood
│ │ └── ApplicationTest.java
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── linhao
│ │ │ └── redridinghood
│ │ │ ├── application
│ │ │ └── MyApplication.java
│ │ │ ├── inject
│ │ │ ├── component
│ │ │ │ ├── ClientApiComponent.java
│ │ │ │ └── ClientApiManagerComponent.java
│ │ │ └── module
│ │ │ │ ├── ClientApiManagerModule.java
│ │ │ │ ├── ClientApiModule.java
│ │ │ │ └── ClientFragmentModule.java
│ │ │ ├── model
│ │ │ ├── api
│ │ │ │ └── ApiClient.java
│ │ │ ├── entity
│ │ │ │ ├── AddRecommend.java
│ │ │ │ ├── Carousel.java
│ │ │ │ ├── ComicList.java
│ │ │ │ ├── Detail.java
│ │ │ │ ├── HotNewAnimate.java
│ │ │ │ ├── News.java
│ │ │ │ ├── NewsDetail.java
│ │ │ │ ├── Pickers.java
│ │ │ │ ├── Ranking.java
│ │ │ │ ├── RecentUpdate.java
│ │ │ │ ├── Search.java
│ │ │ │ ├── SearchEntity.java
│ │ │ │ ├── Topics.java
│ │ │ │ ├── TopicsDetail.java
│ │ │ │ └── WeekUpdate.java
│ │ │ ├── service
│ │ │ │ └── ClientApiManager.java
│ │ │ └── storage
│ │ │ │ ├── SettingShared.java
│ │ │ │ └── SharedWrapper.java
│ │ │ ├── presenter
│ │ │ ├── contract
│ │ │ │ ├── BannerData.java
│ │ │ │ ├── ComicDetailData.java
│ │ │ │ ├── ComicListData.java
│ │ │ │ ├── FragmentData.java
│ │ │ │ ├── HotNewData.java
│ │ │ │ ├── NewsData.java
│ │ │ │ ├── RankingData.java
│ │ │ │ ├── RecentUpdateData.java
│ │ │ │ ├── SearchData.java
│ │ │ │ ├── TopicData.java
│ │ │ │ ├── TopicDetailData.java
│ │ │ │ └── WeekUpdateData.java
│ │ │ └── implement
│ │ │ │ ├── BannerDataImpl.java
│ │ │ │ ├── ComicDetailDataImpl.java
│ │ │ │ ├── ComicListDataImpl.java
│ │ │ │ ├── FragmentDataImpl.java
│ │ │ │ ├── HotNewDataImpl.java
│ │ │ │ ├── NewsDataImpl.java
│ │ │ │ ├── RankingDataImpl.java
│ │ │ │ ├── RecentUpdateDataImpl.java
│ │ │ │ ├── SearchDataImpl.java
│ │ │ │ ├── TopicDataImpl.java
│ │ │ │ ├── TopicDetailDataImpl.java
│ │ │ │ └── WeekUpdateDataImpl.java
│ │ │ ├── ui
│ │ │ ├── activity
│ │ │ │ ├── BaseActivty.java
│ │ │ │ ├── ComicDetailActivity.java
│ │ │ │ ├── ComicListActivity.java
│ │ │ │ ├── DownLoadActivity.java
│ │ │ │ ├── EndComicActivity.java
│ │ │ │ ├── HotNewActivity.java
│ │ │ │ ├── MainActivity.java
│ │ │ │ ├── NewsActivity.java
│ │ │ │ ├── RangkingActivity.java
│ │ │ │ ├── RecentUpdateActivity.java
│ │ │ │ ├── SearchActivity.java
│ │ │ │ ├── TopicActivity.java
│ │ │ │ ├── TopicDetailActivity.java
│ │ │ │ ├── WeekUpdateActivity.java
│ │ │ │ └── WelcomeActivity.java
│ │ │ ├── adapter
│ │ │ │ ├── BannerAdapter.java
│ │ │ │ ├── ComicListAdapter.java
│ │ │ │ ├── CommentAdapter.java
│ │ │ │ ├── CommentViewHolder.java
│ │ │ │ ├── DownLoadAdapter.java
│ │ │ │ ├── GridViewAdapter.java
│ │ │ │ ├── HotNewAdapter.java
│ │ │ │ ├── NewsAdapter.java
│ │ │ │ ├── RankingAdapter.java
│ │ │ │ ├── RecentUpdateAdapter.java
│ │ │ │ ├── RecommandAdapter.java
│ │ │ │ ├── SearchAdapter.java
│ │ │ │ ├── TabFragmentPageAdapter.java
│ │ │ │ ├── TopicAdapter.java
│ │ │ │ ├── TopicDetailAdapter.java
│ │ │ │ └── WeekUpdateAdapter.java
│ │ │ ├── fragment
│ │ │ │ ├── AddEndFragment.java
│ │ │ │ ├── AddSerialFragment.java
│ │ │ │ ├── BaseFragment.java
│ │ │ │ ├── DownLoadFragment.java
│ │ │ │ ├── HotNewFirstFragemnt.java
│ │ │ │ ├── HotNewFourFragemnt.java
│ │ │ │ ├── HotNewItemFragment.java
│ │ │ │ ├── HotNewSecondFragemnt.java
│ │ │ │ ├── HotNewThridFragemnt.java
│ │ │ │ ├── RankingFragment.java
│ │ │ │ ├── RecommendEndFragment.java
│ │ │ │ ├── RecommendSerialFragment.java
│ │ │ │ └── WeekUpdateFragment.java
│ │ │ ├── listener
│ │ │ │ ├── DrawerLayoutListener.java
│ │ │ │ ├── ItemOnClick.java
│ │ │ │ ├── MyPageChangeOnListener.java
│ │ │ │ ├── NavigationFinishClickListener.java
│ │ │ │ ├── NavigationOpenClickListener.java
│ │ │ │ ├── PageLoadMoreListener.java
│ │ │ │ └── TabOnClickListener.java
│ │ │ └── view
│ │ │ │ ├── ActivityView.java
│ │ │ │ └── LoadMoreView.java
│ │ │ ├── util
│ │ │ ├── ActivityUtils.java
│ │ │ ├── ConstantUtil.java
│ │ │ ├── DisplayUtils.java
│ │ │ ├── ExitClickUtil.java
│ │ │ ├── GlideUtil.java
│ │ │ ├── HandlerUtils.java
│ │ │ ├── ResUtils.java
│ │ │ └── ThemeUtils.java
│ │ │ └── widget
│ │ │ ├── DividerItemDecoration.java
│ │ │ ├── PickerScrollView.java
│ │ │ └── ScrimInsetsScrollView.java
│ └── res
│ │ ├── color
│ │ ├── navigation_item_text_dark.xml
│ │ ├── navigation_item_text_light.xml
│ │ ├── reference_text_dark.xml
│ │ └── reference_text_light.xml
│ │ ├── drawable-v21
│ │ ├── button_transparent_image.xml
│ │ ├── selectable_item_background_general_dark.xml
│ │ └── selectable_item_background_general_light.xml
│ │ ├── drawable-xhdpi
│ │ ├── image_error.png
│ │ └── image_placeholder.png
│ │ ├── drawable-xxhdpi
│ │ ├── ic_no_data.png
│ │ └── main_nav_header_bg.png
│ │ ├── drawable-xxxhdpi
│ │ ├── ic_brightness_3_white_24dp.png
│ │ ├── ic_face_grey600_24dp.png
│ │ ├── ic_face_theme_24dp.png
│ │ ├── ic_forum_grey600_24dp.png
│ │ ├── ic_forum_theme_24dp.png
│ │ ├── ic_menu_white_24dp.png
│ │ ├── ic_share_grey600_24dp.png
│ │ ├── ic_share_theme_24dp.png
│ │ ├── ic_share_white_24dp.png
│ │ ├── ic_thumb_up_grey600_24dp.png
│ │ ├── ic_thumb_up_theme_24dp.png
│ │ ├── ic_wb_sunny_white_24dp.png
│ │ ├── ic_work_grey600_24dp.png
│ │ └── ic_work_theme_24dp.png
│ │ ├── drawable
│ │ ├── back.png
│ │ ├── button_transparent_image.xml
│ │ ├── button_transparent_pressed.xml
│ │ ├── dot_focused.xml
│ │ ├── dot_normal.xml
│ │ ├── gap_shadow.xml
│ │ ├── gap_shadow_opposite.xml
│ │ ├── grey_delete.png
│ │ ├── list_divider.xml
│ │ ├── main_nav_ic_all.xml
│ │ ├── main_nav_ic_ask.xml
│ │ ├── main_nav_ic_good.xml
│ │ ├── main_nav_ic_job.xml
│ │ ├── main_nav_ic_share.xml
│ │ ├── navigation_drawer_shadow.xml
│ │ ├── picker_tv_bg.png
│ │ ├── red_down.png
│ │ ├── reference_background_accent.xml
│ │ ├── reference_background_dark.xml
│ │ ├── reference_background_light.xml
│ │ ├── reference_background_normal_dark.xml
│ │ ├── reference_background_normal_light.xml
│ │ ├── search.png
│ │ ├── selectable_item_background_general_dark.xml
│ │ ├── selectable_item_background_general_light.xml
│ │ ├── time5.png
│ │ ├── time6.png
│ │ ├── time7.png
│ │ ├── time8.png
│ │ └── white_down.png
│ │ ├── layout
│ │ ├── activity_main.xml
│ │ ├── activity_main_center.xml
│ │ ├── activity_main_market.xml
│ │ ├── activity_main_nav.xml
│ │ ├── addend.xml
│ │ ├── addserial.xml
│ │ ├── banner_content.xml
│ │ ├── banner_item.xml
│ │ ├── comic_list.xml
│ │ ├── comic_list_item.xml
│ │ ├── download_item.xml
│ │ ├── download_list.xml
│ │ ├── footer_load_more.xml
│ │ ├── fragment_content.xml
│ │ ├── grid_item_layout.xml
│ │ ├── hot_new_animate.xml
│ │ ├── hot_new_animate_item.xml
│ │ ├── hot_new_content.xml
│ │ ├── hot_new_item_content.xml
│ │ ├── include_empty.xml
│ │ ├── include_error.xml
│ │ ├── include_toolbar.xml
│ │ ├── news.xml
│ │ ├── news_item.xml
│ │ ├── picker_layout.xml
│ │ ├── rangk_content_item.xml
│ │ ├── rangking_item.xml
│ │ ├── ranking.xml
│ │ ├── recent_update.xml
│ │ ├── recent_update_content.xml
│ │ ├── recent_update_item.xml
│ │ ├── recommandand.xml
│ │ ├── recommandserial.xml
│ │ ├── search.xml
│ │ ├── tab_item.xml
│ │ ├── topic.xml
│ │ ├── topic_item.xml
│ │ ├── webview.xml
│ │ ├── week_update.xml
│ │ ├── week_update_content.xml
│ │ ├── week_update_item.xml
│ │ └── welcome.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_placeholder.jpg
│ │ ├── mipmap-mdpi
│ │ ├── icon.png
│ │ └── search.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_empty.png
│ │ ├── ic_error.png
│ │ └── splash.png
│ │ ├── raw
│ │ └── open_source.license
│ │ ├── values-v19
│ │ └── styles.xml
│ │ ├── values-v21
│ │ └── styles.xml
│ │ ├── values-w820dp
│ │ └── dimens.xml
│ │ ├── values
│ │ ├── attrs.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── fractions.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ │ └── xml
│ │ └── bottombar_tabs.xml
│ └── test
│ └── java
│ └── linhao
│ └── redridinghood
│ └── ExampleUnitTest.java
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/.idea/.name:
--------------------------------------------------------------------------------
1 | RedRidingHood
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/.idea/copyright/profiles_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.idea/encodings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
22 |
23 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
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 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 | 1.8
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/.idea/modules.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RedRidingHood
2 |
3 | 该App所使用到的所有Api 由 https://hltm-api.tomoya.cn/ 提供
4 |
5 | 
6 | 
7 |
8 | 
9 | 
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'android-apt'
3 | apply plugin: 'com.neenbedankt.android-apt'
4 | apply plugin: 'com.antfortune.freeline'
5 |
6 | android {
7 | compileSdkVersion 23
8 | buildToolsVersion "23.0.3"
9 |
10 | defaultConfig {
11 | applicationId "linhao.redridinghood"
12 | minSdkVersion 14
13 | targetSdkVersion 23
14 | versionCode 1
15 | versionName "1.0"
16 | multiDexEnabled true //多渠道打包 , 当文件多时 必须为true ,否则出错
17 |
18 | }
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | freeline {
26 | hack true
27 | }
28 | }
29 |
30 | dependencies {
31 | compile fileTree(include: ['*.jar'], dir: 'libs')
32 | testCompile 'junit:junit:4.12'
33 | compile 'com.android.support:appcompat-v7:23.1.1'
34 | compile 'com.android.support:design:23.1.1'
35 | compile 'com.android.support:cardview-v7:23.1.1'
36 | //butterknife
37 | compile 'com.jakewharton:butterknife:8.2.1'
38 | apt 'com.jakewharton:butterknife-compiler:8.2.1'
39 | //retrofit
40 | compile 'com.squareup.retrofit2:retrofit:2.1.0'
41 | compile 'com.squareup.retrofit2:converter-gson:2.1.0'
42 | compile 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
43 | //rxjava
44 | compile 'io.reactivex:rxjava:1.1.9'
45 | compile 'io.reactivex:rxandroid:1.2.1'
46 | compile 'com.google.code.gson:gson:2.7'
47 | //okhttp
48 | compile 'com.squareup.okhttp3:okhttp:3.4.1'
49 | compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
50 | //glide
51 | compile 'com.github.bumptech.glide:glide:3.7.0'
52 | //dagger2
53 | compile 'com.google.dagger:dagger:2.6'
54 | apt 'com.google.dagger:dagger-compiler:2.6'
55 | compile 'com.google.android.gms:play-services-appindexing:8.1.0'
56 | compile 'com.roughike:bottom-bar:2.0.2'
57 | compile 'de.hdodenhof:circleimageview:2.1.0'
58 | compile 'com.pnikosis:materialish-progress:1.7'
59 |
60 |
61 | //友盟统计
62 | compile 'com.umeng.analytics:analytics:latest.integration'
63 |
64 | debugCompile 'com.squareup.leakcanary:leakcanary-android:1.4'
65 | releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4'
66 | testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.4'
67 | }
68 |
--------------------------------------------------------------------------------
/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 E:\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 | -keep public class [linhao.redridinghood].R$*{
19 | public static final int *;
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/linhao/redridinghood/ApplicationTest.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood;
2 |
3 | import android.app.Application;
4 | import android.test.ApplicationTestCase;
5 |
6 | /**
7 | * Testing Fundamentals
8 | */
9 | public class ApplicationTest extends ApplicationTestCase {
10 | public ApplicationTest() {
11 | super(Application.class);
12 | }
13 | }
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/application/MyApplication.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.application;
2 |
3 | import android.app.Application;
4 | import android.content.Context;
5 |
6 | import com.squareup.leakcanary.LeakCanary;
7 | import com.squareup.leakcanary.RefWatcher;
8 |
9 | import linhao.redridinghood.inject.component.ClientApiComponent;
10 | import linhao.redridinghood.inject.component.DaggerClientApiComponent;
11 | import linhao.redridinghood.inject.module.ClientApiModule;
12 |
13 | /**
14 | * Created by linhao on 2016/8/17.
15 | */
16 | public class MyApplication extends Application {
17 |
18 | private static ClientApiComponent clientApiComponent;
19 | private RefWatcher refWatcher;
20 | @Override
21 | public void onCreate() {
22 | super.onCreate();
23 | clientApiComponent= DaggerClientApiComponent
24 | .builder()
25 | .clientApiModule(new ClientApiModule())
26 | .build();
27 |
28 | if (LeakCanary.isInAnalyzerProcess(this)) {
29 | return;
30 | }
31 | refWatcher=LeakCanary.install(this);
32 | }
33 |
34 | public static RefWatcher getRefWatcher(Context context){
35 | MyApplication application = (MyApplication)context.getApplicationContext();
36 | return application.refWatcher;
37 | }
38 |
39 | public static ClientApiComponent Instance() {
40 | return clientApiComponent;
41 | }
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/inject/component/ClientApiComponent.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.inject.component;
2 |
3 | import com.google.gson.Gson;
4 |
5 | import javax.inject.Singleton;
6 |
7 | import dagger.Component;
8 | import linhao.redridinghood.inject.module.ClientApiModule;
9 | import linhao.redridinghood.model.api.ApiClient;
10 | import linhao.redridinghood.model.service.ClientApiManager;
11 |
12 | /**
13 | * Created by linhao on 2016/8/14.
14 | */
15 | @Singleton
16 | @Component(modules = ClientApiModule.class)
17 | public interface ClientApiComponent {
18 |
19 | void inject(ClientApiManager clientApiManager);
20 | Gson getGson();
21 | ApiClient getApiClient();
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/inject/module/ClientApiModule.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.inject.module;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.gson.GsonBuilder;
5 |
6 | import java.util.concurrent.TimeUnit;
7 |
8 | import javax.inject.Singleton;
9 |
10 | import dagger.Module;
11 | import dagger.Provides;
12 | import linhao.redridinghood.model.api.ApiClient;
13 | import okhttp3.OkHttpClient;
14 | import okhttp3.logging.HttpLoggingInterceptor;
15 | import retrofit2.Converter;
16 | import retrofit2.Retrofit;
17 | import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
18 | import retrofit2.converter.gson.GsonConverterFactory;
19 |
20 | /**
21 | * Created by linhao on 2016/8/14.
22 | */
23 | @Module
24 | public class ClientApiModule {
25 |
26 | String BASE_URL = "https://hltm-api.tomoya.cn/";
27 |
28 | @Singleton
29 | @Provides
30 | public OkHttpClient providerOkhttpClient(HttpLoggingInterceptor interceptor) {
31 | OkHttpClient.Builder builder = new OkHttpClient.Builder()
32 | .readTimeout(30, TimeUnit.SECONDS)
33 | .connectTimeout(30, TimeUnit.SECONDS)
34 | .writeTimeout(30, TimeUnit.SECONDS);
35 |
36 | OkHttpClient okHttpClient = builder.build();
37 | // okHttpClient.interceptors().add(interceptor);
38 | return okHttpClient;
39 | }
40 |
41 | @Provides
42 | @Singleton
43 | public Gson providerGson(){
44 | GsonBuilder builder=new GsonBuilder();
45 | return builder.serializeNulls().create();
46 | }
47 |
48 | @Singleton
49 | @Provides
50 | public Converter.Factory providerConvert(Gson gson){
51 | return GsonConverterFactory.create(gson);
52 | }
53 |
54 | @Singleton
55 | @Provides
56 | public Retrofit provider(OkHttpClient okHttpClient,Converter.Factory factory){
57 | Retrofit retrofit=new Retrofit.Builder()
58 | .baseUrl(BASE_URL)
59 | .addConverterFactory(factory)
60 | .client(okHttpClient)
61 | .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
62 | .build();
63 | return retrofit;
64 | }
65 |
66 | @Singleton
67 | @Provides
68 | public ApiClient providerApiClient(Retrofit retrofit){
69 | ApiClient apiClient=retrofit.create(ApiClient.class);
70 | return apiClient;
71 | }
72 |
73 | @Singleton
74 | @Provides
75 | public HttpLoggingInterceptor providerInterceptor(){
76 | HttpLoggingInterceptor interceptor=new HttpLoggingInterceptor();
77 | interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
78 | return interceptor;
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/inject/module/ClientFragmentModule.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.inject.module;
2 |
3 | import android.support.v4.app.Fragment;
4 | import android.support.v4.app.FragmentActivity;
5 |
6 | import javax.inject.Singleton;
7 |
8 | import dagger.Module;
9 | import dagger.Provides;
10 | import linhao.redridinghood.ui.fragment.HotNewFirstFragemnt;
11 | import linhao.redridinghood.ui.fragment.HotNewFourFragemnt;
12 | import linhao.redridinghood.ui.fragment.HotNewSecondFragemnt;
13 | import linhao.redridinghood.ui.fragment.HotNewThridFragemnt;
14 |
15 | /**
16 | * Created by linhao on 2016/9/10.
17 | */
18 | @Module
19 | public class ClientFragmentModule {
20 |
21 |
22 | private FragmentActivity activity;
23 | public ClientFragmentModule(FragmentActivity activity){
24 | this.activity=activity;
25 | }
26 | /**
27 | @Provides
28 | @Singleton
29 | public Fragment providerHotNewFirstFragment(){
30 | return new HotNewFirstFragemnt();
31 | }
32 |
33 | @Provides
34 | @Singleton
35 | public Fragment providerHotNewSecondFragment(){
36 | return new HotNewSecondFragemnt();
37 | }
38 |
39 | @Provides
40 | @Singleton
41 | public Fragment providerHotNewThridFragment(){
42 | return new HotNewThridFragemnt();
43 | }
44 |
45 | @Provides
46 | @Singleton
47 | public Fragment providerHotNewFourFragment(){
48 | return new HotNewFourFragemnt();
49 | }
50 |
51 | /**
52 | @Provides
53 | @Singleton
54 | public FragmentTransaction providerFragmentTransaction(){
55 | return activity.getSupportFragmentManager().beginTransaction();
56 | }
57 | */
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/entity/AddRecommend.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.entity;
2 |
3 | import android.content.Intent;
4 |
5 | import com.google.gson.annotations.SerializedName;
6 |
7 | import java.io.Serializable;
8 | import java.util.ArrayList;
9 | import java.util.HashMap;
10 | import java.util.List;
11 | import java.util.Map;
12 |
13 | /**
14 | * Created by linhao on 2016/8/13.
15 | * 新增/推荐 连载/完结 动漫
16 | */
17 | public class AddRecommend implements Serializable{
18 |
19 | @SerializedName("tab")
20 | private Tab tabs;
21 |
22 |
23 | @SerializedName("list")
24 | private ListrecommandDataList;
25 |
26 |
27 | public Tab getTabs() {
28 | return tabs;
29 | }
30 |
31 | public void setTabs(Tab tabs) {
32 | this.tabs = tabs;
33 | }
34 |
35 | public List getRecommandDataList() {
36 | return recommandDataList;
37 | }
38 |
39 | public void setRecommandDataList(List recommandDataList) {
40 | this.recommandDataList = recommandDataList;
41 | }
42 |
43 | /**
44 | * 具体推荐数据的标题
45 | */
46 | public class Tab{
47 | private String title;
48 | private String url;
49 |
50 | public String getTitle() {
51 | return title;
52 | }
53 |
54 | public void setTitle(String title) {
55 | this.title = title;
56 | }
57 |
58 | public String getUrl() {
59 | return url;
60 | }
61 |
62 | public void setUrl(String url) {
63 | this.url = url;
64 | }
65 | }
66 |
67 | /**
68 | * 具体推荐的数据
69 | */
70 | public class RecommandData{
71 | private String update;
72 | private String name;
73 | private String url;
74 | private String img;
75 |
76 | public String getUpdate() {
77 | return update;
78 | }
79 |
80 | public void setUpdate(String update) {
81 | this.update = update;
82 | }
83 |
84 | public String getName() {
85 | return name;
86 | }
87 |
88 | public void setName(String name) {
89 | this.name = name;
90 | }
91 |
92 | public String getUrl() {
93 | return url;
94 | }
95 |
96 | public void setUrl(String url) {
97 | this.url = url;
98 | }
99 |
100 | public String getImg() {
101 | return img;
102 | }
103 |
104 | public void setImg(String img) {
105 | this.img = img;
106 | }
107 | }
108 | }
109 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/entity/Carousel.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.entity;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | import java.io.Serializable;
6 |
7 | /**
8 | * Created by linhao on 2016/8/13.
9 | * 轮播图
10 | */
11 | public class Carousel implements Serializable {
12 |
13 | @SerializedName("img")
14 | private String imgUrl;
15 |
16 | @SerializedName("title")
17 | private String imgTitle;
18 |
19 | @SerializedName("url")
20 | private String detailUrl;
21 |
22 | public String getImgUrl() {
23 | return imgUrl;
24 | }
25 |
26 | public void setImgUrl(String imgUrl) {
27 | this.imgUrl = imgUrl;
28 | }
29 |
30 | public String getImgTitle() {
31 | return imgTitle;
32 | }
33 |
34 | public void setImgTitle(String imgTitle) {
35 | this.imgTitle = imgTitle;
36 | }
37 |
38 | public String getDetailUrl() {
39 | return detailUrl;
40 | }
41 |
42 | public void setDetailUrl(String detailUrl) {
43 | this.detailUrl = detailUrl;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/entity/NewsDetail.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.entity;
2 |
3 | import java.io.Serializable;
4 |
5 | import javax.sql.StatementEvent;
6 |
7 | /**
8 | * Created by linhao on 2016/8/13.
9 | */
10 | public class NewsDetail implements Serializable {
11 |
12 | /**
13 | * "title": "红旅公众号今天开始更新动漫资讯啦",
14 | "time": "2016-07-06 10:47:46 ",
15 | "content": "\r\n
16 | */
17 |
18 | private String title;
19 | private String time;
20 | private String content;
21 |
22 | public String getTitle() {
23 | return title;
24 | }
25 |
26 | public void setTitle(String title) {
27 | this.title = title;
28 | }
29 |
30 | public String getTime() {
31 | return time;
32 | }
33 |
34 | public void setTime(String time) {
35 | this.time = time;
36 | }
37 |
38 | public String getContent() {
39 | return content;
40 | }
41 |
42 | public void setContent(String content) {
43 | this.content = content;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/entity/Pickers.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.entity;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | *
7 | * @author zengtao 2015年5月20日下午7:18:14
8 | *
9 | */
10 | public class Pickers implements Serializable {
11 |
12 | private static final long serialVersionUID = 1L;
13 |
14 | private String showConetnt;
15 | private String showId;
16 | private int pageId;
17 | public String getShowConetnt() {
18 | return showConetnt;
19 | }
20 |
21 | public String getShowId() {
22 | return showId;
23 | }
24 |
25 | public Pickers(String showConetnt, String showId,int pageId) {
26 | super();
27 | this.showConetnt = showConetnt;
28 | this.showId = showId;
29 | this.pageId=pageId;
30 | }
31 |
32 | public Pickers() {
33 | super();
34 | }
35 |
36 | public int getPageId() {
37 | return pageId;
38 | }
39 |
40 | public void setPageId(int pageId) {
41 | this.pageId = pageId;
42 | }
43 |
44 | public void setShowConetnt(String showConetnt) {
45 | this.showConetnt = showConetnt;
46 | }
47 |
48 | public void setShowId(String showId) {
49 | this.showId = showId;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/entity/Ranking.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.entity;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | import java.io.Serializable;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by linhao on 2016/8/13.
10 | * 2016年7月新番排行榜/2016年4月新番排行榜/动漫总排行榜/动漫资讯
11 | */
12 | public class Ranking implements Serializable {
13 |
14 | private String tab;
15 | private String url;
16 | @SerializedName("list")
17 | private ListlistDataList;
18 |
19 | public String getTab() {
20 | return tab;
21 | }
22 |
23 | public void setTab(String tab) {
24 | this.tab = tab;
25 | }
26 |
27 | public String getUrl() {
28 | return url;
29 | }
30 |
31 | public void setUrl(String url) {
32 | this.url = url;
33 | }
34 |
35 | public List getListDataList() {
36 | return listDataList;
37 | }
38 |
39 | public void setListDataList(List listDataList) {
40 | this.listDataList = listDataList;
41 | }
42 |
43 | public class ListData{
44 | private String name;
45 | private String url;
46 | private String episode;
47 |
48 | public String getName() {
49 | return name;
50 | }
51 |
52 | public void setName(String name) {
53 | this.name = name;
54 | }
55 |
56 | public String getUrl() {
57 | return url;
58 | }
59 |
60 | public void setUrl(String url) {
61 | this.url = url;
62 | }
63 |
64 | public String getEpisode() {
65 | return episode;
66 | }
67 |
68 | public void setEpisode(String episode) {
69 | this.episode = episode;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/entity/RecentUpdate.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.entity;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | /**
7 | * Created by linhao on 2016/8/13.
8 | * 最新更新
9 | */
10 | public class RecentUpdate implements Serializable {
11 |
12 | private String time;
13 | private String sort;
14 | private String type;
15 | private String name;
16 | private String url;
17 | private String episode;
18 |
19 | public String getTime() {
20 | return time;
21 | }
22 |
23 | public void setTime(String time) {
24 | this.time = time;
25 | }
26 |
27 | public String getSort() {
28 | return sort;
29 | }
30 |
31 | public void setSort(String sort) {
32 | this.sort = sort;
33 | }
34 |
35 | public String getType() {
36 | return type;
37 | }
38 |
39 | public void setType(String type) {
40 | this.type = type;
41 | }
42 |
43 | public String getName() {
44 | return name;
45 | }
46 |
47 | public void setName(String name) {
48 | this.name = name;
49 | }
50 |
51 | public String getUrl() {
52 | return url;
53 | }
54 |
55 | public void setUrl(String url) {
56 | this.url = url;
57 | }
58 |
59 | public String getEpisode() {
60 | return episode;
61 | }
62 |
63 | public void setEpisode(String episode) {
64 | this.episode = episode;
65 | }
66 | }
67 |
68 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/entity/Topics.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.entity;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | import java.io.Serializable;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by linhao on 2016/8/13.
10 | */
11 | public class Topics implements Serializable {
12 |
13 |
14 | private String url;
15 | private String img;
16 | private String title;
17 |
18 | public String getUrl() {
19 | return url;
20 | }
21 |
22 | public void setUrl(String url) {
23 | this.url = url;
24 | }
25 |
26 | public String getImg() {
27 | return img;
28 | }
29 |
30 | public void setImg(String img) {
31 | this.img = img;
32 | }
33 |
34 | public String getTitle() {
35 | return title;
36 | }
37 |
38 | public void setTitle(String title) {
39 | this.title = title;
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/entity/WeekUpdate.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.entity;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 |
5 | import java.io.Serializable;
6 | import java.util.List;
7 |
8 | /**
9 | * Created by linhao on 2016/8/13.
10 | * 一周更新(节目单)
11 | */
12 | public class WeekUpdate implements Serializable {
13 |
14 | @SerializedName("week")
15 | String weekDay;
16 |
17 | @SerializedName("list")
18 | private List weekLists;
19 |
20 | public String getWeekDay() {
21 | return weekDay;
22 | }
23 |
24 | public void setWeekDay(String weekDay) {
25 | this.weekDay = weekDay;
26 | }
27 |
28 | public List getWeekLists() {
29 | return weekLists;
30 | }
31 |
32 | public void setWeekLists(List weekLists) {
33 | this.weekLists = weekLists;
34 | }
35 |
36 | /**
37 | * 推荐的具体数据
38 | */
39 | public class WeekListItem {
40 | private String updateDate;
41 | private String name;
42 | private String url;
43 |
44 | public String getUpdateDate() {
45 | return updateDate;
46 | }
47 |
48 | public void setUpdateDate(String updateDate) {
49 | this.updateDate = updateDate;
50 | }
51 |
52 | public String getName() {
53 | return name;
54 | }
55 |
56 | public void setName(String name) {
57 | this.name = name;
58 | }
59 |
60 | public String getUrl() {
61 | return url;
62 | }
63 |
64 | public void setUrl(String url) {
65 | this.url = url;
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/storage/SettingShared.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.storage;
2 |
3 | import android.content.Context;
4 | import android.support.annotation.NonNull;
5 |
6 | /**
7 | * Created by linhao on 2016/8/23.
8 | */
9 | public final class SettingShared {
10 |
11 | private static final String TAG = "SettingShared";
12 | private static final String KEY_ENABLE_THEME_DARK = "enableThemeDark";
13 |
14 |
15 | //保存夜间和白天的主题
16 | public static void setEnableThemeDark(@NonNull Context context, boolean enable) {
17 | SharedWrapper.with(context,TAG);
18 | SharedWrapper.setBool(KEY_ENABLE_THEME_DARK,enable);
19 | }
20 |
21 | public static boolean isEnableThemeDark(@NonNull Context context) {
22 | SharedWrapper.with(context,TAG);
23 | boolean enableThemeDark=SharedWrapper.getBoolean(KEY_ENABLE_THEME_DARK,false);
24 | return enableThemeDark;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/model/storage/SharedWrapper.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.model.storage;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.support.annotation.NonNull;
6 |
7 | public final class SharedWrapper {
8 |
9 | private static SharedPreferences sp;
10 |
11 | public static SharedPreferences with(@NonNull Context context,@NonNull String shareName){
12 | if (sp !=null){
13 | return sp;
14 | }else {
15 | sp=context.getSharedPreferences(shareName,Context.MODE_PRIVATE);
16 | }
17 | return sp;
18 | }
19 |
20 |
21 | public static void set(String key,String value){
22 | sp.edit().putString(key,value).apply();
23 | }
24 |
25 |
26 | public static void setBool(String key,boolean value){
27 | set(key,Boolean.toString(value));
28 | }
29 |
30 | public static String getString(String key){
31 | String value=sp.getString(key,null);
32 | return value;
33 | }
34 |
35 | public static boolean getBoolean(String key,boolean defaultValue){
36 | String value=sp.getString(key,null);
37 | if ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)){
38 | return Boolean.parseBoolean(value);
39 | }
40 | return defaultValue;
41 | }
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/BannerData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 |
4 |
5 | /**
6 | * Created by linhao on 2016/8/17.
7 | */
8 | public interface BannerData {
9 | void getData();
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/ComicDetailData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/9/15.
5 | */
6 | public interface ComicDetailData {
7 |
8 | void getData(String url);
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/ComicListData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/9/11.
5 | */
6 | public interface ComicListData {
7 | void getData(int edition,String letter,int sort,int tab,int page);
8 |
9 | void getLoadMoreData(int edition,String letter,int sort,int tab,int page);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/FragmentData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/8/25.
5 | */
6 | public interface FragmentData {
7 |
8 | void getFragmentData();
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/HotNewData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/9/10.
5 | */
6 | public interface HotNewData {
7 |
8 | void loadData();
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/NewsData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/9/3.
5 | */
6 | public interface NewsData {
7 |
8 | void getNewData();
9 |
10 | void pageLoadMore(int page);
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/RankingData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/9/2.
5 | */
6 | public interface RankingData {
7 |
8 | void getData();
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/RecentUpdateData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/9/1.
5 | */
6 | public interface RecentUpdateData {
7 |
8 | void getRecentUpdateData();
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/SearchData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/9/18.
5 | */
6 | public interface SearchData {
7 |
8 | void getData(String key,int page,boolean isLoadMore);
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/TopicData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/9/15.
5 | */
6 | public interface TopicData {
7 | void getData();
8 | }
9 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/TopicDetailData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | /**
4 | * Created by linhao on 2016/9/15.
5 | */
6 | public interface TopicDetailData{
7 |
8 | void getData(String url,int page,boolean isLoadMore);
9 | }
10 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/contract/WeekUpdateData.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.contract;
2 |
3 | import linhao.redridinghood.model.entity.WeekUpdate;
4 |
5 | /**
6 | * Created by linhao on 2016/9/4.
7 | */
8 | public interface WeekUpdateData {
9 | void getWeekUpdateData();
10 | void getWeekUpdataItem(String key, String url, int pageNum, WeekUpdate weekUpdate, int position);
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/implement/BannerDataImpl.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.implement;
2 |
3 | import java.util.List;
4 |
5 |
6 | import javax.inject.Inject;
7 |
8 | import linhao.redridinghood.model.entity.Carousel;
9 | import linhao.redridinghood.model.service.ClientApiManager;
10 | import linhao.redridinghood.presenter.contract.BannerData;
11 | import linhao.redridinghood.ui.activity.MainActivity;
12 | import linhao.redridinghood.ui.adapter.BannerAdapter;
13 | import linhao.redridinghood.ui.view.ActivityView;
14 | import rx.Observable;
15 | import rx.android.schedulers.AndroidSchedulers;
16 | import rx.functions.Action0;
17 | import rx.functions.Action1;
18 | import rx.schedulers.Schedulers;
19 |
20 | /**
21 | * Created by linhao on 2016/8/17.
22 | */
23 | public class BannerDataImpl implements BannerData {
24 |
25 | @Inject
26 | ClientApiManager clientApiManager;
27 |
28 | @Inject
29 | ActivityView bannerView;
30 |
31 | @Inject
32 | BannerAdapter bannerAdapter;
33 |
34 | public BannerDataImpl() {
35 | MainActivity.InstanceManager().inject(this);
36 | }
37 |
38 | @Override
39 | public void getData() {
40 | final Observable> data = clientApiManager.getCarousel();
41 | data.subscribeOn(Schedulers.io())
42 | .observeOn(AndroidSchedulers.mainThread())
43 | .doOnSubscribe(new Action0() {
44 | @Override
45 | public void call() {
46 | bannerView.showProgress();
47 | }
48 | })
49 | .doOnUnsubscribe(new Action0() {
50 | @Override
51 | public void call() {
52 | bannerView.hideProgress();
53 | if (bannerAdapter.getCarouselList() != null) {
54 | if (bannerAdapter.getCarouselList().isEmpty()) {
55 | bannerView.loadFailView();
56 | System.out.println("banner-------doOnUnsubscribe");
57 | }
58 | }
59 | }
60 | })
61 | .subscribeOn(Schedulers.io())
62 | .observeOn(AndroidSchedulers.mainThread())
63 | .subscribe(new Action1>() {
64 | @Override
65 | public void call(List carouselList) {
66 | if (carouselList != null) {
67 | if (bannerAdapter != null) {
68 | bannerAdapter.setCarouselList(carouselList);
69 | bannerAdapter.notifyDataSetChanged();
70 | System.out.print("carouselList --- " + carouselList.size());
71 | }
72 | }
73 | }
74 | }, new Action1() {
75 | @Override
76 | public void call(Throwable throwable) {
77 | bannerView.loadFailView();
78 | System.out.println("throwable--------" + throwable.getMessage());
79 | }
80 | });
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/implement/ComicDetailDataImpl.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.implement;
2 |
3 | import javax.inject.Inject;
4 |
5 | import linhao.redridinghood.model.entity.Detail;
6 | import linhao.redridinghood.model.entity.Search;
7 | import linhao.redridinghood.model.service.ClientApiManager;
8 | import linhao.redridinghood.presenter.contract.ComicDetailData;
9 | import linhao.redridinghood.ui.activity.ComicDetailActivity;
10 | import linhao.redridinghood.ui.activity.MainActivity;
11 | import linhao.redridinghood.ui.adapter.DownLoadAdapter;
12 | import linhao.redridinghood.ui.fragment.DownLoadFragment;
13 | import linhao.redridinghood.ui.view.ActivityView;
14 | import rx.Observable;
15 | import rx.android.schedulers.AndroidSchedulers;
16 | import rx.functions.Action0;
17 | import rx.functions.Action1;
18 | import rx.functions.Func1;
19 | import rx.schedulers.Schedulers;
20 |
21 | /**
22 | * Created by linhao on 2016/9/15.
23 | */
24 | public class ComicDetailDataImpl implements ComicDetailData {
25 |
26 | @Inject
27 | ClientApiManager clientApiManager;
28 | @Inject
29 | ActivityView activityView;
30 |
31 | public ComicDetailActivity comicDetailActivity;
32 | public DownLoadFragment downLoadFragment;
33 |
34 |
35 | public ComicDetailDataImpl(){
36 | MainActivity.InstanceManager().inject(this);
37 | }
38 |
39 | public void setComicDetailActivity(ComicDetailActivity comicDetailActivity){
40 | this.comicDetailActivity=comicDetailActivity;
41 | }
42 |
43 | @Override
44 | public void getData(String url) {
45 | Observable detail = clientApiManager.getDetail(url);
46 | detail.subscribeOn(Schedulers.io())
47 | .observeOn(AndroidSchedulers.mainThread())
48 | .doOnSubscribe(new Action0() {
49 | @Override
50 | public void call() {
51 | activityView.showProgress();
52 | }
53 | }).doOnUnsubscribe(new Action0() {
54 | @Override
55 | public void call() {
56 | activityView.hideProgress();
57 | }
58 | }).observeOn(AndroidSchedulers.mainThread())
59 | .subscribe(new Action1() {
60 | @Override
61 | public void call(Detail detail) {
62 | comicDetailActivity.setContent(detail);
63 | }
64 | }, new Action1() {
65 | @Override
66 | public void call(Throwable throwable) {
67 | System.out.println("comicDetail---error"+throwable.getMessage());
68 | activityView.hideProgress();
69 | activityView.loadFailView();
70 | }
71 | });
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/implement/FragmentDataImpl.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.implement;
2 |
3 | import java.util.List;
4 |
5 | import javax.inject.Inject;
6 |
7 | import linhao.redridinghood.model.entity.AddRecommend;
8 | import linhao.redridinghood.model.service.ClientApiManager;
9 | import linhao.redridinghood.presenter.contract.FragmentData;
10 | import linhao.redridinghood.ui.activity.MainActivity;
11 | import linhao.redridinghood.ui.adapter.GridViewAdapter;
12 | import linhao.redridinghood.ui.view.ActivityView;
13 | import rx.Observable;
14 | import rx.android.schedulers.AndroidSchedulers;
15 | import rx.functions.Action0;
16 | import rx.functions.Action1;
17 | import rx.schedulers.Schedulers;
18 |
19 | /**
20 | * Created by linhao on 2016/8/25.
21 | */
22 | public class FragmentDataImpl implements FragmentData {
23 |
24 | @Inject
25 | ClientApiManager clientApiManager;
26 |
27 | @Inject
28 | ActivityView bannerView;
29 |
30 | @Inject
31 | GridViewAdapter gridViewAdapter;
32 |
33 | public FragmentDataImpl() {
34 | MainActivity.InstanceManager().inject(this);
35 | }
36 |
37 | @Override
38 | public void getFragmentData() {
39 | Observable> data = clientApiManager.getAddRecommend();
40 | data.subscribeOn(Schedulers.io())
41 | .doOnSubscribe(new Action0() {
42 | @Override
43 | public void call() {
44 | bannerView.showProgress();
45 | if (gridViewAdapter.getAddRecommendList() != null) {
46 | if (gridViewAdapter.getAddRecommendList().isEmpty()) {
47 | bannerView.loadFailView();
48 | System.out.println("doOnSubscribe");
49 | }
50 | }
51 | }
52 | }).doOnUnsubscribe(new Action0() {
53 | @Override
54 | public void call() {
55 | bannerView.hideProgress();
56 | }
57 | }).subscribeOn(Schedulers.io())
58 | .observeOn(AndroidSchedulers.mainThread())
59 | .subscribe(new Action1>() {
60 | @Override
61 | public void call(List addRecommends) {
62 | gridViewAdapter.setAddRecommendList(addRecommends);
63 | gridViewAdapter.notifyDataSetChanged();
64 | }
65 | }, new Action1() {
66 | @Override
67 | public void call(Throwable throwable) {
68 | bannerView.hideProgress();
69 | bannerView.loadFailView();
70 | System.out.println("throwable " + throwable.getMessage());
71 | }
72 | });
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/implement/HotNewDataImpl.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.implement;
2 |
3 | import java.util.List;
4 |
5 | import javax.inject.Inject;
6 |
7 | import linhao.redridinghood.model.entity.HotNewAnimate;
8 | import linhao.redridinghood.model.service.ClientApiManager;
9 | import linhao.redridinghood.presenter.contract.HotNewData;
10 | import linhao.redridinghood.ui.activity.MainActivity;
11 | import linhao.redridinghood.ui.adapter.GridViewAdapter;
12 | import linhao.redridinghood.ui.adapter.HotNewAdapter;
13 | import linhao.redridinghood.ui.view.ActivityView;
14 | import rx.Observable;
15 | import rx.android.schedulers.AndroidSchedulers;
16 | import rx.functions.Action0;
17 | import rx.functions.Action1;
18 | import rx.schedulers.Schedulers;
19 |
20 | /**
21 | * Created by linhao on 2016/9/10.
22 | */
23 | public class HotNewDataImpl implements HotNewData {
24 |
25 | @Inject
26 | ActivityView activityView;
27 | @Inject
28 | ClientApiManager clientApiManager;
29 | @Inject
30 | GridViewAdapter gridViewAdapter;
31 | @Inject
32 | HotNewAdapter hotNewAdapter;
33 |
34 | public HotNewDataImpl() {
35 | MainActivity.InstanceManager().inject(this);
36 | }
37 |
38 | @Override
39 | public void loadData() {
40 | Observable> hotNewAnimate = clientApiManager.getHotNewAnimate();
41 | hotNewAnimate.subscribeOn(Schedulers.io())
42 | .observeOn(AndroidSchedulers.mainThread())
43 | .doOnSubscribe(new Action0() {
44 | @Override
45 | public void call() {
46 | activityView.showProgress();
47 | }
48 | }).doOnUnsubscribe(new Action0() {
49 | @Override
50 | public void call() {
51 | activityView.hideProgress();
52 | if (hotNewAdapter != null) {
53 | if (hotNewAdapter.getHotNewAnimateList().isEmpty()) {
54 | activityView.loadFailView();
55 | }
56 | }
57 | }
58 | }).observeOn(AndroidSchedulers.mainThread())
59 | .subscribe(new Action1>() {
60 | @Override
61 | public void call(List hotNewAnimates) {
62 | if (hotNewAnimates != null) {
63 | hotNewAdapter.setHotNewAnimateList(hotNewAnimates);
64 | hotNewAdapter.setType(hotNewAdapter.getYear_Fragment_Flag(),hotNewAdapter.getMonth_Fragment_Flag());
65 | hotNewAdapter.notifyDataSetChanged();
66 | }
67 | }
68 | }, new Action1() {
69 | @Override
70 | public void call(Throwable throwable) {
71 | System.out.println("hot_new_data" + throwable.getMessage());
72 | activityView.hideProgress();
73 | activityView.loadFailView();
74 | }
75 | });
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/implement/RankingDataImpl.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.implement;
2 |
3 | import java.util.List;
4 |
5 | import javax.inject.Inject;
6 |
7 | import linhao.redridinghood.model.entity.Ranking;
8 | import linhao.redridinghood.model.service.ClientApiManager;
9 | import linhao.redridinghood.presenter.contract.RankingData;
10 | import linhao.redridinghood.ui.activity.MainActivity;
11 | import linhao.redridinghood.ui.adapter.RankingAdapter;
12 | import linhao.redridinghood.ui.view.ActivityView;
13 | import rx.Observable;
14 | import rx.android.schedulers.AndroidSchedulers;
15 | import rx.functions.Action0;
16 | import rx.functions.Action1;
17 | import rx.schedulers.Schedulers;
18 |
19 | /**
20 | * Created by linhao on 2016/9/2.
21 | */
22 | public class RankingDataImpl implements RankingData {
23 |
24 | @Inject
25 | ClientApiManager clientApiManager;
26 | @Inject
27 | ActivityView activityView;
28 | @Inject
29 | RankingAdapter rankingAdapter;
30 |
31 | public RankingDataImpl(){
32 | MainActivity.InstanceManager().inject(this);
33 | }
34 | @Override
35 | public void getData() {
36 | final Observable> ranking = clientApiManager.getRanking();
37 | ranking.subscribeOn(Schedulers.io())
38 | .observeOn(AndroidSchedulers.mainThread())
39 | .doOnSubscribe(new Action0() {
40 | @Override
41 | public void call() {
42 | activityView.showProgress();
43 | }
44 | }).doOnUnsubscribe(new Action0() {
45 | @Override
46 | public void call() {
47 | if (rankingAdapter.getRankingList()!=null){
48 | if (rankingAdapter.getRankingList().isEmpty()){
49 | activityView.loadFailView();
50 | }
51 | }
52 | activityView.hideProgress();
53 | }
54 | }).subscribe(new Action1>() {
55 | @Override
56 | public void call(List rankings) {
57 | if (rankingAdapter !=null) {
58 | rankingAdapter.setRankingList(rankings);
59 | rankingAdapter.notifyDataSetChanged();
60 | }
61 | }
62 | }, new Action1() {
63 | @Override
64 | public void call(Throwable throwable) {
65 | System.out.println("ranking-error--"+throwable.getMessage());
66 | activityView.hideProgress();
67 | activityView.loadFailView();
68 | }
69 | });
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/implement/RecentUpdateDataImpl.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.implement;
2 |
3 | import java.util.List;
4 |
5 | import javax.inject.Inject;
6 |
7 | import linhao.redridinghood.model.entity.RecentUpdate;
8 | import linhao.redridinghood.model.service.ClientApiManager;
9 | import linhao.redridinghood.presenter.contract.RecentUpdateData;
10 | import linhao.redridinghood.ui.activity.MainActivity;
11 | import linhao.redridinghood.ui.adapter.RecentUpdateAdapter;
12 | import linhao.redridinghood.ui.view.ActivityView;
13 | import rx.Observable;
14 | import rx.Scheduler;
15 | import rx.android.schedulers.AndroidSchedulers;
16 | import rx.functions.Action0;
17 | import rx.functions.Action1;
18 | import rx.schedulers.Schedulers;
19 |
20 | /**
21 | * Created by linhao on 2016/9/1.
22 | */
23 | public class RecentUpdateDataImpl implements RecentUpdateData {
24 |
25 | @Inject
26 | ClientApiManager clientApiManager;
27 |
28 | @Inject
29 | ActivityView bannerView;
30 |
31 | @Inject
32 | RecentUpdateAdapter recentUpdateAdapter;
33 |
34 | public RecentUpdateDataImpl() {
35 | MainActivity.InstanceManager().inject(this);
36 | }
37 |
38 | @Override
39 | public void getRecentUpdateData() {
40 | Observable> recentUpdate = clientApiManager.getRecentUpdate();
41 | recentUpdate.subscribeOn(Schedulers.io())
42 | .observeOn(AndroidSchedulers.mainThread())
43 | .doOnSubscribe(new Action0() {
44 | @Override
45 | public void call() {
46 | bannerView.showProgress();
47 | }
48 | }).doOnUnsubscribe(new Action0() {
49 | @Override
50 | public void call() {
51 | bannerView.hideProgress();
52 | if (recentUpdateAdapter.getRecentUpdateList() != null) {
53 | if (recentUpdateAdapter.getRecentUpdateList().isEmpty()) {
54 | bannerView.loadFailView();
55 | }
56 | }
57 | }
58 | }).subscribeOn(AndroidSchedulers.mainThread())
59 | .subscribe(new Action1>() {
60 | @Override
61 | public void call(List recentUpdates) {
62 | if (recentUpdateAdapter != null) {
63 | // recentUpdateAdapter.getRecentUpdateList().clear();
64 | recentUpdateAdapter.setRecentUpdateList(recentUpdates);
65 | // recentUpdateAdapter.getRecentUpdateList().addAll(recentUpdates);
66 | recentUpdateAdapter.notifyDataSetChanged();
67 | }
68 | }
69 | }, new Action1() {
70 | @Override
71 | public void call(Throwable throwable) {
72 | bannerView.hideProgress();
73 | bannerView.loadFailView();
74 | }
75 | });
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/presenter/implement/TopicDataImpl.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.presenter.implement;
2 |
3 | import java.util.List;
4 |
5 | import javax.inject.Inject;
6 |
7 | import linhao.redridinghood.model.entity.Topics;
8 | import linhao.redridinghood.model.service.ClientApiManager;
9 | import linhao.redridinghood.presenter.contract.TopicData;
10 | import linhao.redridinghood.ui.activity.MainActivity;
11 | import linhao.redridinghood.ui.adapter.TopicAdapter;
12 | import linhao.redridinghood.ui.view.ActivityView;
13 | import rx.Observable;
14 | import rx.android.schedulers.AndroidSchedulers;
15 | import rx.functions.Action0;
16 | import rx.functions.Action1;
17 | import rx.schedulers.Schedulers;
18 |
19 | /**
20 | * Created by linhao on 2016/9/15.
21 | */
22 | public class TopicDataImpl implements TopicData {
23 |
24 | @Inject
25 | ClientApiManager clientApiManager;
26 | @Inject
27 | ActivityView activityView;
28 | @Inject
29 | TopicAdapter topicAdapter;
30 |
31 | public TopicDataImpl(){
32 | MainActivity.InstanceManager().inject(this);
33 | }
34 | @Override
35 | public void getData() {
36 | Observable> topics = clientApiManager.getTopics();
37 | topics.subscribeOn(Schedulers.io())
38 | .observeOn(AndroidSchedulers.mainThread())
39 | .doOnSubscribe(new Action0() {
40 | @Override
41 | public void call() {
42 | activityView.showProgress();
43 | }
44 | }).doOnUnsubscribe(new Action0() {
45 | @Override
46 | public void call() {
47 | activityView.hideProgress();
48 | if (topicAdapter.getList()!=null){
49 | if (topicAdapter.getList().isEmpty()){
50 | activityView.loadFailView();
51 | }
52 | }
53 | }
54 | }).subscribeOn(AndroidSchedulers.mainThread())
55 | .subscribe(new Action1>() {
56 | @Override
57 | public void call(List topicses) {
58 | System.out.println("title------"+topicses.get(0).getTitle());
59 | topicAdapter.settList(topicses);
60 | topicAdapter.notifyDataSetChanged();
61 | }
62 | }, new Action1() {
63 | @Override
64 | public void call(Throwable throwable) {
65 | System.out.println("topic---error"+throwable.getMessage());
66 | activityView.hideProgress();
67 | activityView.loadFailView();
68 | }
69 | });
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/activity/BaseActivty.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v7.app.AppCompatActivity;
6 |
7 | import butterknife.ButterKnife;
8 |
9 | /**
10 | * Created by linhao on 2016/8/13.
11 | */
12 | public abstract class BaseActivty extends AppCompatActivity {
13 |
14 | protected abstract int getLayoutId();
15 |
16 | @Override
17 | protected void onCreate(@Nullable Bundle savedInstanceState) {
18 | super.onCreate(savedInstanceState);
19 | setContentView(getLayoutId());
20 | ButterKnife.bind(this);
21 | afterCreate(savedInstanceState);
22 | }
23 |
24 | protected abstract void afterCreate(Bundle bundle);
25 |
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/activity/DownLoadActivity.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.activity;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.webkit.WebChromeClient;
6 | import android.webkit.WebView;
7 |
8 | import com.squareup.leakcanary.RefWatcher;
9 | import com.umeng.analytics.MobclickAgent;
10 |
11 | import butterknife.BindView;
12 | import linhao.redridinghood.R;
13 | import linhao.redridinghood.application.MyApplication;
14 |
15 | /**
16 | * Created by linhao on 2016/9/18.
17 | */
18 | public class DownLoadActivity extends BaseActivty {
19 |
20 | @BindView(R.id.webview)
21 | WebView webView;
22 | private String url;
23 |
24 | @Override
25 | protected int getLayoutId() {
26 | return R.layout.webview;
27 | }
28 |
29 | @Override
30 | protected void afterCreate(Bundle bundle) {
31 | url = getIntent().getStringExtra("url");
32 | webView.setWebChromeClient(new WebChromeClient());
33 | webView.getSettings().setJavaScriptEnabled(true);
34 | webView.getSettings().setDisplayZoomControls(true);
35 | webView.getSettings().setLoadsImagesAutomatically(true);
36 | webView.loadUrl(url);
37 | }
38 |
39 | @Override
40 | protected void onPause() {
41 | super.onPause();
42 | MobclickAgent.onPause(this);
43 | }
44 |
45 | @Override
46 | protected void onResume() {
47 | super.onResume();
48 | MobclickAgent.onResume(this);
49 | }
50 |
51 | @Override
52 | protected void onCreate(@Nullable Bundle savedInstanceState) {
53 | super.onCreate(savedInstanceState);
54 | RefWatcher refWatcher = MyApplication.getRefWatcher(this);
55 | refWatcher.watch(this);
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/activity/WelcomeActivity.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.activity;
2 |
3 | import android.content.Intent;
4 | import android.graphics.Color;
5 | import android.net.Uri;
6 | import android.os.Bundle;
7 | import android.os.Handler;
8 | import android.support.annotation.Nullable;
9 | import android.support.v4.widget.SwipeRefreshLayout;
10 | import android.support.v7.app.AppCompatActivity;
11 | import android.util.DisplayMetrics;
12 | import android.view.View;
13 | import android.view.ViewTreeObserver;
14 |
15 | import com.google.android.gms.appindexing.Action;
16 | import com.google.android.gms.appindexing.AppIndex;
17 | import com.google.android.gms.common.api.GoogleApiClient;
18 | import com.squareup.leakcanary.RefWatcher;
19 | import com.umeng.analytics.MobclickAgent;
20 |
21 | import java.lang.reflect.Field;
22 |
23 | import butterknife.BindView;
24 | import butterknife.ButterKnife;
25 | import linhao.redridinghood.R;
26 | import linhao.redridinghood.application.MyApplication;
27 | import linhao.redridinghood.model.entity.News;
28 |
29 | /**
30 | * Created by linhao on 2016/8/13.
31 | */
32 | public class WelcomeActivity extends BaseActivty{
33 |
34 | @BindView(R.id.weclome_refresh)
35 | SwipeRefreshLayout welcomeRefersh;
36 |
37 | @Override
38 | protected int getLayoutId() {
39 | return R.layout.welcome;
40 | }
41 |
42 | @Override
43 | protected void afterCreate(Bundle bundle) {
44 |
45 | new Handler().postDelayed(new Runnable() {
46 | @Override
47 | public void run() {
48 | Intent intent=new Intent(WelcomeActivity.this,MainActivity.class);
49 | startActivity(intent);
50 | finish();
51 | }
52 | },2000);
53 | }
54 |
55 |
56 | @Override
57 | protected void onPause() {
58 | super.onPause();
59 | MobclickAgent.onPause(this);
60 | }
61 |
62 | @Override
63 | protected void onResume() {
64 | super.onResume();
65 | MobclickAgent.onResume(this);
66 | }
67 |
68 | @Override
69 | protected void onCreate(@Nullable Bundle savedInstanceState) {
70 | super.onCreate(savedInstanceState);
71 | RefWatcher refWatcher = MyApplication.getRefWatcher(this);
72 | refWatcher.watch(this);
73 | }
74 |
75 | }
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/adapter/BannerAdapter.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.adapter;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.support.v4.view.PagerAdapter;
6 | import android.support.v4.view.ViewPager;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.ImageView;
11 |
12 | import java.util.List;
13 |
14 | import linhao.redridinghood.R;
15 | import linhao.redridinghood.model.entity.Carousel;
16 | import linhao.redridinghood.util.GlideUtil;
17 |
18 | /**
19 | * Created by linhao on 2016/8/13.
20 | */
21 | public class BannerAdapter extends PagerAdapter{
22 |
23 | private Context context;
24 | private ListcarouselList;
25 | private ViewPager viewPager;
26 | private final int FAKE_BANNER_SIZE = 100;
27 | private final int DEFAULT_BANNER_SIZE = 4;
28 |
29 | public BannerAdapter(Context context, ViewPager viewPager){
30 | this.context=context;
31 | this.viewPager=viewPager;
32 | }
33 |
34 | public BannerAdapter(Context context){
35 | this.context=context;
36 | }
37 |
38 | public void setCarouselList(List carouselList1){
39 | this.carouselList=carouselList1;
40 | }
41 |
42 | public List getCarouselList(){
43 | return carouselList;
44 | }
45 |
46 | @Override
47 | public int getCount() {
48 | return carouselList==null ? 0:carouselList.size();
49 | }
50 |
51 | @Override
52 | public boolean isViewFromObject(View view, Object object) {
53 | return view==object;
54 | }
55 |
56 | @Override
57 | public Object instantiateItem(ViewGroup container, final int position) {
58 | View view= LayoutInflater.from(context).inflate(R.layout.banner_item,container,false);
59 | ImageView imageView= (ImageView) view.findViewById(R.id.banner_img);
60 | GlideUtil.LoadImg(context,imageView,carouselList.get(position).getImgUrl());
61 | imageView.setOnClickListener(new View.OnClickListener() {
62 | @Override
63 | public void onClick(View view) {
64 | String url=carouselList.get(position).getDetailUrl();
65 | }
66 | });
67 | container.addView(view);
68 | return view;
69 | }
70 |
71 | @Override
72 | public void destroyItem(ViewGroup container, int position, Object object) {
73 | container.removeView((View) object);
74 | }
75 |
76 | @Override
77 | public void finishUpdate(ViewGroup container) {
78 | int position = viewPager.getCurrentItem();
79 | if (position == 0){
80 | // position = DEFAULT_BANNER_SIZE;
81 | viewPager.setCurrentItem(position,false);
82 | }else if (position == FAKE_BANNER_SIZE - 1){
83 | position = DEFAULT_BANNER_SIZE - 1;
84 | viewPager.setCurrentItem(position,false);
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/adapter/CommentAdapter.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | import java.util.List;
10 |
11 | /**
12 | * Created by linhao on 2016/9/3.
13 | */
14 | public abstract class CommentAdapter extends RecyclerView.Adapter {
15 |
16 |
17 | private List tList;
18 | private Context context;
19 | private LayoutInflater inflater;
20 |
21 | public CommentAdapter(Context context) {
22 | this.context = context;
23 | inflater = LayoutInflater.from(context);
24 | }
25 |
26 | public void settList(List tList) {
27 | this.tList = tList;
28 | }
29 |
30 | public List getList() {
31 | return tList;
32 | }
33 |
34 | public abstract int getLayoutId();
35 |
36 | @Override
37 | public void onBindViewHolder(CommentViewHolder holder, int position) {
38 | if (position + 1 == getItemCount()) {
39 | convert(holder, null, position);
40 | } else {
41 | convert(holder, tList.get(position), position);
42 | }
43 | }
44 |
45 | @Override
46 | public CommentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
47 | View view = inflater.inflate(getLayoutId(), parent, false);
48 | return new CommentViewHolder(view, context);
49 | }
50 |
51 | @Override
52 | public int getItemCount() {
53 | return tList == null ? 0 : tList.size();
54 | }
55 |
56 |
57 | public abstract void convert(CommentViewHolder viewHolder, T t, int position);
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/adapter/CommentViewHolder.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.adapter;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.support.v7.widget.RecyclerView;
6 | import android.util.SparseArray;
7 | import android.view.View;
8 | import android.widget.ImageView;
9 | import android.widget.TextView;
10 |
11 | import linhao.redridinghood.util.GlideUtil;
12 |
13 | /**
14 | * Created by linhao on 2016/9/3.
15 | */
16 | public class CommentViewHolder extends RecyclerView.ViewHolder {
17 |
18 | private SparseArray views;
19 | private View convertView;
20 | private Context context;
21 |
22 | public CommentViewHolder(View itemView,Context context) {
23 | super(itemView);
24 | this.convertView = itemView;
25 | views = new SparseArray<>();
26 | this.context =context;
27 | }
28 |
29 | protected T getView(int viewId) {
30 | View view = views.get(viewId);
31 | if (view == null) {
32 | view = convertView.findViewById(viewId);
33 | views.put(viewId, view);
34 | }
35 | return (T) view;
36 | }
37 |
38 | protected void setTextView(int viewId, String content) {
39 | TextView textView = (TextView)getView(viewId);
40 | textView.setText(content);
41 | }
42 |
43 | protected void setImageView(int viewId, String imgUrl) {
44 | ImageView imageView = (ImageView)getView(viewId);
45 | GlideUtil.LoadImg(context,imageView,imgUrl);
46 | }
47 |
48 | protected void setImageView(int viewId, Bitmap bitmap){
49 | ImageView imageView=(ImageView)getView(viewId);
50 | imageView.setImageBitmap(bitmap);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/adapter/NewsAdapter.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.TextView;
8 |
9 | import com.pnikosis.materialishprogress.ProgressWheel;
10 |
11 | import java.util.List;
12 |
13 | import linhao.redridinghood.R;
14 | import linhao.redridinghood.model.entity.News;
15 | import linhao.redridinghood.ui.listener.PageLoadMoreListener;
16 |
17 | /**
18 | * Created by linhao on 2016/9/3.
19 | */
20 | public class NewsAdapter extends CommentAdapter {
21 |
22 |
23 | private List newses;
24 | private static final int TYPE_ITEM = 0;
25 | private static final int TYPE_FOOTER = 1;
26 | private boolean IS_TYPE_FOOTER;
27 | private Context context;
28 | private PageLoadMoreListener loadMoreListener;
29 | public NewsAdapter(Context context) {
30 | super(context);
31 | this.context = context;
32 | }
33 |
34 | public void setLoadMoreListener(PageLoadMoreListener pageLoadMoreListener){
35 | this.loadMoreListener=pageLoadMoreListener;
36 | }
37 |
38 | @Override
39 | public void settList(List newses) {
40 | super.settList(newses);
41 | this.newses = newses;
42 | }
43 |
44 | @Override
45 | public List getList() {
46 | return newses;
47 | }
48 |
49 | @Override
50 | public int getLayoutId() {
51 | if (IS_TYPE_FOOTER) {
52 | return R.layout.footer_load_more;
53 | } else {
54 | return R.layout.news_item;
55 | }
56 | }
57 |
58 | @Override
59 | public void convert(final CommentViewHolder viewHolder, News.NewList newList, int position) {
60 | if (IS_TYPE_FOOTER) {
61 | final TextView load_more=(TextView)viewHolder.getView(R.id.load_text);
62 | load_more.setOnClickListener(new View.OnClickListener() {
63 | @Override
64 | public void onClick(View v) {
65 | ProgressWheel progressWheel=(ProgressWheel)viewHolder.getView(R.id.icon_loading);
66 | progressWheel.setVisibility(View.VISIBLE);
67 | loadMoreListener.loadMore(load_more,progressWheel);
68 | }
69 | });
70 | } else {
71 | viewHolder.setTextView(R.id.new_title, newList.getTitle());
72 | viewHolder.setTextView(R.id.new_content, newList.getDescription());
73 | viewHolder.setTextView(R.id.new_time, newList.getTime());
74 | viewHolder.setImageView(R.id.new_img, newList.getImg());
75 | }
76 | }
77 |
78 |
79 | @Override
80 | public int getItemViewType(int position) {
81 | if (position + 1 == getItemCount()) {
82 | IS_TYPE_FOOTER = true;
83 | return TYPE_FOOTER;
84 | } else {
85 | IS_TYPE_FOOTER = false;
86 | return TYPE_ITEM;
87 | }
88 | }
89 |
90 | @Override
91 | public int getItemCount() {
92 | return newses == null ? 0 : newses.size() + 1;
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/adapter/RecentUpdateAdapter.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.adapter;
2 |
3 | import android.content.Context;
4 | import android.support.v7.widget.RecyclerView;
5 | import android.view.LayoutInflater;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 | import android.widget.TextView;
9 |
10 | import java.util.List;
11 |
12 | import butterknife.BindView;
13 | import butterknife.ButterKnife;
14 | import linhao.redridinghood.R;
15 | import linhao.redridinghood.model.entity.RecentUpdate;
16 | import linhao.redridinghood.ui.listener.ItemOnClick;
17 |
18 | /**
19 | * Created by linhao on 2016/9/1.
20 | */
21 | public class RecentUpdateAdapter extends RecyclerView.Adapter {
22 |
23 | private Context context;
24 | private List recentUpdateList;
25 | private ItemOnClick itemOnClick;
26 |
27 | public RecentUpdateAdapter(Context context) {
28 | this.context = context;
29 | }
30 |
31 | public void setRecentUpdateList(List recentUpdateList) {
32 | this.recentUpdateList = recentUpdateList;
33 | }
34 |
35 | public void setItemOnClick(ItemOnClick itemOnClick){
36 | this.itemOnClick=itemOnClick;
37 | }
38 |
39 | public List getRecentUpdateList() {
40 | return recentUpdateList;
41 | }
42 |
43 | @Override
44 | public RecentUpdateViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
45 | View view = LayoutInflater.from(context).inflate(R.layout.recent_update_item, parent, false);
46 | view.setOnClickListener(new View.OnClickListener() {
47 | @Override
48 | public void onClick(View v) {
49 | itemOnClick.onClick(v,(String)v.getTag());
50 | }
51 | });
52 | return new RecentUpdateViewHolder(view);
53 | }
54 |
55 | @Override
56 | public void onBindViewHolder(RecentUpdateViewHolder holder, int position) {
57 | holder.update(recentUpdateList.get(position));
58 | }
59 |
60 | @Override
61 | public int getItemCount() {
62 | return recentUpdateList == null ? 0 : recentUpdateList.size();
63 | }
64 |
65 |
66 | public class RecentUpdateViewHolder extends RecyclerView.ViewHolder {
67 | @BindView(R.id.num)
68 | TextView num;
69 | @BindView(R.id.content_type)
70 | TextView contentType;
71 | @BindView(R.id.content_title)
72 | TextView contentTitle;
73 | @BindView(R.id.content_time)
74 | TextView contentTime;
75 |
76 | public RecentUpdateViewHolder(View itemView) {
77 | super(itemView);
78 | ButterKnife.bind(this, itemView);
79 | }
80 |
81 | public void update(RecentUpdate recentUpdate){
82 | num.setText(recentUpdate.getSort());
83 | contentType.setText(recentUpdate.getType());
84 | contentTitle.setText(recentUpdate.getName());
85 | contentTime.setText(recentUpdate.getTime());
86 | this.itemView.setTag(recentUpdate.getUrl());
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/adapter/RecommandAdapter.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 |
6 | import linhao.redridinghood.R;
7 | import linhao.redridinghood.model.entity.Detail;
8 | import linhao.redridinghood.ui.listener.ItemOnClick;
9 |
10 | /**
11 | * Created by linhao on 2016/9/16.
12 | */
13 | public class RecommandAdapter extends CommentAdapter {
14 |
15 | private ItemOnClick itemOnClick;
16 | public RecommandAdapter(Context context) {
17 | super(context);
18 | }
19 |
20 | public void setItemOnClick(ItemOnClick itemOnClick){
21 | this.itemOnClick=itemOnClick;
22 | }
23 |
24 | @Override
25 | public int getLayoutId() {
26 | return R.layout.recommandand;
27 | }
28 |
29 | @Override
30 | public void convert(CommentViewHolder viewHolder, Detail.EditRecommend editRecommend, int position) {
31 | if (editRecommend != null) {
32 | viewHolder.setTextView(R.id.recommand_sort, editRecommend.getSort());
33 | viewHolder.setTextView(R.id.recommand_content, editRecommend.getName());
34 | viewHolder.itemView.setTag(editRecommend.getUrl());
35 | viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
36 | @Override
37 | public void onClick(View v) {
38 | itemOnClick.onClick(v,(String)v.getTag());
39 | }
40 | });
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/adapter/SearchAdapter.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.View;
5 | import android.widget.TextView;
6 |
7 | import com.pnikosis.materialishprogress.ProgressWheel;
8 |
9 | import java.util.List;
10 |
11 | import linhao.redridinghood.R;
12 | import linhao.redridinghood.model.entity.Search;
13 | import linhao.redridinghood.ui.listener.ItemOnClick;
14 | import linhao.redridinghood.ui.listener.PageLoadMoreListener;
15 | import linhao.redridinghood.ui.view.LoadMoreView;
16 |
17 | /**
18 | * Created by linhao on 2016/9/18.
19 | */
20 | public class SearchAdapter extends CommentAdapter {
21 |
22 | private boolean IS_TYPE_FOOTER;
23 | private PageLoadMoreListener loadMoreListener;
24 | private static final int TYPE_ITEM = 0;
25 | private static final int TYPE_FOOTER = 1;
26 | private List listItems;
27 | private ItemOnClick itemOnClick;
28 |
29 | public SearchAdapter(Context context) {
30 | super(context);
31 | }
32 |
33 | public void setItemOnClick(ItemOnClick itemOnClick){
34 | this.itemOnClick=itemOnClick;
35 | }
36 |
37 | public void setLoadMoreListener(PageLoadMoreListener pageLoadMoreListener){
38 | this.loadMoreListener=pageLoadMoreListener;
39 | }
40 |
41 | @Override
42 | public void settList(List listItems) {
43 | super.settList(listItems);
44 | this.listItems=listItems;
45 | }
46 |
47 | @Override
48 | public int getLayoutId() {
49 | if (IS_TYPE_FOOTER) {
50 | return R.layout.footer_load_more;
51 | } else {
52 | return R.layout.comic_list_item;
53 | }
54 | }
55 |
56 | @Override
57 | public void convert(final CommentViewHolder viewHolder, final Search.ListItem listItem, int position) {
58 | if (IS_TYPE_FOOTER) {
59 | final TextView load_more=(TextView)viewHolder.getView(R.id.load_text);
60 | load_more.setOnClickListener(new View.OnClickListener() {
61 | @Override
62 | public void onClick(View v) {
63 | ProgressWheel progressWheel=(ProgressWheel)viewHolder.getView(R.id.icon_loading);
64 | loadMoreListener.loadMore(load_more,progressWheel);
65 | }
66 | });
67 | } else {
68 | viewHolder.setTextView(R.id.comic_title, listItem.getName());
69 | viewHolder.setTextView(R.id.episode, listItem.getType());
70 | viewHolder.setTextView(R.id.updateTime, listItem.getLastest());
71 | viewHolder.setTextView(R.id.downloadCount, listItem.getDownload());
72 | viewHolder.setImageView(R.id.comic_img, listItem.getImg());
73 | viewHolder.itemView.setTag(listItem.getUrl());
74 | viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
75 | @Override
76 | public void onClick(View v) {
77 | itemOnClick.onClick(v,(String)v.getTag());
78 | }
79 | });
80 | }
81 | }
82 |
83 | @Override
84 | public int getItemCount() {
85 | return listItems == null ? 0 : listItems.size() + 1;
86 | }
87 |
88 | @Override
89 | public int getItemViewType(int position) {
90 | if (position + 1 == getItemCount()) {
91 | IS_TYPE_FOOTER = true;
92 | return TYPE_FOOTER;
93 | } else {
94 | IS_TYPE_FOOTER = false;
95 | return TYPE_ITEM;
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/adapter/TabFragmentPageAdapter.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.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.view.ViewGroup;
7 |
8 | import java.lang.reflect.Array;
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | import linhao.redridinghood.ui.fragment.WeekUpdateFragment;
13 | import linhao.redridinghood.util.ConstantUtil;
14 |
15 | /**
16 | * Created by linhao on 2016/8/14.
17 | */
18 | public class TabFragmentPageAdapter extends FragmentPagerAdapter {
19 |
20 | private ArrayList fragmentArrayList;
21 | private List titleList;
22 | private int Fragment_Flag;
23 | private FragmentManager fm;
24 |
25 | public void setFragment_Flag(int Fragment_Flag) {
26 | this.Fragment_Flag = Fragment_Flag;
27 | }
28 |
29 | public TabFragmentPageAdapter(FragmentManager fm) {
30 | super(fm);
31 | }
32 |
33 | public TabFragmentPageAdapter(FragmentManager fm, ArrayList fragmentArrayList, List titleList) {
34 | super(fm);
35 | this.fm = fm;
36 | this.fragmentArrayList = fragmentArrayList;
37 | this.titleList = titleList;
38 | }
39 |
40 | @Override
41 | public Fragment getItem(int position) {
42 |
43 | return fragmentArrayList == null ? null : fragmentArrayList.get(position);
44 | }
45 |
46 |
47 | @Override
48 | public int getCount() {
49 | return fragmentArrayList == null ? 0 : fragmentArrayList.size();
50 | }
51 |
52 | @Override
53 | public CharSequence getPageTitle(int position) {
54 | if (titleList != null) {
55 | String title = titleList.get(position);
56 | return title;
57 | }
58 | return null;
59 | }
60 |
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/adapter/TopicAdapter.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.adapter;
2 |
3 | import android.content.Context;
4 | import android.view.LayoutInflater;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.ImageView;
8 | import android.widget.TextView;
9 |
10 | import linhao.redridinghood.R;
11 | import linhao.redridinghood.model.entity.Topics;
12 | import linhao.redridinghood.ui.listener.ItemOnClick;
13 | import linhao.redridinghood.util.GlideUtil;
14 |
15 | /**
16 | * Created by linhao on 2016/9/15.
17 | */
18 | public class TopicAdapter extends CommentAdapter{
19 |
20 | private Context context;
21 | private LayoutInflater inflater;
22 | private ItemOnClick itemOnClick;
23 |
24 | public TopicAdapter(Context context) {
25 | super(context);
26 | this.context=context;
27 | inflater=LayoutInflater.from(context);
28 | }
29 |
30 | public void setItemOnClick(ItemOnClick itemOnClick){
31 | this.itemOnClick=itemOnClick;
32 | }
33 |
34 | @Override
35 | public int getLayoutId() {
36 | return R.layout.topic_item;
37 | }
38 |
39 | @Override
40 | public void convert(CommentViewHolder viewHolder, Topics topics, int position) {
41 | ImageView img=viewHolder.getView(R.id.topic_img);
42 | TextView title=viewHolder.getView(R.id.topic_title);
43 | GlideUtil.LoadImg(context,img,topics.getImg());
44 | title.setText(topics.getTitle());
45 | viewHolder.itemView.setTag(topics.getUrl());
46 | }
47 |
48 | @Override
49 | public CommentViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
50 | View view = inflater.inflate(getLayoutId(), parent, false);
51 | view.setOnClickListener(new View.OnClickListener() {
52 | @Override
53 | public void onClick(View v) {
54 | itemOnClick.onClick(v,(String) v.getTag());
55 | }
56 | });
57 | return new CommentViewHolder(view, context);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/fragment/AddSerialFragment.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.fragment;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.GridLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.View;
8 |
9 | import com.squareup.leakcanary.RefWatcher;
10 | import com.umeng.analytics.MobclickAgent;
11 |
12 | import java.util.List;
13 |
14 | import javax.inject.Inject;
15 |
16 | import butterknife.BindView;
17 | import linhao.redridinghood.R;
18 | import linhao.redridinghood.application.MyApplication;
19 | import linhao.redridinghood.model.entity.AddRecommend;
20 | import linhao.redridinghood.ui.activity.MainActivity;
21 | import linhao.redridinghood.ui.adapter.GridViewAdapter;
22 | import linhao.redridinghood.util.ConstantUtil;
23 |
24 | /**
25 | * Created by linhao on 2016/8/14.
26 | */
27 | public class AddSerialFragment extends BaseFragment {
28 |
29 | @Inject
30 | GridViewAdapter gridViewAdapter;
31 | private static Context context;
32 | @BindView(R.id.recycle_content)
33 | RecyclerView recycleContent;
34 |
35 | public static AddSerialFragment Instance(Context context1, Bundle bundle) {
36 | context = context1;
37 | AddSerialFragment addSerialFragment = new AddSerialFragment();
38 | addSerialFragment.setArguments(bundle);
39 | return addSerialFragment;
40 | }
41 |
42 | public void setAddSerialFragment(List recommendList) {
43 | gridViewAdapter.getAddRecommendList().clear();
44 | gridViewAdapter.getAddRecommendList().addAll(recommendList);
45 | gridViewAdapter.setAddRecommendList(recommendList);
46 | gridViewAdapter.notifyDataSetChanged();
47 | }
48 |
49 | @Override
50 | public int getLayoutId() {
51 | return R.layout.fragment_content;
52 | }
53 |
54 | @Override
55 | public void afterCreateView(View view) {
56 | MainActivity.InstanceManager().inject(this);
57 | gridViewAdapter.setFragment_flag(ConstantUtil.AddSerialFragment_Flag);
58 | GridLayoutManager layoutManager = new GridLayoutManager(context, 2);
59 | recycleContent.setLayoutManager(layoutManager);
60 | recycleContent.setAdapter(gridViewAdapter);
61 | }
62 |
63 | @Override
64 | public void setUserVisibleHint(boolean isVisibleToUser) {
65 | super.setUserVisibleHint(isVisibleToUser);
66 | }
67 |
68 | @Override
69 | public void onResume() {
70 | super.onResume();
71 | MobclickAgent.onPageStart("AddSerialFragment");
72 | }
73 |
74 | @Override
75 | public void onPause() {
76 | super.onPause();
77 | MobclickAgent.onPageEnd("AddSerialFragment");
78 | }
79 |
80 | @Override
81 | public void onDestroy() {
82 | super.onDestroy();
83 | RefWatcher refWatcher = MyApplication.getRefWatcher(getActivity());
84 | refWatcher.watch(this);
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/fragment/BaseFragment.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.fragment;
2 |
3 | import android.os.Bundle;
4 | import android.support.annotation.Nullable;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 |
10 | import butterknife.BindView;
11 | import butterknife.ButterKnife;
12 |
13 | /**
14 | * Created by linhao on 2016/8/14.
15 | */
16 | public abstract class BaseFragment extends Fragment {
17 |
18 | @Nullable
19 | @Override
20 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
21 | View view = inflater.inflate(getLayoutId(), container, false);
22 | return view;
23 | }
24 |
25 | @Override
26 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
27 | super.onViewCreated(view, savedInstanceState);
28 | ButterKnife.bind(this,view);
29 | afterCreateView(view);
30 | }
31 |
32 | public abstract int getLayoutId();
33 |
34 | public abstract void afterCreateView(View view);
35 | }
36 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/fragment/DownLoadFragment.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.fragment;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.support.v7.widget.StaggeredGridLayoutManager;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 |
12 | import com.squareup.leakcanary.RefWatcher;
13 | import com.umeng.analytics.MobclickAgent;
14 |
15 | import java.util.ArrayList;
16 | import java.util.List;
17 |
18 | import javax.inject.Inject;
19 |
20 | import butterknife.BindView;
21 | import butterknife.ButterKnife;
22 | import linhao.redridinghood.R;
23 | import linhao.redridinghood.application.MyApplication;
24 | import linhao.redridinghood.model.entity.Detail;
25 | import linhao.redridinghood.ui.activity.DownLoadActivity;
26 | import linhao.redridinghood.ui.activity.MainActivity;
27 | import linhao.redridinghood.ui.adapter.DownLoadAdapter;
28 | import linhao.redridinghood.ui.listener.ItemOnClick;
29 | import linhao.redridinghood.widget.DividerItemDecoration;
30 |
31 | /**
32 | * Created by linhao on 2016/9/16.
33 | */
34 | public class DownLoadFragment extends BaseFragment implements ItemOnClick {
35 |
36 | @Inject
37 | DownLoadAdapter downLoadAdapter;
38 | @BindView(R.id.download_list)
39 | RecyclerView downloadList;
40 | private static final int SPAN_COUNT = 1; //列数
41 |
42 | @Override
43 | public int getLayoutId() {
44 | return R.layout.download_list;
45 | }
46 |
47 | @Override
48 | public void afterCreateView(View view) {
49 | MainActivity.InstanceManager().inject(this);
50 | downLoadAdapter.setItemOnClick(this);
51 | RecyclerView.LayoutManager manager = new StaggeredGridLayoutManager(SPAN_COUNT, StaggeredGridLayoutManager.VERTICAL);
52 | downloadList.setLayoutManager(manager);
53 | downloadList.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL_LIST));
54 | downloadList.setAdapter(downLoadAdapter);
55 | }
56 |
57 | @Override
58 | public void onClick(View view, String url) {
59 | Intent intent = null;
60 | if (url.indexOf("http") > 0) {
61 | intent = new Intent(getActivity(), DownLoadActivity.class);
62 | intent.putExtra("url", url);
63 | } else {
64 | intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
65 | intent.addCategory("android.intent.category.DEFAULT");
66 | }
67 | startActivity(intent);
68 | }
69 |
70 | @Override
71 | public void onResume() {
72 | super.onResume();
73 | MobclickAgent.onPageStart("DownLoadFragment");
74 | }
75 |
76 | @Override
77 | public void onPause() {
78 | super.onPause();
79 | MobclickAgent.onPageEnd("DownLoadFragment");
80 | }
81 |
82 | @Override
83 | public void onDestroy() {
84 | super.onDestroy();
85 | RefWatcher refWatcher = MyApplication.getRefWatcher(getActivity());
86 | refWatcher.watch(this);
87 | }
88 |
89 | }
90 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/fragment/HotNewItemFragment.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.fragment;
2 | import android.support.v7.widget.GridLayoutManager;
3 | import android.support.v7.widget.RecyclerView;
4 | import android.view.View;
5 |
6 | import com.squareup.leakcanary.RefWatcher;
7 | import com.umeng.analytics.MobclickAgent;
8 |
9 | import javax.inject.Inject;
10 | import butterknife.BindView;
11 | import linhao.redridinghood.R;
12 | import linhao.redridinghood.application.MyApplication;
13 | import linhao.redridinghood.ui.activity.MainActivity;
14 | import linhao.redridinghood.ui.adapter.HotNewAdapter;
15 |
16 | /**
17 | * Created by linhao on 2016/9/10.
18 | */
19 | public class HotNewItemFragment extends BaseFragment {
20 | @BindView(R.id.item_content_listView)
21 | RecyclerView itemContentListView;
22 | @Inject
23 | HotNewAdapter hotNewAdapter;
24 | private int currentPosition;
25 | private int currentYear;
26 | private boolean isVisibleToUser;
27 | @Override
28 | public int getLayoutId() {
29 | return R.layout.hot_new_item_content;
30 | }
31 |
32 | @Override
33 | public void afterCreateView(View view) {
34 | initView();
35 | }
36 |
37 | private void initView() {
38 | MainActivity.InstanceManager().inject(this);
39 | GridLayoutManager layoutManager = new GridLayoutManager(getContext(), 2);
40 | itemContentListView.setLayoutManager(layoutManager);
41 | itemContentListView.setAdapter(hotNewAdapter);
42 | currentPosition=this.getArguments().getInt("currentPosition");
43 | currentYear=this.getArguments().getInt("currentYear");
44 | hotNewAdapter.setType(currentYear,currentPosition);
45 | hotNewAdapter.notifyDataSetChanged();
46 | }
47 |
48 | @Override
49 | public void onStart() {
50 | MainActivity.InstanceManager().inject(this);
51 | if (isVisibleToUser){
52 | hotNewAdapter.setType(currentYear,currentPosition);
53 | hotNewAdapter.notifyDataSetChanged();
54 | }
55 | super.onStart();
56 | }
57 |
58 | @Override
59 | public void setUserVisibleHint(boolean isVisibleToUser) {
60 | this.isVisibleToUser=isVisibleToUser;
61 | super.setUserVisibleHint(isVisibleToUser);
62 | }
63 |
64 | @Override
65 | public void onResume() {
66 | super.onResume();
67 | MobclickAgent.onPageStart("HotNewItemFragment");
68 | }
69 |
70 | @Override
71 | public void onPause() {
72 | super.onPause();
73 | MobclickAgent.onPageEnd("HotNewItemFragment");
74 | }
75 |
76 | @Override
77 | public void onDestroy() {
78 | super.onDestroy();
79 | RefWatcher refWatcher = MyApplication.getRefWatcher(getActivity());
80 | refWatcher.watch(this);
81 | hotNewAdapter = null;
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/fragment/RankingFragment.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.fragment;
2 |
3 | import android.content.Intent;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.LinearLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.support.v7.widget.StaggeredGridLayoutManager;
8 | import android.view.LayoutInflater;
9 | import android.view.View;
10 | import android.view.ViewGroup;
11 |
12 | import com.squareup.leakcanary.RefWatcher;
13 | import com.umeng.analytics.MobclickAgent;
14 |
15 | import javax.inject.Inject;
16 |
17 | import butterknife.BindView;
18 | import butterknife.ButterKnife;
19 | import linhao.redridinghood.R;
20 | import linhao.redridinghood.application.MyApplication;
21 | import linhao.redridinghood.model.entity.Ranking;
22 | import linhao.redridinghood.ui.activity.ComicDetailActivity;
23 | import linhao.redridinghood.ui.activity.MainActivity;
24 | import linhao.redridinghood.ui.adapter.RankingAdapter;
25 | import linhao.redridinghood.ui.listener.ItemOnClick;
26 | import linhao.redridinghood.util.ConstantUtil;
27 | import linhao.redridinghood.widget.DividerItemDecoration;
28 |
29 | /**
30 | * Created by linhao on 2016/9/2.
31 | */
32 | public class RankingFragment extends BaseFragment implements ItemOnClick {
33 |
34 |
35 | private int currentFragmentItem;
36 | private RankingFragment rankingFragment;
37 | private Ranking.ListData listData;
38 | public static final int SPAN_COUNT = 1; //列数
39 |
40 | @BindView(R.id.ranking_recycle)
41 | RecyclerView rankingRecycle;
42 |
43 | @Inject
44 | RankingAdapter rankingAdapter;
45 |
46 | @Override
47 | public int getLayoutId() {
48 | return R.layout.rangking_item;
49 | }
50 |
51 | @Override
52 | public void afterCreateView(View view) {
53 | MainActivity.InstanceManager().inject(this);
54 | rankingAdapter.setItemOnClick(this);
55 | initView();
56 | loadData();
57 | }
58 |
59 | private void loadData() {
60 | currentFragmentItem = this.getArguments().getInt("position");
61 | // listData= (Ranking.ListData)this.getArguments().getSerializable("listData");
62 | rankingAdapter.setRanking_Flag(currentFragmentItem);
63 | }
64 |
65 | private void initView() {
66 | RecyclerView.LayoutManager layoutManager = new StaggeredGridLayoutManager(SPAN_COUNT, StaggeredGridLayoutManager.VERTICAL);
67 | rankingRecycle.setLayoutManager(layoutManager);
68 | rankingRecycle.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL_LIST));
69 | rankingRecycle.setAdapter(rankingAdapter);
70 | }
71 |
72 | @Override
73 | public void onClick(View view, String url) {
74 | Intent intent = new Intent(getActivity(), ComicDetailActivity.class);
75 | intent.putExtra("url", url);
76 | startActivity(intent);
77 | }
78 |
79 | @Override
80 | public void onResume() {
81 | super.onResume();
82 | MobclickAgent.onPageStart("RankingFragment");
83 | }
84 |
85 | @Override
86 | public void onPause() {
87 | super.onPause();
88 | MobclickAgent.onPageEnd("RankingFragment");
89 | }
90 |
91 | @Override
92 | public void onDestroy() {
93 | super.onDestroy();
94 | RefWatcher refWatcher = MyApplication.getRefWatcher(getActivity());
95 | refWatcher.watch(this);
96 | rankingAdapter = null;
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/fragment/RecommendEndFragment.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.fragment;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.GridLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.View;
8 |
9 | import com.squareup.leakcanary.RefWatcher;
10 | import com.umeng.analytics.MobclickAgent;
11 |
12 | import java.util.List;
13 |
14 | import javax.inject.Inject;
15 |
16 | import butterknife.BindView;
17 | import linhao.redridinghood.R;
18 | import linhao.redridinghood.application.MyApplication;
19 | import linhao.redridinghood.model.entity.AddRecommend;
20 | import linhao.redridinghood.ui.activity.MainActivity;
21 | import linhao.redridinghood.ui.adapter.GridViewAdapter;
22 | import linhao.redridinghood.util.ConstantUtil;
23 |
24 | /**
25 | * Created by linhao on 2016/8/14.
26 | */
27 | public class RecommendEndFragment extends BaseFragment {
28 |
29 | @Inject
30 | GridViewAdapter gridViewAdapter;
31 | private static Context context;
32 | @BindView(R.id.recycle_content)
33 | RecyclerView recycleContent;
34 | private List recommendList;
35 |
36 | public static RecommendEndFragment Instance(Context context1, Bundle bundle){
37 | context=context1;
38 | RecommendEndFragment recommendEndFragment=new RecommendEndFragment();
39 | recommendEndFragment.setArguments(bundle);
40 | return recommendEndFragment;
41 | }
42 |
43 | public void setRecommendEndFragment(List recommendList) {
44 | this.recommendList = recommendList;
45 | gridViewAdapter.getAddRecommendList().clear();
46 | gridViewAdapter.getAddRecommendList().addAll(recommendList);
47 | gridViewAdapter.setAddRecommendList(recommendList);
48 | gridViewAdapter.notifyDataSetChanged();
49 | }
50 |
51 | @Override
52 | public int getLayoutId() {
53 | return R.layout.fragment_content;
54 | }
55 |
56 | @Override
57 | public void afterCreateView(View view) {
58 | MainActivity.InstanceManager().inject(this);
59 | gridViewAdapter.setFragment_flag(ConstantUtil.RecommendEndFragmentt_Flag);
60 | GridLayoutManager layoutManager = new GridLayoutManager(context, 2);
61 | recycleContent.setLayoutManager(layoutManager);
62 | recycleContent.setAdapter(gridViewAdapter);
63 | }
64 |
65 | @Override
66 | public void onResume() {
67 | super.onResume();
68 | MobclickAgent.onPageStart("RecommendEndFragment");
69 | }
70 |
71 | @Override
72 | public void onPause() {
73 | super.onPause();
74 | MobclickAgent.onPageEnd("RecommendEndFragment");
75 | }
76 |
77 | @Override
78 | public void onDestroy() {
79 | super.onDestroy();
80 | RefWatcher refWatcher = MyApplication.getRefWatcher(getActivity());
81 | refWatcher.watch(this);
82 | }
83 |
84 | }
85 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/fragment/RecommendSerialFragment.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.fragment;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v7.widget.GridLayoutManager;
6 | import android.support.v7.widget.RecyclerView;
7 | import android.view.View;
8 |
9 | import com.squareup.leakcanary.RefWatcher;
10 | import com.umeng.analytics.MobclickAgent;
11 |
12 | import java.util.List;
13 |
14 | import javax.inject.Inject;
15 |
16 | import butterknife.BindView;
17 | import linhao.redridinghood.R;
18 | import linhao.redridinghood.application.MyApplication;
19 | import linhao.redridinghood.model.entity.AddRecommend;
20 | import linhao.redridinghood.ui.activity.MainActivity;
21 | import linhao.redridinghood.ui.adapter.GridViewAdapter;
22 | import linhao.redridinghood.util.ConstantUtil;
23 |
24 | /**
25 | * Created by linhao on 2016/8/14.
26 | */
27 | public class RecommendSerialFragment extends BaseFragment {
28 |
29 | @Inject
30 | GridViewAdapter gridViewAdapter;
31 | private static Context context;
32 | @BindView(R.id.recycle_content)
33 | RecyclerView recycleContent;
34 | private List recommendList;
35 |
36 | public static RecommendSerialFragment Instance(Context context1, Bundle bundle) {
37 | context = context1;
38 | RecommendSerialFragment recommendSerialFragment = new RecommendSerialFragment();
39 | recommendSerialFragment.setArguments(bundle);
40 | return recommendSerialFragment;
41 | }
42 |
43 | public void setRecommendSerialFragment(List recommendList) {
44 | this.recommendList = recommendList;
45 | gridViewAdapter.getAddRecommendList().clear();
46 | gridViewAdapter.getAddRecommendList().addAll(recommendList);
47 | gridViewAdapter.setAddRecommendList(recommendList);
48 | gridViewAdapter.notifyDataSetChanged();
49 | }
50 |
51 |
52 | @Override
53 | public int getLayoutId() {
54 | return R.layout.fragment_content;
55 | }
56 |
57 | @Override
58 | public void afterCreateView(View view) {
59 | MainActivity.InstanceManager().inject(this);
60 | gridViewAdapter.setFragment_flag(ConstantUtil.RecommendSerialFragmentt_Flag);
61 | GridLayoutManager layoutManager = new GridLayoutManager(context, 2);
62 | recycleContent.setLayoutManager(layoutManager);
63 | recycleContent.setAdapter(gridViewAdapter);
64 | }
65 |
66 | @Override
67 | public void onResume() {
68 | super.onResume();
69 | MobclickAgent.onPageStart("RecommendSerialFragment");
70 | }
71 |
72 | @Override
73 | public void onPause() {
74 | super.onPause();
75 | MobclickAgent.onPageEnd("RecommendSerialFragment");
76 | }
77 |
78 | @Override
79 | public void onDestroy() {
80 | super.onDestroy();
81 | RefWatcher refWatcher = MyApplication.getRefWatcher(getActivity());
82 | refWatcher.watch(this);
83 | }
84 |
85 | }
86 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/fragment/WeekUpdateFragment.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.fragment;
2 |
3 | import android.support.v7.widget.RecyclerView;
4 | import android.support.v7.widget.StaggeredGridLayoutManager;
5 | import android.view.View;
6 |
7 | import com.squareup.leakcanary.RefWatcher;
8 | import com.umeng.analytics.MobclickAgent;
9 |
10 | import butterknife.BindView;
11 | import linhao.redridinghood.R;
12 | import linhao.redridinghood.application.MyApplication;
13 | import linhao.redridinghood.ui.activity.MainActivity;
14 | import linhao.redridinghood.ui.adapter.WeekUpdateAdapter;
15 | import linhao.redridinghood.widget.DividerItemDecoration;
16 |
17 | /**
18 | * Created by linhao on 2016/8/27.
19 | */
20 | public class WeekUpdateFragment extends BaseFragment {
21 |
22 |
23 | @BindView(R.id.week_update_content)
24 | RecyclerView weekUpdateContent;
25 |
26 | // @Inject
27 | WeekUpdateAdapter weekUpdateAdapter;
28 | private final static int SPAN_COUNT = 1;
29 | int currentPosition = 0;
30 |
31 | @Override
32 | public int getLayoutId() {
33 | return R.layout.week_update_content;
34 | }
35 |
36 | @Override
37 | public void afterCreateView(View view) {
38 | initView();
39 | loadData();
40 | }
41 |
42 | private void initView() {
43 | MainActivity.InstanceManager().inject(this);
44 | RecyclerView.LayoutManager layoutManager = new StaggeredGridLayoutManager(SPAN_COUNT, StaggeredGridLayoutManager.VERTICAL);
45 | weekUpdateContent.setLayoutManager(layoutManager);
46 | weekUpdateContent.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL_LIST));
47 | weekUpdateContent.setAdapter(weekUpdateAdapter);
48 | }
49 |
50 | private void loadData() {
51 | currentPosition = this.getArguments().getInt("currentPosition");
52 | weekUpdateAdapter.setWeek_Data_Type(currentPosition);
53 | weekUpdateAdapter.notifyDataSetChanged();
54 | }
55 |
56 | public void setWeekUpdateAdapter(WeekUpdateAdapter weekUpdateAdapter) {
57 | this.weekUpdateAdapter = weekUpdateAdapter;
58 | }
59 |
60 | @Override
61 | public void onResume() {
62 | super.onResume();
63 | MobclickAgent.onPageStart("WeekUpdateFragment");
64 | }
65 |
66 | @Override
67 | public void onPause() {
68 | super.onPause();
69 | MobclickAgent.onPageEnd("WeekUpdateFragment");
70 | }
71 |
72 | @Override
73 | public void onDestroy() {
74 | super.onDestroy();
75 | RefWatcher refWatcher = MyApplication.getRefWatcher(getActivity());
76 | refWatcher.watch(this);
77 | weekUpdateAdapter = null;
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/listener/DrawerLayoutListener.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.listener;
2 |
3 | import android.support.v4.widget.DrawerLayout;
4 | import android.view.View;
5 | import android.widget.CheckedTextView;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by linhao on 2016/8/22.
11 | */
12 | public class DrawerLayoutListener extends DrawerLayout.SimpleDrawerListener {
13 |
14 | private List checkedTextViewList;
15 |
16 | public DrawerLayoutListener(List checkedTextViewList){
17 | this.checkedTextViewList=checkedTextViewList;
18 | }
19 |
20 | @Override
21 | public void onDrawerOpened(View drawerView) {
22 | super.onDrawerOpened(drawerView);
23 | }
24 |
25 | @Override
26 | public void onDrawerClosed(View drawerView) {
27 | super.onDrawerClosed(drawerView);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/listener/ItemOnClick.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.listener;
2 |
3 | import android.view.View;
4 |
5 | /**
6 | * Created by linhao on 2016/9/15.
7 | */
8 | public interface ItemOnClick {
9 | void onClick(View view,String url);
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/listener/NavigationFinishClickListener.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.listener;
2 |
3 | import android.app.Activity;
4 | import android.support.annotation.NonNull;
5 | import android.support.v4.app.ActivityCompat;
6 | import android.view.View;
7 | import android.view.View.OnClickListener;
8 |
9 |
10 | /**
11 | * Created by linhao on 2016/9/17.
12 | */
13 | public class NavigationFinishClickListener implements OnClickListener {
14 |
15 | private final Activity activity;
16 |
17 | public NavigationFinishClickListener(@NonNull Activity activity) {
18 | this.activity = activity;
19 | }
20 |
21 | @Override
22 | public void onClick(View v) {
23 | ActivityCompat.finishAfterTransition(activity);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/listener/NavigationOpenClickListener.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.listener;
2 |
3 | import android.support.v4.view.GravityCompat;
4 | import android.support.v4.widget.DrawerLayout;
5 | import android.view.View;
6 |
7 | import linhao.redridinghood.R;
8 |
9 | /**
10 | * Created by linhao on 2016/8/22.
11 | */
12 | public class NavigationOpenClickListener implements View.OnClickListener {
13 |
14 | private DrawerLayout drawerLayout;
15 |
16 | public NavigationOpenClickListener(DrawerLayout drawerLayout) {
17 | this.drawerLayout = drawerLayout;
18 | }
19 |
20 | @Override
21 | public void onClick(View view) {
22 | drawerLayout.openDrawer(GravityCompat.START);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/listener/PageLoadMoreListener.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.listener;
2 |
3 | import android.widget.TextView;
4 |
5 | import com.pnikosis.materialishprogress.ProgressWheel;
6 |
7 | /**
8 | * Created by linhao on 2016/9/4.
9 | */
10 | public interface PageLoadMoreListener {
11 |
12 | public void loadMore(TextView text, ProgressWheel progressWheel);
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/listener/TabOnClickListener.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.listener;
2 |
3 | import android.support.v4.view.ViewPager;
4 | import android.view.View;
5 |
6 | /**
7 | * Created by linhao on 2016/8/14.
8 | */
9 | public class TabOnClickListener implements View.OnClickListener{
10 |
11 | private ViewPager viewPager;
12 | private int currentItem;
13 | public TabOnClickListener(ViewPager viewPager,int currentItem){
14 | this.viewPager=viewPager;
15 | }
16 |
17 | @Override
18 | public void onClick(View view) {
19 | viewPager.setCurrentItem(currentItem);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/view/ActivityView.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.view;
2 |
3 | /**
4 | * Created by linhao on 2016/8/17.
5 | */
6 | public interface ActivityView {
7 |
8 | void showProgress();
9 | void hideProgress();
10 | void loadFailView();
11 | }
12 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/ui/view/LoadMoreView.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.ui.view;
2 |
3 | /**
4 | * Created by linhao on 2016/9/4.
5 | */
6 | public interface LoadMoreView{
7 | void showMoreProgress();
8 | void showLoadFail();
9 | void hideMoreProgress();
10 | }
11 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/util/ActivityUtils.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.util;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.os.Build;
6 | import android.support.annotation.NonNull;
7 |
8 |
9 | public final class ActivityUtils {
10 |
11 | private ActivityUtils() {}
12 |
13 | public static boolean isAlive(Activity activity) {
14 | return activity != null && !(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 && activity.isDestroyed()) && !activity.isFinishing();
15 | }
16 |
17 | public static void recreate(@NonNull Activity activity) {
18 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
19 | activity.recreate();
20 | } else {
21 | Intent intent = activity.getIntent();
22 | intent.setClass(activity, activity.getClass());
23 | activity.startActivity(intent);
24 | activity.finish();
25 | activity.overridePendingTransition(0, 0);
26 | }
27 | }
28 |
29 | public static void recreateDelayed(@NonNull final Activity activity) {
30 | HandlerUtils.post(new Runnable() {
31 |
32 | @Override
33 | public void run() {
34 | recreate(activity);
35 | }
36 |
37 | });
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/util/ConstantUtil.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.util;
2 |
3 | /**
4 | * Created by linhao on 2016/8/29.
5 | */
6 | public class ConstantUtil {
7 |
8 | //recommendList 的下标是从零开始的 表示要获取的数据是在recommendList 的下标为0的数据
9 |
10 | /**
11 | * 首页的页面数据类型
12 | */
13 | public final static int AddEndFragment_Flag = 0;
14 | public final static int AddSerialFragment_Flag = 1;
15 | public final static int RecommendEndFragmentt_Flag = 2;
16 | public final static int RecommendSerialFragmentt_Flag = 3;
17 |
18 | public final static int WeekUpdateFragment = 4;
19 | public final static int GridViewAdapter = 5;
20 | public final static int RecycleViewAdapter = 6;
21 |
22 | public final static int Recent_Year_Month_One = 7;
23 | public final static int Recent_Year_Month_Two = 8;
24 | public final static int Carouse_Ranking = 9;
25 | public final static int Carouse_News = 10;
26 |
27 | /**
28 | * 在myOmPageChangeListener中根据adapter类型去刷新adapter数据
29 | */
30 | public final static int RankingAdapter = 11;
31 | public final static int WeekUpdater = 14;
32 | public final static int HotNewAdapter = 15;
33 | public final static int DownLoadAdapter=16;
34 |
35 | public final static int Week_Update_Week = 12;
36 | public final static int Week_Update_Content = 13;
37 |
38 | /**
39 | * 热门新播的年份
40 | */
41 | public final static int First_Year_Fragment_Flag = 3;
42 | public final static int Second_Year_Fragment_Flag = 2;
43 | public final static int Thrid_Year_Fragment_Flag = 1;
44 | public final static int Four_Year_Fragment_Flag = 0;
45 |
46 | /**
47 | * 热门新播的月份
48 | */
49 | public final static int October_Month_Fragment_Flag = 0;
50 | public final static int July_Fragment_Flag = 1;
51 | public final static int April_Month_Fragment_Flag = 2;
52 | public final static int January_Month_Fragment_Flag = 3;
53 |
54 | public final static int Comic_List = 10;
55 | public final static int Comic_List_Edition = 0;
56 | public final static int Comic_List_Letter = 1;
57 | public final static int Comic_List_Sort = 2;
58 | public final static int Comic_List_Type = 3;
59 |
60 | public final static int DownLoad_Ftp=0;
61 | public final static int DownLoad_Baidun=1;
62 | public final static int DownLoad_Magnetic=2;
63 |
64 | public final static String Comic_Content_State = "状态";
65 | public final static String Comic_Content_Volumn = "点击量";
66 | public final static String Comic_Content_Type = "动漫类型";
67 | public final static String Comic_Content_Zone = "动漫地区";
68 | public final static String Comic_Content_Language = "配音语言";
69 | public final static String Comic_Content_Year = "上映年份";
70 | public final static String Comic_Content_Update = "最后更新";
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/util/DisplayUtils.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.util;
2 |
3 | import android.content.Context;
4 | import android.os.Build;
5 | import android.support.annotation.NonNull;
6 | import android.view.View;
7 | import android.view.ViewGroup;
8 |
9 | public final class DisplayUtils {
10 |
11 | private DisplayUtils() {}
12 |
13 | public static void adaptStatusBar(@NonNull Context context, @NonNull View statusBar) {
14 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
15 | ViewGroup.LayoutParams layoutParams = statusBar.getLayoutParams();
16 | layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
17 | layoutParams.height = ResUtils.getStatusBarHeight(context);
18 | statusBar.setLayoutParams(layoutParams);
19 | }
20 | }
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/util/ExitClickUtil.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.util;
2 |
3 | /**
4 | * Created by coreVK on 2016/4/2.
5 | */
6 | public class ExitClickUtil {
7 |
8 | private static long lastClickTime;
9 |
10 | public static boolean isClickAgain() {
11 | long time = System.currentTimeMillis();
12 | long timeAgain = time - lastClickTime;
13 | if (0 < timeAgain && timeAgain < 1500) {
14 | return true;
15 | }
16 | lastClickTime = time;
17 | return false;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/util/GlideUtil.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.util;
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 |
10 | import de.hdodenhof.circleimageview.CircleImageView;
11 |
12 | /**
13 | * Created by linhao on 2016/8/13.
14 | */
15 | public class GlideUtil {
16 |
17 | public static void LoadImg(Context context, ImageView imageView,String url){
18 | Glide.with(context)
19 | .load(url)
20 | .diskCacheStrategy(DiskCacheStrategy.ALL)
21 | .into(imageView);
22 | }
23 |
24 | public static void clear(Activity activity){
25 | // Glide.clear();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/util/HandlerUtils.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.util;
2 |
3 | import android.os.Handler;
4 | import android.os.Looper;
5 |
6 | public final class HandlerUtils {
7 |
8 | private HandlerUtils() {}
9 |
10 | private static final Handler handler = new Handler(Looper.getMainLooper());
11 |
12 | public static boolean post(Runnable r) {
13 | return handler.post(r);
14 | }
15 |
16 | public static boolean postDelayed(Runnable r, long delayMillis) {
17 | return handler.postDelayed(r, delayMillis);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/util/ResUtils.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.util;
2 |
3 | import android.content.Context;
4 | import android.content.res.TypedArray;
5 | import android.graphics.drawable.Drawable;
6 | import android.support.annotation.AttrRes;
7 | import android.support.annotation.ColorInt;
8 | import android.support.annotation.NonNull;
9 | import android.support.annotation.RawRes;
10 |
11 | import java.io.BufferedReader;
12 | import java.io.IOException;
13 | import java.io.InputStream;
14 | import java.io.InputStreamReader;
15 |
16 | public final class ResUtils {
17 |
18 | private ResUtils() {}
19 |
20 | public static int getStatusBarHeight(@NonNull Context context) {
21 | int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
22 | return resourceId > 0 ? context.getResources().getDimensionPixelSize(resourceId) : 0;
23 | }
24 |
25 | @ColorInt
26 | public static int getThemeAttrColor(@NonNull Context context, @AttrRes int attr) {
27 | TypedArray a = context.obtainStyledAttributes(null, new int[]{attr});
28 | try {
29 | return a.getColor(0, 0);
30 | } finally {
31 | a.recycle();
32 | }
33 | }
34 |
35 | public static Drawable getThemeAttrDrawable(@NonNull Context context, @AttrRes int attr) {
36 | TypedArray a = context.obtainStyledAttributes(null, new int[]{attr});
37 | try {
38 | return a.getDrawable(0);
39 | } finally {
40 | a.recycle();
41 | }
42 | }
43 |
44 | public static String getRawString(@NonNull Context context, @RawRes int rawId) throws IOException {
45 | InputStream is = context.getResources().openRawResource(rawId);
46 | BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
47 | StringBuilder sb = new StringBuilder();
48 | String line;
49 | while ((line = reader.readLine()) != null) {
50 | sb.append(line).append("\n");
51 | }
52 | sb.deleteCharAt(sb.length() - 1);
53 | reader.close();
54 | return sb.toString();
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/util/ThemeUtils.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.util;
2 |
3 | import android.app.Activity;
4 | import android.support.annotation.NonNull;
5 | import android.support.annotation.StyleRes;
6 |
7 | import linhao.redridinghood.model.storage.SettingShared;
8 |
9 | /**
10 | * Created by linhao on 2016/8/23.
11 | */
12 | public final class ThemeUtils {
13 |
14 | public static boolean configThemeBeforeOnCreate(@NonNull Activity activity, @StyleRes int light, @StyleRes int dark) {
15 | boolean enable = SettingShared.isEnableThemeDark(activity);
16 | activity.setTheme(enable ? dark : light);
17 | return enable;
18 | }
19 |
20 | public static void notifyThemeApply(@NonNull Activity activity, boolean delay) {
21 | if (delay) {
22 | ActivityUtils.recreateDelayed(activity);
23 | } else {
24 | ActivityUtils.recreate(activity);
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/app/src/main/java/linhao/redridinghood/widget/DividerItemDecoration.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood.widget;
2 |
3 | import android.content.Context;
4 | import android.graphics.Canvas;
5 | import android.graphics.Rect;
6 | import android.graphics.drawable.Drawable;
7 | import android.support.v4.content.ContextCompat;
8 | import android.support.v7.widget.LinearLayoutManager;
9 | import android.support.v7.widget.RecyclerView;
10 | import android.view.View;
11 |
12 | import linhao.redridinghood.R;
13 |
14 |
15 | /**
16 | * 用于RecyclerView分割线
17 | *
18 | * @author lsxiao
19 | * @date 2015-11-05 00:27
20 | */
21 | public class DividerItemDecoration extends RecyclerView.ItemDecoration {
22 |
23 | public static final int HORIZONTAL_LIST = LinearLayoutManager.HORIZONTAL;
24 |
25 | public static final int VERTICAL_LIST = LinearLayoutManager.VERTICAL;
26 |
27 | private Drawable mDivider;
28 |
29 | private int mOrientation;
30 |
31 | public DividerItemDecoration(Context context, int orientation) {
32 | mDivider = ContextCompat.getDrawable(context,R.drawable.list_divider);
33 | setOrientation(orientation);
34 | }
35 |
36 | public void setOrientation(int orientation) {
37 | if (orientation != HORIZONTAL_LIST && orientation != VERTICAL_LIST) {
38 | throw new IllegalArgumentException("invalid orientation");
39 | }
40 | mOrientation = orientation;
41 | }
42 |
43 | @Override
44 | public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
45 | if (mOrientation == VERTICAL_LIST) {
46 | drawVertical(c, parent);
47 | } else {
48 | drawHorizontal(c, parent);
49 | }
50 | }
51 |
52 | public void drawVertical(Canvas c, RecyclerView parent) {
53 | final int left = parent.getPaddingLeft();
54 | final int right = parent.getWidth() - parent.getPaddingRight();
55 |
56 | final int childCount = parent.getChildCount();
57 | for (int i = 0; i < childCount; i++) {
58 | final View child = parent.getChildAt(i);
59 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
60 | .getLayoutParams();
61 | final int top = child.getBottom() + params.bottomMargin;
62 | final int bottom = top + mDivider.getIntrinsicHeight();
63 | mDivider.setBounds(left, top, right, bottom);
64 | mDivider.draw(c);
65 | }
66 | }
67 |
68 | public void drawHorizontal(Canvas c, RecyclerView parent) {
69 | final int top = parent.getPaddingTop();
70 | final int bottom = parent.getHeight() - parent.getPaddingBottom();
71 |
72 | final int childCount = parent.getChildCount();
73 | for (int i = 0; i < childCount; i++) {
74 | final View child = parent.getChildAt(i);
75 | final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
76 | .getLayoutParams();
77 | final int left = child.getRight() + params.rightMargin;
78 | final int right = left + mDivider.getIntrinsicHeight();
79 | mDivider.setBounds(left, top, right, bottom);
80 | mDivider.draw(c);
81 | }
82 | }
83 |
84 | @Override
85 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
86 | if (mOrientation == VERTICAL_LIST) {
87 | outRect.set(0, 0, 0, mDivider.getIntrinsicHeight());
88 | } else {
89 | outRect.set(0, 0, mDivider.getIntrinsicWidth(), 0);
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/app/src/main/res/color/navigation_item_text_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/color/navigation_item_text_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/color/reference_text_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/color/reference_text_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/button_transparent_image.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/selectable_item_background_general_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v21/selectable_item_background_general_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/image_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xhdpi/image_error.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/image_placeholder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xhdpi/image_placeholder.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_no_data.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxhdpi/ic_no_data.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/main_nav_header_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxhdpi/main_nav_header_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_brightness_3_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_brightness_3_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_face_grey600_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_face_grey600_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_face_theme_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_face_theme_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_forum_grey600_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_forum_grey600_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_forum_theme_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_forum_theme_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_menu_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_menu_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_share_grey600_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_share_grey600_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_share_theme_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_share_theme_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_share_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_thumb_up_grey600_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_thumb_up_grey600_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_thumb_up_theme_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_thumb_up_theme_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_wb_sunny_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_wb_sunny_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_work_grey600_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_work_grey600_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_work_theme_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable-xxxhdpi/ic_work_theme_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/back.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_transparent_image.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/button_transparent_pressed.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/dot_focused.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/dot_normal.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/gap_shadow.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/gap_shadow_opposite.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/grey_delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/grey_delete.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/list_divider.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/main_nav_ic_all.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/main_nav_ic_ask.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/main_nav_ic_good.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/main_nav_ic_job.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/main_nav_ic_share.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/navigation_drawer_shadow.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/picker_tv_bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/picker_tv_bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/red_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/red_down.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/reference_background_accent.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/reference_background_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/reference_background_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/reference_background_normal_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/reference_background_normal_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/search.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selectable_item_background_general_dark.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/selectable_item_background_general_light.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/time5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/time5.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/time6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/time6.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/time7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/time7.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/time8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/time8.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/white_down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/drawable/white_down.png
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main_center.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
16 |
17 |
21 |
22 |
23 |
24 |
25 |
26 |
31 |
32 |
33 |
38 |
39 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main_market.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
21 |
22 |
23 |
24 |
33 |
34 |
35 |
36 |
45 |
46 |
47 |
56 |
57 |
58 |
63 |
64 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/addend.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/addserial.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/banner_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
18 |
19 |
31 |
32 |
39 |
40 |
46 |
47 |
53 |
54 |
60 |
61 |
67 |
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/banner_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/comic_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
15 |
20 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/comic_list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
17 |
27 |
28 |
39 |
40 |
51 |
52 |
64 |
65 |
77 |
78 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/download_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/download_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/footer_load_more.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
19 |
20 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/grid_item_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
17 |
24 |
29 |
30 |
31 |
32 |
41 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/hot_new_animate.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
17 |
18 |
19 |
20 |
24 |
25 |
29 |
30 |
31 |
32 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/hot_new_animate_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
19 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/hot_new_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/hot_new_item_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/include_empty.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/include_error.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/include_toolbar.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
22 |
23 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/news.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
20 |
21 |
22 |
23 |
28 |
29 |
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/news_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
17 |
28 |
29 |
39 |
40 |
41 |
52 |
53 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/picker_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
28 |
29 |
40 |
41 |
47 |
48 |
54 |
55 |
56 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rangk_content_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rangking_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/ranking.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
12 |
15 |
19 |
25 |
26 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/recent_update.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
20 |
21 |
22 |
23 |
28 |
29 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/recent_update_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
18 |
19 |
20 |
24 |
25 |
33 |
34 |
45 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/recommandand.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/recommandserial.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/search.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
15 |
23 |
24 |
32 |
33 |
43 |
44 |
48 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/tab_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/topic.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
14 |
15 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/topic_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
17 |
18 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/webview.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/week_update.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
11 |
12 |
13 |
18 |
19 |
20 |
25 |
26 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/week_update_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/welcome.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_placeholder.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/mipmap-hdpi/ic_placeholder.jpg
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/mipmap-mdpi/icon.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/mipmap-mdpi/search.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_empty.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/mipmap-xxxhdpi/ic_empty.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/mipmap-xxxhdpi/ic_error.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/splash.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/app/src/main/res/mipmap-xxxhdpi/splash.png
--------------------------------------------------------------------------------
/app/src/main/res/values-v19/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
13 |
14 |
15 |
19 |
20 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/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 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | #3F51B5
5 | #303F9F
6 | #FF4081
7 | #e0e0e0
8 | #FFEA0703
9 | #ffcccccc
10 | #DE181717
11 | #eeeeee
12 | #CCF2F0F0
13 |
14 | #70f2f0f0
15 |
16 | #ff333333
17 | #ff222222
18 | #ff80bd01
19 |
20 | #ffeeeeee
21 | #ff303030
22 | #ffe0e0e0
23 | #ff666666
24 |
25 | #66000000
26 |
27 | #de000000
28 | #ffffffff
29 | #39000000
30 | #4dffffff
31 | #8a000000
32 | #b3ffffff
33 | #24000000
34 | #36ffffff
35 |
36 | @android:color/white
37 | #ffeeeeee
38 | #ffcccccc
39 | #ff3c3c3c
40 | #ff444444
41 | #ff666666
42 |
43 | @color/color_accent
44 | #ff48bd06
45 | #99ffffff
46 | #ffffffff
47 | #ffeeeeee
48 | #3301ee15
49 |
50 | #ffff4444
51 | #ff99cc00
52 | #ff33b5e5
53 | #ffffbb33
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 56dp
5 | 4dp
6 |
7 | 2dp
8 |
9 | 2dp
10 | 6dp
11 |
12 | 2dp
13 |
14 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/fractions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 70%
5 | 90%
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 红帽社区
5 |
6 | 新增连载
7 | 新增完结
8 | 推荐连载
9 | 推荐完结
10 |
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 | 加载更多
40 |
41 | 十月新播
42 | 七月新播
43 | 四月新播
44 | 一月新播
45 |
46 | 版本
47 | 字母
48 | 排序
49 | 类型
50 |
51 | FTP下载
52 | 百度网盘下载
53 | 磁力链接下载
54 | 搜索
55 | 正在搜索
56 | 播放器
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/bottombar_tabs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
11 |
15 |
19 |
--------------------------------------------------------------------------------
/app/src/test/java/linhao/redridinghood/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package linhao.redridinghood;
2 |
3 | import org.junit.Test;
4 |
5 | import linhao.redridinghood.model.entity.Search;
6 | import linhao.redridinghood.model.service.ClientApiManager;
7 | import rx.Observable;
8 | import rx.functions.Action1;
9 | import rx.schedulers.Schedulers;
10 |
11 | import static org.junit.Assert.*;
12 |
13 | /**
14 | * To work on unit tests, switch the Test Artifact in the Build Variants view.
15 | */
16 | public class ExampleUnitTest {
17 | @Test
18 | public void addition_isCorrect() throws Exception {
19 | assertEquals(4, 2 + 2);
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 |
3 | buildscript {
4 | repositories {
5 | mavenCentral()
6 | jcenter()
7 | maven { url "http://search.maven.org" }
8 | }
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:2.1.0'
11 | classpath 'com.jakewharton:butterknife-gradle-plugin:8.2.1'
12 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
13 | classpath 'com.antfortune.freeline:gradle:0.6.0'
14 | // NOTE: Do not place your application dependencies here; they belong
15 | // in the individual module build.gradle files
16 | }
17 | }
18 |
19 | allprojects {
20 | repositories {
21 | mavenCentral()
22 | jcenter()
23 | }
24 | }
25 |
26 | task clean(type: Delete) {
27 | delete rootProject.buildDir
28 | }
29 |
--------------------------------------------------------------------------------
/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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/linhaosheng/RedRidingHood/b43c5764497c6ab8b7db2929ca91716d20ac5342/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Dec 28 10:00:20 PST 2015
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-2.10-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
--------------------------------------------------------------------------------