Remove some dead code
DashboardCategory is no longer rendered in the dashboard ui Bug: 33861822 Test: make RunSettingsRoboTests existing tests still pass Change-Id: I0479967b0099f76f8c0c7894643d50b655de2892
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2014 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/category"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dashboard_category_height"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dip">
|
||||
|
||||
<TextView android:id="@android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="@dimen/dashboard_category_title_margin_start"
|
||||
android:singleLine="true"
|
||||
android:ellipsize="marquee"
|
||||
android:gravity="center_vertical"
|
||||
android:textAppearance="@style/TextAppearance.CategoryTitle"
|
||||
android:textAlignment="viewStart"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
@@ -99,9 +99,6 @@
|
||||
<!-- Dashboard category layout height -->
|
||||
<dimen name="dashboard_category_height">48dp</dimen>
|
||||
|
||||
<!-- Dashboard category title margin start -->
|
||||
<dimen name="dashboard_category_title_margin_start">16dp</dimen>
|
||||
|
||||
<!-- Dashboard tile minimum height -->
|
||||
<dimen name="dashboard_tile_minimum_height">72dp</dimen>
|
||||
|
||||
|
@@ -293,10 +293,6 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
||||
case R.layout.dashboard_header_spacer:
|
||||
onBindHeaderSpacer(holder, position);
|
||||
break;
|
||||
case R.layout.dashboard_category:
|
||||
onBindCategory(holder,
|
||||
(DashboardCategory) mDashboardData.getItemEntityByPosition(position));
|
||||
break;
|
||||
case R.layout.dashboard_tile:
|
||||
final Tile tile = (Tile) mDashboardData.getItemEntityByPosition(position);
|
||||
onBindTile(holder, tile);
|
||||
|
@@ -18,7 +18,6 @@ package com.android.settings.dashboard;
|
||||
import android.annotation.IntDef;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v7.util.DiffUtil;
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -272,8 +271,7 @@ public class DashboardData {
|
||||
tile.remoteViews != null
|
||||
? R.layout.suggestion_tile_card
|
||||
: R.layout.suggestion_tile,
|
||||
Objects.hash(tile.title),
|
||||
false));
|
||||
Objects.hash(tile.title)));
|
||||
}
|
||||
mId++;
|
||||
}
|
||||
@@ -358,8 +356,6 @@ public class DashboardData {
|
||||
resetCount();
|
||||
for (int i = 0; mCategories != null && i < mCategories.size(); i++) {
|
||||
DashboardCategory category = mCategories.get(i);
|
||||
countItem(category, R.layout.dashboard_category,
|
||||
!TextUtils.isEmpty(category.title), NS_ITEMS);
|
||||
for (int j = 0; j < category.tiles.size(); j++) {
|
||||
Tile tile = category.tiles.get(j);
|
||||
countItem(tile, R.layout.dashboard_tile, true, NS_ITEMS);
|
||||
@@ -534,7 +530,6 @@ public class DashboardData {
|
||||
*/
|
||||
private static class Item {
|
||||
// valid types in field type
|
||||
private static final int TYPE_DASHBOARD_CATEGORY = R.layout.dashboard_category;
|
||||
private static final int TYPE_DASHBOARD_TILE = R.layout.dashboard_tile;
|
||||
@Deprecated
|
||||
private static final int TYPE_SUGGESTION_HEADER = R.layout.suggestion_header;
|
||||
@@ -550,7 +545,7 @@ public class DashboardData {
|
||||
R.layout.suggestion_condition_footer;
|
||||
private static final int TYPE_DASHBOARD_SPACER = R.layout.dashboard_spacer;
|
||||
|
||||
@IntDef({TYPE_DASHBOARD_CATEGORY, TYPE_DASHBOARD_TILE, TYPE_SUGGESTION_HEADER,
|
||||
@IntDef({TYPE_DASHBOARD_TILE, TYPE_SUGGESTION_HEADER,
|
||||
TYPE_SUGGESTION_TILE, TYPE_SUGGESTION_CONDITION_CONTAINER,
|
||||
TYPE_SUGGESTION_CONDITION_HEADER, TYPE_CONDITION_CARD,
|
||||
TYPE_SUGGESTION_CONDITION_FOOTER, TYPE_DASHBOARD_SPACER})
|
||||
@@ -558,8 +553,8 @@ public class DashboardData {
|
||||
public @interface ItemTypes{}
|
||||
|
||||
/**
|
||||
* The main data object in item, usually is a {@link Tile}, {@link Condition} or
|
||||
* {@link DashboardCategory} object. This object can also be null when the
|
||||
* The main data object in item, usually is a {@link Tile}, {@link Condition}
|
||||
* object. This object can also be null when the
|
||||
* item is an divider line. Please refer to {@link #buildItemsData()} for
|
||||
* detail usage of the Item.
|
||||
*/
|
||||
@@ -615,10 +610,6 @@ public class DashboardData {
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case TYPE_DASHBOARD_CATEGORY:
|
||||
// Only check title for dashboard category
|
||||
return TextUtils.equals(((DashboardCategory) entity).title,
|
||||
((DashboardCategory) targetItem.entity).title);
|
||||
case TYPE_DASHBOARD_TILE:
|
||||
final Tile localTile = (Tile) entity;
|
||||
final Tile targetTile = (Tile) targetItem.entity;
|
||||
|
@@ -23,6 +23,7 @@ import android.support.v7.widget.RecyclerView.State;
|
||||
import android.support.v7.widget.RecyclerView.ViewHolder;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public class DashboardDecorator extends RecyclerView.ItemDecoration {
|
||||
@@ -43,12 +44,7 @@ public class DashboardDecorator extends RecyclerView.ItemDecoration {
|
||||
for (int i = 1; i < childCount; i++) {
|
||||
final View child = parent.getChildAt(i);
|
||||
final ViewHolder holder = parent.getChildViewHolder(child);
|
||||
if (holder.getItemViewType() == R.layout.dashboard_category) {
|
||||
if (parent.getChildViewHolder(parent.getChildAt(i - 1)).getItemViewType()
|
||||
!= R.layout.dashboard_tile) {
|
||||
continue;
|
||||
}
|
||||
} else if (holder.getItemViewType() != R.layout.condition_card) {
|
||||
if (holder.getItemViewType() != R.layout.condition_card) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -19,11 +19,13 @@ package com.android.settings.dashboard;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.util.DiffUtil;
|
||||
import android.support.v7.util.ListUpdateCallback;
|
||||
|
||||
import com.android.settings.TestConfig;
|
||||
import com.android.settings.dashboard.conditional.AirplaneModeCondition;
|
||||
import com.android.settings.dashboard.conditional.Condition;
|
||||
import com.android.settingslib.drawer.DashboardCategory;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -116,15 +118,15 @@ public class DashboardDataTest {
|
||||
public void testBuildItemsData_containsAllData() {
|
||||
final DashboardData.SuggestionConditionHeaderData data =
|
||||
new DashboardData.SuggestionConditionHeaderData(
|
||||
mDashboardDataWithOneConditions.getConditions(), 0);
|
||||
mDashboardDataWithOneConditions.getConditions(), 0);
|
||||
final Object[] expectedObjects = {null, data,
|
||||
mDashboardDataWithOneConditions.getSuggestions(),
|
||||
mDashboardDataWithOneConditions.getConditions(),
|
||||
null, mDashboardCategory, mTestCategoryTile};
|
||||
mDashboardDataWithOneConditions.getSuggestions(),
|
||||
mDashboardDataWithOneConditions.getConditions(),
|
||||
null, mTestCategoryTile};
|
||||
final int expectedSize = expectedObjects.length;
|
||||
|
||||
assertThat(mDashboardDataWithOneConditions.getItemList().size())
|
||||
.isEqualTo(expectedSize);
|
||||
assertThat(mDashboardDataWithOneConditions.getItemList()).hasSize(expectedSize);
|
||||
|
||||
for (int i = 0; i < expectedSize; i++) {
|
||||
final Object item = mDashboardDataWithOneConditions.getItemEntityByPosition(i);
|
||||
if (item instanceof DashboardData.SuggestionHeaderData
|
||||
@@ -211,7 +213,7 @@ public class DashboardDataTest {
|
||||
//Build testResultData
|
||||
final List<ListUpdateResult.ResultData> testResultData = new ArrayList<>();
|
||||
testResultData.add(new ListUpdateResult.ResultData(
|
||||
ListUpdateResult.ResultData.TYPE_OPERATION_REMOVE, 1, 6));
|
||||
ListUpdateResult.ResultData.TYPE_OPERATION_REMOVE, 1, 5));
|
||||
|
||||
testDiffUtil(mDashboardDataWithOneConditions, mDashboardDataWithNoItems, testResultData);
|
||||
}
|
||||
|
Reference in New Issue
Block a user