Remove code that check for dashboard feature.
- remove DashboardFeatureProvider.isEnabled() and all relating code and tests. Bug: 35764802 Test: make RunSettingsRoboTests Change-Id: If7796677abc8904b7436525836d50cdef38e37a4
This commit is contained in:
@@ -146,8 +146,7 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
||||
List<Tile> suggestions) {
|
||||
// TODO: Better place for tinting?
|
||||
final TypedArray a = mContext.obtainStyledAttributes(new int[]{
|
||||
mDashboardFeatureProvider.isEnabled()
|
||||
? android.R.attr.colorControlNormal : android.R.attr.colorAccent});
|
||||
android.R.attr.colorControlNormal});
|
||||
int tintColor = a.getColor(0, mContext.getColor(android.R.color.white));
|
||||
a.recycle();
|
||||
for (int i = 0; i < categories.size(); i++) {
|
||||
|
||||
@@ -30,11 +30,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface DashboardFeatureProvider {
|
||||
|
||||
/**
|
||||
* Whether or not this feature is enabled.
|
||||
*/
|
||||
boolean isEnabled();
|
||||
|
||||
/**
|
||||
* Get tiles (wrapped in {@link DashboardCategory}) for key defined in CategoryKey.
|
||||
*/
|
||||
|
||||
@@ -68,11 +68,6 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
||||
mMetricsFeatureProvider = FeatureFactory.getFactory(context).getMetricsFeatureProvider();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DashboardCategory getTilesForCategory(String key) {
|
||||
return mCategoryManager.getTilesByCategory(mContext, key);
|
||||
@@ -81,9 +76,6 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
||||
@Override
|
||||
public List<Preference> getPreferencesForCategory(Activity activity, Context context,
|
||||
int sourceMetricsCategory, String key) {
|
||||
if (!isEnabled()) {
|
||||
return null;
|
||||
}
|
||||
final DashboardCategory category = getTilesForCategory(key);
|
||||
if (category == null) {
|
||||
Log.d(TAG, "NO dashboard tiles for " + TAG);
|
||||
@@ -177,7 +169,7 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
|
||||
@Override
|
||||
public ProgressiveDisclosureMixin getProgressiveDisclosureMixin(Context context,
|
||||
DashboardFragment fragment) {
|
||||
return new ProgressiveDisclosureMixin(context, this, mMetricsFeatureProvider, fragment);
|
||||
return new ProgressiveDisclosureMixin(context, mMetricsFeatureProvider, fragment);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -309,8 +309,7 @@ public abstract class DashboardFragment extends SettingsPreferenceFragment
|
||||
mSummaryLoader = new SummaryLoader(getActivity(), getCategoryKey());
|
||||
mSummaryLoader.setSummaryConsumer(this);
|
||||
final TypedArray a = context.obtainStyledAttributes(new int[]{
|
||||
mDashboardFeatureProvider.isEnabled() ? android.R.attr.colorControlNormal
|
||||
: android.R.attr.colorAccent});
|
||||
android.R.attr.colorControlNormal});
|
||||
final int tintColor = a.getColor(0, context.getColor(android.R.color.white));
|
||||
a.recycle();
|
||||
final String pkgName = context.getPackageName();
|
||||
|
||||
@@ -30,7 +30,6 @@ import android.view.ViewGroup;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.core.InstrumentedFragment;
|
||||
import com.android.settings.dashboard.conditional.Condition;
|
||||
import com.android.settings.dashboard.conditional.ConditionAdapterUtils;
|
||||
@@ -87,12 +86,7 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
mSuggestionFeatureProvider = FeatureFactory.getFactory(activity)
|
||||
.getSuggestionFeatureProvider(activity);
|
||||
|
||||
if (mDashboardFeatureProvider.isEnabled()) {
|
||||
mSummaryLoader = new SummaryLoader(activity, CategoryKey.CATEGORY_HOMEPAGE);
|
||||
} else {
|
||||
mSummaryLoader = new SummaryLoader(activity,
|
||||
((SettingsActivity) getActivity()).getDashboardCategories());
|
||||
}
|
||||
mSummaryLoader = new SummaryLoader(activity, CategoryKey.CATEGORY_HOMEPAGE);
|
||||
|
||||
mConditionManager = ConditionManager.get(activity, false);
|
||||
mSuggestionParser = new SuggestionParser(activity,
|
||||
@@ -279,20 +273,15 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
return;
|
||||
}
|
||||
|
||||
if (mDashboardFeatureProvider.isEnabled()) {
|
||||
// Temporary hack to wrap homepage category into a list. Soon we will create adapter
|
||||
// API that takes a single category.
|
||||
List<DashboardCategory> categories = new ArrayList<>();
|
||||
categories.add(mDashboardFeatureProvider.getTilesForCategory(
|
||||
CategoryKey.CATEGORY_HOMEPAGE));
|
||||
if (suggestions != null) {
|
||||
mAdapter.setCategoriesAndSuggestions(categories, suggestions);
|
||||
} else {
|
||||
mAdapter.setCategory(categories);
|
||||
}
|
||||
// Temporary hack to wrap homepage category into a list. Soon we will create adapter
|
||||
// API that takes a single category.
|
||||
List<DashboardCategory> categories = new ArrayList<>();
|
||||
categories.add(mDashboardFeatureProvider.getTilesForCategory(
|
||||
CategoryKey.CATEGORY_HOMEPAGE));
|
||||
if (suggestions != null) {
|
||||
mAdapter.setCategoriesAndSuggestions(categories, suggestions);
|
||||
} else {
|
||||
mAdapter.setCategoriesAndSuggestions(
|
||||
((SettingsActivity) activity).getDashboardCategories(), suggestions);
|
||||
mAdapter.setCategory(categories);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ public class ProgressiveDisclosureMixin implements Preference.OnPreferenceClickL
|
||||
private static final int DEFAULT_TILE_LIMIT = 300;
|
||||
|
||||
private final Context mContext;
|
||||
private final DashboardFeatureProvider mDashboardFeatureProvider;
|
||||
// Collapsed preference sorted by order.
|
||||
private final List<Preference> mCollapsedPrefs = new ArrayList<>();
|
||||
private final MetricsFeatureProvider mMetricsFeatureProvider;
|
||||
@@ -57,14 +56,12 @@ public class ProgressiveDisclosureMixin implements Preference.OnPreferenceClickL
|
||||
private boolean mUserExpanded;
|
||||
|
||||
public ProgressiveDisclosureMixin(Context context,
|
||||
DashboardFeatureProvider dashboardFeatureProvider,
|
||||
MetricsFeatureProvider metricsFeatureProvider,
|
||||
PreferenceFragment fragment) {
|
||||
mContext = context;
|
||||
mFragment = fragment;
|
||||
mExpandButton = new ExpandPreference(context);
|
||||
mExpandButton.setOnPreferenceClickListener(this);
|
||||
mDashboardFeatureProvider = dashboardFeatureProvider;
|
||||
mMetricsFeatureProvider = metricsFeatureProvider;
|
||||
}
|
||||
|
||||
@@ -122,8 +119,7 @@ public class ProgressiveDisclosureMixin implements Preference.OnPreferenceClickL
|
||||
* Whether the screen should be collapsed.
|
||||
*/
|
||||
public boolean shouldCollapse(PreferenceScreen screen) {
|
||||
return mDashboardFeatureProvider.isEnabled() && screen.getPreferenceCount() >= mTileLimit
|
||||
&& !mUserExpanded;
|
||||
return screen.getPreferenceCount() >= mTileLimit && !mUserExpanded;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -116,23 +116,8 @@ public class SummaryLoader {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
final Tile tile;
|
||||
if (mDashboardFeatureProvider.isEnabled()) {
|
||||
tile = getTileFromCategory(
|
||||
mDashboardFeatureProvider.getTilesForCategory(mCategoryKey), component);
|
||||
} else {
|
||||
// Since tiles are not always cached (like on locale change for instance),
|
||||
// we need to always get the latest one.
|
||||
if (!(mActivity instanceof SettingsDrawerActivity)) {
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Can't get category list.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
tile = getTileFromCategory(
|
||||
((SettingsDrawerActivity) mActivity).getDashboardCategories(),
|
||||
component);
|
||||
}
|
||||
final Tile tile = getTileFromCategory(
|
||||
mDashboardFeatureProvider.getTilesForCategory(mCategoryKey), component);
|
||||
|
||||
if (tile == null) {
|
||||
if (DEBUG) {
|
||||
|
||||
Reference in New Issue
Block a user