use of com.android.settingslib.drawer.Tile in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DashboardSummary method onStop.
@Override
public void onStop() {
super.onStop();
((SettingsDrawerActivity) getActivity()).remCategoryListener(this);
mSummaryLoader.setListening(false);
for (Condition c : mConditionManager.getConditions()) {
if (c.shouldShow()) {
MetricsLogger.hidden(getContext(), c.getMetricsConstant());
}
}
if (mAdapter.getSuggestions() == null) {
return;
}
if (!getActivity().isChangingConfigurations()) {
for (Tile suggestion : mAdapter.getSuggestions()) {
String id = DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion);
if (!mSuggestionsHiddenLogged.contains(id)) {
mSuggestionsHiddenLogged.add(id);
MetricsLogger.action(getContext(), MetricsEvent.ACTION_HIDE_SETTINGS_SUGGESTION, id);
}
}
}
}
use of com.android.settingslib.drawer.Tile in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DashboardAdapter method setCategoriesAndSuggestions.
public void setCategoriesAndSuggestions(List<DashboardCategory> categories, List<Tile> suggestions) {
mCategories = categories;
if ((Settings.System.getInt(mContext.getContentResolver(), Settings.System.DISABLE_SUGGESTIONS, 0) == 1)) {
mSuggestions = null;
} else {
mSuggestions = suggestions;
}
TypedValue tintColorValue = new TypedValue();
mContext.getResources().getValue(R.color.external_tile_icon_tint_color, tintColorValue, true);
for (int i = 0; i < categories.size(); i++) {
for (int j = 0; j < categories.get(i).tiles.size(); j++) {
Tile tile = categories.get(i).tiles.get(j);
if (!mContext.getPackageName().equals(tile.intent.getComponent().getPackageName())) {
// color.
if (tintColorValue.type == TypedValue.TYPE_ATTRIBUTE) {
mContext.getTheme().resolveAttribute(tintColorValue.data, tintColorValue, true);
}
tile.icon.setTint(tintColorValue.data).setTintMode(Mode.SRC_ATOP);
}
}
}
recountItems();
}
use of com.android.settingslib.drawer.Tile in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DashboardAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(DashboardItemHolder holder, int position) {
switch(mTypes.get(position)) {
case R.layout.dashboard_category:
onBindCategory(holder, (DashboardCategory) mItems.get(position));
break;
case R.layout.dashboard_tile:
final Tile tile = (Tile) mItems.get(position);
onBindTile(holder, tile);
holder.itemView.setTag(tile);
holder.itemView.setOnClickListener(this);
break;
case R.layout.suggestion_header:
onBindSuggestionHeader(holder);
break;
case R.layout.suggestion_tile:
final Tile suggestion = (Tile) mItems.get(position);
onBindTile(holder, suggestion);
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MetricsLogger.action(mContext, MetricsEvent.ACTION_SETTINGS_SUGGESTION, DashboardAdapter.getSuggestionIdentifier(mContext, suggestion));
((SettingsActivity) mContext).startSuggestion(suggestion.intent);
}
});
holder.itemView.findViewById(R.id.overflow).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showRemoveOption(v, suggestion);
}
});
break;
case R.layout.see_all:
onBindSeeAll(holder);
break;
case R.layout.condition_card:
ConditionAdapterUtils.bindViews((Condition) mItems.get(position), holder, mItems.get(position) == mExpandedCondition, this, new View.OnClickListener() {
@Override
public void onClick(View v) {
onExpandClick(v);
}
});
break;
}
}
use of com.android.settingslib.drawer.Tile in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SummaryLoader method getTileFromCategory.
private Tile getTileFromCategory(List<DashboardCategory> categories, ComponentName component) {
if (categories == null) {
if (DEBUG) {
Log.d(TAG, "Category is null, can't find tile");
}
return null;
}
final int categorySize = categories.size();
for (int i = 0; i < categorySize; i++) {
final DashboardCategory category = categories.get(i);
final int tileCount = category.tiles.size();
for (int j = 0; j < tileCount; j++) {
final Tile tile = category.tiles.get(j);
if (component.equals(tile.intent.getComponent())) {
return tile;
}
}
}
return null;
}
use of com.android.settingslib.drawer.Tile in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DashboardSummary method onStart.
@Override
public void onStart() {
long startTime = System.currentTimeMillis();
super.onStart();
((SettingsDrawerActivity) getActivity()).addCategoryListener(this);
mSummaryLoader.setListening(true);
for (Condition c : mConditionManager.getConditions()) {
if (c.shouldShow()) {
MetricsLogger.visible(getContext(), c.getMetricsConstant());
}
}
if (mAdapter.getSuggestions() != null) {
for (Tile suggestion : mAdapter.getSuggestions()) {
MetricsLogger.action(getContext(), MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION, DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion));
}
}
if (DEBUG_TIMING)
Log.d(TAG, "onStart took " + (System.currentTimeMillis() - startTime) + " ms");
updateSettings();
}
Aggregations