Search in sources :

Example 16 with SystemUIDialog

use of com.android.systemui.statusbar.phone.SystemUIDialog in project platform_frameworks_base by android.

the class QSFooter method createDialog.

private void createDialog() {
    String deviceOwner = mSecurityController.getDeviceOwnerName();
    String profileOwner = mSecurityController.getProfileOwnerName();
    String primaryVpn = mSecurityController.getPrimaryVpnName();
    String profileVpn = mSecurityController.getProfileVpnName();
    boolean managed = mSecurityController.hasProfileOwner();
    boolean isBranded = deviceOwner == null && mSecurityController.isVpnBranded();
    mDialog = new SystemUIDialog(mContext);
    if (!isBranded) {
        mDialog.setTitle(getTitle(deviceOwner));
    }
    mDialog.setMessage(getMessage(deviceOwner, profileOwner, primaryVpn, profileVpn, managed, isBranded));
    mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getPositiveButton(isBranded), this);
    if (mSecurityController.isVpnEnabled() && !mSecurityController.isVpnRestricted()) {
        mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getSettingsButton(), this);
    }
    mDialog.show();
}
Also used : SystemUIDialog(com.android.systemui.statusbar.phone.SystemUIDialog)

Example 17 with SystemUIDialog

use of com.android.systemui.statusbar.phone.SystemUIDialog in project android_frameworks_base by DirtyUnicorns.

the class VolumeUI method showServiceActivationDialog.

private void showServiceActivationDialog(final ComponentName component) {
    final SystemUIDialog d = new SystemUIDialog(mContext);
    d.setMessage(mContext.getString(R.string.volumeui_prompt_message, getAppLabel(component)));
    d.setPositiveButton(R.string.volumeui_prompt_allow, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            mVolumeControllerService.setComponent(component);
        }
    });
    d.setNegativeButton(R.string.volumeui_prompt_deny, null);
    d.show();
}
Also used : SystemUIDialog(com.android.systemui.statusbar.phone.SystemUIDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener)

Example 18 with SystemUIDialog

use of com.android.systemui.statusbar.phone.SystemUIDialog in project android_frameworks_base by AOSPA.

the class QSFooter method createDialog.

private void createDialog() {
    final String deviceOwnerPackage = mSecurityController.getDeviceOwnerName();
    final String profileOwnerPackage = mSecurityController.getProfileOwnerName();
    final boolean isNetworkLoggingEnabled = mSecurityController.isNetworkLoggingEnabled();
    final String primaryVpn = mSecurityController.getPrimaryVpnName();
    final String profileVpn = mSecurityController.getProfileVpnName();
    boolean hasProfileOwner = mSecurityController.hasProfileOwner();
    boolean isBranded = deviceOwnerPackage == null && mSecurityController.isVpnBranded();
    mDialog = new SystemUIDialog(mContext);
    if (!isBranded) {
        mDialog.setTitle(getTitle(deviceOwnerPackage));
    }
    CharSequence msg = getMessage(deviceOwnerPackage, profileOwnerPackage, primaryVpn, profileVpn, hasProfileOwner, isBranded);
    if (deviceOwnerPackage == null) {
        mDialog.setMessage(msg);
        if (mSecurityController.isVpnEnabled() && !mSecurityController.isVpnRestricted()) {
            mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getSettingsButton(), this);
        }
    } else {
        View dialogView = LayoutInflater.from(mContext).inflate(R.layout.quick_settings_footer_dialog, null, false);
        mDialog.setView(dialogView);
        TextView deviceOwnerWarning = (TextView) dialogView.findViewById(R.id.device_owner_warning);
        deviceOwnerWarning.setText(msg);
        // Make the link "learn more" clickable.
        deviceOwnerWarning.setMovementMethod(new LinkMovementMethod());
        if (primaryVpn == null) {
            dialogView.findViewById(R.id.vpn_icon).setVisibility(View.GONE);
            dialogView.findViewById(R.id.vpn_subtitle).setVisibility(View.GONE);
            dialogView.findViewById(R.id.vpn_warning).setVisibility(View.GONE);
        } else {
            final SpannableStringBuilder message = new SpannableStringBuilder();
            message.append(mContext.getString(R.string.monitoring_description_do_body_vpn, primaryVpn));
            if (!mSecurityController.isVpnRestricted()) {
                message.append(mContext.getString(R.string.monitoring_description_vpn_settings_separator));
                message.append(mContext.getString(R.string.monitoring_description_vpn_settings), new VpnSpan(), 0);
            }
            TextView vpnWarning = (TextView) dialogView.findViewById(R.id.vpn_warning);
            vpnWarning.setText(message);
            // Make the link "Open VPN Settings" clickable.
            vpnWarning.setMovementMethod(new LinkMovementMethod());
        }
        if (!isNetworkLoggingEnabled) {
            dialogView.findViewById(R.id.network_logging_icon).setVisibility(View.GONE);
            dialogView.findViewById(R.id.network_logging_subtitle).setVisibility(View.GONE);
            dialogView.findViewById(R.id.network_logging_warning).setVisibility(View.GONE);
        }
    }
    mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getPositiveButton(isBranded), this);
    mDialog.show();
    mDialog.getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
Also used : SystemUIDialog(com.android.systemui.statusbar.phone.SystemUIDialog) LinkMovementMethod(android.text.method.LinkMovementMethod) TextView(android.widget.TextView) ImageView(android.widget.ImageView) View(android.view.View) TextView(android.widget.TextView) SpannableStringBuilder(android.text.SpannableStringBuilder)

Example 19 with SystemUIDialog

use of com.android.systemui.statusbar.phone.SystemUIDialog in project android_frameworks_base by AOSPA.

the class PowerNotificationWarnings method showTemperatureDialog.

private void showTemperatureDialog() {
    if (mHighTempDialog != null)
        return;
    final SystemUIDialog d = new SystemUIDialog(mContext);
    d.setIconAttribute(android.R.attr.alertDialogIcon);
    d.setTitle(R.string.high_temp_title);
    d.setMessage(R.string.high_temp_dialog_message);
    d.setPositiveButton(com.android.internal.R.string.ok, null);
    d.setShowForAllUsers(true);
    d.setOnDismissListener(dialog -> mHighTempDialog = null);
    d.show();
    mHighTempDialog = d;
}
Also used : SystemUIDialog(com.android.systemui.statusbar.phone.SystemUIDialog)

Example 20 with SystemUIDialog

use of com.android.systemui.statusbar.phone.SystemUIDialog in project android_frameworks_base by AOSPA.

the class VolumeUI method showServiceActivationDialog.

private void showServiceActivationDialog(final ComponentName component) {
    final SystemUIDialog d = new SystemUIDialog(mContext);
    d.setMessage(mContext.getString(R.string.volumeui_prompt_message, getAppLabel(component)));
    d.setPositiveButton(R.string.volumeui_prompt_allow, new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            mVolumeControllerService.setComponent(component);
        }
    });
    d.setNegativeButton(R.string.volumeui_prompt_deny, null);
    d.show();
}
Also used : SystemUIDialog(com.android.systemui.statusbar.phone.SystemUIDialog) DialogInterface(android.content.DialogInterface) OnClickListener(android.content.DialogInterface.OnClickListener)

Aggregations

SystemUIDialog (com.android.systemui.statusbar.phone.SystemUIDialog)28 DialogInterface (android.content.DialogInterface)19 OnClickListener (android.content.DialogInterface.OnClickListener)9 OnDismissListener (android.content.DialogInterface.OnDismissListener)5 View (android.view.View)5 ImageView (android.widget.ImageView)5 TextView (android.widget.TextView)5 Intent (android.content.Intent)4 SpannableStringBuilder (android.text.SpannableStringBuilder)4 LinkMovementMethod (android.text.method.LinkMovementMethod)4 ActivityManager (android.app.ActivityManager)1 ApplicationInfo (android.content.pm.ApplicationInfo)1 PackageManager (android.content.pm.PackageManager)1 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)1 Drawable (android.graphics.drawable.Drawable)1 StatusBarNotification (android.service.notification.StatusBarNotification)1 ViewGroup (android.view.ViewGroup)1 OnDismissAction (com.android.keyguard.KeyguardHostView.OnDismissAction)1 GestureAnywhereView (com.android.systemui.chaos.lab.gestureanywhere.GestureAnywhereView)1 NavigationBarView (com.android.systemui.statusbar.phone.NavigationBarView)1