Search in sources :

Example 81 with SettingsActivity

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);
}
Also used : RemoteException(android.os.RemoteException) SettingsActivity(com.android.settings.SettingsActivity)

Example 82 with SettingsActivity

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);
}
Also used : ScanningSettings(com.android.settings.location.ScanningSettings) LinkifyUtils(com.android.settings.LinkifyUtils) SettingsActivity(com.android.settings.SettingsActivity)

Example 83 with SettingsActivity

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);
    }
}
Also used : EngineInfo(android.speech.tts.TextToSpeech.EngineInfo) SettingsActivity(com.android.settings.SettingsActivity)

Example 84 with SettingsActivity

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);
    }
}
Also used : SettingsActivity(com.android.settings.SettingsActivity) SwitchBarController(com.android.settings.widget.SwitchBarController)

Example 85 with SettingsActivity

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);
    });
}
Also used : ViewGroup(android.view.ViewGroup) Tile(com.android.settingslib.drawer.Tile) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) SettingsActivity(com.android.settings.SettingsActivity)

Aggregations

SettingsActivity (com.android.settings.SettingsActivity)246 Bundle (android.os.Bundle)71 Intent (android.content.Intent)37 ArrayList (java.util.ArrayList)27 Preference (android.support.v7.preference.Preference)25 AnomalySummaryPreferenceController (com.android.settings.fuelgauge.anomaly.AnomalySummaryPreferenceController)18 SwitchBarController (com.android.settings.widget.SwitchBarController)16 ContentResolver (android.content.ContentResolver)15 TextView (android.widget.TextView)15 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)15 Test (org.junit.Test)15 Context (android.content.Context)14 View (android.view.View)14 LinkifyUtils (com.android.settings.LinkifyUtils)14 RemoteException (android.os.RemoteException)13 EngineInfo (android.speech.tts.TextToSpeech.EngineInfo)13 PreferenceScreen (android.support.v7.preference.PreferenceScreen)13 RecyclerView (android.support.v7.widget.RecyclerView)12 LayoutPreference (com.android.settings.applications.LayoutPreference)12 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)11