Search in sources :

Example 1 with IconPickHelper

use of com.crdroid.settings.fragments.navbar.IconPickHelper in project android_packages_apps_crDroidSettings by crdroidandroid.

the class Fling method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.fling_settings);
    ContentResolver resolver = getActivity().getContentResolver();
    mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.fling_back_home_policy);
    mContext = (Context) getActivity();
    mIconPickHelper = new IconPickHelper(getActivity(), this);
    mShowLogo = (SwitchPreference) findPreference("eos_fling_show_logo");
    mShowLogo.setChecked(Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LOGO_VISIBLE, 1, UserHandle.USER_CURRENT) == 1);
    mShowLogo.setOnPreferenceChangeListener(this);
    mAnimateLogo = (SwitchPreference) findPreference("eos_fling_animate_logo");
    mAnimateLogo.setChecked(Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LOGO_ANIMATES, 1, UserHandle.USER_CURRENT) == 1);
    mAnimateLogo.setOnPreferenceChangeListener(this);
    mShowRipple = (SwitchPreference) findPreference("eos_fling_show_ripple");
    mShowRipple.setChecked(Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_RIPPLE_ENABLED, 1, UserHandle.USER_CURRENT) == 1);
    mShowRipple.setOnPreferenceChangeListener(this);
    int rippleColor = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_RIPPLE_COLOR, Color.WHITE, UserHandle.USER_CURRENT);
    mRippleColor = (ColorPickerPreference) findPreference("eos_fling_ripple_color");
    mRippleColor.setNewPreviewColor(rippleColor);
    mRippleColor.setOnPreferenceChangeListener(this);
    // NOTE: we display to the user actual timeouts starting from touch event
    // but framework wants the value less tap timeout, which is 100ms
    // so we always write 100ms less but display 100ms more
    mLongPressTimeout = (CustomSeekBarPreference) findPreference("du_fling_longpress_pref");
    int val = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LONGPRESS_TIMEOUT, 250, UserHandle.USER_CURRENT);
    val += 100;
    mLongPressTimeout.setValue(val);
    mLongPressTimeout.setOnPreferenceChangeListener(this);
    final boolean isTablet = !DUActionUtils.navigationBarCanMove();
    mSwipePortRight = (CustomSeekBarPreference) findPreference("du_fling_longswipe_port_right");
    val = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LONGSWIPE_THRESHOLD_RIGHT_PORT, isTablet ? 30 : 40, UserHandle.USER_CURRENT);
    mSwipePortRight.setValue(val);
    mSwipePortRight.setOnPreferenceChangeListener(this);
    mSwipePortLeft = (CustomSeekBarPreference) findPreference("du_fling_longswipe_port_left");
    val = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LONGSWIPE_THRESHOLD_LEFT_PORT, isTablet ? 30 : 40, UserHandle.USER_CURRENT);
    mSwipePortLeft.setValue(val);
    mSwipePortLeft.setOnPreferenceChangeListener(this);
    mSwipeLandRight = (CustomSeekBarPreference) findPreference("du_fling_longswipe_land_right");
    mSwipeLandLeft = (CustomSeekBarPreference) findPreference("du_fling_longswipe_land_left");
    mSwipeVertUp = (CustomSeekBarPreference) findPreference("du_fling_longswipe_vert_up");
    mSwipeVertDown = (CustomSeekBarPreference) findPreference("du_fling_longswipe_vert_down");
    PreferenceCategory longSwipeCategory = (PreferenceCategory) getPreferenceScreen().findPreference("eos_long_swipe_category");
    if (isTablet) {
        longSwipeCategory.removePreference(mSwipeVertUp);
        longSwipeCategory.removePreference(mSwipeVertDown);
        val = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LONGSWIPE_THRESHOLD_RIGHT_LAND, 25, UserHandle.USER_CURRENT);
        mSwipeLandRight.setValue(val);
        mSwipeLandRight.setOnPreferenceChangeListener(this);
        val = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LONGSWIPE_THRESHOLD_LEFT_LAND, 25, UserHandle.USER_CURRENT);
        mSwipeLandLeft.setValue(val);
        mSwipeLandLeft.setOnPreferenceChangeListener(this);
    } else {
        longSwipeCategory.removePreference(mSwipeLandRight);
        longSwipeCategory.removePreference(mSwipeLandLeft);
        val = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LONGSWIPE_THRESHOLD_UP_LAND, 40, UserHandle.USER_CURRENT);
        mSwipeVertUp.setValue(val);
        mSwipeVertUp.setOnPreferenceChangeListener(this);
        val = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LONGSWIPE_THRESHOLD_DOWN_LAND, 40, UserHandle.USER_CURRENT);
        mSwipeVertDown.setValue(val);
        mSwipeVertDown.setOnPreferenceChangeListener(this);
    }
    mKbCursors = (SwitchPreference) findPreference("fling_keyboard_cursors");
    mKbCursors.setChecked(Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_KEYBOARD_CURSORS, 1, UserHandle.USER_CURRENT) == 1);
    mKbCursors.setOnPreferenceChangeListener(this);
    mLogoOpacity = (CustomSeekBarPreference) findPreference("fling_logo_opacity");
    int alpha = Settings.Secure.getIntForUser(resolver, Settings.Secure.FLING_LOGO_OPACITY, 255, UserHandle.USER_CURRENT);
    mLogoOpacity.setValue(alpha);
    mLogoOpacity.setOnPreferenceChangeListener(this);
    onPreferenceScreenLoaded(ActionConstants.getDefaults(ActionConstants.FLING));
}
Also used : IconPickHelper(com.crdroid.settings.fragments.navbar.IconPickHelper) PreferenceCategory(android.support.v7.preference.PreferenceCategory) ContentResolver(android.content.ContentResolver)

Aggregations

ContentResolver (android.content.ContentResolver)1 PreferenceCategory (android.support.v7.preference.PreferenceCategory)1 IconPickHelper (com.crdroid.settings.fragments.navbar.IconPickHelper)1