11 |
12 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/README.MD:
--------------------------------------------------------------------------------
1 | # Meizhi & Gank.io / 妹纸 & Gank.io
2 |
3 |
4 |
5 |
6 |
7 | ## Overview
8 |
9 | A concise of Programmer Worth Readings and a Pretty Meizhi update on every weekday.
10 |
11 | Data provided by daimajia: http://gank.io
12 |
13 | This Project is developed using MVP structure and Dagger 2 as a best practice of Uncle Bob's Clean Architecture.
14 |
15 |
16 | 每天都会更新一篇值得阅读的程式员精选干货和一个精选妹纸!
17 |
18 | 数据内容来源于代码家的 http://gank.io
19 |
20 | 这个项目是用 MVP 和 Dagger 2 开发的,并且以 Uncle Bob's Clean Architecture 为模板以达到干净代码的实现。
21 |
22 |
23 | ## Download
24 |
25 | [Google Play](https://play.google.com/store/apps/details?id=me.chkfung.meizhigankio)
26 |
27 | [酷安市场 Cool APK](http://www.coolapk.com/apk/me.chkfung.meizhigankio)
28 |
29 | ## Screenshot:
30 |
31 | 
32 | 
33 | 
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | ## 文章
42 |
43 | [夜间模式实现](http://www.jianshu.com/p/f30ebec8b4ed)
44 |
45 | ## Thanks
46 |
47 | [Drakeet](https://github.com/drakeet)
48 | [代码家](https://github.com/daimajia)
49 |
50 | ## License
51 |
52 | ```
53 | Meizhi & Gank.io
54 | Copyright (C) 2016 ChkFung
55 |
56 | This program is free software: you can redistribute it and/or modify
57 | it under the terms of the GNU General Public License as published by
58 | the Free Software Foundation, either version 3 of the License, or
59 | (at your option) any later version.
60 |
61 | This program is distributed in the hope that it will be useful,
62 | but WITHOUT ANY WARRANTY; without even the implied warranty of
63 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
64 | GNU General Public License for more details.
65 |
66 | You should have received a copy of the GNU General Public License
67 | along with this program. If not, see .
68 | ```
--------------------------------------------------------------------------------
/Screenshot/1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/Screenshot/1.gif
--------------------------------------------------------------------------------
/Screenshot/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/Screenshot/1.png
--------------------------------------------------------------------------------
/Screenshot/2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/Screenshot/2.gif
--------------------------------------------------------------------------------
/Screenshot/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/Screenshot/2.png
--------------------------------------------------------------------------------
/Screenshot/3.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/Screenshot/3.gif
--------------------------------------------------------------------------------
/Screenshot/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/Screenshot/3.png
--------------------------------------------------------------------------------
/Screenshot/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/Screenshot/4.png
--------------------------------------------------------------------------------
/Screenshot/5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/Screenshot/5.png
--------------------------------------------------------------------------------
/Screenshot/ic_web_hi_res_144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/Screenshot/ic_web_hi_res_144.png
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "479805264884",
4 | "firebase_url": "https://meizhi-c1800.firebaseio.com",
5 | "project_id": "meizhi-c1800",
6 | "storage_bucket": "meizhi-c1800.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:479805264884:android:81b5325810cd6540",
12 | "android_client_info": {
13 | "package_name": "me.chkfung.meizhigank"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "479805264884-h1f082h5hmdrbe7bo0pn9vcrkj9bqe3g.apps.googleusercontent.com",
19 | "client_type": 1,
20 | "android_info": {
21 | "package_name": "me.chkfung.meizhigank",
22 | "certificate_hash": "6FB9AA0ADE468D63AF01791B4E0C0403392BA23C"
23 | }
24 | },
25 | {
26 | "client_id": "479805264884-s3ql6496fh6jdovgggojcibai4ana34m.apps.googleusercontent.com",
27 | "client_type": 3
28 | }
29 | ],
30 | "api_key": [
31 | {
32 | "current_key": "AIzaSyByaj7TzeKy24d02WoC5_1FSNGnO1NeKu8"
33 | }
34 | ],
35 | "services": {
36 | "analytics_service": {
37 | "status": 1
38 | },
39 | "appinvite_service": {
40 | "status": 2,
41 | "other_platform_oauth_client": [
42 | {
43 | "client_id": "479805264884-s3ql6496fh6jdovgggojcibai4ana34m.apps.googleusercontent.com",
44 | "client_type": 3
45 | }
46 | ]
47 | },
48 | "ads_service": {
49 | "status": 2
50 | }
51 | }
52 | },
53 | {
54 | "client_info": {
55 | "mobilesdk_app_id": "1:479805264884:android:697a7f569ccbd04c",
56 | "android_client_info": {
57 | "package_name": "me.chkfung.meizhigankio"
58 | }
59 | },
60 | "oauth_client": [
61 | {
62 | "client_id": "479805264884-bm6q6keh083hho1h20akc71rueqgp7sn.apps.googleusercontent.com",
63 | "client_type": 1,
64 | "android_info": {
65 | "package_name": "me.chkfung.meizhigankio",
66 | "certificate_hash": "6FB9AA0ADE468D63AF01791B4E0C0403392BA23C"
67 | }
68 | },
69 | {
70 | "client_id": "479805264884-s3ql6496fh6jdovgggojcibai4ana34m.apps.googleusercontent.com",
71 | "client_type": 3
72 | }
73 | ],
74 | "api_key": [
75 | {
76 | "current_key": "AIzaSyByaj7TzeKy24d02WoC5_1FSNGnO1NeKu8"
77 | }
78 | ],
79 | "services": {
80 | "analytics_service": {
81 | "status": 1
82 | },
83 | "appinvite_service": {
84 | "status": 2,
85 | "other_platform_oauth_client": [
86 | {
87 | "client_id": "479805264884-s3ql6496fh6jdovgggojcibai4ana34m.apps.googleusercontent.com",
88 | "client_type": 3
89 | }
90 | ]
91 | },
92 | "ads_service": {
93 | "status": 2
94 | }
95 | }
96 | }
97 | ],
98 | "configuration_version": "1"
99 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/Shared/AndroidSDK/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 | ## Proguard normal ##
19 |
20 | # 代码混淆的压缩比例(0-7) , 默认为5 , 一般不需要改
21 | -optimizationpasses 5
22 |
23 | # 混淆后类名都小写 (windows最后加上 , 因为windows大小写敏感)
24 | -dontusemixedcaseclassnames
25 | # 指定不去忽略非公共的库的类(即混淆第三方, 第三方库可能自己混淆了 , 可在后面配置某些第三方库不混淆)
26 | # 默认跳过,有些情况下编写的代码与类库中的类在同一个包下,并且持有包中内容的引用,此时就需要加入此条声明
27 | -dontskipnonpubliclibraryclasses
28 |
29 | # 指定不去忽略非公共的库的类的成员
30 | -dontskipnonpubliclibraryclassmembers
31 |
32 | # 不做预检验,preverify是proguard的四个步骤之一
33 | # Android不需要preverify,去掉这一步可以加快混淆速度
34 | -dontpreverify
35 |
36 |
37 | # 指定混淆时采用的算法,后面的参数是一个过滤器
38 | # 这个过滤器是谷歌推荐的算法,一般不改变
39 | -optimizations !code/simplification/cast,!field/*,!class/merging/*
40 | ## Normal
41 |
42 | # OkHttp
43 | -keepattributes Signature
44 | -keepattributes *Annotation*
45 | -keep class okhttp3.** { *; }
46 | -keep interface okhttp3.** { *; }
47 | -dontwarn okhttp3.**
48 |
49 | # Okio
50 | -keep class sun.misc.Unsafe { *; }
51 | -dontwarn java.nio.file.*
52 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
53 | -dontwarn okio.**
54 |
55 | # Retrofit 2.X
56 | ## https://square.github.io/retrofit/ ##
57 |
58 | -dontwarn retrofit2.**
59 | -keep class retrofit2.** { *; }
60 | -keepattributes Signature
61 | -keepattributes Exceptions
62 |
63 | -keepclasseswithmembers class * {
64 | @retrofit2.http.* ;
65 | }
66 | #
67 | ## Rx Android
68 | -keep class rx.schedulers.Schedulers {
69 | public static ;
70 | }
71 | -keep class rx.schedulers.ImmediateScheduler {
72 | public ;
73 | }
74 | -keep class rx.schedulers.TestScheduler {
75 | public ;
76 | }
77 | -keep class rx.schedulers.Schedulers {
78 | public static ** test();
79 | }
80 | -keepclassmembers class rx.internal.util.unsafe.*ArrayQueue*Field* {
81 | long producerIndex;
82 | long consumerIndex;
83 | }
84 | -keepclassmembers class rx.internal.util.unsafe.BaseLinkedQueueProducerNodeRef {
85 | long producerNode;
86 | long consumerNode;
87 | }
88 | -dontwarn rx.internal.util.unsafe.*
89 |
90 | -keepattributes EnclosingMethod
91 |
92 | ## GSON 2.2.4 specific rules ##
93 |
94 | # Gson uses generic type information stored in a class file when working with fields. Proguard
95 | # removes such information by default, so configure it to keep all of it.
96 | -keepattributes Signature
97 |
98 | # For using GSON @Expose annotation
99 | -keepattributes *Annotation*
100 |
101 | -keepattributes EnclosingMethod
102 |
103 | # Gson specific classes
104 | -keep class sun.misc.Unsafe { *; }
105 | -keep class com.google.gson.stream.** { *; }
106 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/me/chkfung/meizhigank/ExampleInstrumentedTest.java:
--------------------------------------------------------------------------------
1 | package me.chkfung.meizhigank;
2 |
3 | import android.content.Context;
4 | import android.support.test.InstrumentationRegistry;
5 | import android.support.test.runner.AndroidJUnit4;
6 |
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | import static org.junit.Assert.assertEquals;
11 |
12 | /**
13 | * Instrumentation test, which will execute on an Android device.
14 | *
15 | * @see Testing documentation
16 | */
17 | @RunWith(AndroidJUnit4.class)
18 | public class ExampleInstrumentedTest {
19 | @Test
20 | public void useAppContext() throws Exception {
21 | // Context of the app under test.
22 | Context appContext = InstrumentationRegistry.getTargetContext();
23 |
24 | assertEquals("me.chkfung.meizhigank", appContext.getPackageName());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
36 |
41 |
42 |
43 |
44 |
45 |
46 |
49 |
50 |
53 |
54 |
55 |
56 |
57 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Base/BaseActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Base;
21 |
22 | import android.annotation.SuppressLint;
23 | import android.content.Context;
24 | import android.content.Intent;
25 | import android.support.annotation.LayoutRes;
26 | import android.support.annotation.Nullable;
27 | import android.support.v7.app.AppCompatActivity;
28 | import android.support.v7.widget.Toolbar;
29 |
30 | import butterknife.BindView;
31 | import butterknife.ButterKnife;
32 | import me.chkfung.meizhigank.R;
33 |
34 | /**
35 | * Base Activity to make life easy
36 | * Created by Fung on 21/07/2016.
37 | */
38 |
39 | @SuppressLint("Registered")
40 | public class BaseActivity extends AppCompatActivity implements BaseContract.View {
41 |
42 | @Nullable
43 | @BindView(R.id.toolbar)
44 | Toolbar toolbar;
45 |
46 | @Override
47 | public void setContentView(@LayoutRes int layoutResID) {
48 | super.setContentView(layoutResID);
49 | ButterKnife.bind(this);
50 |
51 | if (toolbar != null) {
52 | //Setup Toolbar
53 | setSupportActionBar(toolbar);
54 | getSupportActionBar().setDisplayShowTitleEnabled(false);
55 | }
56 | }
57 |
58 | @Override
59 | public Context getContext() {
60 | return this;
61 | }
62 |
63 |
64 | @Override
65 | public void onBackPressed() {
66 | super.onBackPressed();
67 | overridePendingTransition(R.anim.right_in_back, R.anim.right_out_back);
68 | }
69 |
70 | @Override
71 | public void startActivity(Intent intent) {
72 | super.startActivity(intent);
73 | overridePendingTransition(R.anim.right_in, R.anim.right_out);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Base/BaseContract.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Base;
21 |
22 | import android.content.Context;
23 |
24 | /**
25 | * Base Contract for MVP
26 | * Created by Fung on 26/07/2016.
27 | */
28 |
29 | public interface BaseContract {
30 | interface Presenter {
31 |
32 | /**
33 | * Detach View to prevent Memory Leak
34 | * Call it in onDestroy of all Activity
35 | */
36 | @SuppressWarnings("unused")
37 | void detachView();
38 |
39 | }
40 |
41 | interface View {
42 |
43 | Context getContext();
44 |
45 | }
46 |
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Constants.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank;
21 |
22 | /**
23 | * Constants of the Application
24 | * Created by Fung on 26/07/2016.
25 | */
26 |
27 | public class Constants {
28 | public static final int MEIZHI_AMOUNT = 10;
29 | public static final int MEIZHI_PRELOAD = 4;
30 | public static final String SHARED_PREF = "TIBBER";
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Contract/GankContract.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Contract;
21 |
22 | import me.chkfung.meizhigank.Base.BaseContract;
23 | import me.chkfung.meizhigank.Model.Day;
24 |
25 | /**
26 | * Gank Activity MVP Contract
27 | * Created by Fung on 04/08/2016.
28 | */
29 |
30 | public interface GankContract {
31 | interface Presenter extends BaseContract.Presenter {
32 | @SuppressWarnings("unused")
33 | void getGank(String date);
34 | }
35 |
36 | interface View extends BaseContract.View {
37 | void setupRecycleView(Day day);
38 | void showError(Throwable e);
39 |
40 | @SuppressWarnings("unused")
41 | void startCustomTabIntent(String Desc, String url);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Contract/MainContract.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Contract;
21 |
22 | import android.view.MenuItem;
23 |
24 | import java.util.ArrayList;
25 |
26 | import me.chkfung.meizhigank.Base.BaseContract;
27 | import me.chkfung.meizhigank.Model.DataInfo;
28 | import me.chkfung.meizhigank.ui.Adapter.MeizhiRvAdapter;
29 |
30 | /**
31 | * Main Activity MVP Contract
32 | * Created by Fung on 21/07/2016.
33 | */
34 |
35 | public interface MainContract {
36 | interface Presenter extends BaseContract.Presenter {
37 | /**
38 | * Perform Network Request to Obtain Meizhi Data
39 | */
40 | @SuppressWarnings("unused")
41 | void loadMeizhi(boolean clearItem);
42 |
43 | ArrayList getData();
44 |
45 | void updateAdapter(boolean clearItem, ArrayList newData);
46 | }
47 |
48 | interface View extends BaseContract.View {
49 |
50 |
51 | MeizhiRvAdapter getAdapter();
52 |
53 | /**
54 | * UI Action when Network Error
55 | * @param e Throwable
56 | */
57 | void networkError(Throwable e);
58 |
59 | void firstTimelaunch();
60 |
61 | void tutorial();
62 |
63 | void setDayNightMode(boolean day);
64 |
65 | void setupAlarm(boolean enabled);
66 |
67 | void setMenuIcon(MenuItem item);
68 |
69 | void swipeRefreshStatus(boolean show);
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Contract/MeizhiContract.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Contract;
21 |
22 | import me.chkfung.meizhigank.Base.BaseContract;
23 | import me.chkfung.meizhigank.Dagger.Presenter.MeizhiPresenter;
24 | import rx.Observable;
25 |
26 | /**
27 | * Meizhi Activity MVP Contract
28 | * Created by Fung on 26/07/2016.
29 | */
30 |
31 | public interface MeizhiContract {
32 | interface Presenter extends BaseContract.Presenter {
33 |
34 | /**
35 | * Save Image to Storage
36 | * @param url URL
37 | */
38 | @SuppressWarnings("unused")
39 | void SaveImage(String url);
40 |
41 | /**
42 | * Download Image using OkHttpClient
43 | * @param mUrl URL
44 | * @return Uri for informing gallery to update
45 | */
46 | @SuppressWarnings("unused")
47 | Observable DownloadImage(String mUrl);
48 |
49 |
50 | }
51 |
52 | interface View extends BaseContract.View {
53 | @SuppressWarnings("unused")
54 | void SaveMenuTapped();
55 |
56 | void DownloadFailure();
57 |
58 | void ImageSaved();
59 |
60 | void updateProgressBar(float progress);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Component/AppComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Component;
21 |
22 | import android.app.Application;
23 | import android.content.SharedPreferences;
24 |
25 | import javax.inject.Singleton;
26 |
27 | import dagger.Component;
28 | import me.chkfung.meizhigank.Dagger.Module.AppModule;
29 | import me.chkfung.meizhigank.Dagger.Module.NetModule;
30 | import me.chkfung.meizhigank.MeizhiApp;
31 | import me.chkfung.meizhigank.NetworkApi;
32 | import rx.Scheduler;
33 |
34 | /**
35 | * AppComponent preserved by Application class to maintain global
36 | * Created by Fung on 12/08/2016.
37 | */
38 | @Singleton
39 | @Component(
40 | modules = {
41 | AppModule.class,
42 | NetModule.class
43 | }
44 | )
45 | public interface AppComponent {
46 | @SuppressWarnings("unused")
47 | void inject(MeizhiApp meizhiApp);
48 |
49 | @SuppressWarnings("unused")
50 | Application getApplication();
51 |
52 | NetworkApi getNetworkApi();
53 |
54 | Scheduler getScheduler();
55 |
56 | SharedPreferences getSharedPreferences();
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Component/GankPresenterComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Component;
21 |
22 | import dagger.Component;
23 | import me.chkfung.meizhigank.Dagger.Module.GankPresenterModule;
24 | import me.chkfung.meizhigank.Dagger.PresenterScope;
25 | import me.chkfung.meizhigank.ui.GankActivity;
26 |
27 | /**
28 | * Gank Presenter Component injection
29 | * Created by Fung on 26/08/2016.
30 | */
31 | @PresenterScope
32 | @Component(
33 | modules = GankPresenterModule.class,
34 | dependencies = AppComponent.class
35 | )
36 | public interface GankPresenterComponent {
37 | void inject(GankActivity gankActivity);
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Component/MainPresenterComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Component;
21 |
22 | import dagger.Component;
23 | import me.chkfung.meizhigank.Dagger.Module.MainPresenterModule;
24 | import me.chkfung.meizhigank.Dagger.PresenterScope;
25 | import me.chkfung.meizhigank.ui.MainActivity;
26 |
27 | /**
28 | * Main Presenter Component Injection
29 | * Created by Fung on 25/08/2016.
30 | */
31 | @PresenterScope
32 | @Component(
33 | dependencies = {AppComponent.class},
34 | modules = {MainPresenterModule.class}
35 | )
36 | public interface MainPresenterComponent {
37 | void inject(MainActivity mainActivity);
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Component/MeizhiPresenterComponent.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Component;
21 |
22 | import dagger.Component;
23 | import me.chkfung.meizhigank.Dagger.Module.MeizhiPresenterModule;
24 | import me.chkfung.meizhigank.Dagger.PresenterScope;
25 | import me.chkfung.meizhigank.ui.MeizhiActivity;
26 |
27 | /**
28 | * Meizhi Presenter Component Injection
29 | * Created by Fung on 29/08/2016.
30 | */
31 | @PresenterScope
32 | @Component(
33 | modules = MeizhiPresenterModule.class,
34 | dependencies = AppComponent.class
35 | )
36 | public interface MeizhiPresenterComponent {
37 | void inject(MeizhiActivity meizhiActivity);
38 | }
39 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Module/AppModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Module;
21 |
22 | import android.app.Application;
23 | import android.content.Context;
24 | import android.content.SharedPreferences;
25 |
26 | import javax.inject.Singleton;
27 |
28 | import dagger.Module;
29 | import dagger.Provides;
30 | import me.chkfung.meizhigank.Constants;
31 |
32 | /**
33 | * AppModule provide required object
34 | * Created by Fung on 12/08/2016.
35 | */
36 | @Module
37 | public class AppModule {
38 |
39 | private final Application mApplication;
40 |
41 | public AppModule(Application application) {
42 | mApplication = application;
43 | }
44 |
45 | @Provides
46 | @Singleton
47 | Application provideApplication() {
48 | return mApplication;
49 | }
50 |
51 | @Provides
52 | @Singleton
53 | SharedPreferences provideSharedPreferences(Application application) {
54 | return application.getSharedPreferences(Constants.SHARED_PREF, Context.MODE_PRIVATE);
55 | }
56 |
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Module/GankPresenterModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Module;
21 |
22 | import android.content.Context;
23 | import android.graphics.BitmapFactory;
24 | import android.support.customtabs.CustomTabsIntent;
25 | import android.support.v4.content.ContextCompat;
26 |
27 | import dagger.Module;
28 | import dagger.Provides;
29 | import me.chkfung.meizhigank.Contract.GankContract;
30 | import me.chkfung.meizhigank.Dagger.PresenterScope;
31 | import me.chkfung.meizhigank.R;
32 |
33 | import static me.chkfung.meizhigank.Util.CommonUtil.getPackageNameToUse;
34 |
35 | /**
36 | * Gank Presenter Module to provide required Object
37 | * Created by Fung on 26/08/2016.
38 | */
39 | @Module
40 | public class GankPresenterModule {
41 | private final GankContract.View mView;
42 |
43 |
44 | public GankPresenterModule(GankContract.View view) {
45 | mView = view;
46 | }
47 |
48 | @PresenterScope
49 | @Provides
50 | GankContract.View provideGankContractView() {
51 | return mView;
52 | }
53 |
54 | @PresenterScope
55 | @Provides
56 | Context provideContext() {
57 | return mView.getContext();
58 | }
59 |
60 | @PresenterScope
61 | @Provides
62 | CustomTabsIntent.Builder provideCustomTabIntent(GankContract.View view) {
63 | String chromeAvailable = getPackageNameToUse(view.getContext());
64 | //Dagger 2 cannot return null, maybe I should do this somewhere else.
65 | if (chromeAvailable == null)
66 | return new CustomTabsIntent.Builder();
67 | else {
68 | Context mContext = view.getContext();
69 | CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder();
70 | builder.setToolbarColor(ContextCompat.getColor(mContext, R.color.colorPrimary))
71 | .setShowTitle(true);
72 |
73 | builder.setStartAnimations(mContext, R.anim.right_in, R.anim.right_out);
74 | builder.setExitAnimations(mContext, R.anim.right_in_back, R.anim.right_out_back);
75 | builder.setCloseButtonIcon(
76 | BitmapFactory.decodeResource(mContext.getResources(), android.R.drawable.ic_menu_close_clear_cancel));
77 | return builder;
78 | }
79 | }
80 |
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Module/MainPresenterModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Module;
21 |
22 | import android.content.Context;
23 |
24 | import dagger.Module;
25 | import dagger.Provides;
26 | import me.chkfung.meizhigank.Contract.MainContract;
27 | import me.chkfung.meizhigank.Dagger.PresenterScope;
28 |
29 | /**
30 | * Provide Main Presenter Object
31 | * Created by Fung on 25/08/2016.
32 | */
33 | @Module
34 | public class MainPresenterModule {
35 | private final MainContract.View mView;
36 |
37 | public MainPresenterModule(MainContract.View mView) {
38 | this.mView = mView;
39 | }
40 |
41 | @PresenterScope
42 | @Provides
43 | MainContract.View providesMainContractView() {
44 | return mView;
45 | }
46 |
47 | @PresenterScope
48 | @Provides
49 | Context provideContext() {
50 | return mView.getContext();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Module/MeizhiPresenterModule.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Module;
21 |
22 | import android.content.Context;
23 |
24 | import dagger.Module;
25 | import dagger.Provides;
26 | import me.chkfung.meizhigank.Contract.MeizhiContract;
27 | import me.chkfung.meizhigank.Dagger.PresenterScope;
28 |
29 | /**
30 | * Provide Meizhi Presenter Object
31 | * Created by Fung on 29/08/2016.
32 | */
33 | @Module
34 | public class MeizhiPresenterModule {
35 | private final MeizhiContract.View mView;
36 |
37 | public MeizhiPresenterModule(MeizhiContract.View view) {
38 | mView = view;
39 | }
40 |
41 | @PresenterScope
42 | @Provides
43 | MeizhiContract.View provideView() {
44 | return mView;
45 | }
46 |
47 | @PresenterScope
48 | @Provides
49 | Context provideContext() {
50 | return mView.getContext();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Presenter/GankPresenter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Presenter;
21 |
22 | import java.util.Collections;
23 |
24 | import javax.inject.Inject;
25 |
26 | import me.chkfung.meizhigank.Contract.GankContract;
27 | import me.chkfung.meizhigank.Model.Day;
28 | import me.chkfung.meizhigank.NetworkApi;
29 | import rx.Scheduler;
30 | import rx.Subscriber;
31 | import rx.Subscription;
32 | import rx.android.schedulers.AndroidSchedulers;
33 |
34 | /**
35 | * Gank Presenter that perform business logic
36 | * Created by Fung on 04/08/2016.
37 | */
38 |
39 | public class GankPresenter implements GankContract.Presenter {
40 | @Inject
41 | NetworkApi networkApi;
42 | @Inject
43 | Scheduler scheduler;
44 | private GankContract.View mView;
45 | private Subscription mSubscription;
46 |
47 | @Inject
48 | GankPresenter(GankContract.View view) {
49 | this.mView = view;
50 | }
51 |
52 | @Override
53 | public void getGank(String date) {
54 | if (mSubscription != null) mSubscription.unsubscribe();
55 | mSubscription = networkApi.getDay(date)
56 | .subscribeOn(scheduler)
57 | .observeOn(AndroidSchedulers.mainThread())
58 | .subscribe(new Subscriber() {
59 | @Override
60 | public void onCompleted() {
61 |
62 | }
63 |
64 | @Override
65 | public void onError(Throwable e) {
66 | mView.showError(e);
67 | }
68 |
69 | @Override
70 | public void onNext(Day day) {
71 | Collections.sort(day.getCategory());
72 | mView.setupRecycleView(day);
73 | }
74 | });
75 | }
76 |
77 | @Override
78 | public void detachView() {
79 | mView = null;
80 | if (mSubscription != null) mSubscription.unsubscribe();
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/Presenter/MainPresenter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger.Presenter;
21 |
22 | import java.util.ArrayList;
23 |
24 | import javax.inject.Inject;
25 |
26 | import me.chkfung.meizhigank.Constants;
27 | import me.chkfung.meizhigank.Contract.MainContract;
28 | import me.chkfung.meizhigank.Model.DataInfo;
29 | import me.chkfung.meizhigank.Model.Meizhi;
30 | import me.chkfung.meizhigank.NetworkApi;
31 | import rx.Observable;
32 | import rx.Scheduler;
33 | import rx.Subscriber;
34 | import rx.Subscription;
35 | import rx.android.schedulers.AndroidSchedulers;
36 | import rx.functions.Func1;
37 |
38 | /**
39 | * Main Presenter that perform business logic
40 | * Created by Fung on 26/07/2016.
41 | */
42 |
43 | public class MainPresenter implements MainContract.Presenter {
44 | @Inject
45 | NetworkApi networkApi;
46 | @Inject
47 | Scheduler scheduler;
48 | private MainContract.View mView;
49 | private Subscription mSubscription;
50 | private ArrayList MeizhiData = new ArrayList<>();
51 |
52 | @Inject
53 | MainPresenter(MainContract.View mView) {
54 | this.mView = mView;
55 | mView.getAdapter().setMeizhiList(MeizhiData);
56 | }
57 |
58 | @Override
59 | public void loadMeizhi(final boolean clearItem) {
60 | mView.swipeRefreshStatus(true);
61 | int page = 1;
62 | if (!clearItem)
63 | page += MeizhiData.size() / 10;
64 |
65 | if (mSubscription != null) mSubscription.unsubscribe();
66 | mSubscription = networkApi.getMeizhi(Constants.MEIZHI_AMOUNT, page)
67 | .observeOn(AndroidSchedulers.mainThread())
68 | .subscribeOn(scheduler)
69 | .flatMap(new Func1>() {
70 | @Override
71 | public Observable call(Meizhi meizhi) {
72 | return Observable.from(meizhi.getResults());
73 | }
74 | })
75 | .subscribe(new Subscriber() {
76 | ArrayList TempData = new ArrayList();
77 |
78 | @Override
79 | public void onCompleted() {
80 | updateAdapter(clearItem, TempData);
81 | }
82 |
83 | @Override
84 | public void onError(Throwable e) {
85 | mView.networkError(e);
86 | }
87 |
88 | @Override
89 | public void onNext(DataInfo resultsBean) {
90 | TempData.add(resultsBean);
91 | }
92 | });
93 | }
94 |
95 | @Override
96 | public void updateAdapter(boolean clearItem, ArrayList newData) {
97 | if (clearItem) {
98 | MeizhiData.clear();
99 | MeizhiData.addAll(newData);
100 | mView.getAdapter().notifyDataSetChanged();
101 | } else {
102 | MeizhiData.addAll(newData);
103 | mView.getAdapter().notifyItemRangeChanged(MeizhiData.size(), Constants.MEIZHI_AMOUNT);
104 | }
105 | mView.swipeRefreshStatus(false);
106 | }
107 |
108 | @Override
109 | public void detachView() {
110 | mView = null;
111 | if (mSubscription != null) mSubscription.unsubscribe();
112 | }
113 |
114 | @Override
115 | public ArrayList getData() {
116 | return MeizhiData;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Dagger/PresenterScope.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Dagger;
21 |
22 | import javax.inject.Scope;
23 |
24 | /**
25 | * Presenter Scope is not maintained, thus it life cycle will be destroy with activity
26 | * Created by Fung on 25/08/2016.
27 | */
28 |
29 | @Scope
30 | public @interface PresenterScope {
31 | }
32 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/MeizhiApp.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank;
21 |
22 | import android.app.Application;
23 | import android.content.Context;
24 |
25 | //import com.crashlytics.android.Crashlytics;
26 | import com.orhanobut.logger.Logger;
27 |
28 | //import io.fabric.sdk.android.Fabric;
29 | import me.chkfung.meizhigank.Dagger.Component.AppComponent;
30 | import me.chkfung.meizhigank.Dagger.Component.DaggerAppComponent;
31 | import me.chkfung.meizhigank.Dagger.Module.AppModule;
32 | import me.chkfung.meizhigank.Dagger.Module.NetModule;
33 |
34 | //import com.frogermcs.androiddevmetrics.AndroidDevMetrics;
35 |
36 | /**
37 | * Application Class to initialize Dagger dependencies
38 | * Created by Fung on 21/07/2016.
39 | */
40 |
41 | public class MeizhiApp extends Application {
42 |
43 | private AppComponent appComponent;
44 |
45 | public static MeizhiApp get(Context context) {
46 | return (MeizhiApp) context.getApplicationContext();
47 | }
48 |
49 | @Override
50 | public void onCreate() {
51 | super.onCreate();
52 |
53 | if (BuildConfig.DEBUG) {
54 | Logger.init("Tibber Say");
55 | // LeakCanary.install(this);
56 | } else {
57 | Logger.init("Tibber Say");
58 | // Logger.init().setLogLevel(LogLevel.NONE);
59 | // Fabric.with(this, new Crashlytics());
60 | }
61 |
62 | appComponent = DaggerAppComponent.builder()
63 | .appModule(new AppModule(this))
64 | .netModule(new NetModule())
65 | .build();
66 | }
67 |
68 | public AppComponent getAppComponent() {
69 | return appComponent;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/MeizhiImageView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank;
21 |
22 | import android.content.Context;
23 | import android.util.AttributeSet;
24 | import android.widget.ImageView;
25 |
26 | /**
27 | * Can be removed
28 | * Created by Fung on 25/07/2016.
29 | */
30 |
31 | public class MeizhiImageView extends ImageView {
32 |
33 | private int originalWidth;
34 | private int originalHeight;
35 |
36 | public MeizhiImageView(Context context) {
37 | super(context);
38 | }
39 |
40 | public MeizhiImageView(Context context, AttributeSet attrs) {
41 | super(context, attrs);
42 | }
43 |
44 | public MeizhiImageView(Context context, AttributeSet attrs, int defStyleAttr) {
45 | super(context, attrs, defStyleAttr);
46 | }
47 |
48 | public void setOriginalSize(int originalWidth, int originalHeight) {
49 | this.originalWidth = originalWidth;
50 | this.originalHeight = originalHeight;
51 | }
52 |
53 | @Override
54 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
55 | if (originalWidth > 0 && originalHeight > 0) {
56 | float ratio = (float) originalWidth / (float) originalHeight;
57 |
58 | int width = MeasureSpec.getSize(widthMeasureSpec);
59 | int height = MeasureSpec.getSize(heightMeasureSpec);
60 |
61 | if (width > 0) {
62 | height = (int) ((float) width / ratio);
63 | } else if (height > 0) {
64 | width = (int) ((float) height * ratio);
65 | }
66 |
67 | setMeasuredDimension(width, height);
68 | } else {
69 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/NetworkApi.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank;
21 |
22 | import me.chkfung.meizhigank.Model.Day;
23 | import me.chkfung.meizhigank.Model.Meizhi;
24 | import retrofit2.http.GET;
25 | import retrofit2.http.Path;
26 | import rx.Observable;
27 |
28 | /**
29 | * Network API
30 | * Created by Fung on 21/07/2016.
31 | */
32 |
33 | public interface NetworkApi {
34 |
35 |
36 | @SuppressWarnings("SameParameterValue")
37 | @GET("api/data/福利/{amount}/{page}")
38 | Observable getMeizhi(@Path("amount") int meizhiCount, @Path("page") int page);
39 |
40 | @GET("api/day/{date}")
41 | Observable getDay(@Path("date") String date);
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Service/BootReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.service;
21 |
22 | import android.content.BroadcastReceiver;
23 | import android.content.Context;
24 | import android.content.Intent;
25 |
26 | /**
27 | * This Receiver will re-activate the alarm after device reboot.
28 | * If the notification disabled in Main Activity, this service will be disabled as well
29 | * Created by Fung on 31/08/2016.
30 | */
31 |
32 | public class BootReceiver extends BroadcastReceiver {
33 | private final AlarmReceiver alarmReceiver = new AlarmReceiver();
34 |
35 | @Override
36 | public void onReceive(Context context, Intent intent) {
37 | if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED"))
38 | alarmReceiver.setAlarm(context);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Service/SchedulingService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.service;
21 |
22 | import android.app.IntentService;
23 | import android.app.NotificationManager;
24 | import android.app.PendingIntent;
25 | import android.content.Context;
26 | import android.content.Intent;
27 | import android.graphics.BitmapFactory;
28 | import android.support.v4.app.NotificationCompat;
29 |
30 | import java.util.Calendar;
31 |
32 | import me.chkfung.meizhigank.R;
33 | import me.chkfung.meizhigank.ui.MainActivity;
34 |
35 | /**
36 | * Notification Settings
37 | * Created by Fung on 31/08/2016.
38 | */
39 |
40 | public class SchedulingService extends IntentService {
41 | // An ID used to post the notification.
42 | private static final int NOTIFICATION_ID = 1;
43 |
44 | public SchedulingService() {
45 | super("SchedulingService");
46 | }
47 |
48 | @Override
49 | protected void onHandleIntent(Intent intent) {
50 |
51 | Calendar calendar = Calendar.getInstance();
52 | int day = calendar.get(Calendar.DAY_OF_WEEK);
53 | if (day > 0 && day < 6)
54 | sendNotification();
55 | AlarmReceiver.completeWakefulIntent(intent);
56 | }
57 |
58 | private void sendNotification() {
59 | NotificationManager mNotificationManager = (NotificationManager)
60 | this.getSystemService(Context.NOTIFICATION_SERVICE);
61 |
62 | PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
63 | new Intent(this, MainActivity.class), 0);
64 |
65 | NotificationCompat.Builder mBuilder =
66 | new NotificationCompat.Builder(this)
67 | .setSmallIcon( R.drawable.ic_stat_notificon)
68 | .setLargeIcon(BitmapFactory.decodeResource(getResources(),R.mipmap.ic_launcher))
69 | .setContentTitle(getResources().getString(R.string.app_name))
70 | .setStyle(new NotificationCompat.BigTextStyle()
71 | .bigText(getString(R.string.Notification_bigText)))
72 | .setContentText(getString(R.string.Notification_content))
73 | .setAutoCancel(true);
74 |
75 | mBuilder.setContentIntent(contentIntent);
76 | mNotificationManager.notify(NOTIFICATION_ID, mBuilder.build());
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/UI/AboutMeActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.ui;
21 |
22 | import android.content.pm.PackageInfo;
23 | import android.content.pm.PackageManager;
24 | import android.os.Bundle;
25 | import android.support.annotation.Nullable;
26 | import android.support.v4.view.animation.FastOutSlowInInterpolator;
27 | import android.support.v7.widget.LinearLayoutManager;
28 | import android.support.v7.widget.RecyclerView;
29 | import android.view.Menu;
30 | import android.view.MenuItem;
31 | import android.view.animation.Animation;
32 | import android.view.animation.AnimationUtils;
33 | import android.widget.TextView;
34 |
35 | import butterknife.BindView;
36 | import me.chkfung.meizhigank.Base.BaseActivity;
37 | import me.chkfung.meizhigank.R;
38 | import me.chkfung.meizhigank.Util.CommonUtil;
39 | import me.chkfung.meizhigank.ui.Adapter.AboutRvAdapter;
40 |
41 | import static me.chkfung.meizhigank.Util.CommonUtil.FancyAnimation;
42 |
43 | /**
44 | * About Me Activity
45 | * Created by Fung on 15/08/2016.
46 | */
47 |
48 | public class AboutMeActivity extends BaseActivity {
49 | @BindView(R.id.version)
50 | TextView version;
51 | @BindView(R.id.toolbar_title)
52 | TextView toolbarTitle;
53 | @BindView(R.id.rv_about)
54 | RecyclerView rvAbout;
55 | @BindView(R.id.AppName)
56 | TextView AppName;
57 |
58 | @Override
59 | protected void onCreate(@Nullable Bundle savedInstanceState) {
60 | super.onCreate(savedInstanceState);
61 | setContentView(R.layout.activity_aboutme);
62 |
63 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
64 | PackageManager pck = getPackageManager();
65 | String ver;
66 | try {
67 | PackageInfo pckInfo = pck.getPackageInfo(getPackageName(), 0);
68 | ver = pckInfo.versionName + "." + pckInfo.versionCode;
69 | } catch (Exception e) {
70 | ver = getString(R.string.version_error);
71 | }
72 | version.setText(ver);
73 |
74 | String[][] item = {
75 | {"Butterknife", "Jake Wharton"},
76 | {"Dagger 2", "Google, Square"},
77 | {"Glide", "Bumptech"},
78 | {"Gson", "Google"},
79 | {"Leak Canary", "Square"},
80 | {"Logger", "Orhan Obut"},
81 | {"Retrofit", "Square"},
82 | {"RxAndroid", "RxAndroid authors"},
83 | {"Support Library", "Android Developers"},
84 | };
85 |
86 | rvAbout.setNestedScrollingEnabled(false);
87 | rvAbout.setLayoutManager(new LinearLayoutManager(this));
88 | rvAbout.setAdapter(new AboutRvAdapter(item));
89 |
90 | if (savedInstanceState == null) {
91 | FancyAnimation(toolbarTitle);
92 | Animation animation = AnimationUtils.loadAnimation(this, R.anim.anim_fade_scale);
93 | animation.setInterpolator(new FastOutSlowInInterpolator());
94 | AppName.startAnimation(animation);
95 | }
96 | }
97 |
98 | @Override
99 | public boolean onOptionsItemSelected(MenuItem item) {
100 | switch (item.getItemId()) {
101 | case android.R.id.home:
102 | onBackPressed();
103 | break;
104 | case R.id.action_share:
105 | CommonUtil.Share(this,getString(R.string.share_app_title),getString(R.string.share_app_url),getString(R.string.share_app_intent_chooser));
106 | break;
107 | }
108 | return super.onOptionsItemSelected(item);
109 | }
110 |
111 | @Override
112 | public boolean onCreateOptionsMenu(Menu menu) {
113 | getMenuInflater().inflate(R.menu.menu_about,menu);
114 | return super.onCreateOptionsMenu(menu);
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/UI/Adapter/AboutRvAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.ui.Adapter;
21 |
22 | import android.support.v7.widget.RecyclerView;
23 | import android.view.LayoutInflater;
24 | import android.view.View;
25 | import android.view.ViewGroup;
26 | import android.widget.TextView;
27 |
28 | import butterknife.BindView;
29 | import butterknife.ButterKnife;
30 | import me.chkfung.meizhigank.R;
31 |
32 | /**
33 | * Adapter for Open Source Library Author in About me
34 | * {@link me.chkfung.meizhigank.ui.AboutMeActivity}
35 | * Created by Fung on 23/08/2016.
36 | */
37 |
38 | public class AboutRvAdapter extends RecyclerView.Adapter {
39 | private final String[][] data;
40 |
41 | public AboutRvAdapter(String[][] data) {
42 | this.data = data;
43 | }
44 |
45 | @Override
46 | public AboutRvAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
47 | return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_aboutme, parent, false));
48 |
49 | }
50 |
51 | @Override
52 | public void onBindViewHolder(AboutRvAdapter.ViewHolder holder, int position) {
53 | String formattedText = holder.itemView.getResources().getString(R.string.format_open_source_library_author, data[position][0], data[position][1]);
54 | holder.title.setText(formattedText);
55 | }
56 |
57 | @Override
58 | public int getItemCount() {
59 | return data.length;
60 | }
61 |
62 | class ViewHolder extends RecyclerView.ViewHolder {
63 | @BindView(R.id.title)
64 | TextView title;
65 |
66 | public ViewHolder(View view) {
67 | super(view);
68 | ButterKnife.bind(this, view);
69 | }
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/UI/Adapter/GankInfoRvAdapter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.ui.Adapter;
21 |
22 | import android.content.Context;
23 | import android.support.v7.widget.RecyclerView;
24 | import android.view.LayoutInflater;
25 | import android.view.View;
26 | import android.view.ViewGroup;
27 | import android.widget.TextView;
28 |
29 | import java.util.ArrayList;
30 |
31 | import butterknife.BindView;
32 | import butterknife.ButterKnife;
33 | import me.chkfung.meizhigank.Model.DataInfo;
34 | import me.chkfung.meizhigank.R;
35 | import me.chkfung.meizhigank.ui.WebActivity;
36 |
37 | /**
38 | * Recycler View in Gank Activity Grid Layout
39 | * A Simple Recycler View that open a Web View
40 | * {@link me.chkfung.meizhigank.ui.GankInfoActivity}
41 | * Created by Fung on 10/08/2016.
42 | */
43 |
44 | public class GankInfoRvAdapter extends RecyclerView.Adapter {
45 | private final ArrayList Data;
46 |
47 | public GankInfoRvAdapter(ArrayList Data) {
48 | this.Data = Data;
49 | }
50 |
51 | @Override
52 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
53 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_gankinfo, parent, false);
54 | return new ViewHolder(v);
55 | }
56 |
57 | @Override
58 | public void onBindViewHolder(final ViewHolder holder, int position) {
59 | final String titleText = Data.get(position).getDesc();
60 | holder.title.setText(titleText);
61 | holder.title.setOnClickListener(new View.OnClickListener() {
62 | @Override
63 | public void onClick(View v) {
64 | Context context = holder.itemView.getContext();
65 | context.startActivity(
66 | WebActivity.newIntent(context, titleText, Data.get(holder.getAdapterPosition()).getUrl()));
67 | }
68 | });
69 | }
70 |
71 | @Override
72 | public int getItemCount() {
73 | return Data.size();
74 | }
75 |
76 | class ViewHolder extends RecyclerView.ViewHolder {
77 | @BindView(R.id.title)
78 | TextView title;
79 |
80 | ViewHolder(View view) {
81 | super(view);
82 | ButterKnife.bind(this, view);
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/UI/AdapterCallBack/GankDiffUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.ui.AdapterCallBack;
21 |
22 | import android.support.v7.util.DiffUtil;
23 |
24 | import java.util.Objects;
25 |
26 | import me.chkfung.meizhigank.Model.Day;
27 |
28 | /**
29 | * New Util introduce in Support 24.2.0
30 | * Still Figuring Use cases
31 | * Created by Fung on 29/08/2016.
32 | */
33 |
34 | public class GankDiffUtil extends DiffUtil.Callback {
35 | private final Day oldData;
36 | private final Day newData;
37 |
38 | public GankDiffUtil(Day oldData, Day newData) {
39 | this.oldData = oldData;
40 | this.newData = newData;
41 | }
42 |
43 | @Override
44 | public int getOldListSize() {
45 | return oldData.getCategory().size();
46 | }
47 |
48 | @Override
49 | public int getNewListSize() {
50 | return newData.getCategory().size();
51 | }
52 |
53 | @Override
54 | public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
55 | return Objects.equals(oldData.getCategory().get(oldItemPosition), newData.getCategory().get(newItemPosition));
56 | }
57 |
58 | @Override
59 | public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
60 | return Objects.equals(oldData.getCategory().get(oldItemPosition), newData.getCategory().get(newItemPosition));
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/UI/AdapterCallBack/MeizhiDiffUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.ui.AdapterCallBack;
21 |
22 | import android.support.v7.util.DiffUtil;
23 |
24 | import java.util.List;
25 | import java.util.Objects;
26 |
27 | import me.chkfung.meizhigank.Model.DataInfo;
28 |
29 | /**
30 | * New Util introduce in Support 24.2.0
31 | * Still Figuring Use cases
32 | * Created by Fung on 23/08/2016.
33 | */
34 |
35 | public class MeizhiDiffUtil extends DiffUtil.Callback {
36 | private final List oldMeizhi;
37 | private final List newMeizhi;
38 |
39 | public MeizhiDiffUtil(List oldMeizhi, List newMeizhi) {
40 | this.oldMeizhi = oldMeizhi;
41 | this.newMeizhi = newMeizhi;
42 | }
43 |
44 | @Override
45 | public int getOldListSize() {
46 | return oldMeizhi.size();
47 | }
48 |
49 | @Override
50 | public int getNewListSize() {
51 | return newMeizhi.size();
52 | }
53 |
54 | @Override
55 | public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {
56 | return Objects.equals(oldMeizhi.get(oldItemPosition).get_id(), newMeizhi.get(newItemPosition).get_id());
57 | }
58 |
59 | @Override
60 | public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
61 | return Objects.equals(oldMeizhi.get(oldItemPosition).getUrl(), newMeizhi.get(newItemPosition).getUrl());
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/UI/GankInfoActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.ui;
21 |
22 | import android.animation.Animator;
23 | import android.os.Build;
24 | import android.os.Bundle;
25 | import android.support.annotation.Nullable;
26 | import android.support.v7.widget.LinearLayoutManager;
27 | import android.support.v7.widget.RecyclerView;
28 | import android.view.ViewAnimationUtils;
29 | import android.view.animation.AccelerateInterpolator;
30 | import android.widget.ImageView;
31 | import android.widget.LinearLayout;
32 | import android.widget.TextView;
33 |
34 | import java.util.ArrayList;
35 |
36 | import butterknife.BindView;
37 | import butterknife.OnClick;
38 | import me.chkfung.meizhigank.Base.BaseActivity;
39 | import me.chkfung.meizhigank.Model.DataInfo;
40 | import me.chkfung.meizhigank.R;
41 | import me.chkfung.meizhigank.ui.Adapter.GankInfoRvAdapter;
42 |
43 | /**
44 | * Gank Info Activity
45 | * Created by Fung on 09/08/2016.
46 | */
47 |
48 | public class GankInfoActivity extends BaseActivity {
49 | @BindView(R.id.headerImage)
50 | ImageView headerImage;
51 | @BindView(R.id.category)
52 | TextView category;
53 | @BindView(R.id.rv_gankinfo)
54 | RecyclerView rvGankinfo;
55 | @BindView(R.id.revealTest)
56 | LinearLayout revealTest;
57 |
58 | @Override
59 | protected void onCreate(@Nullable Bundle savedInstanceState) {
60 | super.onCreate(savedInstanceState);
61 | setContentView(R.layout.activity_gankinfo);
62 | ArrayList mData;
63 | mData = getIntent().getParcelableArrayListExtra("Data");
64 | category.setText(mData.get(0).getType());
65 |
66 | rvGankinfo.setAdapter(new GankInfoRvAdapter(mData));
67 | rvGankinfo.setLayoutManager(new LinearLayoutManager(this));
68 | revealTest.post(new Runnable() {
69 | @Override
70 | public void run() {
71 |
72 | if (Build.VERSION.SDK_INT > 21) {
73 | Animator circularReveal = ViewAnimationUtils.createCircularReveal(revealTest, revealTest.getWidth() / 2, 0, 0, revealTest.getWidth());
74 | circularReveal.setDuration(500);
75 | circularReveal.setInterpolator(new AccelerateInterpolator(1.5f));
76 | circularReveal.start();
77 | }
78 | }
79 | });
80 | }
81 |
82 | @OnClick({R.id.close_button})
83 | void Close() {
84 | this.onBackPressed();
85 | }
86 |
87 | @Override
88 | public void onBackPressed() {
89 | super.onBackPressed();
90 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
91 | overridePendingTransition(R.anim.pre_lolipop_enter, R.anim.pre_lolipop_exit);
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Util/ConnectionUtil.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Util;
21 |
22 | import android.content.Context;
23 | import android.net.ConnectivityManager;
24 |
25 | /**
26 | * Detect Connectivity
27 | * Created by Fung on 03/08/2016.
28 | */
29 |
30 | public class ConnectionUtil {
31 | /**
32 | * Check Network availability
33 | *
34 | * @param mContext Current Context
35 | * @return true = Available
36 | */
37 | public static boolean isNetworkAvailable(Context mContext) {
38 | ConnectivityManager connectivityManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
39 | return connectivityManager.getActiveNetworkInfo() != null && connectivityManager.getActiveNetworkInfo().isConnectedOrConnecting();
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/Util/PermissionUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.Util;
21 |
22 | import android.app.Activity;
23 | import android.content.pm.PackageManager;
24 | import android.support.v4.app.ActivityCompat;
25 |
26 | import java.util.ArrayList;
27 | import java.util.List;
28 |
29 | /**
30 | * Permission Util for easy life
31 | * Created by Fung on 01/08/2016.
32 | */
33 |
34 | public class PermissionUtils {
35 | @SuppressWarnings("SameParameterValue")
36 | public static boolean requestPermission(Activity activity, int requestCode, String... permissions) {
37 | boolean granted = true;
38 | List permissionRequired = new ArrayList<>();
39 | for (String s : permissions) {
40 | int permissionCode = ActivityCompat.checkSelfPermission(activity, s);
41 | if (permissionCode == PackageManager.PERMISSION_DENIED) {
42 | permissionRequired.add(s);
43 | granted = false;
44 | }
45 | }
46 | if (granted)
47 | return granted;
48 | else {
49 | ActivityCompat.requestPermissions(activity,
50 | permissionRequired.toArray(new String[permissionRequired.size()]),
51 | requestCode);
52 | return false;
53 | }
54 | }
55 |
56 | @SuppressWarnings("SameParameterValue")
57 | public static boolean permissionGranted(int requestCode, int permissionCode, int[] grantResults) {
58 | if (requestCode != permissionCode) {
59 | return false;
60 | }
61 | return grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/ui/widget/ExpandView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.ui.widget;
21 |
22 | import android.content.Context;
23 | import android.util.AttributeSet;
24 | import android.widget.FrameLayout;
25 |
26 | /**
27 | * A View that width = height
28 | * Created by Fung on 09/08/2016.
29 | */
30 |
31 | public class ExpandView extends FrameLayout {
32 | public ExpandView(Context context) {
33 | super(context);
34 | }
35 |
36 | public ExpandView(Context context, AttributeSet attrs) {
37 | super(context, attrs);
38 | }
39 |
40 | public ExpandView(Context context, AttributeSet attrs, int defStyleAttr) {
41 | super(context, attrs, defStyleAttr);
42 | }
43 |
44 | @Override
45 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
46 | super.onMeasure(widthMeasureSpec, heightMeasureSpec);
47 | int width = getMeasuredWidth();
48 | setMeasuredDimension(width, width);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/me/chkfung/meizhigank/ui/widget/ScrollAwareFABBehavior.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | package me.chkfung.meizhigank.ui.widget;
21 |
22 | import android.content.Context;
23 | import android.support.design.widget.CoordinatorLayout;
24 | import android.support.design.widget.FloatingActionButton;
25 | import android.support.v4.view.ViewCompat;
26 | import android.util.AttributeSet;
27 | import android.view.View;
28 |
29 | /**
30 | * Scroll Aware Behavior
31 | * Created by Fung on 18/08/2016.
32 | */
33 |
34 | public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior {
35 | public ScrollAwareFABBehavior(Context context, AttributeSet attrs) {
36 | super();
37 | }
38 |
39 | @Override
40 | public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
41 | final View directTargetChild, final View target, final int nestedScrollAxes) {
42 | // Ensure we react to vertical scrolling
43 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL
44 | || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes);
45 | }
46 |
47 | @Override
48 | public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child,
49 | final View target, final int dxConsumed, final int dyConsumed,
50 | final int dxUnconsumed, final int dyUnconsumed) {
51 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed);
52 | if (dyConsumed > 0 && child.getVisibility() == View.VISIBLE) {
53 | // User scrolled down and the FAB is currently visible -> hide the FAB
54 | child.hide();
55 | } else if (dyConsumed < 0 && child.getVisibility() != View.VISIBLE) {
56 | // User scrolled up and the FAB is currently not visible -> show the FAB
57 | child.show();
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/anim_fade_scale.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
25 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/app_quit_in.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/app_quit_out.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/fade_in.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/fade_out.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/pre_lolipop_enter.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/pre_lolipop_exit.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
29 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/right_in.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/right_in_back.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
27 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/right_out.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
27 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/right_out_back.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi-v11/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-hdpi-v11/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/author_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-hdpi/author_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-hdpi/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_web_hi_res_144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-hdpi/ic_web_hi_res_144.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi-v11/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-mdpi-v11/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/author_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-mdpi/author_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-mdpi/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_web_hi_res_144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-mdpi/ic_web_hi_res_144.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/ic_keyboard_arrow_down.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/ic_nightmode.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/ic_notifications.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/ic_notifications_off.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/ic_octoface.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/ic_refresh.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/ic_share.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/ic_view_expand.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/ic_view_grid.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi-v11/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xhdpi-v11/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/author_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xhdpi/author_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xhdpi/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_web_hi_res_144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xhdpi/ic_web_hi_res_144.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi-v11/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xxhdpi-v11/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/author_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xxhdpi/author_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xxhdpi/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_web_hi_res_144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xxhdpi/ic_web_hi_res_144.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi-v11/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xxxhdpi-v11/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/author_image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xxxhdpi/author_image.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_stat_notificon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xxxhdpi/ic_stat_notificon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_web_hi_res_144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/drawable-xxxhdpi/ic_web_hi_res_144.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/circular_background.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
31 |
32 |
33 |
34 |
35 |
40 |
41 |
42 |
43 |
44 |
49 |
50 |
51 |
52 |
53 |
54 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_keyboard_arrow_down.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_nightmode.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notifications.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_notifications_off.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_octoface.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_refresh.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_share.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_view_expand.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_view_grid.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/launcher_coldstart.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_gank.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
45 |
46 |
51 |
52 |
58 |
59 |
60 |
65 |
66 |
71 |
72 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_gankinfo.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
27 |
28 |
36 |
37 |
44 |
45 |
52 |
53 |
58 |
59 |
64 |
65 |
66 |
67 |
75 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
27 |
28 |
29 |
30 |
35 |
36 |
44 |
45 |
46 |
47 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_meizhi.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
27 |
28 |
35 |
36 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_web.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
24 |
25 |
26 |
27 |
28 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_aboutme.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
26 |
27 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_expandable_gank_header.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
26 |
27 |
33 |
34 |
40 |
46 |
47 |
48 |
54 |
55 |
62 |
63 |
64 |
65 |
71 |
72 |
77 |
78 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_expandable_gank_list.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
30 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_gank.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
30 |
31 |
34 |
40 |
41 |
48 |
49 |
56 |
57 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_gankinfo.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
26 |
27 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/item_meizhi.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
25 |
26 |
30 |
31 |
38 |
39 |
46 |
47 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_toolbar.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
26 |
27 |
34 |
35 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_toolbar_pin.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
26 |
27 |
34 |
35 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_toolbar_trans.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
28 |
29 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/view_toolbar_web.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
27 |
28 |
35 |
36 |
41 |
42 |
51 |
52 |
61 |
62 |
63 |
64 |
65 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_about.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_gank.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_image.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_main.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
37 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_web.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/values-night/colors.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 | #ff243447
22 | #ff1b2836
23 | @color/md_blue_500
24 |
25 | @color/md_blue_grey_500
26 | @color/md_white_1000
27 | @color/md_blue_100
28 | @color/md_black_1000
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
24 | 64dp
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh/strings.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 | 关于
22 | 每天都会更新一篇值得阅读的程式员精选干货和一个精选妹纸!\n\n数据内容来源于代码家的 http://gank.io\n\n这个项目是用 MVP 和 Dagger 2 开发的,并且以 Uncle Bob\'s Clean Architecture 为模板以达到干净代码的实现。\n\n我的Github: https://github.com/chkfung\n此项目已在Github开源以支持开源精神,有兴趣的童鞋可以来看一看星一星!靴靴!
23 | 开源库
24 | 下载妹纸
25 | 分享
26 | 开发人员
27 | 展开 / 收起
28 | 妹纸
29 | 刷新
30 | 复制链接
31 | 通知
32 | 列 / 格
33 | 在浏览器打开
34 | 刷新
35 | 今天的日报和妹子都准备好了!
36 | 今天的日报和妹子都准备好了!
37 | 权限取得失败
38 | 取得权限! 请重启APP生效
39 | 设计与开发
40 | 下载失败
41 | 大师球捕抓妹子成功!
42 | 无法连接
43 | 通知取消
44 | 通知开启
45 | 请求失败: %s
46 | 重试
47 | 下载失败
48 | 分享APP
49 | 这个APP 可真棒!
50 | 分享妹子到
51 | 捕抓到一个妹子和你分享!
52 | 分享APP
53 | 分享链接
54 | 取得失败
55 | 点击卡片的标题可以打开干货页面!
56 |
--------------------------------------------------------------------------------
/app/src/main/res/values/android_material_design_colors.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
24 |
25 |
26 | #f44336
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | #BBDEFB
38 | #64B5F6
39 | #2196F3
40 | #1976D2
41 | #0D47A1
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | #BDBDBD
67 | #757575
68 | #000000
69 | #ffffff
70 |
71 |
72 | #607D8B
73 |
74 |
75 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 | @color/md_white_1000
22 | @color/md_grey_600
23 | @color/md_blue_500
24 | @color/md_blue_100
25 | @color/md_black_1000
26 | @color/md_blue_900
27 | @color/md_white_1000
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 | 16dp
23 | 16dp
24 | 3dp
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 | M e i z h i
22 | Meizhi & Gank.io
23 | Share
24 | Save
25 | Refresh
26 | Copy Link
27 | Open In Browser
28 | About Me
29 | Meizhi Image
30 | Expand/Collapse
31 | Refresh Button
32 | (via @%s )
33 | %s / %s
34 | Meizhi & Gank.io
35 | Proudly Presented By ChkFung
36 | Meizhi Project
37 | A concise of Programmer Worth Readings and a Pretty Meizhi update on every weekday.\n\nData provided by daimajia: http://gank.io \n\nThis Project is developed using MVP structure and Dagger 2 as a best practice of Uncle Bob\'s Clean Architecture.\n\nMy Github: https://github.com/chkfung \nThis Project is currently open source at GitHub to support the open source community.
38 | Author
39 | ChkFung
40 | Open Source Library Used
41 | List / Popup
42 | Notification
43 | Client Design and Develop
44 | Download Failure
45 | MeizhiGank
46 | New Worth Readings and Meizhi Arrived!
47 | Programmer Worth Readings and Meizhi Updated
48 | Share this app
49 | I found a cute Meizhi
50 | "Share Meizhi to "
51 | This App is Amazing!
52 | https://play.google.com/store/apps/details?id=me.chkfung.meizhigankio
53 | Share this App to
54 | Unable to retrieve Info
55 | Request Failed: %s
56 | Retry
57 | Share Url
58 | Notification Disabled
59 | Notification Enabled
60 | No Internet Connection and cache unavailable
61 | Save Failed
62 | Permission Granted! Image Saving will be taking effect on next Restart
63 | Permission Denied
64 | Image saved successfully!
65 | Tap card title to open Programmer Worth Readings
66 |
67 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
19 |
20 |
21 |
22 |
27 |
28 |
42 |
43 |
46 |
47 |
50 |
51 |
54 |
55 |
58 |
59 |
65 |
66 |
70 |
71 |
79 |
80 |
84 |
85 |
88 |
89 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/app/src/test/java/me/chkfung/meizhigank/ExampleUnitTest.java:
--------------------------------------------------------------------------------
1 | package me.chkfung.meizhigank;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.junit.Assert.assertEquals;
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * @see Testing documentation
11 | */
12 | public class ExampleUnitTest {
13 | @Test
14 | public void addition_isCorrect() throws Exception {
15 | assertEquals(4, 2 + 2);
16 | }
17 | }
--------------------------------------------------------------------------------
/app/version.properties:
--------------------------------------------------------------------------------
1 | #Mon Sep 05 16:55:31 MYT 2016
2 | VERSION_CODE=2462
3 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
21 | apply from: 'dependencies.gradle'
22 |
23 | buildscript {
24 | repositories {
25 | jcenter()
26 | }
27 | dependencies {
28 | classpath 'com.android.tools.build:gradle:2.2.0'
29 |
30 | classpath 'com.google.gms:google-services:3.0.0'
31 |
32 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
33 |
34 | // classpath 'com.frogermcs.androiddevmetrics:androiddevmetrics-plugin:0.4'
35 | // NOTE: Do not place your application dependencies here; they belong
36 | // in the individual module build.gradle files
37 | }
38 | }
39 |
40 | allprojects {
41 | repositories {
42 | jcenter()
43 | maven { url "https://jitpack.io" }
44 | }
45 | }
46 |
47 | task clean(type: Delete) {
48 | delete rootProject.buildDir
49 | }
50 |
--------------------------------------------------------------------------------
/dependencies.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | ext {
21 | supportLibraryVersion = '24.2.0'
22 | retrofitVersion = '2.0.2'
23 | butterKnife = '8.1.0'
24 | rxAndroid = '1.1.0'
25 | gson = '2.6.2'
26 | dagger = '2.6'
27 | glide = '3.7.0'
28 | leakCanary = '1.4-beta2'
29 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | ## Project-wide Gradle settings.
2 | #
3 | # For more details on how to configure your build environment visit
4 | # http://www.gradle.org/docs/current/userguide/build_environment.html
5 | #
6 | # Specifies the JVM arguments used for the daemon process.
7 | # The setting is particularly useful for tweaking memory settings.
8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m
9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
10 | #
11 | # When configured, Gradle will run in incubating parallel mode.
12 | # This option should only be used with decoupled projects. More details, visit
13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
14 | # org.gradle.parallel=true
15 | #Tue Sep 06 14:38:55 MYT 2016
16 | org.gradle.jvmargs=-Xmx1536m
17 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chkfung/MeizhiGank/7ddfe457efc26cbbce92857770ad7c6607fa4516/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #
2 | # Meizhi & Gank.io
3 | # Copyright (C) 2016 ChkFung
4 | #
5 | # This program is free software: you can redistribute it and/or modify
6 | # it under the terms of the GNU General Public License as published by
7 | # the Free Software Foundation, either version 3 of the License, or
8 | # (at your option) any later version.
9 | #
10 | # This program is distributed in the hope that it will be useful, but
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | # See the GNU General Public License for more details.
14 | #
15 | # You should have received a copy of the GNU General Public License
16 | # along with this program. If not, see .
17 | #
18 | #
19 |
20 | #Thu Aug 11 10:06:36 MYT 2016
21 | distributionBase=GRADLE_USER_HOME
22 | distributionPath=wrapper/dists
23 | zipStoreBase=GRADLE_USER_HOME
24 | zipStorePath=wrapper/dists
25 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip
26 |
--------------------------------------------------------------------------------
/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 | /*
2 | * Meizhi & Gank.io
3 | * Copyright (C) 2016 ChkFung
4 | *
5 | * This program is free software: you can redistribute it and/or modify
6 | * it under the terms of the GNU General Public License as published by
7 | * the Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * This program is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License
16 | * along with this program. If not, see .
17 | *
18 | */
19 |
20 | include ':app'
21 |
--------------------------------------------------------------------------------