Search in sources :

Example 56 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_Settings by crdroidandroid.

the class ProgressiveDisclosureMixin method addPreference.

/**
 * Adds preference to screen. If there are too many preference on screen, adds it to
 * collapsed list instead.
 */
public void addPreference(PreferenceScreen screen, Preference pref) {
    // Either add to screen, or to collapsed list.
    if (isCollapsed()) {
        // insert the preference to right position.
        final int lastPreferenceIndex = screen.getPreferenceCount() - 2;
        if (lastPreferenceIndex >= 0) {
            final Preference lastPreference = screen.getPreference(lastPreferenceIndex);
            if (lastPreference.getOrder() > pref.getOrder()) {
                // insert to screen and move the last pref to collapsed list.
                screen.removePreference(lastPreference);
                screen.addPreference(pref);
                addToCollapsedList(lastPreference);
            } else {
                // Insert to collapsed list.
                addToCollapsedList(pref);
            }
        } else {
            // Couldn't find last preference on screen, just add to collapsed list.
            addToCollapsedList(pref);
        }
    } else if (shouldCollapse(screen)) {
        // About to have too many tiles on scree, collapse and add pref to collapsed list.
        screen.addPreference(pref);
        collapse(screen);
    } else {
        // No need to collapse, add to screen directly.
        screen.addPreference(pref);
    }
}
Also used : Preference(android.support.v7.preference.Preference)

Example 57 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_Settings by crdroidandroid.

the class AppLaunchSettings method buildStateDropDown.

private void buildStateDropDown() {
    if (mIsBrowser) {
        // Browsers don't show the app-link prefs
        mAppLinkState.setShouldDisableView(true);
        mAppLinkState.setEnabled(false);
        mAppDomainUrls.setShouldDisableView(true);
        mAppDomainUrls.setEnabled(false);
    } else {
        // Designed order of states in the dropdown:
        // 
        // * always
        // * ask
        // * never
        mAppLinkState.setEntries(new CharSequence[] { getString(R.string.app_link_open_always), getString(R.string.app_link_open_ask), getString(R.string.app_link_open_never) });
        mAppLinkState.setEntryValues(new CharSequence[] { Integer.toString(INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS), Integer.toString(INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK), Integer.toString(INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_NEVER) });
        mAppLinkState.setEnabled(mHasDomainUrls);
        if (mHasDomainUrls) {
            // Present 'undefined' as 'ask' because the OS treats them identically for
            // purposes of the UI (and does the right thing around pending domain
            // verifications that might arrive after the user chooses 'ask' in this UI).
            final int state = mPm.getIntentVerificationStatusAsUser(mPackageName, UserHandle.myUserId());
            mAppLinkState.setValue(Integer.toString((state == INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_UNDEFINED) ? INTENT_FILTER_DOMAIN_VERIFICATION_STATUS_ALWAYS_ASK : state));
            // Set the callback only after setting the initial selected item
            mAppLinkState.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {

                @Override
                public boolean onPreferenceChange(Preference preference, Object newValue) {
                    return updateAppLinkState(Integer.parseInt((String) newValue));
                }
            });
        }
    }
}
Also used : Preference(android.support.v7.preference.Preference) DropDownPreference(android.support.v7.preference.DropDownPreference) OnPreferenceChangeListener(android.support.v7.preference.Preference.OnPreferenceChangeListener)

Example 58 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_Settings by crdroidandroid.

the class InputMethodAndSubtypeEnabler method onCreate.

@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    // Input method id should be available from an Intent when this preference is launched as a
    // single Activity (see InputMethodAndSubtypeEnablerActivity). It should be available
    // from a preference argument when the preference is launched as a part of the other
    // Activity (like a right pane of 2-pane Settings app)
    final String targetImi = getStringExtraFromIntentOrArguments(android.provider.Settings.EXTRA_INPUT_METHOD_ID);
    final PreferenceScreen root = getPreferenceManager().createPreferenceScreen(getPrefContext());
    mManager = new InputMethodAndSubtypeEnablerManager(this);
    mManager.init(this, targetImi, root);
    setPreferenceScreen(root);
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) InputMethodAndSubtypeEnablerManager(com.android.settingslib.inputmethod.InputMethodAndSubtypeEnablerManager)

Example 59 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_Settings by SudaMod.

the class ProgressiveDisclosureMixin method addPreference.

/**
 * Adds preference to screen. If there are too many preference on screen, adds it to
 * collapsed list instead.
 */
public void addPreference(PreferenceScreen screen, Preference pref) {
    // Either add to screen, or to collapsed list.
    if (isCollapsed()) {
        // insert the preference to right position.
        final int lastPreferenceIndex = screen.getPreferenceCount() - 2;
        if (lastPreferenceIndex >= 0) {
            final Preference lastPreference = screen.getPreference(lastPreferenceIndex);
            if (lastPreference.getOrder() > pref.getOrder()) {
                // insert to screen and move the last pref to collapsed list.
                screen.removePreference(lastPreference);
                screen.addPreference(pref);
                addToCollapsedList(lastPreference);
            } else {
                // Insert to collapsed list.
                addToCollapsedList(pref);
            }
        } else {
            // Couldn't find last preference on screen, just add to collapsed list.
            addToCollapsedList(pref);
        }
    } else if (shouldCollapse(screen)) {
        // About to have too many tiles on scree, collapse and add pref to collapsed list.
        screen.addPreference(pref);
        collapse(screen);
    } else {
        // No need to collapse, add to screen directly.
        screen.addPreference(pref);
    }
}
Also used : Preference(android.support.v7.preference.Preference)

Example 60 with RIGHT

use of android.support.v7.widget.helper.ItemTouchHelper.RIGHT in project android_packages_apps_Settings by SudaMod.

the class InputMethodAndSubtypeEnabler method onCreate.

@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    // Input method id should be available from an Intent when this preference is launched as a
    // single Activity (see InputMethodAndSubtypeEnablerActivity). It should be available
    // from a preference argument when the preference is launched as a part of the other
    // Activity (like a right pane of 2-pane Settings app)
    final String targetImi = getStringExtraFromIntentOrArguments(android.provider.Settings.EXTRA_INPUT_METHOD_ID);
    final PreferenceScreen root = getPreferenceManager().createPreferenceScreen(getPrefContext());
    mManager = new InputMethodAndSubtypeEnablerManager(this);
    mManager.init(this, targetImi, root);
    setPreferenceScreen(root);
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) InputMethodAndSubtypeEnablerManager(com.android.settingslib.inputmethod.InputMethodAndSubtypeEnablerManager)

Aggregations

View (android.view.View)315 RecyclerView (android.support.v7.widget.RecyclerView)294 Paint (android.graphics.Paint)47 TextView (android.widget.TextView)46 ImageView (android.widget.ImageView)29 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)27 ViewGroup (android.view.ViewGroup)15 Intent (android.content.Intent)13 Rect (android.graphics.Rect)12 Preference (android.support.v7.preference.Preference)12 GridLayoutManager (android.support.v7.widget.GridLayoutManager)11 SuppressLint (android.annotation.SuppressLint)10 AlertDialog (android.support.v7.app.AlertDialog)10 Bundle (android.os.Bundle)9 Bitmap (android.graphics.Bitmap)8 OnLayoutChangeListener (android.view.View.OnLayoutChangeListener)8 Button (android.widget.Button)8 PreferenceScreen (android.support.v7.preference.PreferenceScreen)7 ArrayList (java.util.ArrayList)7 Animator (android.animation.Animator)6