summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcyberta <cyberta@riseup.net>2021-11-28 23:08:16 +0000
committercyberta <cyberta@riseup.net>2021-11-28 23:08:16 +0000
commit6c089933ec5aa79987fdec9cfdfe7f0b51598c5b (patch)
tree8ecc586dbbaae70669adb5d7a2fc0e3b5e318f29
parentda382d031d07b8c4197c4dae68a2fd5afe93eb5e (diff)
parent83685da4414d38d2be2bf7441d274aa2f693e0d2 (diff)
Merge branch 'last_minute_UI_changes' into 'master'
Last minute ui changes See merge request leap/bitmask_android!151
-rw-r--r--app/src/custom/res/values/custom-theme.xml4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/EipFragment.java3
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/NavigationDrawerFragment.java22
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/fragments/SettingsFragment.java15
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/base/views/LocationIndicator.java42
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/providersetup/ProviderSetupFailedDialog.java2
-rw-r--r--app/src/main/res/layout/v_location_button.xml5
-rw-r--r--app/src/main/res/values/attrs.xml4
-rw-r--r--app/src/main/res/values/colors.xml3
-rw-r--r--app/src/main/res/values/strings.xml7
10 files changed, 56 insertions, 51 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 @@
<color name="colorMainBtnHighlight">#58FFA9</color>
<!-- glow effect color of the on / off button if no network / traffic blocked -->
<color name="colorMainBtnError">#eF2222</color>
-
+ <!-- location button icon tint color -->
+ <color name="colorLocationButtonTint">#ffffff</color>
+ <color name="colorLocationButtonTintTransparent">#22ffffff</color>
</resources>
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/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();
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/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/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:
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"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/recommended_icn"
@@ -31,6 +32,8 @@
android:layout_toEndOf="@id/world_icn"
android:layout_toRightOf="@id/world_icn"
android:src="@drawable/ic_lightning_bolt"
+ app:tint="@color/colorLocationButtonTint"
+
android:visibility="gone"
tools:visibility="visible"
/>
@@ -77,6 +80,7 @@
android:src="@drawable/ic_bridge_36"
android:visibility="gone"
tools:visibility="visible"
+ app:tint="@color/colorLocationButtonTint"
/>
<se.leap.bitmaskclient.base.views.LocationIndicator
@@ -91,6 +95,7 @@
android:paddingBottom="@dimen/stdpadding"
android:visibility="visible"
android:layout_gravity="center_vertical"
+ app:tint="@color/colorLocationButtonTintTransparent"
/>
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 @@
<attr name="icon" format="reference"/>
<attr name="subtitle" format="string|reference"/>
<attr name="singleLine" format="boolean"/>
+ <attr name="tint" format="reference|color" />
<declare-styleable name="IconSwitchEntry">
<attr name="text"/>
<attr name="subtitle" />
@@ -22,4 +23,7 @@
<attr name="icon"/>
<attr name="singleLine"/>
</declare-styleable>
+ <declare-styleable name="LocationIndicator">
+ <attr name="tint"/>
+ </declare-styleable>
</resources> \ 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 name="colorEipFragmentFont">@color/black800</color>
<color name="colorFontBtn">@color/black800</color>
<color name="colorFontBtnEnabled">@color/white</color>
-
+ <color name="colorLocationButtonTint">@color/black800</color>
+ <color name="colorLocationButtonTintTransparent">@color/black800_high_transparent</color>
<color name="colorWarning">#B33A3A</color>
</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index c32e0d3c..c5f021f3 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -128,7 +128,7 @@
<string name="donate_button_donate">Donate</string>
<string name="obfuscated_connection">Using an obfuscated connection.</string>
<string name="obfuscated_connection_try">Trying an obfuscated connection.</string>
- <string name="nav_drawer_obfuscated_connection">Using Bridges</string>
+ <string name="nav_drawer_obfuscated_connection">Use Bridges</string>
<string name="nav_drawer_subtitle_obfuscated_connection">Circumvent VPN filtering</string>
<string name="warning_exclude_apps_message">Be careful of excluding apps from VPN. This will reveal your identity and compromise your security.</string>
<plurals name="subtitle_exclude_apps">
@@ -152,7 +152,7 @@
<string name="version_update_error">Update failed.</string>
<string name="version_update_error_permissions">No permissions to install app.</string>
<string name="gateway_selection_title">Select location</string>
- <string name="gateway_selection_recommended_location">Use recommended location</string>
+ <string name="gateway_selection_recommended_location">Recommended location</string>
<string name="gateway_selection_recommended">Recommended</string>
<string name="gateway_selection_manually">Manually select</string>
<string name="gateway_selection_automatic_location">Automatically use best connection.</string>
@@ -185,7 +185,7 @@
<string name="error_network_connection">%s has no internet connection. Please check your WiFi and cellular data settings.</string>
<string name="censorship_circumvention">Censorship circumvention</string>
<string name="use_snowflake">Use Snowflake</string>
- <string name="snowflake_description">Circumvent blocking of the provider\'s configuration server.</string>
+ <string name="snowflake_description">Protect configuration process against censorship.</string>
<string name="vpn_settings">VPN settings</string>
<string name="prefer_udp">Use UDP if available</string>
<string name="prefer_udp_subtitle">UDP can be faster and better for streaming, but does not work for all networks.</string>
@@ -196,4 +196,5 @@
<string name="connection_not_connected" >You may be leaking information to your internet provider or local network.</string>
<string name="eip_state_no_network">You have no working Internet connection. Once you get it back, you will be automatically connected to</string>
<string name="eip_state_blocking">%1$s is blocking all internet traffic.</string>
+ <string name="disabled_while_udp_on">Disabled while UDP is on.</string>
</resources>