mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-23 20:54:13 -04:00
Add ProgressDialog for turning on webserver
This commit is contained in:
parent
05d7546c9c
commit
a1b35317a3
@ -2,6 +2,7 @@ package org.kiwix.kiwixmobile.webserver;
|
|||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.app.ProgressDialog;
|
||||||
import android.content.ComponentName;
|
import android.content.ComponentName;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -321,10 +322,15 @@ public class ZimHostActivity extends AppCompatActivity implements
|
|||||||
//TO DO: START SERVER WITHIN THE SERVICE.
|
//TO DO: START SERVER WITHIN THE SERVICE.
|
||||||
//Adding a handler because sometimes hotspot can take time to turn on.
|
//Adding a handler because sometimes hotspot can take time to turn on.
|
||||||
//TO DO: Add a progress dialog instead of handler
|
//TO DO: Add a progress dialog instead of handler
|
||||||
|
ProgressDialog progressDialog =
|
||||||
|
ProgressDialog.show(this, getString(R.string.progress_dialog_starting_server), "",
|
||||||
|
true);
|
||||||
|
progressDialog.show();
|
||||||
final Handler handler = new Handler();
|
final Handler handler = new Handler();
|
||||||
handler.postDelayed(new Runnable() {
|
handler.postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
progressDialog.dismiss();
|
||||||
startService(ACTION_START_SERVER);
|
startService(ACTION_START_SERVER);
|
||||||
}
|
}
|
||||||
}, 7000);
|
}, 7000);
|
||||||
@ -380,11 +386,18 @@ public class ZimHostActivity extends AppCompatActivity implements
|
|||||||
|
|
||||||
//Show an alert dialog for hotspot details
|
//Show an alert dialog for hotspot details
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, dialogStyle());
|
AlertDialog.Builder builder = new AlertDialog.Builder(this, dialogStyle());
|
||||||
|
|
||||||
|
ProgressDialog progressDialog =
|
||||||
|
ProgressDialog.show(this, getString(R.string.progress_dialog_starting_server), "",
|
||||||
|
true);
|
||||||
|
progressDialog.show();
|
||||||
|
|
||||||
builder.setPositiveButton(android.R.string.ok, (dialog, id) -> {
|
builder.setPositiveButton(android.R.string.ok, (dialog, id) -> {
|
||||||
final Handler handler = new Handler();
|
final Handler handler = new Handler();
|
||||||
handler.postDelayed(new Runnable() {
|
handler.postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
progressDialog.dismiss();
|
||||||
startService(ACTION_START_SERVER);
|
startService(ACTION_START_SERVER);
|
||||||
//webServerHelper.startServerHelper();
|
//webServerHelper.startServerHelper();
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
<string name="hotspot_pass_label">Pass : </string>
|
<string name="hotspot_pass_label">Pass : </string>
|
||||||
<string name="port_hint">8080</string>
|
<string name="port_hint">8080</string>
|
||||||
<string name="server_textview_default_message">Select the files you wish to host on the server</string>
|
<string name="server_textview_default_message">Select the files you wish to host on the server</string>
|
||||||
|
<string name="progress_dialog_starting_server">Starting server</string>
|
||||||
<string name="start_server_dialog_title">Start server</string>
|
<string name="start_server_dialog_title">Start server</string>
|
||||||
<string name="start_server_dialog_message">You can now start the server using this ip address and port no.</string>
|
<string name="start_server_dialog_message">You can now start the server using this ip address and port no.</string>
|
||||||
<string name="mobile_data_enabled">Warning: Mobile data enabled</string>
|
<string name="mobile_data_enabled">Warning: Mobile data enabled</string>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user