From 0ae22b0017c4796d0f27482b83ed282c1dbe7fea Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 28 Nov 2021 19:19:11 +0100 Subject: remove navigation drawer introduction for first-time users feature --- .../base/fragments/NavigationDrawerFragment.java | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java index 9f210bd5..ae961366 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java @@ -83,7 +83,6 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen * Per the design guidelines, you should show the drawer on launch until the user manually * expands it. This shared preference tracks this. */ - private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned"; private static final String TAG = NavigationDrawerFragment.class.getName(); public static final int TWO_SECONDS = 2000; @@ -100,7 +99,6 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen private IconSwitchEntry saveBattery; private IconTextEntry manualGatewaySelection; - private boolean userLearnedDrawer; private volatile boolean wasPaused; private volatile boolean shouldCloseOnResume; @@ -116,7 +114,6 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen // Reads in the flag indicating whether or not the user has demonstrated awareness of the // drawer. See PREF_USER_LEARNED_DRAWER for details. preferences = getContext().getSharedPreferences(SHARED_PREFERENCES, MODE_PRIVATE); - userLearnedDrawer = preferences.getBoolean(PREF_USER_LEARNED_DRAWER, false); preferences.registerOnSharedPreferenceChangeListener(this); } @@ -181,10 +178,6 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen setupEntries(); setupActionBarDrawerToggle(activity); - if (!userLearnedDrawer) { - openNavigationDrawerForFirstTimeUsers(); - } - // Defer code dependent on restoration of previous instance state. this.drawerLayout.post(() -> drawerToggle.syncState()); this.drawerLayout.addDrawerListener(drawerToggle); @@ -216,12 +209,6 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen return; } - if (!userLearnedDrawer) { - // The user manually opened the drawer; store this flag to prevent auto-showing - // the navigation drawer automatically in the future. - userLearnedDrawer = true; - preferences.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply(); - } activity.invalidateOptionsMenu(); } }; @@ -369,15 +356,6 @@ public class NavigationDrawerFragment extends Fragment implements SharedPreferen return actionBar; } - private void openNavigationDrawerForFirstTimeUsers() { - if (userLearnedDrawer) { - return; - } - - drawerLayout.openDrawer(fragmentContainerView, false); - closeDrawerWithDelay(); - } - @NonNull private void closeDrawerWithDelay() { final Handler navigationDrawerHandler = new Handler(); -- cgit v1.2.3 From 3228b17f43b232116c192728438954c4c1412ec3 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 28 Nov 2021 21:09:02 +0100 Subject: make location button icon tint color configurable, use white tint for riseupvpn --- app/src/custom/res/values/custom-theme.xml | 4 ++- .../base/views/LocationIndicator.java | 42 +++++++++++++--------- app/src/main/res/layout/v_location_button.xml | 5 +++ app/src/main/res/values/attrs.xml | 4 +++ app/src/main/res/values/colors.xml | 3 +- 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/app/src/custom/res/values/custom-theme.xml b/app/src/custom/res/values/custom-theme.xml index 91b48f8c..a17b401c 100644 --- a/app/src/custom/res/values/custom-theme.xml +++ b/app/src/custom/res/values/custom-theme.xml @@ -15,5 +15,7 @@ #58FFA9 #eF2222 - + + #ffffff + #22ffffff diff --git a/app/src/main/java/se/leap/bitmaskclient/base/views/LocationIndicator.java b/app/src/main/java/se/leap/bitmaskclient/base/views/LocationIndicator.java index 72ad03f9..08a852ec 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/views/LocationIndicator.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/views/LocationIndicator.java @@ -1,13 +1,13 @@ package se.leap.bitmaskclient.base.views; import android.content.Context; +import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.widget.LinearLayout; import androidx.annotation.Nullable; -import androidx.core.content.ContextCompat; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.eip.GatewaysManager; @@ -22,25 +22,26 @@ public class LocationIndicator extends LinearLayout { private View level2_2; private View level3; private View level3_2; + private int tintColor; public LocationIndicator(Context context) { super(context); - initLayout(context); + initLayout(context, null); } public LocationIndicator(Context context, @Nullable AttributeSet attrs) { super(context, attrs); - initLayout(context); + initLayout(context, attrs); } public LocationIndicator(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - initLayout(context); + initLayout(context, attrs); } - void initLayout(Context context) { + void initLayout(Context context, AttributeSet attrs) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rootview = inflater.inflate(R.layout.v_location_status_indicator, this, true); @@ -50,6 +51,13 @@ public class LocationIndicator extends LinearLayout { level2_2 = rootview.findViewById(R.id.level2_2); level3 = rootview.findViewById(R.id.level3); level3_2 = rootview.findViewById(R.id.level3_2); + if (attrs != null) { + TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.LocationIndicator); + this.tintColor = typedArray.getColor(R.styleable.LocationIndicator_tint, getColor(context, R.color.black800_high_transparent)); + typedArray.recycle(); + } else { + this.tintColor = getColor(context, R.color.black800_high_transparent); + } } public void setLoad(GatewaysManager.Load load) { @@ -67,24 +75,24 @@ public class LocationIndicator extends LinearLayout { level1_2.setBackgroundColor(getColor(getContext(), R.color.amber200)); level2.setBackgroundColor(getColor(getContext(), R.color.amber200)); level2_2.setBackgroundColor(getColor(getContext(), R.color.amber200)); - level3.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); - level3_2.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); + level3.setBackgroundColor(tintColor); + level3_2.setBackgroundColor(tintColor); break; case CRITICAL: level1.setBackgroundColor(getColor(getContext(), R.color.red200)); level1_2.setBackgroundColor(getColor(getContext(), R.color.red200)); - level2.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); - level2_2.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); - level3.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); - level3_2.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); + level2.setBackgroundColor(tintColor); + level2_2.setBackgroundColor(tintColor); + level3.setBackgroundColor(tintColor); + level3_2.setBackgroundColor(tintColor); break; default: - level1.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); - level1_2.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); - level2.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); - level2_2.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); - level3.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent)); - level3_2.setBackgroundColor(getColor(getContext(), R.color.black800_high_transparent));; + level1.setBackgroundColor(tintColor); + level1_2.setBackgroundColor(tintColor); + level2.setBackgroundColor(tintColor); + level2_2.setBackgroundColor(tintColor); + level3.setBackgroundColor(tintColor); + level3_2.setBackgroundColor(tintColor); break; } } diff --git a/app/src/main/res/layout/v_location_button.xml b/app/src/main/res/layout/v_location_button.xml index 3779a964..7f16a6b1 100644 --- a/app/src/main/res/layout/v_location_button.xml +++ b/app/src/main/res/layout/v_location_button.xml @@ -18,6 +18,7 @@ android:scaleType="fitCenter" android:src="@drawable/ic_web" android:layout_gravity="center" + app:tint="@color/colorLocationButtonTint" /> @@ -77,6 +80,7 @@ android:src="@drawable/ic_bridge_36" android:visibility="gone" tools:visibility="visible" + app:tint="@color/colorLocationButtonTint" /> diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 5631e3f3..2bf4d8ce 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -9,6 +9,7 @@ + @@ -22,4 +23,7 @@ + + + \ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index c1039f70..792db1ee 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -41,7 +41,8 @@ @color/black800 @color/black800 @color/white - + @color/black800 + @color/black800_high_transparent #B33A3A -- cgit v1.2.3 From 247c0b5eca6ee988ead3e66f1d9ea990385d315e Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 28 Nov 2021 21:34:53 +0100 Subject: use 'recommended location' or the location name instead of 'select location' in the location button --- .../main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java | 3 ++- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) 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 45c6307a..14673874 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 @@ -477,7 +477,8 @@ public class EipFragment extends Fragment implements Observer { greyscaleBackground(); locationButton.setLocationLoad(UNKNOWN); locationButton.showBridgeIndicator(false); - locationButton.setText(getString(R.string.gateway_selection_title)); + String city = getPreferredCity(getContext()); + locationButton.setText(city == null ? getString(R.string.gateway_selection_recommended_location) : city); locationButton.showRecommendedIndicator(false); mainDescription.setText(R.string.eip_state_insecure); subDescription.setText(R.string.connection_not_connected); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c32e0d3c..9f1e73b1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -152,7 +152,7 @@ Update failed. No permissions to install app. Select location - Use recommended location + Recommended location Recommended Manually select Automatically use best connection. -- cgit v1.2.3 From e4335df262cf9604195c62301ab3b48a2eeddca6 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 28 Nov 2021 22:11:31 +0100 Subject: fix string: 'Use bridges' instead of 'Using bridges' --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 9f1e73b1..f927cae0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -128,7 +128,7 @@ Donate Using an obfuscated connection. Trying an obfuscated connection. - Using Bridges + Use Bridges Circumvent VPN filtering Be careful of excluding apps from VPN. This will reveal your identity and compromise your security. -- cgit v1.2.3 From 14a2c58d8b666b9707df534306a15784e253f415 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 28 Nov 2021 23:30:33 +0100 Subject: disable bridges UI switch if UDP preference is enabled --- .../bitmaskclient/base/fragments/SettingsFragment.java | 15 ++++++++++----- app/src/main/res/values/strings.xml | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java index 5ea70085..a20d0b73 100644 --- a/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java +++ b/app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java @@ -32,7 +32,7 @@ import static android.content.Context.MODE_PRIVATE; import static android.view.View.GONE; import static android.view.View.VISIBLE; import static se.leap.bitmaskclient.R.string.advanced_settings; -import static se.leap.bitmaskclient.base.MainActivity.ACTION_SHOW_VPN_FRAGMENT; +import static se.leap.bitmaskclient.base.models.Constants.PREFER_UDP; import static se.leap.bitmaskclient.base.models.Constants.SHARED_PREFERENCES; import static se.leap.bitmaskclient.base.models.Constants.USE_BRIDGES; import static se.leap.bitmaskclient.base.models.Constants.USE_IPv6_FIREWALL; @@ -53,6 +53,7 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh private IconTextEntry tethering; private IconSwitchEntry firewall; + IconSwitchEntry useUdpEntry; @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -98,8 +99,12 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh Toast.makeText(getContext(), R.string.reconnecting, Toast.LENGTH_LONG).show(); } }); - - + //We check the UI state of the useUdpEntry here as well, in order to avoid a situation + //where both entries are disabled, because both preferences are enabled. + //bridges can be enabled not only from here but also from error handling + boolean useUDP = getPreferUDP(getContext()) && useUdpEntry.isEnabled(); + useBridges.setEnabled(!useUDP); + useBridges.setSubtitle(getString(useUDP ? R.string.disabled_while_udp_on : R.string.nav_drawer_subtitle_obfuscated_connection)); } else { useBridges.setVisibility(GONE); } @@ -134,7 +139,7 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh } private void initPreferUDPEntry(View rootView) { - IconSwitchEntry useUdpEntry = rootView.findViewById(R.id.prefer_udp); + useUdpEntry = rootView.findViewById(R.id.prefer_udp); useUdpEntry.setVisibility(VISIBLE); useUdpEntry.setChecked(getPreferUDP(getContext())); useUdpEntry.setOnCheckedChangeListener((buttonView, isChecked) -> { @@ -235,7 +240,7 @@ public class SettingsFragment extends Fragment implements SharedPreferences.OnSh if (rootView == null) { return; } - if (key.equals(USE_BRIDGES)) { + if (key.equals(USE_BRIDGES) || key.equals(PREFER_UDP)) { initUseBridgesEntry(rootView); initPreferUDPEntry(rootView); } else if (key.equals(USE_IPv6_FIREWALL)) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f927cae0..741633bd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -196,4 +196,5 @@ You may be leaking information to your internet provider or local network. You have no working Internet connection. Once you get it back, you will be automatically connected to %1$s is blocking all internet traffic. + Disabled while UDP is on. -- cgit v1.2.3 From 3f25f3f40de171061fae38e2e6ebc4f02252aebb Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 28 Nov 2021 23:31:59 +0100 Subject: fix unobfuscated reconnect option if configuring provider using snowflake failed --- .../se/leap/bitmaskclient/providersetup/ProviderSetupFailedDialog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupFailedDialog.java b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupFailedDialog.java index a9247807..0d5f903f 100644 --- a/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupFailedDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupFailedDialog.java @@ -143,7 +143,7 @@ public class ProviderSetupFailedDialog extends DialogFragment { handleTorTimeoutError(); }); builder.setNeutralButton(R.string.retry_unobfuscated, ((dialog, id) -> { - PreferenceHelper.useBridges(getContext(), false); + PreferenceHelper.useSnowflake(getContext(), false); handleTorTimeoutError(); })); default: -- cgit v1.2.3 From 83685da4414d38d2be2bf7441d274aa2f693e0d2 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Sun, 28 Nov 2021 23:35:19 +0100 Subject: improve snowflake description --- app/src/main/res/values/strings.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 741633bd..c5f021f3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -185,7 +185,7 @@ %s has no internet connection. Please check your WiFi and cellular data settings. Censorship circumvention Use Snowflake - Circumvent blocking of the provider\'s configuration server. + Protect configuration process against censorship. VPN settings Use UDP if available UDP can be faster and better for streaming, but does not work for all networks. -- cgit v1.2.3