use of android.support.v7.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimSettings method updateSubscriptions.
private void updateSubscriptions() {
mSubInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();
for (int i = 0; i < mNumSlots; ++i) {
Preference pref = mSimCards.findPreference("sim" + i);
if (pref instanceof SimPreference) {
mSimCards.removePreference(pref);
}
}
mMobileNetwork.removeAll();
mAvailableSubInfos.clear();
mSelectableSubInfos.clear();
for (int i = 0; i < mNumSlots; ++i) {
final SubscriptionInfo sir = mSubscriptionManager.getActiveSubscriptionInfoForSimSlotIndex(i);
final int subscriptionId = sir != null ? sir.getSubscriptionId() : SubscriptionManager.INVALID_SUBSCRIPTION_ID;
SimPreference simPreference = new SimEnablerPreference(getPrefContext(), sir, i);
simPreference.setOrder(i - mNumSlots);
mSimCards.addPreference(simPreference);
mAvailableSubInfos.add(sir);
if (sir != null && mUiccProvisionStatus[i] == PROVISIONED) {
mSelectableSubInfos.add(sir);
}
Intent mobileNetworkIntent = new Intent();
mobileNetworkIntent.setComponent(new ComponentName("com.android.phone", "com.android.phone.MobileNetworkSettings"));
SubscriptionManager.putPhoneIdAndSubIdExtra(mobileNetworkIntent, i, subscriptionId);
Preference mobileNetworkPref = new Preference(getActivity());
mobileNetworkPref.setTitle(getString(R.string.sim_mobile_network_settings_title, (i + 1)));
mobileNetworkPref.setIntent(mobileNetworkIntent);
mobileNetworkPref.setEnabled(subscriptionId != SubscriptionManager.INVALID_SUBSCRIPTION_ID);
mMobileNetwork.addPreference(mobileNetworkPref);
}
updateAllOptions();
}
use of android.support.v7.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimSettings method updateCallValues.
private void updateCallValues() {
final Preference simPref = findPreference(KEY_CALLS);
final TelecomManager telecomManager = TelecomManager.from(mContext);
final PhoneAccountHandle phoneAccountHandle = telecomManager.getUserSelectedOutgoingPhoneAccount();
final List<PhoneAccountHandle> allPhoneAccounts = telecomManager.getCallCapablePhoneAccounts();
simPref.setTitle(R.string.calls_title);
PhoneAccount phoneAccount = null;
if (phoneAccountHandle != null) {
phoneAccount = telecomManager.getPhoneAccount(phoneAccountHandle);
}
simPref.setSummary(phoneAccount == null ? mContext.getResources().getString(R.string.sim_calls_ask_first_prefs_title) : (String) phoneAccount.getLabel());
simPref.setEnabled(allPhoneAccounts.size() > 1);
}
use of android.support.v7.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SimSettings method updateSmsValues.
private void updateSmsValues() {
final Preference simPref = findPreference(KEY_SMS);
final SubscriptionInfo sir = mSubscriptionManager.getDefaultSmsSubscriptionInfo();
simPref.setTitle(R.string.sms_messages_title);
if (DBG)
log("[updateSmsValues] mSubInfoList=" + mSubInfoList);
if (sir != null) {
simPref.setSummary(sir.getDisplayName());
simPref.setEnabled(mSelectableSubInfos.size() > 1);
} else if (sir == null) {
simPref.setSummary(R.string.sim_selection_required_pref);
simPref.setEnabled(mSelectableSubInfos.size() >= 1);
}
}
use of android.support.v7.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class TextToSpeechSettings method onVoiceDataIntegrityCheckDone.
/*
* Step 5: The voice data check is complete.
*/
private void onVoiceDataIntegrityCheckDone(Intent data) {
final String engine = mTts.getCurrentEngine();
if (engine == null) {
Log.e(TAG, "Voice data check complete, but no engine bound");
return;
}
if (data == null) {
Log.e(TAG, "Engine failed voice data integrity check (null return)" + mTts.getCurrentEngine());
return;
}
android.provider.Settings.Secure.putString(getContentResolver(), TTS_DEFAULT_SYNTH, engine);
mAvailableStrLocals = data.getStringArrayListExtra(TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES);
if (mAvailableStrLocals == null) {
Log.e(TAG, "Voice data check complete, but no available voices found");
// Set mAvailableStrLocals to empty list
mAvailableStrLocals = new ArrayList<String>();
}
if (evaluateDefaultLocale()) {
getSampleText();
}
final int engineCount = mEnginePreferenceCategory.getPreferenceCount();
for (int i = 0; i < engineCount; ++i) {
final Preference p = mEnginePreferenceCategory.getPreference(i);
if (p instanceof TtsEnginePreference) {
TtsEnginePreference enginePref = (TtsEnginePreference) p;
if (enginePref.getKey().equals(engine)) {
enginePref.setVoiceDataDetails(data);
break;
}
}
}
}
use of android.support.v7.preference.Preference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiSettings method onAccessPointsChanged.
/**
* Shows the latest access points available with supplemental information like
* the strength of network and the security for it.
*/
@Override
public synchronized void onAccessPointsChanged() {
// Safeguard from some delayed event handling
if (getActivity() == null)
return;
if (isUiRestricted()) {
if (!isUiRestrictedByOnlyAdmin()) {
addMessagePreference(R.string.wifi_empty_list_user_restricted);
}
getPreferenceScreen().removeAll();
return;
}
final int wifiState = mWifiManager.getWifiState();
switch(wifiState) {
case WifiManager.WIFI_STATE_ENABLED:
// AccessPoints are automatically sorted with TreeSet.
final Collection<AccessPoint> accessPoints = mWifiTracker.getAccessPoints();
boolean hasAvailableAccessPoints = false;
int index = 0;
cacheRemoveAllPrefs(getPreferenceScreen());
for (AccessPoint accessPoint : accessPoints) {
// Ignore access points that are out of range.
if (accessPoint.getLevel() != -1) {
String key = accessPoint.getBssid();
if (TextUtils.isEmpty(key)) {
key = accessPoint.getSsidStr();
}
hasAvailableAccessPoints = true;
LongPressAccessPointPreference pref = (LongPressAccessPointPreference) getCachedPreference(key);
if (pref != null) {
pref.setOrder(index++);
continue;
}
LongPressAccessPointPreference preference = new LongPressAccessPointPreference(accessPoint, getPrefContext(), mUserBadgeCache, false, R.drawable.ic_wifi_signal_0, this);
preference.setKey(key);
preference.setOrder(index++);
if (mOpenSsid != null && mOpenSsid.equals(accessPoint.getSsidStr()) && !accessPoint.isSaved() && accessPoint.getSecurity() != AccessPoint.SECURITY_NONE) {
onPreferenceTreeClick(preference);
mOpenSsid = null;
}
getPreferenceScreen().addPreference(preference);
accessPoint.setListener(this);
preference.refresh();
}
}
removeCachedPrefs(getPreferenceScreen());
if (!hasAvailableAccessPoints) {
setProgressBarVisible(true);
Preference pref = new Preference(getContext()) {
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
// Show a line on each side of add network.
holder.setDividerAllowedBelow(true);
}
};
pref.setSelectable(false);
pref.setSummary(R.string.wifi_empty_list_wifi_on);
pref.setOrder(0);
pref.setKey(PREF_KEY_EMPTY_WIFI_LIST);
getPreferenceScreen().addPreference(pref);
mAddPreference.setOrder(1);
getPreferenceScreen().addPreference(mAddPreference);
} else {
mAddPreference.setOrder(index++);
getPreferenceScreen().addPreference(mAddPreference);
setProgressBarVisible(false);
}
if (mScanMenuItem != null) {
mScanMenuItem.setEnabled(true);
}
break;
case WifiManager.WIFI_STATE_ENABLING:
getPreferenceScreen().removeAll();
setProgressBarVisible(true);
break;
case WifiManager.WIFI_STATE_DISABLING:
addMessagePreference(R.string.wifi_stopping);
setProgressBarVisible(true);
break;
case WifiManager.WIFI_STATE_DISABLED:
setOffMessage();
setProgressBarVisible(false);
if (mScanMenuItem != null) {
mScanMenuItem.setEnabled(false);
}
break;
}
}
Aggregations