mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 20:24:03 -04:00
Add ShowHotspotDetails in KiwixDialog
This commit is contained in:
parent
270714a5d5
commit
7ea9ada728
@ -1,5 +1,6 @@
|
||||
package org.kiwix.kiwixmobile.utils
|
||||
|
||||
import android.net.wifi.WifiConfiguration
|
||||
import org.kiwix.kiwixmobile.R
|
||||
import org.kiwix.kiwixmobile.zim_manager.fileselect_view.adapter.BooksOnDiskListItem.BookOnDisk
|
||||
|
||||
@ -52,6 +53,20 @@ sealed class KiwixDialog(
|
||||
null
|
||||
)
|
||||
|
||||
data class ShowHotspotDetails(override val args: Array<out Any>) : KiwixDialog(
|
||||
R.string.hotspot_turned_on,
|
||||
R.string.hotspot_details_message,
|
||||
android.R.string.ok,
|
||||
null
|
||||
), HasBodyFormatArgs {
|
||||
constructor(wifiConfiguration: WifiConfiguration) : this(
|
||||
arrayOf(
|
||||
wifiConfiguration.SSID,
|
||||
wifiConfiguration.preSharedKey
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
data class FileTransferConfirmation(override val args: Array<out Any>) : KiwixDialog(
|
||||
null, R.string.transfer_to, R.string.yes, android.R.string.cancel
|
||||
), HasBodyFormatArgs {
|
||||
|
@ -314,8 +314,6 @@ public class ZimHostActivity extends BaseActivity implements
|
||||
progressDialog =
|
||||
ProgressDialog.show(this, getString(R.string.progress_dialog_starting_server), "",
|
||||
true);
|
||||
progressDialog.show();
|
||||
|
||||
pollForValidIpAddress();
|
||||
});
|
||||
|
||||
@ -399,27 +397,17 @@ public class ZimHostActivity extends BaseActivity implements
|
||||
|
||||
hotspotService.startForegroundNotificationHelper();
|
||||
|
||||
//Show an alert dialog for hotspot details
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, dialogStyle());
|
||||
|
||||
builder.setPositiveButton(android.R.string.ok, (dialog, id) -> {
|
||||
|
||||
progressDialog =
|
||||
ProgressDialog.show(this, getString(R.string.progress_dialog_starting_server), "",
|
||||
true);
|
||||
progressDialog.show();
|
||||
|
||||
pollForValidIpAddress();
|
||||
});
|
||||
|
||||
builder.setTitle(this.getString(R.string.hotspot_turned_on));
|
||||
builder.setMessage(getString(R.string.hotspot_details_message, wifiConfiguration.SSID,
|
||||
wifiConfiguration.preSharedKey));
|
||||
builder.setCancelable(false);
|
||||
AlertDialog dialog = builder.create();
|
||||
dialog.show();
|
||||
|
||||
//setupServer();
|
||||
alertDialogShower.show(new KiwixDialog.ShowHotspotDetails(wifiConfiguration),
|
||||
new Function0<Unit>() {
|
||||
@Override public Unit invoke() {
|
||||
progressDialog =
|
||||
ProgressDialog.show(ZimHostActivity.this,
|
||||
getString(R.string.progress_dialog_starting_server), "",
|
||||
true);
|
||||
pollForValidIpAddress();
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void launchTetheringSettingsScreen() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user