Search in sources :

Example 16 with Dialog

use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.

the class VolumePreference method cleanup.

/**
     * Do clean up.  This can be called multiple times!
     */
private void cleanup() {
    getPreferenceManager().unregisterOnActivityStopListener(this);
    if (mSeekBarVolumizer != null) {
        Dialog dialog = getDialog();
        if (dialog != null && dialog.isShowing()) {
            View view = dialog.getWindow().getDecorView().findViewById(com.android.internal.R.id.seekbar);
            if (view != null)
                view.setOnKeyListener(null);
            // Stopped while dialog was showing, revert changes
            mSeekBarVolumizer.revertVolume();
        }
        mSeekBarVolumizer.stop();
        mSeekBarVolumizer = null;
    }
}
Also used : Dialog(android.app.Dialog) View(android.view.View)

Example 17 with Dialog

use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.

the class FakeApp method onCreate.

@Override
public void onCreate() {
    String processName = ActivityThread.currentProcessName();
    Slog.i("FakeOEMFeatures", "Creating app in process: " + processName);
    if (!getApplicationInfo().packageName.equals(processName)) {
        // our extra overhead stuff.
        return;
    }
    final WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
    final Display display = wm.getDefaultDisplay();
    // is a user build, WARN!  Do not want!
    if ("user".equals(android.os.Build.TYPE)) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Should not be on user build");
        builder.setMessage("The app Fake OEM Features should not be installed on a " + "user build.  Please remove this .apk before shipping this build to " + " your customers!");
        builder.setCancelable(false);
        builder.setPositiveButton("I understand", null);
        Dialog dialog = builder.create();
        dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        dialog.show();
    }
    // Make a fake window that is always around eating graphics resources.
    FakeView view = new FakeView(this);
    WindowManager.LayoutParams lp = new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
    if (ActivityManager.isHighEndGfx()) {
        lp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED;
    }
    lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
    lp.height = ViewGroup.LayoutParams.MATCH_PARENT;
    int maxSize = display.getMaximumSizeDimension();
    maxSize *= 2;
    lp.x = maxSize;
    lp.y = maxSize;
    lp.setTitle(getPackageName());
    wm.addView(view, lp);
    // Bind to a fake service we want to keep running in another process.
    bindService(new Intent(this, FakeCoreService.class), mServiceConnection, Context.BIND_AUTO_CREATE);
    bindService(new Intent(this, FakeCoreService2.class), mServiceConnection2, Context.BIND_AUTO_CREATE);
    bindService(new Intent(this, FakeCoreService3.class), mServiceConnection3, Context.BIND_AUTO_CREATE);
    // Start to a fake service that should run in the background of
    // another process.
    mHandler.sendEmptyMessage(MSG_TICK);
    // Make a fake allocation to consume some RAM.
    mStuffing = new int[STUFFING_SIZE_INTS];
    for (int i = 0; i < STUFFING_SIZE_BYTES / PAGE_SIZE; i++) {
        // Fill each page with a unique value.
        final int VAL = i * 2 + 100;
        final int OFF = (i * PAGE_SIZE) / 4;
        for (int j = 0; j < (PAGE_SIZE / 4); j++) {
            mStuffing[OFF + j] = VAL;
        }
    }
}
Also used : AlertDialog(android.app.AlertDialog) Intent(android.content.Intent) WindowManager(android.view.WindowManager) Dialog(android.app.Dialog) AlertDialog(android.app.AlertDialog) Display(android.view.Display)

Example 18 with Dialog

use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.

the class BrightnessTile method showBrightnessDialog.

private void showBrightnessDialog() {
    if (mBrightnessDialog == null) {
        mBrightnessDialog = new Dialog(mContext);
        mBrightnessDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        mBrightnessDialog.setContentView(R.layout.quick_settings_brightness_dialog);
        mBrightnessDialog.setCanceledOnTouchOutside(true);
        new BrightnessController(mContext, (ImageView) mBrightnessDialog.findViewById(R.id.brightness_icon), (ToggleSlider) mBrightnessDialog.findViewById(R.id.brightness_slider));
        mBrightnessDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
        mBrightnessDialog.getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
        mBrightnessDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
    }
    if (!mBrightnessDialog.isShowing()) {
        try {
            WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
        } catch (RemoteException e) {
        // Do nothing here
        }
        mBrightnessDialog.show();
        dismissBrightnessDialog(mBrightnessDialogLongTimeout);
    }
}
Also used : BrightnessController(com.android.systemui.settings.BrightnessController) Dialog(android.app.Dialog) RemoteException(android.os.RemoteException)

Example 19 with Dialog

use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.

the class BugReportTile method showBugreportDialog.

private void showBugreportDialog() {
    final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    builder.setPositiveButton(com.android.internal.R.string.report, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                // Add a little delay before executing, to give the
                // dialog a chance to go away before it takes a
                // screenshot.
                mHandler.postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            ActivityManagerNative.getDefault().requestBugReport();
                        } catch (RemoteException e) {
                        }
                    }
                }, 500);
            }
        }
    });
    builder.setMessage(com.android.internal.R.string.bugreport_message);
    builder.setTitle(com.android.internal.R.string.bugreport_title);
    builder.setCancelable(true);
    final Dialog dialog = builder.create();
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
    try {
        WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
    } catch (RemoteException e) {
    }
    dialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) Dialog(android.app.Dialog) AlertDialog(android.app.AlertDialog) OnClickListener(android.content.DialogInterface.OnClickListener) RemoteException(android.os.RemoteException)

Example 20 with Dialog

use of android.app.Dialog in project android_frameworks_base by ParanoidAndroid.

the class QuickSettings method showBugreportDialog.

private void showBugreportDialog() {
    final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
    builder.setPositiveButton(com.android.internal.R.string.report, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (which == DialogInterface.BUTTON_POSITIVE) {
                // Add a little delay before executing, to give the
                // dialog a chance to go away before it takes a
                // screenshot.
                mHandler.postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        try {
                            ActivityManagerNative.getDefault().requestBugReport();
                        } catch (RemoteException e) {
                        }
                    }
                }, 500);
            }
        }
    });
    builder.setMessage(com.android.internal.R.string.bugreport_message);
    builder.setTitle(com.android.internal.R.string.bugreport_title);
    builder.setCancelable(true);
    final Dialog dialog = builder.create();
    dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
    try {
        WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
    } catch (RemoteException e) {
    }
    dialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) AlertDialog(android.app.AlertDialog) Dialog(android.app.Dialog) OnClickListener(android.content.DialogInterface.OnClickListener) RemoteException(android.os.RemoteException)

Aggregations

Dialog (android.app.Dialog)356 View (android.view.View)109 AlertDialog (android.app.AlertDialog)99 DialogInterface (android.content.DialogInterface)87 TextView (android.widget.TextView)76 AlertDialog (android.support.v7.app.AlertDialog)48 Intent (android.content.Intent)38 EditText (android.widget.EditText)34 ListView (android.widget.ListView)34 LayoutInflater (android.view.LayoutInflater)32 Context (android.content.Context)31 ProgressDialog (android.app.ProgressDialog)29 AdapterView (android.widget.AdapterView)29 WindowManager (android.view.WindowManager)28 ImageView (android.widget.ImageView)25 LinearLayout (android.widget.LinearLayout)25 Test (org.junit.Test)25 BrowserDialog (acr.browser.lightning.dialog.BrowserDialog)23 Button (android.widget.Button)22 Activity (android.app.Activity)18