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