From 5b7657902244d3264cbd9fe4436d38224a5a107f Mon Sep 17 00:00:00 2001 From: Adeel Zafar Date: Sun, 11 Aug 2019 13:55:07 +0500 Subject: [PATCH] Refactor ACTION_IS_HOTSPOT_ENABLED --- .../java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java | 4 ++-- .../org/kiwix/kiwixmobile/wifi_hotspot/HotspotService.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java index 1cc1aa4c1..ce8c25160 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java +++ b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java @@ -58,7 +58,7 @@ public class ZimHostActivity extends AppCompatActivity implements public static final String ACTION_TURN_ON_AFTER_O = "Turn_on_hotspot_after_oreo"; public static final String ACTION_TURN_OFF_AFTER_O = "Turn_off_hotspot_after_oreo"; - public static final String ACTION_CHECK_HOTSPOT_STATE = "Check_hotspot_state"; + public static final String ACTION_IS_HOTSPOT_ENABLED = "Is_hotspot_enabled"; public static final String ACTION_START_SERVER = "start_server"; public static final String ACTION_STOP_SERVER = "stop_server"; private final String IP_STATE_KEY = "ip_state_key"; @@ -163,7 +163,7 @@ public class ZimHostActivity extends AppCompatActivity implements if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) { - startService(ACTION_CHECK_HOTSPOT_STATE); //If hotspot is already enabled, turn it off + startService(ACTION_IS_HOTSPOT_ENABLED); //If hotspot is already enabled, turn it off } else { //Ask location permission if not granted ActivityCompat.requestPermissions(this, diff --git a/app/src/main/java/org/kiwix/kiwixmobile/wifi_hotspot/HotspotService.java b/app/src/main/java/org/kiwix/kiwixmobile/wifi_hotspot/HotspotService.java index f2ca3f6b6..05245a758 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/wifi_hotspot/HotspotService.java +++ b/app/src/main/java/org/kiwix/kiwixmobile/wifi_hotspot/HotspotService.java @@ -22,7 +22,7 @@ import org.kiwix.kiwixmobile.webserver.ServerStateListener; import org.kiwix.kiwixmobile.webserver.WebServerHelper; import org.kiwix.kiwixmobile.webserver.ZimHostActivity; -import static org.kiwix.kiwixmobile.webserver.ZimHostActivity.ACTION_CHECK_HOTSPOT_STATE; +import static org.kiwix.kiwixmobile.webserver.ZimHostActivity.ACTION_IS_HOTSPOT_ENABLED; import static org.kiwix.kiwixmobile.webserver.ZimHostActivity.ACTION_START_SERVER; import static org.kiwix.kiwixmobile.webserver.ZimHostActivity.ACTION_STOP_SERVER; import static org.kiwix.kiwixmobile.webserver.ZimHostActivity.ACTION_TURN_OFF_AFTER_O; @@ -82,7 +82,7 @@ public class HotspotService extends Service { @Override public int onStartCommand(Intent intent, int flags, int startId) { switch (intent.getAction()) { - case ACTION_CHECK_HOTSPOT_STATE: + case ACTION_IS_HOTSPOT_ENABLED: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { serverStateListener.hotspotState(hotspotManager.checkHotspotState()); }