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