eventClass) {
40 | return bus.ofType(eventClass);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/app/src/main/java/name/caiyao/microreader/utils/ScreenUtil.java:
--------------------------------------------------------------------------------
1 | package name.caiyao.microreader.utils;
2 |
3 | import android.content.Context;
4 | import android.util.DisplayMetrics;
5 | import android.view.WindowManager;
6 |
7 | /**
8 | * Created by 蔡小木 on 2016/3/8 0008.
9 | */
10 | public class ScreenUtil {
11 |
12 | private ScreenUtil() {}
13 |
14 | public static int getScreenHight(Context context) {
15 | DisplayMetrics displaymetrics = new DisplayMetrics();
16 | ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(displaymetrics);
17 | return displaymetrics.heightPixels;
18 | }
19 |
20 | public static int getScreenWidth(Context context) {
21 | DisplayMetrics displaymetrics = new DisplayMetrics();
22 | ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getMetrics(displaymetrics);
23 | return displaymetrics.widthPixels;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/app/src/main/java/name/caiyao/microreader/utils/SharePreferenceUtil.java:
--------------------------------------------------------------------------------
1 | package name.caiyao.microreader.utils;
2 |
3 | import android.content.Context;
4 | import android.content.SharedPreferences;
5 | import android.preference.PreferenceManager;
6 |
7 | import name.caiyao.microreader.R;
8 |
9 | /**
10 | * Created by 蔡小木 on 2016/3/13 0013.
11 | */
12 | public class SharePreferenceUtil {
13 |
14 | private SharePreferenceUtil() {}
15 |
16 | public static final String SHARED_PREFERENCE_NAME = "micro_reader";
17 | public static final String IMAGE_DESCRIPTION = "image_description";
18 | public static final String VIBRANT = "vibrant";
19 | public static final String MUTED = "muted";
20 | public static final String IMAGE_GET_TIME = "image_get_time";
21 | public static final String SAVED_CHANNEL = "saved_channel";
22 |
23 | public static boolean isRefreshOnlyWifi(Context context) {
24 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
25 | return sharedPreferences.getBoolean(context.getResources().getString(R.string.pre_refresh_data), false);
26 | }
27 |
28 | public static boolean isChangeThemeAuto(Context context) {
29 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
30 | return sharedPreferences.getBoolean(context.getResources().getString(R.string.pre_get_image), true);
31 | }
32 |
33 | public static boolean isImmersiveMode(Context context) {
34 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
35 | return sharedPreferences.getBoolean(context.getString(R.string.pre_status_bar), true);
36 | }
37 |
38 | public static boolean isChangeNavColor(Context context) {
39 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
40 | return sharedPreferences.getBoolean(context.getString(R.string.pre_nav_color), true);
41 | }
42 |
43 | public static boolean isUseLocalBrowser(Context context) {
44 | SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
45 | return sharedPreferences.getBoolean(context.getString(R.string.pre_use_local), false);
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/src/main/java/name/caiyao/microreader/utils/WebUtil.java:
--------------------------------------------------------------------------------
1 | package name.caiyao.microreader.utils;
2 |
3 | /**
4 | * Created by 蔡小木 on 2016/3/7 0007.
5 | */
6 | public class WebUtil {
7 |
8 | private WebUtil() {
9 | }
10 |
11 | public static final String BASE_URL = "file:///android_asset/";
12 | public static final String MIME_TYPE = "text/html";
13 | public static final String ENCODING = "utf-8";
14 | public static final String FAIL_URL = "http//:daily.zhihu.com/";
15 |
16 | private static final String CSS_LINK_PATTERN = " ";
17 | private static final String NIGHT_DIV_TAG_START = "";
18 | private static final String NIGHT_DIV_TAG_END = "
";
19 |
20 | private static final String DIV_IMAGE_PLACE_HOLDER = "class=\"img-place-holder\"";
21 | private static final String DIV_IMAGE_PLACE_HOLDER_IGNORED = "class=\"img-place-holder-ignored\"";
22 |
23 | public static String buildHtmlWithCss(String html, String[] cssUrls, boolean isNightMode) {
24 | StringBuilder result = new StringBuilder();
25 | for (String cssUrl : cssUrls) {
26 | result.append(String.format(CSS_LINK_PATTERN, cssUrl));
27 | }
28 |
29 | if (isNightMode) {
30 | result.append(NIGHT_DIV_TAG_START);
31 | }
32 | result.append(html.replace(DIV_IMAGE_PLACE_HOLDER, DIV_IMAGE_PLACE_HOLDER_IGNORED));
33 | if (isNightMode) {
34 | result.append(NIGHT_DIV_TAG_END);
35 | }
36 | return result.toString();
37 | }
38 |
39 | public static String buildHtmlForIt(String content, boolean isNightMode) {
40 | StringBuilder modifiedHtml = new StringBuilder();
41 | modifiedHtml.append("" + ""
42 | + "" + "" + ""
43 | + "" + ""
44 | + ""
45 | + "" + "");
46 | modifiedHtml.append("");
51 | modifiedHtml.append(content);
52 | modifiedHtml.append("");
53 | return modifiedHtml.toString();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/zoomin.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
12 |
--------------------------------------------------------------------------------
/app/src/main/res/anim/zoomout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
13 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/app/src/main/res/drawable/bg.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_arrow_upward_white_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_block_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_brightness_2_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_drag_handle_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_expand_less_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_expand_more_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_help_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_more_vert_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_open_in_browser_white_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_play_arrow_white_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_remove_circle_outline_black_24dp.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_settings_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_share_white_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_sort_black_24px.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/app/src/main/res/drawable/icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_guokr.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_it.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
9 |
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_video.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_weixin.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
18 |
21 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/icon_zhihu.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/web_view_progress.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
5 |
6 |
7 |
8 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_change_channel.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_ithome.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
22 |
23 |
30 |
31 |
32 |
37 |
38 |
42 |
43 |
44 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
21 |
22 |
23 |
24 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_video.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
13 |
14 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_video_webview.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_weixin_news.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
22 |
23 |
30 |
31 |
32 |
33 |
38 |
39 |
43 |
44 |
45 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_welcome.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
19 |
20 |
30 |
31 |
37 |
38 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_zhihu_story.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
15 |
16 |
24 |
25 |
35 |
36 |
42 |
43 |
44 |
45 |
46 |
47 |
52 |
53 |
57 |
58 |
59 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/app_bar_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
15 |
16 |
20 |
21 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/channel.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
24 |
25 |
32 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/channel_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
13 |
14 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_common.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
15 |
16 |
20 |
21 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/ithome_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
23 |
24 |
29 |
30 |
37 |
38 |
46 |
47 |
48 |
57 |
58 |
59 |
60 |
61 |
68 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
15 |
16 |
17 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/share_buttion.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/video_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
16 |
17 |
21 |
22 |
29 |
30 |
36 |
37 |
44 |
45 |
51 |
52 |
53 |
54 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/weixin_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
15 |
16 |
23 |
24 |
34 |
35 |
43 |
44 |
52 |
53 |
54 |
59 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/zhihu_daily_card_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/zhihu_daily_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
19 |
20 |
26 |
27 |
35 |
36 |
37 |
42 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/activity_main_drawer.xml:
--------------------------------------------------------------------------------
1 |
2 |
22 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/menu_share.xml:
--------------------------------------------------------------------------------
1 |
2 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/pop_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/values-en/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | MicroReader
4 | Settings
5 | Cache size:
6 | I see
7 | Loading
8 | Loading error,please check your network!
9 | Loading hardly…
10 | Load successfully
11 | Release to load
12 | Retry
13 | The beauty of life need you to find by your heart, with eye to recording.
14 | Small and beautiful reading experience
15 | Guokr Hot
16 | Getting player address…
17 | Get player address fail!
18 | Video
19 | Wechat Hot
20 | Zhihu Daily
21 | Help and suggestion
22 | No permission,Nothing to do!
23 | Please give me permission to cache file!
24 | Share to
25 | (Share from MicroReader,The beauty of life need you to find by your heart, with eye to recording.)
26 | Data will not be load because no wifi!
27 | about
28 | IT Home
29 | Update available
30 | The latest version %1$s is available of my app!\nReleaseNote:\n%2$s
31 | Update now
32 | Huh, not interested
33 | Update not available
34 | No update available. Check for updates again later!
35 | Cancel
36 | Other channel
37 | Show channel
38 | Change Channel
39 | Open with browser
40 | Load success
41 | Load more
42 | Refresh complete
43 | Swipe to load more
44 | Swipe to refresh
45 | Set as read
46 | Set as unread
47 | Night Mode
48 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v19/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 25dp
4 |
--------------------------------------------------------------------------------
/app/src/main/res/values-w820dp/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 64dp
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 220dp
5 |
6 | 16dp
7 | 16dp
8 | 16dp
9 | 0dp
10 | 5dp
11 | 16sp
12 |
13 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 微阅
3 |
4 | Open navigation drawer
5 | Close navigation drawer
6 |
7 | refresh_data
8 | get_image
9 | cache_size
10 | feedback
11 | author
12 | version
13 | pre_nav_color
14 | pre_use_local
15 | pre_status_bar
16 |
17 | 生活的美好,需要你用心去发现,用眼去摄录。
18 | 微信精选
19 | 知乎日报
20 | 果壳热门
21 | 视频推荐
22 | IT之家
23 |
24 | 设置
25 | 更改栏目
26 |
27 | \r\n(分享自微阅,小而美的阅读体验!)
28 | 分享到
29 | 请允许此应用的读写文件以便于缓存文件!
30 | 没有权限臣妾做不到呀!
31 | 非WIFI下不自动加载数据!
32 | 缓存大小:
33 | 正在获取播放地址…
34 | 获取播放地址失败,请检查网络!
35 | 小而美的阅读体验
36 | 帮助与反馈
37 | 关于
38 | 使用浏览器打开
39 | 现在升级
40 | 新版%1$s版本可用\n更新内容\n%2$s
41 | 有更新可用
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 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
15 |
16 |
17 |
26 |
27 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/preferences.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
17 |
18 |
19 |
20 |
26 |
32 |
33 |
34 |
35 |
41 |
42 |
43 |
44 |
48 |
49 |
50 |
51 |
55 |
59 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | repositories {
4 | jcenter()
5 | mavenCentral()
6 | }
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:2.3.0-beta1'
9 | classpath 'com.bugtags.library:bugtags-gradle:latest.integration'
10 | classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
11 | // NOTE: Do not place your application dependencies here; they belong
12 | // in the individual module build.gradle files
13 | }
14 | }
15 | allprojects {
16 | repositories {
17 | jcenter()
18 | mavenCentral()
19 | }
20 | }
21 | task clean(type: Delete) {
22 | delete rootProject.buildDir
23 | }
24 |
--------------------------------------------------------------------------------
/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 | #Wed Oct 19 08:49:15 CST 2016
16 | systemProp.http.proxyHost=127.0.0.1
17 | systemProp.http.proxyPort=1080
18 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sun Jan 01 13:43:23 CST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.2-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/screenshot/Screenshot_20160503-085830.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/screenshot/Screenshot_20160503-085830.png
--------------------------------------------------------------------------------
/screenshot/Screenshot_20160503-085853.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/screenshot/Screenshot_20160503-085853.png
--------------------------------------------------------------------------------
/screenshot/Screenshot_20160503-085902.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/screenshot/Screenshot_20160503-085902.png
--------------------------------------------------------------------------------
/screenshot/Screenshot_20160503-085945.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/screenshot/Screenshot_20160503-085945.png
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':swipebackactivity'
2 |
--------------------------------------------------------------------------------
/swipebackactivity/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/swipebackactivity/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion '25.0.2'
6 |
7 | defaultConfig {
8 | minSdkVersion 10
9 | targetSdkVersion 25
10 | versionCode 1
11 | versionName "1.0"
12 | }
13 | buildTypes {
14 | release {
15 | minifyEnabled false
16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
17 | }
18 | }
19 | }
20 |
21 | dependencies {
22 | compile fileTree(dir: 'libs', include: ['*.jar'])
23 | compile 'com.android.support:appcompat-v7:25.1.0'
24 | }
25 |
--------------------------------------------------------------------------------
/swipebackactivity/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in E:\sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/swipebackactivity/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/swipebackactivity/src/main/java/com/example/swipebackactivity/Utils.java:
--------------------------------------------------------------------------------
1 |
2 | package com.example.swipebackactivity;
3 |
4 | import android.app.Activity;
5 | import android.app.ActivityOptions;
6 | import android.os.Build;
7 |
8 | import java.lang.reflect.Method;
9 |
10 | public class Utils {
11 | private Utils() {
12 | }
13 |
14 | public static void convertActivityToTranslucent(Activity activity) {
15 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
16 | convertActivityToTranslucentAfterL(activity);
17 | } else {
18 | convertActivityToTranslucentBeforeL(activity);
19 | }
20 | }
21 |
22 | /**
23 | * Calling the convertToTranslucent method on platforms before Android 5.0
24 | */
25 | public static void convertActivityToTranslucentBeforeL(Activity activity) {
26 | try {
27 | Class>[] classes = Activity.class.getDeclaredClasses();
28 | Class> translucentConversionListenerClazz = null;
29 | for (Class clazz : classes) {
30 | if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
31 | translucentConversionListenerClazz = clazz;
32 | }
33 | }
34 | Method method = Activity.class.getDeclaredMethod("convertToTranslucent",
35 | translucentConversionListenerClazz);
36 | method.setAccessible(true);
37 | method.invoke(activity, new Object[] {
38 | null
39 | });
40 | } catch (Throwable t) {
41 | }
42 | }
43 |
44 | /**
45 | * Calling the convertToTranslucent method on platforms after Android 5.0
46 | */
47 | private static void convertActivityToTranslucentAfterL(Activity activity) {
48 | try {
49 | Method getActivityOptions = Activity.class.getDeclaredMethod("getActivityOptions");
50 | getActivityOptions.setAccessible(true);
51 | Object options = getActivityOptions.invoke(activity);
52 |
53 | Class>[] classes = Activity.class.getDeclaredClasses();
54 | Class> translucentConversionListenerClazz = null;
55 | for (Class clazz : classes) {
56 | if (clazz.getSimpleName().contains("TranslucentConversionListener")) {
57 | translucentConversionListenerClazz = clazz;
58 | }
59 | }
60 | Method convertToTranslucent = Activity.class.getDeclaredMethod("convertToTranslucent",
61 | translucentConversionListenerClazz, ActivityOptions.class);
62 | convertToTranslucent.setAccessible(true);
63 | convertToTranslucent.invoke(activity, null, options);
64 | } catch (Throwable t) {
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/swipebackactivity/src/main/java/com/example/swipebackactivity/app/SwipeBackActivity.java:
--------------------------------------------------------------------------------
1 |
2 | package com.example.swipebackactivity.app;
3 |
4 | import android.os.Bundle;
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.view.View;
7 |
8 | import com.example.swipebackactivity.SwipeBackLayout;
9 | import com.example.swipebackactivity.Utils;
10 |
11 |
12 | public class SwipeBackActivity extends AppCompatActivity implements SwipeBackActivityBase {
13 | private SwipeBackActivityHelper mHelper;
14 |
15 | @Override
16 | protected void onCreate(Bundle savedInstanceState) {
17 | super.onCreate(savedInstanceState);
18 | mHelper = new SwipeBackActivityHelper(this);
19 | mHelper.onActivityCreate();
20 | }
21 |
22 | @Override
23 | protected void onPostCreate(Bundle savedInstanceState) {
24 | super.onPostCreate(savedInstanceState);
25 | mHelper.onPostCreate();
26 | }
27 |
28 | @Override
29 | public View findViewById(int id) {
30 | View v = super.findViewById(id);
31 | if (v == null && mHelper != null)
32 | return mHelper.findViewById(id);
33 | return v;
34 | }
35 |
36 | @Override
37 | public SwipeBackLayout getSwipeBackLayout() {
38 | return mHelper.getSwipeBackLayout();
39 | }
40 |
41 | @Override
42 | public void setSwipeBackEnable(boolean enable) {
43 | getSwipeBackLayout().setEnableGesture(enable);
44 | }
45 |
46 | @Override
47 | public void scrollToFinishActivity() {
48 | Utils.convertActivityToTranslucent(this);
49 | getSwipeBackLayout().scrollToFinishActivity();
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/swipebackactivity/src/main/java/com/example/swipebackactivity/app/SwipeBackActivityBase.java:
--------------------------------------------------------------------------------
1 | package com.example.swipebackactivity.app;
2 |
3 | import com.example.swipebackactivity.SwipeBackLayout;
4 |
5 |
6 | public interface SwipeBackActivityBase {
7 | SwipeBackLayout getSwipeBackLayout();
8 |
9 | void setSwipeBackEnable(boolean enable);
10 |
11 | void scrollToFinishActivity();
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/swipebackactivity/src/main/java/com/example/swipebackactivity/app/SwipeBackActivityHelper.java:
--------------------------------------------------------------------------------
1 | package com.example.swipebackactivity.app;
2 |
3 | import android.app.Activity;
4 | import android.graphics.Color;
5 | import android.graphics.drawable.ColorDrawable;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 |
9 | import com.example.swipebackactivity.R;
10 | import com.example.swipebackactivity.SwipeBackLayout;
11 | import com.example.swipebackactivity.Utils;
12 |
13 |
14 | public class SwipeBackActivityHelper {
15 | private Activity mActivity;
16 |
17 | private SwipeBackLayout mSwipeBackLayout;
18 |
19 | public SwipeBackActivityHelper(Activity activity) {
20 | mActivity = activity;
21 | }
22 |
23 | public void onActivityCreate() {
24 | mActivity.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
25 | mSwipeBackLayout = (SwipeBackLayout) LayoutInflater.from(mActivity).inflate(
26 | R.layout.swipeback_layout, null);
27 | mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {
28 | @Override
29 | public void onScrollStateChange(int state, float scrollPercent) {
30 | }
31 |
32 | @Override
33 | public void onEdgeTouch(int edgeFlag) {
34 | Utils.convertActivityToTranslucent(mActivity);
35 | }
36 |
37 | @Override
38 | public void onScrollOverThreshold() {
39 |
40 | }
41 | });
42 | }
43 |
44 | public void onPostCreate() {
45 | mSwipeBackLayout.attachToActivity(mActivity);
46 | }
47 |
48 | public View findViewById(int id) {
49 | if (mSwipeBackLayout != null) {
50 | return mSwipeBackLayout.findViewById(id);
51 | }
52 | return null;
53 | }
54 |
55 | public SwipeBackLayout getSwipeBackLayout() {
56 | return mSwipeBackLayout;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/swipebackactivity/src/main/java/com/example/swipebackactivity/app/SwipeBackPreferenceActivity.java:
--------------------------------------------------------------------------------
1 |
2 | package com.example.swipebackactivity.app;
3 |
4 | import android.os.Bundle;
5 | import android.preference.PreferenceActivity;
6 | import android.view.View;
7 |
8 | import com.example.swipebackactivity.SwipeBackLayout;
9 |
10 | public class SwipeBackPreferenceActivity extends PreferenceActivity implements SwipeBackActivityBase {
11 | private SwipeBackActivityHelper mHelper;
12 |
13 | @Override
14 | protected void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 | mHelper = new SwipeBackActivityHelper(this);
17 | mHelper.onActivityCreate();
18 | }
19 |
20 | @Override
21 | protected void onPostCreate(Bundle savedInstanceState) {
22 | super.onPostCreate(savedInstanceState);
23 | mHelper.onPostCreate();
24 | }
25 |
26 | @Override
27 | public View findViewById(int id) {
28 | View v = super.findViewById(id);
29 | if (v == null && mHelper != null)
30 | return mHelper.findViewById(id);
31 | return v;
32 | }
33 |
34 | @Override
35 | public SwipeBackLayout getSwipeBackLayout() {
36 | return mHelper.getSwipeBackLayout();
37 | }
38 | @Override
39 | public void setSwipeBackEnable(boolean enable) {
40 | getSwipeBackLayout().setEnableGesture(enable);
41 | }
42 |
43 | @Override
44 | public void scrollToFinishActivity() {
45 | getSwipeBackLayout().scrollToFinishActivity();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/swipebackactivity/src/main/res/drawable/shadow_bottom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/swipebackactivity/src/main/res/drawable/shadow_bottom.png
--------------------------------------------------------------------------------
/swipebackactivity/src/main/res/drawable/shadow_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/swipebackactivity/src/main/res/drawable/shadow_left.png
--------------------------------------------------------------------------------
/swipebackactivity/src/main/res/drawable/shadow_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/YiuChoi/MicroReader/1af8fe3a2965588af9705f1e6509a1c88d539630/swipebackactivity/src/main/res/drawable/shadow_right.png
--------------------------------------------------------------------------------
/swipebackactivity/src/main/res/layout/swipeback_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/swipebackactivity/src/main/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/swipebackactivity/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
--------------------------------------------------------------------------------