From a2067cd5b56387405cb653de8940e7afc448449d Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sat, 31 Jul 2021 19:30:54 +0200 Subject: Add BuildConfig to disable color filtering of the main screen background, if VPN is turned off. Make EipFragment's text colors customizable --- app/build.gradle | 4 ++++ app/src/custom/res/values/custom-theme.xml | 7 ++++-- .../bitmaskclient/base/fragments/EipFragment.java | 25 ++++++++++++++-------- app/src/main/res/layout-port/f_eip.xml | 2 ++ app/src/main/res/layout-xlarge-port/f_eip.xml | 2 ++ app/src/main/res/layout-xlarge/f_eip.xml | 2 ++ app/src/main/res/layout/f_eip.xml | 3 ++- app/src/main/res/values/colors.xml | 1 + 8 files changed, 34 insertions(+), 12 deletions(-) (limited to 'app') diff --git a/app/build.gradle b/app/build.gradle index 6db23476..8fcd9e90 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -37,6 +37,8 @@ android { buildConfigField 'boolean', 'priotize_anonymous_usage', 'false' //allow manual gateway selection buildConfigField 'boolean', 'allow_manual_gateway_selection', 'true' + // grey out background in EipFragment (main screen) if VPN is not running + buildConfigField 'boolean', 'use_color_filter', 'true' // static update url pointing to the latest stable release apk buildConfigField "String", "update_apk_url", '"https://dl.bitmask.net/client/android/Bitmask-Android-latest.apk"' @@ -118,6 +120,8 @@ android { buildConfigField 'boolean', 'priotize_anonymous_usage', 'true' //allow manual gateway selection buildConfigField 'boolean', 'allow_manual_gateway_selection', 'true' + // grey out background in EipFragment (main screen) if VPN is not running + buildConfigField 'boolean', 'use_color_filter', 'false' //Build Config Fields for automatic apk update checks diff --git a/app/src/custom/res/values/custom-theme.xml b/app/src/custom/res/values/custom-theme.xml index 1c8f1ab2..71d22ac6 100644 --- a/app/src/custom/res/values/custom-theme.xml +++ b/app/src/custom/res/values/custom-theme.xml @@ -2,11 +2,14 @@ - #5e9ee3 + #2E639C - #5c7ce1 + #021122 #ffffff #cccccc + + #ffffff + diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java index ef16d085..d8be1cc5 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java @@ -54,6 +54,7 @@ import de.blinkt.openvpn.core.ConnectionStatus; import de.blinkt.openvpn.core.IOpenVPNServiceInternal; import de.blinkt.openvpn.core.OpenVPNService; import de.blinkt.openvpn.core.VpnStatus; +import se.leap.bitmaskclient.BuildConfig; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.base.FragmentManagerEnhanced; import se.leap.bitmaskclient.base.MainActivity; @@ -552,21 +553,27 @@ public class EipFragment extends Fragment implements Observer { } private void greyscaleBackground() { - ColorMatrix matrix = new ColorMatrix(); - matrix.setSaturation(0); - ColorMatrixColorFilter cf = new ColorMatrixColorFilter(matrix); - background.setColorFilter(cf); - background.setImageAlpha(255); + if (BuildConfig.use_color_filter) { + ColorMatrix matrix = new ColorMatrix(); + matrix.setSaturation(0); + ColorMatrixColorFilter cf = new ColorMatrixColorFilter(matrix); + background.setColorFilter(cf); + background.setImageAlpha(255); + } } private void colorBackgroundALittle() { - background.setColorFilter(null); - background.setImageAlpha(144); + if (BuildConfig.use_color_filter) { + background.setColorFilter(null); + background.setImageAlpha(144); + } } private void colorBackground() { - background.setColorFilter(null); - background.setImageAlpha(210); + if (BuildConfig.use_color_filter) { + background.setColorFilter(null); + background.setImageAlpha(210); + } } private void updateInvalidVpnCertificate() { diff --git a/app/src/main/res/layout-port/f_eip.xml b/app/src/main/res/layout-port/f_eip.xml index 4dae126c..03401d16 100644 --- a/app/src/main/res/layout-port/f_eip.xml +++ b/app/src/main/res/layout-port/f_eip.xml @@ -65,6 +65,7 @@ android:padding="@dimen/activity_margin" android:textAppearance="@android:style/TextAppearance.Large" android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" tools:text="CONNETION" android:gravity="center" @@ -82,6 +83,7 @@ android:padding="@dimen/activity_margin" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" tools:text="A LONG TEXT WITH SEVERAL THINGS BLABLkk \n kdjfkj \n kjdfkjdf" android:gravity="center" diff --git a/app/src/main/res/layout-xlarge-port/f_eip.xml b/app/src/main/res/layout-xlarge-port/f_eip.xml index 5325d6a6..6a115a8b 100644 --- a/app/src/main/res/layout-xlarge-port/f_eip.xml +++ b/app/src/main/res/layout-xlarge-port/f_eip.xml @@ -76,6 +76,7 @@ android:padding="@dimen/activity_margin" android:textAppearance="@android:style/TextAppearance.Large" android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" tools:text="CONNETION" android:gravity="center" @@ -93,6 +94,7 @@ android:padding="@dimen/activity_margin" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" tools:text="A LONG TEXT WITH SEVERAL THINGS BLABLkk" android:gravity="center" diff --git a/app/src/main/res/layout-xlarge/f_eip.xml b/app/src/main/res/layout-xlarge/f_eip.xml index 8ed9a57c..1ea7ba4b 100644 --- a/app/src/main/res/layout-xlarge/f_eip.xml +++ b/app/src/main/res/layout-xlarge/f_eip.xml @@ -80,6 +80,7 @@ android:padding="@dimen/stdpadding" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" tools:text="CONNETION SECURE" android:maxLines="1" @@ -96,6 +97,7 @@ android:padding="@dimen/stdpadding" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" android:maxLines="5" android:ellipsize="end" diff --git a/app/src/main/res/layout/f_eip.xml b/app/src/main/res/layout/f_eip.xml index 0cefcd6c..e3e8fe0a 100644 --- a/app/src/main/res/layout/f_eip.xml +++ b/app/src/main/res/layout/f_eip.xml @@ -97,6 +97,7 @@ android:paddingEnd="@dimen/stdpadding" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Large" android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" app:layout_constraintDimensionRatio="1:1" tools:text="CONNETION SECURE" /> @@ -111,12 +112,12 @@ app:layout_constraintBottom_toTopOf="@+id/gateway_location_button" android:textAppearance="@android:style/TextAppearance.DeviceDefault.Medium" android:textStyle="bold" + android:textColor="@color/colorEipFragmentFont" android:paddingLeft="@dimen/stdpadding" android:paddingStart="@dimen/stdpadding" android:paddingRight="@dimen/stdpadding" android:paddingEnd="@dimen/stdpadding" android:paddingBottom="@dimen/stdpadding" - app:layout_constraintDimensionRatio="1:1" tools:text="Your traffic is securly routed through \n another" android:maxLines="2" diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index a8cdb28e..e911a6d1 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -34,6 +34,7 @@ @color/white @color/black800 + @color/black800 #B33A3A -- cgit v1.2.3