Search in sources :

Example 46 with DialogInterface

use of android.content.DialogInterface in project android_frameworks_base by ResurrectionRemix.

the class InputMethodManagerService method showInputMethodMenu.

private void showInputMethodMenu(boolean showAuxSubtypes) {
    if (DEBUG)
        Slog.v(TAG, "Show switching menu. showAuxSubtypes=" + showAuxSubtypes);
    final Context context = mContext;
    final boolean isScreenLocked = isScreenLocked();
    final String lastInputMethodId = mSettings.getSelectedInputMethod();
    int lastInputMethodSubtypeId = mSettings.getSelectedInputMethodSubtypeId(lastInputMethodId);
    if (DEBUG)
        Slog.v(TAG, "Current IME: " + lastInputMethodId);
    synchronized (mMethodMap) {
        final HashMap<InputMethodInfo, List<InputMethodSubtype>> immis = mSettings.getExplicitlyOrImplicitlyEnabledInputMethodsAndSubtypeListLocked(mContext);
        if (immis == null || immis.size() == 0) {
            return;
        }
        hideInputMethodMenuLocked();
        final List<ImeSubtypeListItem> imList = mSwitchingController.getSortedInputMethodAndSubtypeListLocked(showAuxSubtypes, isScreenLocked);
        if (lastInputMethodSubtypeId == NOT_A_SUBTYPE_ID) {
            final InputMethodSubtype currentSubtype = getCurrentInputMethodSubtypeLocked();
            if (currentSubtype != null) {
                final InputMethodInfo currentImi = mMethodMap.get(mCurMethodId);
                lastInputMethodSubtypeId = InputMethodUtils.getSubtypeIdFromHashCode(currentImi, currentSubtype.hashCode());
            }
        }
        final int N = imList.size();
        mIms = new InputMethodInfo[N];
        mSubtypeIds = new int[N];
        int checkedItem = 0;
        for (int i = 0; i < N; ++i) {
            final ImeSubtypeListItem item = imList.get(i);
            mIms[i] = item.mImi;
            mSubtypeIds[i] = item.mSubtypeId;
            if (mIms[i].getId().equals(lastInputMethodId)) {
                int subtypeId = mSubtypeIds[i];
                if ((subtypeId == NOT_A_SUBTYPE_ID) || (lastInputMethodSubtypeId == NOT_A_SUBTYPE_ID && subtypeId == 0) || (subtypeId == lastInputMethodSubtypeId)) {
                    checkedItem = i;
                }
            }
        }
        final Context settingsContext = new ContextThemeWrapper(context, com.android.internal.R.style.Theme_DeviceDefault_Settings);
        mDialogBuilder = new AlertDialog.Builder(settingsContext);
        mDialogBuilder.setOnCancelListener(new OnCancelListener() {

            @Override
            public void onCancel(DialogInterface dialog) {
                hideInputMethodMenu();
            }
        });
        final Context dialogContext = mDialogBuilder.getContext();
        final TypedArray a = dialogContext.obtainStyledAttributes(null, com.android.internal.R.styleable.DialogPreference, com.android.internal.R.attr.alertDialogStyle, 0);
        final Drawable dialogIcon = a.getDrawable(com.android.internal.R.styleable.DialogPreference_dialogIcon);
        a.recycle();
        mDialogBuilder.setIcon(dialogIcon);
        final LayoutInflater inflater = dialogContext.getSystemService(LayoutInflater.class);
        final View tv = inflater.inflate(com.android.internal.R.layout.input_method_switch_dialog_title, null);
        mDialogBuilder.setCustomTitle(tv);
        // Setup layout for a toggle switch of the hardware keyboard
        mSwitchingDialogTitleView = tv;
        mSwitchingDialogTitleView.findViewById(com.android.internal.R.id.hard_keyboard_section).setVisibility(mWindowManagerInternal.isHardKeyboardAvailable() ? View.VISIBLE : View.GONE);
        final Switch hardKeySwitch = (Switch) mSwitchingDialogTitleView.findViewById(com.android.internal.R.id.hard_keyboard_switch);
        hardKeySwitch.setChecked(mShowImeWithHardKeyboard);
        hardKeySwitch.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                mSettings.setShowImeWithHardKeyboard(isChecked);
                // Ensure that the input method dialog is dismissed when changing
                // the hardware keyboard state.
                hideInputMethodMenu();
            }
        });
        final ImeSubtypeListAdapter adapter = new ImeSubtypeListAdapter(dialogContext, com.android.internal.R.layout.input_method_switch_item, imList, checkedItem);
        final OnClickListener choiceListener = new OnClickListener() {

            @Override
            public void onClick(final DialogInterface dialog, final int which) {
                synchronized (mMethodMap) {
                    if (mIms == null || mIms.length <= which || mSubtypeIds == null || mSubtypeIds.length <= which) {
                        return;
                    }
                    final InputMethodInfo im = mIms[which];
                    int subtypeId = mSubtypeIds[which];
                    adapter.mCheckedItem = which;
                    adapter.notifyDataSetChanged();
                    hideInputMethodMenu();
                    if (im != null) {
                        if (subtypeId < 0 || subtypeId >= im.getSubtypeCount()) {
                            subtypeId = NOT_A_SUBTYPE_ID;
                        }
                        setInputMethodLocked(im.getId(), subtypeId);
                    }
                }
            }
        };
        mDialogBuilder.setSingleChoiceItems(adapter, checkedItem, choiceListener);
        mSwitchingDialog = mDialogBuilder.create();
        mSwitchingDialog.setCanceledOnTouchOutside(true);
        mSwitchingDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG);
        mSwitchingDialog.getWindow().getAttributes().privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
        mSwitchingDialog.getWindow().getAttributes().setTitle("Select input method");
        updateSystemUi(mCurToken, mImeWindowVis, mBackDisposition);
        mSwitchingDialog.show();
    }
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) InputMethodInfo(android.view.inputmethod.InputMethodInfo) TypedArray(android.content.res.TypedArray) ArrayList(java.util.ArrayList) List(java.util.List) LocaleList(android.os.LocaleList) OnCancelListener(android.content.DialogInterface.OnCancelListener) IInputContext(com.android.internal.view.IInputContext) Context(android.content.Context) InputMethodSubtype(android.view.inputmethod.InputMethodSubtype) OnCheckedChangeListener(android.widget.CompoundButton.OnCheckedChangeListener) Drawable(android.graphics.drawable.Drawable) View(android.view.View) TextView(android.widget.TextView) ImeSubtypeListItem(com.android.internal.inputmethod.InputMethodSubtypeSwitchingController.ImeSubtypeListItem) ContextThemeWrapper(android.view.ContextThemeWrapper) Switch(android.widget.Switch) LayoutInflater(android.view.LayoutInflater) OnClickListener(android.content.DialogInterface.OnClickListener) CompoundButton(android.widget.CompoundButton)

Example 47 with DialogInterface

use of android.content.DialogInterface in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ConfirmDeviceCredentialBaseFragment method showDialog.

private void showDialog(String title, String message, int buttonString, final boolean dismiss) {
    final AlertDialog dialog = new AlertDialog.Builder(getActivity()).setTitle(title).setMessage(message).setPositiveButton(buttonString, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            if (dismiss) {
                getActivity().finish();
            }
        }
    }).create();
    dialog.show();
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 48 with DialogInterface

use of android.content.DialogInterface in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DeviceAdminAdd method onCreate.

@Override
protected void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mHandler = new Handler(getMainLooper());
    mDPM = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
    mAppOps = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);
    PackageManager packageManager = getPackageManager();
    if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK) != 0) {
        Log.w(TAG, "Cannot start ADD_DEVICE_ADMIN as a new task");
        finish();
        return;
    }
    mIsCalledFromSupportDialog = getIntent().getBooleanExtra(EXTRA_CALLED_FROM_SUPPORT_DIALOG, false);
    String action = getIntent().getAction();
    ComponentName who = (ComponentName) getIntent().getParcelableExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN);
    if (who == null) {
        String packageName = getIntent().getStringExtra(EXTRA_DEVICE_ADMIN_PACKAGE_NAME);
        for (ComponentName component : mDPM.getActiveAdmins()) {
            if (component.getPackageName().equals(packageName)) {
                who = component;
                mUninstalling = true;
                break;
            }
        }
        if (who == null) {
            Log.w(TAG, "No component specified in " + action);
            finish();
            return;
        }
    }
    if (action != null && action.equals(DevicePolicyManager.ACTION_SET_PROFILE_OWNER)) {
        setResult(RESULT_CANCELED);
        setFinishOnTouchOutside(true);
        mAddingProfileOwner = true;
        mProfileOwnerName = getIntent().getStringExtra(DevicePolicyManager.EXTRA_PROFILE_OWNER_NAME);
        String callingPackage = getCallingPackage();
        if (callingPackage == null || !callingPackage.equals(who.getPackageName())) {
            Log.e(TAG, "Unknown or incorrect caller");
            finish();
            return;
        }
        try {
            PackageInfo packageInfo = packageManager.getPackageInfo(callingPackage, 0);
            if ((packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
                Log.e(TAG, "Cannot set a non-system app as a profile owner");
                finish();
                return;
            }
        } catch (NameNotFoundException nnfe) {
            Log.e(TAG, "Cannot find the package " + callingPackage);
            finish();
            return;
        }
    }
    ActivityInfo ai;
    try {
        ai = packageManager.getReceiverInfo(who, PackageManager.GET_META_DATA);
    } catch (PackageManager.NameNotFoundException e) {
        Log.w(TAG, "Unable to retrieve device policy " + who, e);
        finish();
        return;
    }
    // invalid device admin.
    if (!mDPM.isAdminActive(who)) {
        List<ResolveInfo> avail = packageManager.queryBroadcastReceivers(new Intent(DeviceAdminReceiver.ACTION_DEVICE_ADMIN_ENABLED), PackageManager.GET_DISABLED_UNTIL_USED_COMPONENTS);
        int count = avail == null ? 0 : avail.size();
        boolean found = false;
        for (int i = 0; i < count; i++) {
            ResolveInfo ri = avail.get(i);
            if (ai.packageName.equals(ri.activityInfo.packageName) && ai.name.equals(ri.activityInfo.name)) {
                try {
                    // We didn't retrieve the meta data for all possible matches, so
                    // need to use the activity info of this specific one that was retrieved.
                    ri.activityInfo = ai;
                    DeviceAdminInfo dpi = new DeviceAdminInfo(this, ri);
                    found = true;
                } catch (XmlPullParserException e) {
                    Log.w(TAG, "Bad " + ri.activityInfo, e);
                } catch (IOException e) {
                    Log.w(TAG, "Bad " + ri.activityInfo, e);
                }
                break;
            }
        }
        if (!found) {
            Log.w(TAG, "Request to add invalid device admin: " + who);
            finish();
            return;
        }
    }
    ResolveInfo ri = new ResolveInfo();
    ri.activityInfo = ai;
    try {
        mDeviceAdmin = new DeviceAdminInfo(this, ri);
    } catch (XmlPullParserException e) {
        Log.w(TAG, "Unable to retrieve device policy " + who, e);
        finish();
        return;
    } catch (IOException e) {
        Log.w(TAG, "Unable to retrieve device policy " + who, e);
        finish();
        return;
    }
    // "OK" immediately.
    if (DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN.equals(getIntent().getAction())) {
        mRefreshing = false;
        if (mDPM.isAdminActive(who)) {
            if (mDPM.isRemovingAdmin(who, android.os.Process.myUserHandle().getIdentifier())) {
                Log.w(TAG, "Requested admin is already being removed: " + who);
                finish();
                return;
            }
            ArrayList<DeviceAdminInfo.PolicyInfo> newPolicies = mDeviceAdmin.getUsedPolicies();
            for (int i = 0; i < newPolicies.size(); i++) {
                DeviceAdminInfo.PolicyInfo pi = newPolicies.get(i);
                if (!mDPM.hasGrantedPolicy(who, pi.ident)) {
                    mRefreshing = true;
                    break;
                }
            }
            if (!mRefreshing) {
                // Nothing changed (or policies were removed) - return immediately
                setResult(Activity.RESULT_OK);
                finish();
                return;
            }
        }
    }
    // need to prompt for permission. Just add and finish.
    if (mAddingProfileOwner && !mDPM.hasUserSetupCompleted()) {
        addAndFinish();
        return;
    }
    mAddMsgText = getIntent().getCharSequenceExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION);
    setContentView(R.layout.device_admin_add);
    mAdminIcon = (ImageView) findViewById(R.id.admin_icon);
    mAdminName = (TextView) findViewById(R.id.admin_name);
    mAdminDescription = (TextView) findViewById(R.id.admin_description);
    mProfileOwnerWarning = (TextView) findViewById(R.id.profile_owner_warning);
    mAddMsg = (TextView) findViewById(R.id.add_msg);
    mAddMsgExpander = (ImageView) findViewById(R.id.add_msg_expander);
    final View.OnClickListener onClickListener = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            toggleMessageEllipsis(mAddMsg);
        }
    };
    mAddMsgExpander.setOnClickListener(onClickListener);
    mAddMsg.setOnClickListener(onClickListener);
    // Determine whether the message can be collapsed - getLineCount() gives the correct
    // number of lines only after a layout pass.
    mAddMsg.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            final int maxLines = getEllipsizedLines();
            // hide the icon if number of visible lines does not exceed maxLines
            boolean hideMsgExpander = mAddMsg.getLineCount() <= maxLines;
            mAddMsgExpander.setVisibility(hideMsgExpander ? View.GONE : View.VISIBLE);
            if (hideMsgExpander) {
                mAddMsg.setOnClickListener(null);
                ((View) mAddMsgExpander.getParent()).invalidate();
            }
            mAddMsg.getViewTreeObserver().removeOnGlobalLayoutListener(this);
        }
    });
    // toggleMessageEllipsis also handles initial layout:
    toggleMessageEllipsis(mAddMsg);
    mAdminWarning = (TextView) findViewById(R.id.admin_warning);
    mAdminPolicies = (ViewGroup) findViewById(R.id.admin_policies);
    mSupportMessage = (TextView) findViewById(R.id.admin_support_message);
    mCancelButton = (Button) findViewById(R.id.cancel_button);
    mCancelButton.setFilterTouchesWhenObscured(true);
    mCancelButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            EventLog.writeEvent(EventLogTags.EXP_DET_DEVICE_ADMIN_DECLINED_BY_USER, mDeviceAdmin.getActivityInfo().applicationInfo.uid);
            finish();
        }
    });
    mUninstallButton = (Button) findViewById(R.id.uninstall_button);
    mUninstallButton.setFilterTouchesWhenObscured(true);
    mUninstallButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            EventLog.writeEvent(EventLogTags.EXP_DET_DEVICE_ADMIN_UNINSTALLED_BY_USER, mDeviceAdmin.getActivityInfo().applicationInfo.uid);
            mDPM.uninstallPackageWithActiveAdmins(mDeviceAdmin.getPackageName());
            finish();
        }
    });
    mActionButton = (Button) findViewById(R.id.action_button);
    mActionButton.setFilterTouchesWhenObscured(true);
    mActionButton.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            if (mAdding) {
                addAndFinish();
            } else if (isManagedProfile(mDeviceAdmin) && mDeviceAdmin.getComponent().equals(mDPM.getProfileOwner())) {
                final int userId = UserHandle.myUserId();
                UserDialogs.createRemoveDialog(DeviceAdminAdd.this, userId, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        UserManager um = UserManager.get(DeviceAdminAdd.this);
                        um.removeUser(userId);
                        finish();
                    }
                }).show();
            } else if (mUninstalling) {
                mDPM.uninstallPackageWithActiveAdmins(mDeviceAdmin.getPackageName());
                finish();
            } else if (!mWaitingForRemoveMsg) {
                try {
                    // Don't allow the admin to put a dialog up in front
                    // of us while we interact with the user.
                    ActivityManagerNative.getDefault().stopAppSwitches();
                } catch (RemoteException e) {
                }
                mWaitingForRemoveMsg = true;
                mDPM.getRemoveWarning(mDeviceAdmin.getComponent(), new RemoteCallback(new RemoteCallback.OnResultListener() {

                    @Override
                    public void onResult(Bundle result) {
                        CharSequence msg = result != null ? result.getCharSequence(DeviceAdminReceiver.EXTRA_DISABLE_WARNING) : null;
                        continueRemoveAction(msg);
                    }
                }, mHandler));
                // Don't want to wait too long.
                getWindow().getDecorView().getHandler().postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        continueRemoveAction(null);
                    }
                }, 2 * 1000);
            }
        }
    });
}
Also used : DialogInterface(android.content.DialogInterface) ResolveInfo(android.content.pm.ResolveInfo) PackageManager(android.content.pm.PackageManager) ComponentName(android.content.ComponentName) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) ViewTreeObserver(android.view.ViewTreeObserver) ActivityInfo(android.content.pm.ActivityInfo) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) PackageInfo(android.content.pm.PackageInfo) Bundle(android.os.Bundle) Handler(android.os.Handler) Intent(android.content.Intent) IOException(java.io.IOException) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) RemoteCallback(android.os.RemoteCallback) UserManager(android.os.UserManager) DeviceAdminInfo(android.app.admin.DeviceAdminInfo) RemoteException(android.os.RemoteException)

Example 49 with DialogInterface

use of android.content.DialogInterface in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class InputMethodPreference method showSecurityWarnDialog.

private void showSecurityWarnDialog() {
    if (mDialog != null && mDialog.isShowing()) {
        mDialog.dismiss();
    }
    final Context context = getContext();
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setCancelable(true);
    builder.setTitle(android.R.string.dialog_alert_title);
    final CharSequence label = mImi.getServiceInfo().applicationInfo.loadLabel(context.getPackageManager());
    builder.setMessage(context.getString(R.string.ime_security_warning, label));
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            // need to prompt if it's not Direct Boot aware.
            if (mImi.getServiceInfo().directBootAware) {
                setCheckedInternal(true);
            } else {
                showDirectBootWarnDialog();
            }
        }
    });
    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(final DialogInterface dialog, final int which) {
            // The user canceled to enable a 3rd party IME.
            setCheckedInternal(false);
        }
    });
    mDialog = builder.create();
    mDialog.show();
}
Also used : Context(android.content.Context) AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface)

Example 50 with DialogInterface

use of android.content.DialogInterface in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class MainSettingsLayout method onCreateView.

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mContainer = container;
    View view = inflater.inflate(R.layout.rr_main, container, false);
    mFab = (FloatingActionsMenu) view.findViewById(R.id.fab_menu);
    mLayout = (LinearLayout) view.findViewById(R.id.main_content);
    mViewPager = (ViewPager) view.findViewById(R.id.viewpager);
    mTabs = (PagerSlidingTabStrip) view.findViewById(R.id.tabs);
    mSettingsObserver = new SettingsObserver(new Handler());
    mInterceptorFrame = (FrameLayout) view.findViewById(R.id.fl_interceptor);
    FloatingActionButton mFab1 = (FloatingActionButton) view.findViewById(R.id.fab_event);
    FloatingActionButton mFab2 = (FloatingActionButton) view.findViewById(R.id.fab_restart);
    FloatingActionButton mFab3 = (FloatingActionButton) view.findViewById(R.id.fab_reset);
    FloatingActionButton mFab4 = (FloatingActionButton) view.findViewById(R.id.fab_info);
    FloatingActionButton mFab5 = (FloatingActionButton) view.findViewById(R.id.fab_config);
    mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
    mViewPager.setAdapter(mSectionsPagerAdapter);
    mTabs.setViewPager(mViewPager);
    mSettingsObserver.observe();
    mContext = getActivity().getApplicationContext();
    ContentResolver resolver = getActivity().getContentResolver();
    mInterceptorFrame.getBackground().setAlpha(0);
    int which = Settings.System.getInt(getActivity().getContentResolver(), Settings.System.RR_CONFIG_STYLE, 0);
    if (which == 1) {
        mTabs.setVisibility(View.GONE);
        mFab5.setTitle(getString(R.string.fab_layout_toggle));
    } else if (which == 0) {
        mTabs.setVisibility(View.VISIBLE);
        mFab5.setTitle(getString(R.string.fab_layout_update));
    }
    boolean isShowing = Settings.System.getInt(resolver, Settings.System.RR_OTA_FAB, 1) == 1;
    mFab1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent fabIntent = new Intent();
            fabIntent.setClassName("com.resurrection.ota", "com.resurrection.ota.MainActivity");
            startActivity(fabIntent);
        }
    });
    mFab2.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Helpers.showSystemUIrestartDialog(getActivity());
        }
    });
    mFab3.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            AlertDialog alertDialog = new AlertDialog.Builder(getActivity()).create();
            alertDialog.setTitle(getString(R.string.rr_reset_settings));
            alertDialog.setMessage(getString(R.string.rr_reset_message));
            alertDialog.setButton(getString(R.string.rr_reset_yes), new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    stockitems();
                }
            });
            alertDialog.setButton(Dialog.BUTTON_NEGATIVE, getString(R.string.rr_reset_cancel), new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int which) {
                    return;
                }
            });
            alertDialog.show();
        }
    });
    mFab4.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent fabIntent = new Intent();
            fabIntent.setClassName("com.android.settings", "com.android.settings.Settings$AboutSettingsActivity");
            startActivity(fabIntent);
        }
    });
    mFab5.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if (which == 0) {
                Settings.System.putInt(getActivity().getContentResolver(), Settings.System.RR_CONFIG_STYLE, 1);
            } else if (which == 1) {
                Settings.System.putInt(getActivity().getContentResolver(), Settings.System.RR_CONFIG_STYLE, 0);
            }
            finish();
            startActivity(getIntent());
        }
    });
    if (isShowing) {
        mFab.setVisibility(View.VISIBLE);
    } else {
        mFab.setVisibility(View.GONE);
    }
    mFab.setOnFloatingActionsMenuUpdateListener(new FloatingActionsMenu.OnFloatingActionsMenuUpdateListener() {

        @Override
        public void onMenuExpanded() {
            mInterceptorFrame.getBackground().setAlpha(240);
            mInterceptorFrame.setOnTouchListener(new View.OnTouchListener() {

                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    mFab.collapse();
                    return true;
                }
            });
        }

        @Override
        public void onMenuCollapsed() {
            mInterceptorFrame.getBackground().setAlpha(0);
            mInterceptorFrame.setOnTouchListener(null);
        }
    });
    mInterceptorFrame.setOnTouchListener(new View.OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (mFab.isExpanded()) {
                mFab.collapse();
                return true;
            }
            return false;
        }
    });
    return view;
}
Also used : AlertDialog(android.app.AlertDialog) DialogInterface(android.content.DialogInterface) FloatingActionsMenu(com.android.settings.rr.fab.FloatingActionsMenu) Handler(android.os.Handler) Intent(android.content.Intent) View(android.view.View) ContentResolver(android.content.ContentResolver) MotionEvent(android.view.MotionEvent) FloatingActionButton(com.android.settings.rr.fab.FloatingActionButton)

Aggregations

DialogInterface (android.content.DialogInterface)2727 AlertDialog (android.app.AlertDialog)1227 View (android.view.View)877 Intent (android.content.Intent)708 TextView (android.widget.TextView)653 AlertDialog (android.support.v7.app.AlertDialog)644 EditText (android.widget.EditText)426 ImageView (android.widget.ImageView)308 OnClickListener (android.content.DialogInterface.OnClickListener)285 LayoutInflater (android.view.LayoutInflater)242 SuppressLint (android.annotation.SuppressLint)225 AdapterView (android.widget.AdapterView)220 ListView (android.widget.ListView)220 ArrayList (java.util.ArrayList)213 Dialog (android.app.Dialog)179 Context (android.content.Context)179 File (java.io.File)160 OnClickListener (android.view.View.OnClickListener)157 Bundle (android.os.Bundle)146 Activity (android.app.Activity)143