mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
Refactor ACTION_IS_HOTSPOT_ENABLED
This commit is contained in:
parent
815ad025d7
commit
5b76579022
@ -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,
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user