Browse Source

Show popup in UI thread

pull/281/head
Zach Strudler 9 years ago
parent
commit
3bc3fbcf78
  1. 18
      app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java

18
app/src/main/java/org/transdroid/core/gui/navigation/NavigationHelper.java

@ -92,13 +92,17 @@ public class NavigationHelper {
return true; return true;
if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { if (!ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) {
// Never asked again: show a dialog with an explanation // Never asked again: show a dialog with an explanation
new MaterialDialog.Builder(context).content(R.string.permission_readtorrent).positiveText(android.R.string.ok) activity.runOnUiThread(new Runnable() {
.onPositive(new MaterialDialog.SingleButtonCallback() { public void run() {
@Override new MaterialDialog.Builder(context).content(R.string.permission_readtorrent).positiveText(android.R.string.ok)
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) { .onPositive(new MaterialDialog.SingleButtonCallback() {
ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode); @Override
} public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
}).show(); ActivityCompat.requestPermissions(activity, new String[]{permission}, requestCode);
}
}).show();
}
});
return false; return false;
} }
// Permission not granted (and we asked for it already before) // Permission not granted (and we asked for it already before)

Loading…
Cancel
Save