FileDocCategorySizeDatePackage
LocationTile.javaAPI DocAndroid 5.1 API4067Thu Mar 12 22:22:42 GMT 2015com.android.systemui.qs.tiles

LocationTile

public class LocationTile extends com.android.systemui.qs.QSTile
Quick settings tile: Location

Fields Summary
private final AnimationIcon
mEnable
private final AnimationIcon
mDisable
private final com.android.systemui.statusbar.policy.LocationController
mController
private final com.android.systemui.statusbar.policy.KeyguardMonitor
mKeyguard
private final Callback
mCallback
Constructors Summary
public LocationTile(Host host)


       
        super(host);
        mController = host.getLocationController();
        mKeyguard = host.getKeyguardMonitor();
    
Methods Summary
protected java.lang.StringcomposeChangeAnnouncement()

        if (mState.value) {
            return mContext.getString(R.string.accessibility_quick_settings_location_changed_on);
        } else {
            return mContext.getString(R.string.accessibility_quick_settings_location_changed_off);
        }
    
protected voidhandleClick()

        final boolean wasEnabled = (Boolean) mState.value;
        mController.setLocationEnabled(!wasEnabled);
        mEnable.setAllowAnimation(true);
        mDisable.setAllowAnimation(true);
    
protected voidhandleUpdateState(BooleanState state, java.lang.Object arg)

        final boolean locationEnabled =  mController.isLocationEnabled();

        // Work around for bug 15916487: don't show location tile on top of lock screen. After the
        // bug is fixed, this should be reverted to only hiding it on secure lock screens:
        // state.visible = !(mKeyguard.isSecure() && mKeyguard.isShowing());
        state.visible = !mKeyguard.isShowing();
        state.value = locationEnabled;
        if (locationEnabled) {
            state.icon = mEnable;
            state.label = mContext.getString(R.string.quick_settings_location_label);
            state.contentDescription = mContext.getString(
                    R.string.accessibility_quick_settings_location_on);
        } else {
            state.icon = mDisable;
            state.label = mContext.getString(R.string.quick_settings_location_label);
            state.contentDescription = mContext.getString(
                    R.string.accessibility_quick_settings_location_off);
        }
    
protected BooleanStatenewTileState()

        return new BooleanState();
    
public voidsetListening(boolean listening)

        if (listening) {
            mController.addSettingsChangedCallback(mCallback);
            mKeyguard.addCallback(mCallback);
        } else {
            mController.removeSettingsChangedCallback(mCallback);
            mKeyguard.removeCallback(mCallback);
        }