From 6cb8ff7680f5f1ab61cd2b3c310e212d7ad13348 Mon Sep 17 00:00:00 2001 From: newmlee Date: Sat, 20 Jun 2015 08:05:30 +0000 Subject: [PATCH] Fix Google Play load in background bug and adjust some settings. --- Ninja/.idea/workspace.xml | 378 ++++++++++-------- Ninja/res/values-zh-rCN/strings.xml | 2 +- Ninja/res/values-zh-rTW/strings.xml | 2 +- .../mthli/Ninja/Activity/BrowserActivity.java | 3 +- .../github/mthli/Ninja/Unit/BrowserUnit.java | 14 +- 5 files changed, 235 insertions(+), 164 deletions(-) diff --git a/Ninja/.idea/workspace.xml b/Ninja/.idea/workspace.xml index 263cba9..cbc07d8 100644 --- a/Ninja/.idea/workspace.xml +++ b/Ninja/.idea/workspace.xml @@ -41,7 +41,91 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -134,8 +218,10 @@ - @@ -160,8 +246,7 @@ - - + @@ -182,7 +267,8 @@ - + + @@ -432,8 +518,8 @@ - - + + @@ -441,26 +527,26 @@ + - + + - - @@ -481,7 +567,7 @@ file://$PROJECT_DIR$/src/io/github/mthli/Ninja/Activity/BrowserActivity.java - 1481 + 1482 @@ -579,13 +665,6 @@ - - - - - - - @@ -721,86 +800,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -880,61 +879,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -942,7 +886,6 @@ - @@ -950,7 +893,6 @@ - @@ -994,6 +936,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ninja/res/values-zh-rCN/strings.xml b/Ninja/res/values-zh-rCN/strings.xml index da85b97..a802be1 100644 --- a/Ninja/res/values-zh-rCN/strings.xml +++ b/Ninja/res/values-zh-rCN/strings.xml @@ -422,7 +422,7 @@ 域名已经存在了 - 双击退出 + 再点击一下退出 (๑•̀ㅂ•́)و✧ diff --git a/Ninja/res/values-zh-rTW/strings.xml b/Ninja/res/values-zh-rTW/strings.xml index 4c93b19..cfbc62f 100644 --- a/Ninja/res/values-zh-rTW/strings.xml +++ b/Ninja/res/values-zh-rTW/strings.xml @@ -422,7 +422,7 @@ 域名已經存在了 - 雙擊退出 + 再點擊一下退出 (๑•̀ㅂ•́)و✧ diff --git a/Ninja/src/io/github/mthli/Ninja/Activity/BrowserActivity.java b/Ninja/src/io/github/mthli/Ninja/Activity/BrowserActivity.java index fcc507c..e04a957 100644 --- a/Ninja/src/io/github/mthli/Ninja/Activity/BrowserActivity.java +++ b/Ninja/src/io/github/mthli/Ninja/Activity/BrowserActivity.java @@ -52,7 +52,8 @@ import java.util.*; public class BrowserActivity extends Activity implements BrowserController { - private static final int DOUBLE_TAPS_QUIT_DEFAULT = 512; + // Sync with NinjaToast.show() 2000ms delay + private static final int DOUBLE_TAPS_QUIT_DEFAULT = 2000; private SwitcherPanel switcherPanel; private int anchor; diff --git a/Ninja/src/io/github/mthli/Ninja/Unit/BrowserUnit.java b/Ninja/src/io/github/mthli/Ninja/Unit/BrowserUnit.java index 2124435..c1d38f4 100644 --- a/Ninja/src/io/github/mthli/Ninja/Unit/BrowserUnit.java +++ b/Ninja/src/io/github/mthli/Ninja/Unit/BrowserUnit.java @@ -60,6 +60,9 @@ public class BrowserUnit { public static final String URL_SCHEME_HTTP = "http://"; public static final String URL_SCHEME_HTTPS = "https://"; public static final String URL_SCHEME_INTENT = "intent://"; + + public static final String URL_PREFIX_GOOGLE_PLAY = "www.google.com/url?q="; + public static final String URL_SUFFIX_GOOGLE_PLAY = "&sa"; public static final String URL_PREFIX_GOOGLE_PLUS = "plus.url.google.com/url?q="; public static final String URL_SUFFIX_GOOGLE_PLUS = "&rct"; @@ -91,9 +94,14 @@ public static boolean isURL(String url) { public static String queryWrapper(Context context, String query) { // Use prefix and suffix to process some special links - if (query.contains(URL_PREFIX_GOOGLE_PLUS)) { - int start = query.indexOf(URL_PREFIX_GOOGLE_PLUS) + URL_PREFIX_GOOGLE_PLUS.length(); - int end = query.indexOf(URL_SUFFIX_GOOGLE_PLUS); + String temp = query.toLowerCase(Locale.getDefault()); + if (temp.contains(URL_PREFIX_GOOGLE_PLAY) && temp.contains(URL_SUFFIX_GOOGLE_PLAY)) { + int start = temp.indexOf(URL_PREFIX_GOOGLE_PLAY) + URL_PREFIX_GOOGLE_PLAY.length(); + int end = temp.indexOf(URL_SUFFIX_GOOGLE_PLAY); + query = query.substring(start, end); + } else if (temp.contains(URL_PREFIX_GOOGLE_PLUS) && temp.contains(URL_SUFFIX_GOOGLE_PLUS)) { + int start = temp.indexOf(URL_PREFIX_GOOGLE_PLUS) + URL_PREFIX_GOOGLE_PLUS.length(); + int end = temp.indexOf(URL_SUFFIX_GOOGLE_PLUS); query = query.substring(start, end); }