FileDocCategorySizeDatePackage
QSFooter.javaAPI DocAndroid 5.1 API10672Thu Mar 12 22:22:42 GMT 2015com.android.systemui.qs

QSFooter

public class QSFooter extends Object implements DialogInterface.OnClickListener, android.view.View.OnClickListener

Fields Summary
protected static final String
TAG
protected static final boolean
DEBUG
private final android.view.View
mRootView
private final android.widget.TextView
mFooterText
private final android.widget.ImageView
mFooterIcon
private final android.content.Context
mContext
private final Callback
mCallback
private com.android.systemui.statusbar.policy.SecurityController
mSecurityController
private android.app.AlertDialog
mDialog
private com.android.systemui.statusbar.phone.QSTileHost
mHost
private android.os.Handler
mHandler
private final android.os.Handler
mMainHandler
private boolean
mIsVisible
private boolean
mIsIconVisible
private int
mFooterTextId
private final Runnable
mUpdateDisplayState
Constructors Summary
public QSFooter(QSPanel qsPanel, android.content.Context context)


         
        mRootView = LayoutInflater.from(context)
                .inflate(R.layout.quick_settings_footer, qsPanel, false);
        mRootView.setOnClickListener(this);
        mFooterText = (TextView) mRootView.findViewById(R.id.footer_text);
        mFooterIcon = (ImageView) mRootView.findViewById(R.id.footer_icon);
        mContext = context;
        mMainHandler = new Handler();
    
Methods Summary
private voidcreateDialog()

        mDialog = new SystemUIDialog(mContext);
        mDialog.setTitle(getTitle());
        mDialog.setMessage(getMessage());
        mDialog.setButton(DialogInterface.BUTTON_POSITIVE, getPositiveButton(), this);
        if (mSecurityController.isVpnEnabled()) {
            mDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getNegativeButton(), this);
        }
        mDialog.show();
    
private java.lang.StringgetMessage()

        if (mSecurityController.hasDeviceOwner()) {
            if (mSecurityController.hasProfileOwner()) {
                if (mSecurityController.isVpnEnabled()) {
                    if (mSecurityController.isLegacyVpn()) {
                        return mContext.getString(
                                R.string.monitoring_description_legacy_vpn_device_and_profile_owned,
                                mSecurityController.getDeviceOwnerName(),
                                mSecurityController.getProfileOwnerName(),
                                mSecurityController.getLegacyVpnName());
                    } else {
                        return mContext.getString(
                                R.string.monitoring_description_vpn_device_and_profile_owned,
                                mSecurityController.getDeviceOwnerName(),
                                mSecurityController.getProfileOwnerName(),
                                mSecurityController.getVpnApp());
                    }
                } else {
                    return mContext.getString(
                            R.string.monitoring_description_device_and_profile_owned,
                            mSecurityController.getDeviceOwnerName(),
                            mSecurityController.getProfileOwnerName());
                }
            } else {
                if (mSecurityController.isVpnEnabled()) {
                    if (mSecurityController.isLegacyVpn()) {
                        return mContext.getString(
                                R.string.monitoring_description_legacy_vpn_device_owned,
                                mSecurityController.getDeviceOwnerName(),
                                mSecurityController.getLegacyVpnName());
                    } else {
                        return mContext.getString(R.string.monitoring_description_vpn_device_owned,
                                mSecurityController.getDeviceOwnerName(),
                                mSecurityController.getVpnApp());
                    }
                } else {
                    return mContext.getString(R.string.monitoring_description_device_owned,
                            mSecurityController.getDeviceOwnerName());
                }
            }
        } else if (mSecurityController.hasProfileOwner()) {
            if (mSecurityController.isVpnEnabled()) {
                if (mSecurityController.isLegacyVpn()) {
                    return mContext.getString(
                            R.string.monitoring_description_legacy_vpn_profile_owned,
                            mSecurityController.getProfileOwnerName(),
                            mSecurityController.getLegacyVpnName());
                } else {
                    return mContext.getString(
                            R.string.monitoring_description_vpn_profile_owned,
                            mSecurityController.getProfileOwnerName(),
                            mSecurityController.getVpnApp());
                }
            } else {
                return mContext.getString(
                        R.string.monitoring_description_profile_owned,
                        mSecurityController.getProfileOwnerName());
            }
        } else {
            if (mSecurityController.isLegacyVpn()) {
                return mContext.getString(R.string.monitoring_description_legacy_vpn,
                        mSecurityController.getLegacyVpnName());

            } else {
                return mContext.getString(R.string.monitoring_description_vpn,
                        mSecurityController.getVpnApp());
            }
        }
    
private java.lang.StringgetNegativeButton()

        if (mSecurityController.isLegacyVpn()) {
            return mContext.getString(R.string.disconnect_vpn);
        } else {
            return mContext.getString(R.string.disable_vpn);
        }
    
private java.lang.StringgetPositiveButton()

        return mContext.getString(R.string.quick_settings_done);
    
private intgetTitle()

        if (mSecurityController.hasDeviceOwner()) {
            return R.string.monitoring_title_device_owned;
        }
        if (mSecurityController.hasProfileOwner()) {
            return R.string.monitoring_title_profile_owned;
        }
        return R.string.monitoring_title;
    
public android.view.ViewgetView()

        return mRootView;
    
private voidhandleClick()

        mHost.collapsePanels();
        // TODO: Delay dialog creation until after panels are collapsed.
        createDialog();
    
private voidhandleRefreshState()

        if (mSecurityController.hasDeviceOwner()) {
            mFooterTextId = R.string.device_owned_footer;
            mIsVisible = true;
            mIsIconVisible = false;
        } else if (mSecurityController.hasProfileOwner()) {
            mFooterTextId = R.string.profile_owned_footer;
            mIsVisible = true;
            mIsIconVisible = false;
        } else if (mSecurityController.isVpnEnabled()) {
            mFooterTextId = R.string.vpn_footer;
            mIsVisible = true;
            mIsIconVisible = true;
        } else {
            mIsVisible = false;
            mIsIconVisible = false;
        }
        mMainHandler.post(mUpdateDisplayState);
    
public booleanhasFooter()

        return mRootView.getVisibility() != View.GONE;
    
public voidonClick(android.content.DialogInterface dialog, int which)

        if (which == DialogInterface.BUTTON_NEGATIVE) {
            mSecurityController.disconnectFromVpn();
        }
    
public voidonClick(android.view.View v)

        mHandler.sendEmptyMessage(H.CLICK);
    
public voidonConfigurationChanged()

        FontSizeUtils.updateFontSize(mFooterText, R.dimen.qs_tile_text_size);
    
public voidrefreshState()

        mHandler.sendEmptyMessage(H.REFRESH_STATE);
    
public voidsetHost(com.android.systemui.statusbar.phone.QSTileHost host)

        mHost = host;
        mSecurityController = host.getSecurityController();
        mHandler = new H(host.getLooper());
    
public voidsetListening(boolean listening)

        if (listening) {
            mSecurityController.addCallback(mCallback);
        } else {
            mSecurityController.removeCallback(mCallback);
        }