Search in sources :

Example 61 with Dialog

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();
    }
}
Also used : HashMap(java.util.HashMap) Dialog(android.app.Dialog) Intent(android.content.Intent)

Example 62 with Dialog

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;
}
Also used : Dialog(android.app.Dialog) GoogleApiAvailability(com.google.android.gms.common.GoogleApiAvailability)

Example 63 with Dialog

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));
}
Also used : AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) ProgressDialog(android.app.ProgressDialog)

Example 64 with Dialog

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;
}
Also used : PreferenceScreen(android.preference.PreferenceScreen) Dialog(android.app.Dialog)

Example 65 with Dialog

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();
}
Also used : DialogInterface(android.content.DialogInterface) Dialog(android.app.Dialog) WebView(android.webkit.WebView) WindowManager(android.view.WindowManager)

Aggregations

Dialog (android.app.Dialog)792 View (android.view.View)317 AlertDialog (android.app.AlertDialog)256 TextView (android.widget.TextView)219 DialogInterface (android.content.DialogInterface)200 Intent (android.content.Intent)97 Bundle (android.os.Bundle)94 Context (android.content.Context)93 AlertDialog (android.support.v7.app.AlertDialog)93 ListView (android.widget.ListView)87 EditText (android.widget.EditText)84 Button (android.widget.Button)80 AdapterView (android.widget.AdapterView)79 NonNull (android.support.annotation.NonNull)77 LayoutInflater (android.view.LayoutInflater)75 ImageView (android.widget.ImageView)70 ArrayList (java.util.ArrayList)64 LinearLayout (android.widget.LinearLayout)54 WindowManager (android.view.WindowManager)52 ProgressDialog (android.app.ProgressDialog)51