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);
}
}
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));
}
});
}
}
}
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);
}
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);
}
}
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);
}
Aggregations