From da824fa125a5583d07e8ac2f6585459956d87ac1 Mon Sep 17 00:00:00 2001 From: cyberta Date: Wed, 30 Nov 2022 01:37:33 +0100 Subject: rename drawables and colors according to the state they're representing --- .../EipFragment.java | 32 ++++----- .../res/drawable/cust_button_primary_rect.xml | 79 ---------------------- app/src/normal/res/layout-port/f_eip.xml | 2 +- app/src/normal/res/layout-xlarge-port/f_eip.xml | 2 +- app/src/normal/res/layout-xlarge/f_eip.xml | 2 +- app/src/normal/res/layout/f_eip.xml | 2 +- app/src/normal/res/layout/v_location_button.xml | 2 +- 7 files changed, 21 insertions(+), 100 deletions(-) delete mode 100644 app/src/normal/res/drawable/cust_button_primary_rect.xml (limited to 'app/src/normal') diff --git a/app/src/normal/java/se.leap.bitmaskclient.base.fragments/EipFragment.java b/app/src/normal/java/se.leap.bitmaskclient.base.fragments/EipFragment.java index 2e291aad..0210077c 100644 --- a/app/src/normal/java/se.leap.bitmaskclient.base.fragments/EipFragment.java +++ b/app/src/normal/java/se.leap.bitmaskclient.base.fragments/EipFragment.java @@ -468,10 +468,10 @@ public class EipFragment extends Fragment implements Observer { } else { subDescription.setText(getString(R.string.updating_certificate_message)); } - background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_yellow)); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connecting)); stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.yellow_mask)); mainButton.updateState(false, true, false); - setActivityBarColor(R.color.bg_yellow_top, R.color.bg_yellow_top_light_transparent); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); } else if (eipStatus.isConnecting()) { setMainButtonEnabled(true); String city = getPreferredCity(getContext()); @@ -484,10 +484,10 @@ public class EipFragment extends Fragment implements Observer { locationButton.showRecommendedIndicator(false); mainDescription.setText(R.string.eip_status_connecting); subDescription.setText(null); - background.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.bg_yellow)); + background.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.bg_connecting)); stateView.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.yellow_mask)); mainButton.updateState(false, true, false); - setActivityBarColor(R.color.bg_yellow_top, R.color.bg_yellow_top_light_transparent); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); } else if (eipStatus.isConnected()) { setMainButtonEnabled(true); mainButton.updateState(true, false, false); @@ -498,9 +498,9 @@ public class EipFragment extends Fragment implements Observer { locationButton.showRecommendedIndicator(getPreferredCity(getContext()) == null); mainDescription.setText(R.string.eip_status_secured); subDescription.setText(null); - background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_green)); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connected)); stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.green_mask)); - setActivityBarColor(R.color.bg_green_top, R.color.bg_green_top_light_transparent); + setActivityBarColor(R.color.bg_running_top, R.color.bg_running_top_light_transparent); } else if(isOpenVpnRunningWithoutNetwork()) { Log.d(TAG, "eip fragment eipStatus - isOpenVpnRunningWithoutNetwork"); setMainButtonEnabled(true); @@ -511,9 +511,9 @@ public class EipFragment extends Fragment implements Observer { locationButton.showRecommendedIndicator(getPreferredCity(getContext())== null); mainDescription.setText(R.string.eip_state_connected); subDescription.setText(R.string.eip_state_no_network); - background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_yellow)); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connecting)); stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.yellow_mask)); - setActivityBarColor(R.color.bg_yellow_top, R.color.bg_yellow_top_light_transparent); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); } else if (eipStatus.isDisconnected() && reconnectingWithDifferentGateway()) { locationButton.setText(VpnStatus.getCurrentlyConnectingVpnName()); locationButton.setLocationLoad(UNKNOWN); @@ -521,17 +521,17 @@ public class EipFragment extends Fragment implements Observer { locationButton.showRecommendedIndicator(false); mainDescription.setText(R.string.eip_status_connecting); subDescription.setText(R.string.reconnecting); - background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_yellow)); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_connecting)); stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.yellow_mask)); - setActivityBarColor(R.color.bg_yellow_top, R.color.bg_yellow_top_light_transparent); + setActivityBarColor(R.color.bg_connecting_top, R.color.bg_connecting_top_light_transparent); } else if (eipStatus.isDisconnecting()) { setMainButtonEnabled(false); - background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_red)); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_disconnected)); stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.red_mask)); mainButton.updateState(false, false, false); mainDescription.setText(R.string.eip_status_unsecured); - setActivityBarColor(R.color.bg_red_top, R.color.bg_red_top_light_transparent); + setActivityBarColor(R.color.bg_disconnected_top, R.color.bg_disconnected_top_light_transparent); } else if (eipStatus.isBlocking()) { setMainButtonEnabled(true); mainButton.updateState(true, false, true); @@ -541,9 +541,9 @@ public class EipFragment extends Fragment implements Observer { locationButton.showRecommendedIndicator(false); mainDescription.setText(R.string.eip_state_connected); subDescription.setText(getString(R.string.eip_state_blocking, getString(R.string.app_name))); - background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_red)); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_disconnected)); stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.red_mask)); - setActivityBarColor(R.color.bg_red_top, R.color.bg_red_top_light_transparent); + setActivityBarColor(R.color.bg_disconnected_top, R.color.bg_disconnected_top_light_transparent); } else { locationButton.setText(getContext().getString(R.string.vpn_button_turn_on)); setMainButtonEnabled(true); @@ -555,9 +555,9 @@ public class EipFragment extends Fragment implements Observer { locationButton.showRecommendedIndicator(false); mainDescription.setText(R.string.eip_status_unsecured); subDescription.setText(null); - background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_red)); + background.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.bg_disconnected)); stateView.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.red_mask)); - setActivityBarColor(R.color.bg_red_top, R.color.bg_red_top_light_transparent); + setActivityBarColor(R.color.bg_disconnected_top, R.color.bg_disconnected_top_light_transparent); } } diff --git a/app/src/normal/res/drawable/cust_button_primary_rect.xml b/app/src/normal/res/drawable/cust_button_primary_rect.xml deleted file mode 100644 index 74ddccb0..00000000 --- a/app/src/normal/res/drawable/cust_button_primary_rect.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/app/src/normal/res/layout-port/f_eip.xml b/app/src/normal/res/layout-port/f_eip.xml index b17e300c..eed5fde6 100644 --- a/app/src/normal/res/layout-port/f_eip.xml +++ b/app/src/normal/res/layout-port/f_eip.xml @@ -61,7 +61,7 @@ android:id="@+id/background" android:layout_width="match_parent" android:layout_height="match_parent" - app:srcCompat="@drawable/bg_red" + app:srcCompat="@drawable/bg_disconnected" android:scaleType="fitXY" android:layout_marginTop="-300dp" android:layout_marginBottom="-300dp" diff --git a/app/src/normal/res/layout-xlarge-port/f_eip.xml b/app/src/normal/res/layout-xlarge-port/f_eip.xml index 26a90403..ae548c82 100644 --- a/app/src/normal/res/layout-xlarge-port/f_eip.xml +++ b/app/src/normal/res/layout-xlarge-port/f_eip.xml @@ -69,7 +69,7 @@ android:id="@+id/background" android:layout_width="match_parent" android:layout_height="match_parent" - app:srcCompat="@drawable/bg_red" + app:srcCompat="@drawable/bg_disconnected" android:scaleType="fitXY" android:layout_marginTop="-300dp" android:layout_marginBottom="-300dp" diff --git a/app/src/normal/res/layout-xlarge/f_eip.xml b/app/src/normal/res/layout-xlarge/f_eip.xml index e1ecf321..a4d94394 100644 --- a/app/src/normal/res/layout-xlarge/f_eip.xml +++ b/app/src/normal/res/layout-xlarge/f_eip.xml @@ -69,7 +69,7 @@ android:layout_marginRight="-300dp" android:layout_marginTop="-300dp" android:layout_marginBottom="-300dp" - app:srcCompat="@drawable/bg_red" /> + app:srcCompat="@drawable/bg_disconnected" /> + app:srcCompat="@drawable/bg_disconnected" />