mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
Refactor turn on hotspot manually dialog
Add go to settings button Remove okay string from string.xml Refactor title and message of dialog
This commit is contained in:
parent
780bddaa6b
commit
378916012f
@ -315,7 +315,8 @@ public class ZimHostActivity extends AppCompatActivity implements
|
||||
void startHotspotDialog() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(this, dialogStyle());
|
||||
|
||||
builder.setPositiveButton(getString(R.string.hotspot_dialog_positive_button), (dialog, id) -> {
|
||||
builder.setPositiveButton(getString(R.string.go_to_wifi_settings_label), (dialog, id) -> {
|
||||
setupWifiSettingsIntent();
|
||||
});
|
||||
|
||||
builder.setNeutralButton(getString(R.string.hotspot_dialog_neutral_button), (dialog, id) -> {
|
||||
@ -415,6 +416,15 @@ public class ZimHostActivity extends AppCompatActivity implements
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
private void setupWifiSettingsIntent() {
|
||||
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
final ComponentName cn =
|
||||
new ComponentName("com.android.settings", "com.android.settings.TetherSettings");
|
||||
intent.setComponent(cn);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
}
|
||||
@Override public void hotspotFailed() {
|
||||
//Show a dialog to turn off default hotspot
|
||||
|
||||
@ -422,13 +432,7 @@ public class ZimHostActivity extends AppCompatActivity implements
|
||||
|
||||
builder.setPositiveButton(getString(R.string.go_to_wifi_settings_label), (dialog, id) -> {
|
||||
//Open wifi settings intent
|
||||
final Intent intent = new Intent(Intent.ACTION_MAIN, null);
|
||||
intent.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
final ComponentName cn =
|
||||
new ComponentName("com.android.settings", "com.android.settings.TetherSettings");
|
||||
intent.setComponent(cn);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
setupWifiSettingsIntent();
|
||||
});
|
||||
|
||||
builder.setTitle(this.getString(R.string.hotspot_failed_title));
|
||||
|
@ -41,10 +41,9 @@
|
||||
<string name="mobile_data_enabled">Warning: Mobile data enabled</string>
|
||||
<string name="mobile_data_message">You\'re about to turn on your wifi hotspot. This feature can work without data usage.</string>
|
||||
<string name="mobile_data_message_confirmation">Do you want to disable your data?</string>
|
||||
<string name="hotspot_dialog_title">Turn on your hotspot</string>
|
||||
<string name="hotspot_dialog_message">In order for this feature to work you need to turn on your hotspot first.</string>
|
||||
<string name="hotspot_dialog_title">Turn on your WIFI hotspot</string>
|
||||
<string name="hotspot_dialog_message">In order for this feature to work you need to turn on your WIFI hotspot first.</string>
|
||||
<string name="hotspot_dialog_neutral_button">YES, I’VE TURNED IT ON</string>
|
||||
<string name="hotspot_dialog_positive_button">Okay</string>
|
||||
<string name="sample_ip_address">http://000.000.000.000</string>
|
||||
<string name="start_server_label">Start server</string>
|
||||
<string name="stop_server_label">Stop server</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user