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

ColorInversionTile

public class ColorInversionTile extends com.android.systemui.qs.QSTile
Quick settings tile: Invert colors

Fields Summary
private final AnimationIcon
mEnable
private final AnimationIcon
mDisable
private final com.android.systemui.qs.SecureSetting
mSetting
private final com.android.systemui.qs.UsageTracker
mUsageTracker
private boolean
mListening
Constructors Summary
public ColorInversionTile(Host host)


       
        super(host);

        mSetting = new SecureSetting(mContext, mHandler,
                Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED) {
            @Override
            protected void handleValueChanged(int value, boolean observedChange) {
                if (value != 0 || observedChange) {
                    mUsageTracker.trackUsage();
                }
                if (mListening) {
                    handleRefreshState(value);
                }
            }
        };
        mUsageTracker = new UsageTracker(host.getContext(), ColorInversionTile.class,
                R.integer.days_to_show_color_inversion_tile);
        if (mSetting.getValue() != 0 && !mUsageTracker.isRecentlyUsed()) {
            mUsageTracker.trackUsage();
        }
        mUsageTracker.setListening(true);
        mSetting.setListening(true);
    
Methods Summary
protected java.lang.StringcomposeChangeAnnouncement()

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

        mSetting.setValue(mState.value ? 0 : 1);
        mEnable.setAllowAnimation(true);
        mDisable.setAllowAnimation(true);
    
protected voidhandleDestroy()

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

        if (mState.value) return;  // don't allow usage reset if inversion 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)

        final int value = arg instanceof Integer ? (Integer) arg : mSetting.getValue();
        final boolean enabled = value != 0;
        state.visible = enabled || mUsageTracker.isRecentlyUsed();
        state.value = enabled;
        state.label = mContext.getString(R.string.quick_settings_inversion_label);
        state.icon = enabled ? mEnable : mDisable;
    
protected voidhandleUserSwitch(int newUserId)

        mSetting.setUserId(newUserId);
        handleRefreshState(mSetting.getValue());
    
protected BooleanStatenewTileState()

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

        mListening = listening;