use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by DirtyUnicorns.
the class ToggleBackupSettingFragment method onViewCreated.
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
mToggleSwitch = mSwitchBar.getSwitch();
// not mention full data backup
if (Settings.Secure.getInt(getContentResolver(), USER_FULL_DATA_BACKUP_AWARE, 0) != 0) {
mSummaryPreference.setSummary(R.string.fullbackup_data_summary);
} else {
mSummaryPreference.setSummary(R.string.backup_data_summary);
}
try {
boolean backupEnabled = mBackupManager == null ? false : mBackupManager.isBackupEnabled();
mSwitchBar.setCheckedInternal(backupEnabled);
} catch (RemoteException e) {
// The world is aflame, turn it off.
mSwitchBar.setEnabled(false);
}
getActivity().setTitle(R.string.backup_data_title);
}
use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by DirtyUnicorns.
the class WifiSettings method setOffMessage.
private void setOffMessage() {
final CharSequence title = getText(R.string.wifi_empty_list_wifi_off);
// Don't use WifiManager.isScanAlwaysAvailable() to check the Wi-Fi scanning mode. Instead,
// read the system settings directly. Because when the device is in Airplane mode, even if
// Wi-Fi scanning mode is on, WifiManager.isScanAlwaysAvailable() still returns "off".
final boolean wifiScanningMode = Settings.Global.getInt(getActivity().getContentResolver(), Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0) == 1;
final CharSequence description = wifiScanningMode ? getText(R.string.wifi_scan_notify_text) : getText(R.string.wifi_scan_notify_text_scanning_off);
final LinkifyUtils.OnClickListener clickListener = new LinkifyUtils.OnClickListener() {
@Override
public void onClick() {
final SettingsActivity activity = (SettingsActivity) getActivity();
activity.startPreferencePanel(WifiSettings.this, ScanningSettings.class.getName(), null, R.string.location_scanning_screen_title, null, null, 0);
}
};
mStatusMessagePreference.setText(title, description, clickListener);
removeConnectedAccessPointPreference();
mAccessPointsPreferenceCategory.removeAll();
mAccessPointsPreferenceCategory.addPreference(mStatusMessagePreference);
}
use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by DirtyUnicorns.
the class TtsEnginePreferenceFragment method initSettings.
private void initSettings() {
if (mTts != null) {
mCurrentEngine = mTts.getCurrentEngine();
}
mEnginePreferenceCategory.removeAll();
SettingsActivity activity = (SettingsActivity) getActivity();
List<EngineInfo> engines = mEnginesHelper.getEngines();
for (EngineInfo engine : engines) {
TtsEnginePreference enginePref = new TtsEnginePreference(getPrefContext(), engine, this, activity);
mEnginePreferenceCategory.addPreference(enginePref);
}
}
use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by DirtyUnicorns.
the class BluetoothSettings method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final SettingsActivity activity = (SettingsActivity) getActivity();
mSwitchBar = activity.getSwitchBar();
mBluetoothEnabler = new BluetoothEnabler(activity, new SwitchBarController(mSwitchBar), mMetricsFeatureProvider, Utils.getLocalBtManager(activity), MetricsEvent.ACTION_BLUETOOTH_TOGGLE);
mBluetoothEnabler.setupSwitchController();
if (mLocalAdapter != null) {
mAlwaysDiscoverable = new AlwaysDiscoverable(getContext(), mLocalAdapter);
}
}
use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by DirtyUnicorns.
the class SuggestionAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(DashboardItemHolder holder, int position) {
final Tile suggestion = (Tile) mSuggestions.get(position);
final String suggestionId = mSuggestionFeatureProvider.getSuggestionIdentifier(mContext, suggestion);
// This is for cases when a suggestion is dismissed and the next one comes to view
if (!mSuggestionsShownLogged.contains(suggestionId)) {
mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION, suggestionId, getSuggestionTaggedData());
mSuggestionsShownLogged.add(suggestionId);
}
if (suggestion.remoteViews != null) {
final ViewGroup itemView = (ViewGroup) holder.itemView;
itemView.removeAllViews();
itemView.addView(suggestion.remoteViews.apply(itemView.getContext(), itemView));
} else {
holder.icon.setImageDrawable(mCache.getIcon(suggestion.icon));
holder.title.setText(suggestion.title);
if (!TextUtils.isEmpty(suggestion.summary)) {
holder.summary.setText(suggestion.summary);
holder.summary.setVisibility(View.VISIBLE);
} else {
holder.summary.setVisibility(View.GONE);
}
}
final View divider = holder.itemView.findViewById(R.id.divider);
if (divider != null) {
divider.setVisibility(position < mSuggestions.size() - 1 ? View.VISIBLE : View.GONE);
}
View clickHandler = holder.itemView;
// If a view with @android:id/primary is defined, use that as the click handler
// instead.
final View primaryAction = holder.itemView.findViewById(android.R.id.primary);
if (primaryAction != null) {
clickHandler = primaryAction;
}
clickHandler.setOnClickListener(v -> {
mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_SUGGESTION, suggestionId, getSuggestionTaggedData());
((SettingsActivity) mContext).startSuggestion(suggestion.intent);
});
}
Aggregations