Search in sources :

Example 46 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by crdroidandroid.

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)

Example 47 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by crdroidandroid.

the class AutomaticStorageManagerSettings method initializeSwitchBar.

private void initializeSwitchBar() {
    final SettingsActivity activity = (SettingsActivity) getActivity();
    mSwitchBar = activity.getSwitchBar();
    mSwitchBar.show();
    mSwitchController = new AutomaticStorageManagerSwitchBarController(getContext(), mSwitchBar, mMetricsFeatureProvider, mDaysToRetain, getFragmentManager());
}
Also used : SettingsActivity(com.android.settings.SettingsActivity)

Example 48 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by crdroidandroid.

the class CaptionPropertiesFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final boolean enabled = mCaptioningManager.isEnabled();
    SettingsActivity activity = (SettingsActivity) getActivity();
    mSwitchBar = activity.getSwitchBar();
    mSwitchBar.setCheckedInternal(enabled);
    mToggleSwitch = mSwitchBar.getSwitch();
    getPreferenceScreen().setEnabled(enabled);
    refreshPreviewText();
    installSwitchBarToggleSwitch();
}
Also used : SettingsActivity(com.android.settings.SettingsActivity)

Example 49 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by crdroidandroid.

the class AppInfoBase method setIntentAndFinish.

protected void setIntentAndFinish(boolean finish, boolean appChanged) {
    if (localLOGV)
        Log.i(TAG, "appChanged=" + appChanged);
    Intent intent = new Intent();
    intent.putExtra(ManageApplications.APP_CHG, appChanged);
    SettingsActivity sa = (SettingsActivity) getActivity();
    sa.finishPreferencePanel(this, Activity.RESULT_OK, intent);
    mFinishing = true;
}
Also used : Intent(android.content.Intent) SettingsActivity(com.android.settings.SettingsActivity)

Example 50 with SettingsActivity

use of com.android.settings.SettingsActivity in project android_packages_apps_Settings by crdroidandroid.

the class AppOpsCategory method startApplicationDetailsActivity.

// utility method used to start sub activity
private void startApplicationDetailsActivity() {
    // start new fragment to display extended information
    Bundle args = new Bundle();
    args.putString(AppOpsDetails.ARG_PACKAGE_NAME, mCurrentPkgName);
    SettingsActivity sa = (SettingsActivity) getActivity();
    sa.startPreferencePanel(this, AppOpsDetails.class.getName(), args, org.lineageos.platform.internal.R.string.privacy_guard_manager_title, null, this, RESULT_APP_DETAILS);
}
Also used : Bundle(android.os.Bundle) 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