use of android.app.Dialog in project android_frameworks_base by AOSPA.
the class AppErrors method handleShowAnrUi.
void handleShowAnrUi(Message msg) {
Dialog d = null;
synchronized (mService) {
HashMap<String, Object> data = (HashMap<String, Object>) msg.obj;
ProcessRecord proc = (ProcessRecord) data.get("app");
if (proc != null && proc.anrDialog != null) {
Slog.e(TAG, "App already has anr dialog: " + proc);
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_APP_ANR, AppNotRespondingDialog.ALREADY_SHOWING);
return;
}
Intent intent = new Intent("android.intent.action.ANR");
if (!mService.mProcessesReady) {
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY | Intent.FLAG_RECEIVER_FOREGROUND);
}
mService.broadcastIntentLocked(null, null, intent, null, null, 0, null, null, null, AppOpsManager.OP_NONE, null, false, false, MY_PID, Process.SYSTEM_UID, 0);
boolean showBackground = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ANR_SHOW_BACKGROUND, 0) != 0;
if (mService.canShowErrorDialogs() || showBackground) {
d = new AppNotRespondingDialog(mService, mContext, proc, (ActivityRecord) data.get("activity"), msg.arg1 != 0);
proc.anrDialog = d;
} else {
MetricsLogger.action(mContext, MetricsProto.MetricsEvent.ACTION_APP_ANR, AppNotRespondingDialog.CANT_SHOW);
// Just kill the app if there is no dialog to be shown.
mService.killAppAtUsersRequest(proc, null);
}
}
// If we've created a crash dialog, show it without the lock held
if (d != null) {
d.show();
}
}
use of android.app.Dialog in project WordPress-Android by wordpress-mobile.
the class WordPress method isGooglePlayServicesAvailable.
public boolean isGooglePlayServicesAvailable(Activity activity) {
GoogleApiAvailability googleApiAvailability = GoogleApiAvailability.getInstance();
int connectionResult = googleApiAvailability.isGooglePlayServicesAvailable(activity);
switch(connectionResult) {
// Success: return true
case ConnectionResult.SUCCESS:
return true;
// Play Services unavailable, show an error dialog is the Play Services Lib needs an update
case ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED:
Dialog dialog = googleApiAvailability.getErrorDialog(activity, connectionResult, 0);
if (dialog != null) {
dialog.show();
}
default:
case ConnectionResult.SERVICE_MISSING:
case ConnectionResult.SERVICE_DISABLED:
case ConnectionResult.SERVICE_INVALID:
AppLog.w(T.NOTIFS, "Google Play Services unavailable, connection result: " + googleApiAvailability.getErrorString(connectionResult));
}
return false;
}
use of android.app.Dialog in project WordPress-Android by wordpress-mobile.
the class SiteSettingsFragment method showListEditorDialog.
private void showListEditorDialog(int titleRes, int headerRes) {
mDialog = new Dialog(getActivity(), R.style.Calypso_SiteSettingsTheme);
mDialog.setOnDismissListener(this);
mDialog.setContentView(getListEditorView(getString(headerRes)));
mDialog.show();
WPActivityUtils.addToolbarToDialog(this, mDialog, getString(titleRes));
}
use of android.app.Dialog in project WordPress-Android by wordpress-mobile.
the class NotificationsSettingsFragment method onPreferenceTreeClick.
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, @NonNull Preference preference) {
super.onPreferenceTreeClick(preferenceScreen, preference);
if (preference instanceof PreferenceScreen) {
Dialog prefDialog = ((PreferenceScreen) preference).getDialog();
if (prefDialog != null) {
String title = String.valueOf(preference.getTitle());
WPActivityUtils.addToolbarToDialog(this, prefDialog, title);
}
AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_SETTINGS_STREAMS_OPENED);
} else {
AnalyticsTracker.track(AnalyticsTracker.Stat.NOTIFICATION_SETTINGS_DETAILS_OPENED);
}
return false;
}
use of android.app.Dialog in project WordPress-Android by wordpress-mobile.
the class LearnMorePreference method showDialog.
private void showDialog() {
final WebView webView = loadSupportWebView();
mDialog = new Dialog(getContext());
mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
webView.stopLoading();
mDialog = null;
}
});
mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
mDialog.setContentView(R.layout.learn_more_pref_screen);
WindowManager.LayoutParams params = mDialog.getWindow().getAttributes();
params.width = WindowManager.LayoutParams.MATCH_PARENT;
params.height = WindowManager.LayoutParams.MATCH_PARENT;
params.gravity = Gravity.CENTER;
params.x = 12;
params.y = 12;
mDialog.getWindow().setAttributes(params);
mDialog.show();
}
Aggregations