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

HotspotTile

public class HotspotTile extends com.android.systemui.qs.QSTile
Quick settings tile: Hotspot

Fields Summary
private final AnimationIcon
mEnable
private final AnimationIcon
mDisable
private final com.android.systemui.statusbar.policy.HotspotController
mController
private final Callback
mCallback
private final com.android.systemui.qs.UsageTracker
mUsageTracker
private final com.android.systemui.statusbar.policy.KeyguardMonitor
mKeyguard
Constructors Summary
public HotspotTile(Host host)


       
        super(host);
        mController = host.getHotspotController();
        mUsageTracker = newUsageTracker(host.getContext());
        mUsageTracker.setListening(true);
        mKeyguard = host.getKeyguardMonitor();
    
Methods Summary
protected java.lang.StringcomposeChangeAnnouncement()

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

        final boolean isEnabled = (Boolean) mState.value;
        mController.setHotspotEnabled(!isEnabled);
        mEnable.setAllowAnimation(true);
        mDisable.setAllowAnimation(true);
    
protected voidhandleDestroy()

        super.handleDestroy();
        mUsageTracker.setListening(false);
    
protected voidhandleLongClick()

        if (mState.value) return;  // don't allow usage reset if hotspot is active
        final String title = mContext.getString(R.string.quick_settings_reset_confirmation_title,
                mState.label);
        mUsageTracker.showResetConfirmation(title, new Runnable() {
            @Override
            public void run() {
                refreshState();
            }
        });
    
protected voidhandleUpdateState(BooleanState state, java.lang.Object arg)

        state.visible = mController.isHotspotSupported() && mUsageTracker.isRecentlyUsed();
        state.label = mContext.getString(R.string.quick_settings_hotspot_label);

        state.value = mController.isHotspotEnabled();
        state.icon = state.visible && state.value ? mEnable : mDisable;
    
protected BooleanStatenewTileState()

        return new BooleanState();
    
private static com.android.systemui.qs.UsageTrackernewUsageTracker(android.content.Context context)

        return new UsageTracker(context, HotspotTile.class, R.integer.days_to_show_hotspot_tile);
    
public voidsetListening(boolean listening)

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