From cff65a4f64cf00066246e4208dbf2bd4fa535e0f Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Fri, 9 Oct 2020 15:04:19 -0700 Subject: [PATCH] Clear the logcat after every page loads in Incognito Mode. https://redmine.stoutner.com/issues/600 --- .../activities/MainWebViewActivity.java | 12 ++++++++++-- app/src/main/res/layout/tab_custom_view.xml | 1 + app/src/main/res/values-night-v23/styles.xml | 2 +- app/src/main/res/values-night-v27/styles.xml | 2 +- app/src/main/res/values-night/colors.xml | 1 + app/src/main/res/values-night/styles.xml | 2 +- app/src/main/res/values-v23/styles.xml | 2 +- app/src/main/res/values-v27/styles.xml | 2 +- app/src/main/res/values/colors.xml | 1 + app/src/main/res/values/styles.xml | 2 +- 10 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java index 78629e55..c49c14ca 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java +++ b/app/src/main/java/com/stoutner/privacybrowser/activities/MainWebViewActivity.java @@ -6291,7 +6291,7 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook } } - // Clear the cache and history if Incognito Mode is enabled. + // Clear the cache, history, and logcat if Incognito Mode is enabled. if (incognitoModeEnabled) { // Clear the cache. `true` includes disk files. nestedScrollWebView.clearCache(true); @@ -6311,9 +6311,17 @@ public class MainWebViewActivity extends AppCompatActivity implements CreateBook // Delete the secondary `Service Worker` cache directory. // A `String[]` must be used because the directory contains a space and `Runtime.exec` will not escape the string correctly otherwise. Runtime.getRuntime().exec(new String[]{"rm", "-rf", privateDataDirectoryString + "/app_webview/Service Worker/"}); - } catch (IOException e) { + } catch (IOException exception) { // Do nothing if an error is thrown. } + + // Clear the logcat. + try { + // Clear the logcat. `-c` clears the logcat. `-b all` clears all the buffers (instead of just crash, main, and system). + Runtime.getRuntime().exec("logcat -b all -c"); + } catch (IOException exception) { + // Do nothing. + } } // Get the current page position. diff --git a/app/src/main/res/layout/tab_custom_view.xml b/app/src/main/res/layout/tab_custom_view.xml index 42782a8c..49f61d4b 100644 --- a/app/src/main/res/layout/tab_custom_view.xml +++ b/app/src/main/res/layout/tab_custom_view.xml @@ -41,6 +41,7 @@ android:layout_width="100dp" android:gravity="center_vertical" android:text="@string/new_tab" + android:textColor="?android:textColorPrimary" android:maxLines="2" android:ellipsize="end" /> \ No newline at end of file diff --git a/app/src/main/res/values-night-v23/styles.xml b/app/src/main/res/values-night-v23/styles.xml index b43b6acd..2d2f1ec0 100644 --- a/app/src/main/res/values-night-v23/styles.xml +++ b/app/src/main/res/values-night-v23/styles.xml @@ -36,7 +36,7 @@ @color/red_900 - @color/gray_400 + @color/white @color/violet_500 @color/gray_875 @color/violet_500 diff --git a/app/src/main/res/values-night-v27/styles.xml b/app/src/main/res/values-night-v27/styles.xml index 91522387..00b22081 100644 --- a/app/src/main/res/values-night-v27/styles.xml +++ b/app/src/main/res/values-night-v27/styles.xml @@ -38,7 +38,7 @@ @color/red_900 - @color/gray_400 + @color/white @color/violet_500 @color/gray_875 @color/violet_500 diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml index 3f7d5af4..6c07cd07 100644 --- a/app/src/main/res/values-night/colors.xml +++ b/app/src/main/res/values-night/colors.xml @@ -78,6 +78,7 @@ #FF313131 #FF2D2D2D #FF212121 + #FF202020 #FFE8F5E9 #FFC8E6C9 diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index e9690ffe..ba21706c 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -34,7 +34,7 @@ @color/red_900 - @color/gray_400 + @color/white @color/violet_500 @color/gray_875 @color/violet_500 diff --git a/app/src/main/res/values-v23/styles.xml b/app/src/main/res/values-v23/styles.xml index 29563350..ff8de443 100644 --- a/app/src/main/res/values-v23/styles.xml +++ b/app/src/main/res/values-v23/styles.xml @@ -36,7 +36,7 @@ @color/red_a700 - @color/gray_700 + @color/gray_925 @color/blue_800 @color/white @color/blue_800 diff --git a/app/src/main/res/values-v27/styles.xml b/app/src/main/res/values-v27/styles.xml index e2d1c511..b56b1179 100644 --- a/app/src/main/res/values-v27/styles.xml +++ b/app/src/main/res/values-v27/styles.xml @@ -38,7 +38,7 @@ @color/red_a700 - @color/gray_700 + @color/gray_925 @color/blue_800 @color/white @color/blue_800 diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 7c7d15f8..77746f32 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -78,6 +78,7 @@ #FF313131 #FF2D2D2D #FF212121 + #FF202020 #FFE8F5E9 #FFC8E6C9 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index e3817521..f57308ae 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -34,7 +34,7 @@ @color/red_a700 - @color/gray_700 + @color/gray_925 @color/blue_800 @color/white @color/blue_800 -- 2.45.2