OSDN Git Service

Revert "Initial search bar implementation."
[android-x86/packages-apps-Settings.git] / src / com / android / settings / dashboard / DashboardAdapter.java
index dc67888..e3e95be 100644 (file)
@@ -15,8 +15,6 @@
  */
 package com.android.settings.dashboard;
 
-import android.annotation.AttrRes;
-import android.annotation.ColorInt;
 import android.app.Activity;
 import android.content.Context;
 import android.content.res.TypedArray;
@@ -57,7 +55,6 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
     private static final String STATE_CATEGORY_LIST = "category_list";
     private static final String STATE_SUGGESTION_MODE = "suggestion_mode";
     private static final String STATE_SUGGESTIONS_SHOWN_LOGGED = "suggestions_shown_logged";
-    private static final int DONT_SET_BACKGROUND_ATTR = -1;
 
     private final IconCache mCache;
     private final Context mContext;
@@ -225,9 +222,6 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
     public void onBindViewHolder(DashboardItemHolder holder, int position) {
         final int type = mDashboardData.getItemTypeByPosition(position);
         switch (type) {
-            case R.layout.dashboard_header_spacer:
-                onBindHeaderSpacer(holder, position);
-                break;
             case R.layout.dashboard_category:
                 onBindCategory(holder,
                         (DashboardCategory) mDashboardData.getItemEntityByPosition(position));
@@ -358,33 +352,6 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
         notifyDashboardDataChanged(prevData);
     }
 
-    private void onBindHeaderSpacer(DashboardItemHolder holder, int position) {
-        if (mDashboardData.size() > (position + 1)) {
-            // The spacer that goes underneath the search bar needs to match the
-            // background of the first real view. That view is either a condition,
-            // a suggestion, or the dashboard item.
-            //
-            // If it's a dashboard item, set null background so it uses the parent's
-            // background like the other views. Otherwise, match the colors.
-            int nextType = mDashboardData.getItemTypeByPosition(position + 1);
-            int colorAttr = nextType == R.layout.suggestion_header
-                    ? android.R.attr.colorSecondary
-                    : nextType == R.layout.condition_card
-                            ? android.R.attr.colorAccent
-                            : DONT_SET_BACKGROUND_ATTR;
-
-            if (colorAttr != DONT_SET_BACKGROUND_ATTR) {
-                TypedArray array = holder.itemView.getContext()
-                        .obtainStyledAttributes(new int[]{colorAttr});
-                @ColorInt int color = array.getColor(0, 0);
-                array.recycle();
-                holder.itemView.setBackgroundColor(color);
-            } else {
-                holder.itemView.setBackground(null);
-            }
-        }
-    }
-
     @VisibleForTesting
     void onBindSuggestionHeader(final DashboardItemHolder holder, DashboardData
             .SuggestionHeaderData data) {