From bf7168d1faf1b8c3841cbb006600751cdd521f04 Mon Sep 17 00:00:00 2001
From: cyBerta <cyberta@riseup.net>
Date: Tue, 31 Oct 2023 23:57:41 +0100
Subject: disable location button in EipFragment in case there's only 1
 Location available

---
 .../java/se/leap/bitmaskclient/base/fragments/EipFragment.java   | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'app/src/main/java/se')

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 c500b55b..f4e09e62 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
@@ -171,11 +171,16 @@ public class EipFragment extends Fragment implements Observer {
         }
 
         restoreFromSavedInstance(savedInstanceState);
-        locationButton.setOnClickListener(v -> {
+        if (provider != null && provider.hasGatewaysInDifferentLocations()) {
+            locationButton.setOnClickListener(v -> {
                 FragmentManagerEnhanced fragmentManager = new FragmentManagerEnhanced(getActivity().getSupportFragmentManager());
                 Fragment fragment = new GatewaySelectionFragment();
                 fragmentManager.replace(R.id.main_container, fragment, MainActivity.TAG);
-        });
+            });
+            locationButton.setEnabled(true);
+        } else {
+            locationButton.setEnabled(false);
+        }
 
         mainButton.setOnClickListener(v -> {
             handleIcon();
-- 
cgit v1.2.3