mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-27 15:11:13 -04:00
Add dialog showing hotspot details for versions <O
This commit is contained in:
parent
ecf134a632
commit
35ed0e079d
@ -185,7 +185,7 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
|
|||||||
public static boolean refresh;
|
public static boolean refresh;
|
||||||
public static boolean wifiOnly;
|
public static boolean wifiOnly;
|
||||||
public static boolean nightMode;
|
public static boolean nightMode;
|
||||||
private WifiHotspotManager wifiHotspotManager;
|
private static WifiHotspotManager wifiHotspotManager;
|
||||||
private static Uri KIWIX_LOCAL_MARKET_URI;
|
private static Uri KIWIX_LOCAL_MARKET_URI;
|
||||||
private static Uri KIWIX_BROWSER_MARKET_URI;
|
private static Uri KIWIX_BROWSER_MARKET_URI;
|
||||||
private final ArrayList<String> bookmarks = new ArrayList<>();
|
private final ArrayList<String> bookmarks = new ArrayList<>();
|
||||||
@ -1099,6 +1099,10 @@ public class MainActivity extends BaseActivity implements WebViewCallback,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void startHotspotDetails() {
|
||||||
|
wifiHotspotManager.hotspotDetailsDialog();
|
||||||
|
}
|
||||||
|
|
||||||
private void startService(String ACTION) {
|
private void startService(String ACTION) {
|
||||||
serviceIntent.setAction(ACTION);
|
serviceIntent.setAction(ACTION);
|
||||||
this.startService(serviceIntent);
|
this.startService(serviceIntent);
|
||||||
|
@ -23,6 +23,7 @@ import static org.kiwix.kiwixmobile.main.MainActivity.ACTION_TURN_OFF_AFTER_O;
|
|||||||
import static org.kiwix.kiwixmobile.main.MainActivity.ACTION_TURN_OFF_BEFORE_O;
|
import static org.kiwix.kiwixmobile.main.MainActivity.ACTION_TURN_OFF_BEFORE_O;
|
||||||
import static org.kiwix.kiwixmobile.main.MainActivity.ACTION_TURN_ON_AFTER_O;
|
import static org.kiwix.kiwixmobile.main.MainActivity.ACTION_TURN_ON_AFTER_O;
|
||||||
import static org.kiwix.kiwixmobile.main.MainActivity.ACTION_TURN_ON_BEFORE_O;
|
import static org.kiwix.kiwixmobile.main.MainActivity.ACTION_TURN_ON_BEFORE_O;
|
||||||
|
import static org.kiwix.kiwixmobile.main.MainActivity.startHotspotDetails;
|
||||||
|
|
||||||
public class HotspotService extends Service {
|
public class HotspotService extends Service {
|
||||||
private static final int HOTSPOT_NOTIFICATION_ID = 666;
|
private static final int HOTSPOT_NOTIFICATION_ID = 666;
|
||||||
@ -57,6 +58,8 @@ public class HotspotService extends Service {
|
|||||||
switch (intent.getAction()) {
|
switch (intent.getAction()) {
|
||||||
case ACTION_TURN_ON_BEFORE_O:
|
case ACTION_TURN_ON_BEFORE_O:
|
||||||
if (hotspotManager.setWifiEnabled(null, true)) {
|
if (hotspotManager.setWifiEnabled(null, true)) {
|
||||||
|
Log.v("DANG", "INSIDE");
|
||||||
|
startHotspotDetails();
|
||||||
updateNotification(getString(R.string.hotspot_running), true);
|
updateNotification(getString(R.string.hotspot_running), true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -179,7 +179,7 @@ public class WifiHotspotManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void hotspotDetailsDialog() {
|
public void hotspotDetailsDialog() {
|
||||||
|
|
||||||
Log.v("DANG", "Coming hotspot details dialog :4");
|
Log.v("DANG", "Coming hotspot details dialog :4");
|
||||||
|
|
||||||
@ -189,10 +189,18 @@ public class WifiHotspotManager {
|
|||||||
//Do nothing
|
//Do nothing
|
||||||
});
|
});
|
||||||
builder.setTitle(context.getString(R.string.hotspot_turned_on));
|
builder.setTitle(context.getString(R.string.hotspot_turned_on));
|
||||||
builder.setMessage(
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
context.getString(R.string.hotspot_details_message) + "\n" + context.getString(
|
builder.setMessage(
|
||||||
R.string.hotspot_ssid_label) + " " + currentConfig.SSID + "\n" + context.getString(
|
context.getString(R.string.hotspot_details_message) + "\n" + context.getString(
|
||||||
R.string.hotspot_pass_label) + " " + currentConfig.preSharedKey);
|
R.string.hotspot_ssid_label) + " " + currentConfig.SSID + "\n" + context.getString(
|
||||||
|
R.string.hotspot_pass_label) + " " + currentConfig.preSharedKey);
|
||||||
|
} else {
|
||||||
|
currentConfig = getWifiApConfiguration();
|
||||||
|
builder.setMessage(
|
||||||
|
context.getString(R.string.hotspot_details_message) + "\n" + context.getString(
|
||||||
|
R.string.hotspot_ssid_label) + " " + currentConfig.SSID + "\n" + context.getString(
|
||||||
|
R.string.hotspot_pass_label) + " " + currentConfig.preSharedKey);
|
||||||
|
}
|
||||||
AlertDialog dialog = builder.create();
|
AlertDialog dialog = builder.create();
|
||||||
dialog.show();
|
dialog.show();
|
||||||
Log.v("DANG", "Coming end of hotspot details dialog :5");
|
Log.v("DANG", "Coming end of hotspot details dialog :5");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user