diff options
author | cyBerta <cyberta@riseup.net> | 2020-03-02 03:19:14 +0100 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2020-03-02 03:19:14 +0100 |
commit | f1c88d01dbbcc2ccd1fd7f82c822e5f280ed75f7 (patch) | |
tree | e1193e71424c4ae6ee92eb66cf8a6d8df3f3b2ac /app/src/main | |
parent | f9e1a1449ee7b8f1aa796416be5fe6de106b8f86 (diff) |
fallback to genereal wifi settings if tethering settings activity cannot not be found
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java index d1e43a38..1bc90605 100644 --- a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java +++ b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java @@ -1,6 +1,7 @@ package se.leap.bitmaskclient.fragments; import android.app.Dialog; +import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Intent; import android.graphics.drawable.Drawable; @@ -200,12 +201,18 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer spannable.setSpan(new ClickableSpan() { @Override public void onClick(@NonNull View widget) { - 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); + try { + 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); + } catch (ActivityNotFoundException e) { + Intent intent = new Intent(Settings.ACTION_WIRELESS_SETTINGS); + startActivity(intent); + } + } }, startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); |