Merge changes from topic 'revert_noe_status'
* changes: Revert "Add suggestion carousel view and dependencies to settings" Remove DashboardStatusFragment and hide sliding tab layout. Revert "Add a RecyclerView adapter for first tab in settings." Revert "Dashboard status cards UI."
This commit is contained in:
@@ -9,7 +9,6 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||
android-support-v7-preference \
|
||||
android-support-v7-appcompat \
|
||||
android-support-v14-preference \
|
||||
android-support-v7-cardview \
|
||||
jsr305
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
@@ -22,8 +21,7 @@ LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res \
|
||||
frameworks/support/v7/preference/res \
|
||||
frameworks/support/v14/preference/res \
|
||||
frameworks/support/v7/appcompat/res \
|
||||
frameworks/support/v7/recyclerview/res \
|
||||
frameworks/support/v7/cardview/res
|
||||
frameworks/support/v7/recyclerview/res
|
||||
|
||||
LOCAL_PACKAGE_NAME := Settings
|
||||
LOCAL_CERTIFICATE := platform
|
||||
@@ -32,7 +30,7 @@ LOCAL_PRIVILEGED_MODULE := true
|
||||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
||||
|
||||
LOCAL_AAPT_FLAGS := --auto-add-overlay \
|
||||
--extra-packages android.support.v7.preference:android.support.v14.preference:android.support.v17.preference:android.support.v7.appcompat:android.support.v7.recyclerview:android.support.v7.cardview
|
||||
--extra-packages android.support.v7.preference:android.support.v14.preference:android.support.v17.preference:android.support.v7.appcompat:android.support.v7.recyclerview
|
||||
|
||||
ifneq ($(INCREMENTAL_BUILDS),)
|
||||
LOCAL_PROGUARD_ENABLED := disabled
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
<com.android.settings.dashboard.conditional.FocusRecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/dashboard_container"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
-->
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<com.android.settings.dashboard.conditional.FocusRecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/dashboard_status_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingStart="@dimen/dashboard_padding_start"
|
||||
android:paddingEnd="@dimen/dashboard_padding_end"
|
||||
android:paddingTop="@dimen/dashboard_padding_top"
|
||||
android:paddingBottom="@dimen/dashboard_padding_bottom"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false" />
|
||||
@@ -1,81 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/title"
|
||||
android:textAllCaps="true"
|
||||
android:textAppearance="@style/TextAppearance.StatusTileTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/material_grey_300"
|
||||
android:padding="@dimen/dashboard_status_item_padding"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dashboard_status_item_padding"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="@dimen/dashboard_status_item_padding"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/summary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.Small"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/dashboard_status_item_padding"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@android:id/icon2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="@dimen/dashboard_status_item_padding"/>
|
||||
|
||||
<TextView
|
||||
android:id="@android:id/text2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@style/TextAppearance.Small"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2016 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.
|
||||
-->
|
||||
|
||||
<android.support.v7.widget.CardView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="200dp"
|
||||
card_view:cardCornerRadius="1dp"
|
||||
card_view:cardElevation="10dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom" />
|
||||
|
||||
</android.support.v7.widget.CardView>
|
||||
@@ -302,8 +302,4 @@
|
||||
<!-- Padding between the radio buttons/checkbox and text on the redaction interstitial -->
|
||||
<dimen name="redaction_padding_start">16dp</dimen>
|
||||
|
||||
<!-- Dashboard status cards -->
|
||||
<dimen name="dashboard_status_item_padding">16dp</dimen>
|
||||
<dimen name="dashboard_status_title_size">14sp</dimen>
|
||||
<dimen name="dashboard_status_summary_size">12sp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -7369,8 +7369,6 @@
|
||||
<string name="notification_suggestion_title">Control lock screen notifications</string>
|
||||
<!-- Summary of notification suggestion during optional steps of setup. [CHAR_LIMIT=80] -->
|
||||
<string name="notification_suggestion_summary">Show or hide notification content</string>
|
||||
<!-- Setting tab title for general status. [CHAR LIMIT=20] -->
|
||||
<string name="page_tab_title_status">Status</string>
|
||||
<!-- Setting tab title for all setting options. [CHAR LIMIT=20] -->
|
||||
<string name="page_tab_title_summary">All</string>
|
||||
|
||||
@@ -7380,15 +7378,6 @@
|
||||
<!-- Title of developer options to set the smallest width of the screen [CHAR LIMIT=60]-->
|
||||
<string name="developer_smallest_width">Smallest width</string>
|
||||
|
||||
<!-- Title for connection status, containing information about connected wifi, mobile data usage etc [CHAR LIMIT=20] -->
|
||||
<string name="status_title_connection">Connection</string>
|
||||
<!-- Title for storage status, containing information about storage left, auto backup status etc [CHAR LIMIT=20] -->
|
||||
<string name="status_title_storage">Storage</string>
|
||||
<!-- Title for battery status, containing information about battery left, apps that uses most battery etc [CHAR LIMIT=20] -->
|
||||
<string name="status_title_battery">Battery</string>
|
||||
<!-- Title for security status, containing information about how secure the current system is [CHAR LIMIT=20] -->
|
||||
<string name="status_title_security">Security</string>
|
||||
|
||||
<!-- Message shown when there are no premium SMS apps [CHAR LIMIT=NONE] -->
|
||||
<string name="premium_sms_none">No installed apps have requested Premium SMS access</string>
|
||||
|
||||
|
||||
@@ -392,8 +392,4 @@
|
||||
<item name="android:textAppearance">@android:style/TextAppearance.Material.Subhead</item>
|
||||
</style>
|
||||
|
||||
<style name="TextAppearance.StatusTileTitle" parent="TextAppearance.TileTitle">
|
||||
<item name="android:textAllCaps">true</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -31,7 +31,6 @@ public abstract class InstrumentedFragment extends PreferenceFragment {
|
||||
public static final int DASHBOARD_CONTAINER = UNDECLARED + 1;
|
||||
// Used by PreferenceActivity for the dummy fragment it adds, no useful data here.
|
||||
public static final int PREFERENCE_ACTIVITY_FRAGMENT = UNDECLARED + 2;
|
||||
public static final int DASHBOARD_STATUS = UNDECLARED + 3;
|
||||
|
||||
/**
|
||||
* Declare the view of this category.
|
||||
|
||||
@@ -29,12 +29,13 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||
import com.android.internal.util.ArrayUtils;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.dashboard.conditional.Condition;
|
||||
import com.android.settings.dashboard.conditional.ConditionAdapterUtils;
|
||||
import com.android.settingslib.SuggestionParser;
|
||||
import com.android.settingslib.drawer.DashboardCategory;
|
||||
import com.android.settingslib.drawer.Tile;
|
||||
@@ -42,11 +43,13 @@ import com.android.settingslib.drawer.Tile;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.DashboardItemHolder> {
|
||||
public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.DashboardItemHolder>
|
||||
implements View.OnClickListener {
|
||||
public static final String TAG = "DashboardAdapter";
|
||||
private static final int NS_SPACER = 0;
|
||||
private static final int NS_SUGGESTION = 1000;
|
||||
private static final int NS_ITEMS = 2000;
|
||||
private static final int NS_CONDITION = 3000;
|
||||
|
||||
private static int SUGGESTION_MODE_DEFAULT = 0;
|
||||
private static int SUGGESTION_MODE_COLLAPSED = 1;
|
||||
@@ -62,6 +65,7 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
||||
private final SuggestionsChecks mSuggestionsChecks;
|
||||
|
||||
private List<DashboardCategory> mCategories;
|
||||
private List<Condition> mConditions;
|
||||
private List<Tile> mSuggestions;
|
||||
|
||||
private boolean mIsShowingAll;
|
||||
@@ -70,6 +74,7 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
||||
|
||||
private int mSuggestionMode = SUGGESTION_MODE_DEFAULT;
|
||||
|
||||
private Condition mExpandedCondition = null;
|
||||
private SuggestionParser mSuggestionParser;
|
||||
|
||||
public DashboardAdapter(Context context) {
|
||||
@@ -126,6 +131,11 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
||||
recountItems();
|
||||
}
|
||||
|
||||
public void setConditions(List<Condition> conditions) {
|
||||
mConditions = conditions;
|
||||
recountItems();
|
||||
}
|
||||
|
||||
public boolean isShowingAll() {
|
||||
return mIsShowingAll;
|
||||
}
|
||||
@@ -141,7 +151,14 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
||||
|
||||
private void recountItems() {
|
||||
reset();
|
||||
boolean hasConditions = false;
|
||||
for (int i = 0; mConditions != null && i < mConditions.size(); i++) {
|
||||
boolean shouldShow = mConditions.get(i).shouldShow();
|
||||
hasConditions |= shouldShow;
|
||||
countItem(mConditions.get(i), R.layout.condition_card, shouldShow, NS_CONDITION);
|
||||
}
|
||||
boolean hasSuggestions = mSuggestions != null && mSuggestions.size() != 0;
|
||||
countItem(null, R.layout.dashboard_spacer, hasConditions && hasSuggestions, NS_SPACER);
|
||||
countItem(null, R.layout.suggestion_header, hasSuggestions, NS_SPACER);
|
||||
resetCount();
|
||||
if (mSuggestions != null) {
|
||||
@@ -237,6 +254,16 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,6 +359,42 @@ public class DashboardAdapter extends RecyclerView.Adapter<DashboardAdapter.Dash
|
||||
return mIds.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getTag() == mExpandedCondition) {
|
||||
MetricsLogger.action(mContext, MetricsEvent.ACTION_SETTINGS_CONDITION_CLICK,
|
||||
mExpandedCondition.getMetricsConstant());
|
||||
mExpandedCondition.onPrimaryClick();
|
||||
} else {
|
||||
mExpandedCondition = (Condition) v.getTag();
|
||||
MetricsLogger.action(mContext, MetricsEvent.ACTION_SETTINGS_CONDITION_EXPAND,
|
||||
mExpandedCondition.getMetricsConstant());
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void onExpandClick(View v) {
|
||||
if (v.getTag() == mExpandedCondition) {
|
||||
MetricsLogger.action(mContext, MetricsEvent.ACTION_SETTINGS_CONDITION_COLLAPSE,
|
||||
mExpandedCondition.getMetricsConstant());
|
||||
mExpandedCondition = null;
|
||||
} else {
|
||||
mExpandedCondition = (Condition) v.getTag();
|
||||
MetricsLogger.action(mContext, MetricsEvent.ACTION_SETTINGS_CONDITION_EXPAND,
|
||||
mExpandedCondition.getMetricsConstant());
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public Object getItem(long itemId) {
|
||||
for (int i = 0; i < mIds.size(); i++) {
|
||||
if (mIds.get(i) == itemId) {
|
||||
return mItems.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getSuggestionIdentifier(Context context, Tile suggestion) {
|
||||
String packageName = suggestion.intent.getComponent().getPackageName();
|
||||
if (packageName.equals(context.getPackageName())) {
|
||||
|
||||
@@ -33,15 +33,13 @@ import com.android.settings.InstrumentedFragment;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.widget.SlidingTabLayout;
|
||||
import com.android.settingslib.HelpUtils;
|
||||
import com.android.settingslib.drawer.SettingsDrawerActivity;
|
||||
|
||||
/**
|
||||
* Container for Dashboard fragments.
|
||||
*/
|
||||
public final class DashboardContainerFragment extends InstrumentedFragment {
|
||||
|
||||
private static final int INDEX_BRIEF_FRAGMENT = 0;
|
||||
private static final int INDEX_SUMMARY_FRAGMENT = 1;
|
||||
private static final int INDEX_SUMMARY_FRAGMENT = 0;
|
||||
|
||||
private ViewPager mViewPager;
|
||||
private View mHeaderView;
|
||||
@@ -73,9 +71,6 @@ public final class DashboardContainerFragment extends InstrumentedFragment {
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
final Activity activity = getActivity();
|
||||
if (activity instanceof SettingsDrawerActivity) {
|
||||
((SettingsDrawerActivity) getActivity()).setContentHeaderView(mHeaderView);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,8 +93,6 @@ public final class DashboardContainerFragment extends InstrumentedFragment {
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
switch (position) {
|
||||
case INDEX_BRIEF_FRAGMENT:
|
||||
return mContext.getString(R.string.page_tab_title_status);
|
||||
case INDEX_SUMMARY_FRAGMENT:
|
||||
return mContext.getString(R.string.page_tab_title_summary);
|
||||
}
|
||||
@@ -109,8 +102,6 @@ public final class DashboardContainerFragment extends InstrumentedFragment {
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
switch (position) {
|
||||
case INDEX_BRIEF_FRAGMENT:
|
||||
return new DashboardStatusFragment();
|
||||
case INDEX_SUMMARY_FRAGMENT:
|
||||
return new DashboardSummary();
|
||||
default:
|
||||
@@ -123,7 +114,7 @@ public final class DashboardContainerFragment extends InstrumentedFragment {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return 2;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,278 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
package com.android.settings.dashboard;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.conditional.Condition;
|
||||
import com.android.settings.dashboard.conditional.ConditionAdapterUtils;
|
||||
import com.android.settings.dashboard.status.StatusCategory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Data adapter for dashboard status fragment.
|
||||
*/
|
||||
public final class DashboardStatusAdapter
|
||||
extends RecyclerView.Adapter<DashboardStatusAdapter.ViewHolder>
|
||||
implements View.OnClickListener {
|
||||
|
||||
public static final int GRID_COLUMN_COUNT = 2;
|
||||
|
||||
// Namespaces
|
||||
private static final int NS_SPACER = 0;
|
||||
private static final int NS_CONDITION = 1000;
|
||||
private static final int NS_STATUS = 2000;
|
||||
|
||||
// Item types
|
||||
private static final int TYPE_SPACER = R.layout.dashboard_spacer;
|
||||
private static final int TYPE_CONDITION = R.layout.condition_card;
|
||||
private static final int TYPE_STATUS = R.layout.dashboard_status_card;
|
||||
|
||||
// Multi namespace support.
|
||||
private final Context mContext;
|
||||
private final List<Object> mItems = new ArrayList<>();
|
||||
private final List<Integer> mTypes = new ArrayList<>();
|
||||
private final List<Integer> mIds = new ArrayList<>();
|
||||
private int mId;
|
||||
|
||||
// Layout control
|
||||
private final SpanSizeLookup mSpanSizeLookup;
|
||||
private final ItemDecoration mItemDecoration;
|
||||
|
||||
private List<Condition> mConditions;
|
||||
private Condition mExpandedCondition = null;
|
||||
private List<StatusCategory> mStatus;
|
||||
|
||||
public DashboardStatusAdapter(Context context) {
|
||||
mContext = context;
|
||||
mSpanSizeLookup = new SpanSizeLookup();
|
||||
mItemDecoration = new ItemDecoration(context);
|
||||
setHasStableIds(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(
|
||||
LayoutInflater.from(parent.getContext()).inflate(viewType, parent, false));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
switch (holder.getItemViewType()) {
|
||||
case TYPE_CONDITION:
|
||||
ConditionAdapterUtils.bindViews((Condition) mItems.get(position), holder,
|
||||
mItems.get(position) == mExpandedCondition, this,
|
||||
new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onExpandClick(v);
|
||||
}
|
||||
});
|
||||
break;
|
||||
case TYPE_STATUS:
|
||||
final StatusCategory status = (StatusCategory) mItems.get(position);
|
||||
status.bindToViewHolder(holder);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return mIds.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return mTypes.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mIds.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getTag() == mExpandedCondition) {
|
||||
mExpandedCondition.onPrimaryClick();
|
||||
} else {
|
||||
mExpandedCondition = (Condition) v.getTag();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public SpanSizeLookup getSpanSizeLookup() {
|
||||
return mSpanSizeLookup;
|
||||
}
|
||||
|
||||
public ItemDecoration getItemDecoration() {
|
||||
return mItemDecoration;
|
||||
}
|
||||
|
||||
public void setConditions(List<Condition> conditions) {
|
||||
mConditions = conditions;
|
||||
recountItems();
|
||||
}
|
||||
|
||||
public Object getItem(long itemId) {
|
||||
for (int i = 0; i < mIds.size(); i++) {
|
||||
if (mIds.get(i) == itemId) {
|
||||
return mItems.get(i);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void countItem(Object object, @LayoutRes int type, boolean add, int nameSpace) {
|
||||
if (add) {
|
||||
mItems.add(object);
|
||||
mTypes.add(type);
|
||||
// TODO: Counting namespaces for handling of suggestions/conds appearing/disappearing.
|
||||
mIds.add(mId + nameSpace);
|
||||
}
|
||||
mId++;
|
||||
}
|
||||
|
||||
private void reset() {
|
||||
mItems.clear();
|
||||
mTypes.clear();
|
||||
mIds.clear();
|
||||
resetCount();
|
||||
}
|
||||
|
||||
private void resetCount() {
|
||||
mId = 0;
|
||||
}
|
||||
|
||||
private void recountItems() {
|
||||
reset();
|
||||
countItem(null, TYPE_SPACER, true /* add */, NS_SPACER);
|
||||
boolean hasCondition = false;
|
||||
for (int i = 0; mConditions != null && i < mConditions.size(); i++) {
|
||||
boolean shouldShow = mConditions.get(i).shouldShow();
|
||||
countItem(mConditions.get(i), TYPE_CONDITION, shouldShow, NS_CONDITION);
|
||||
hasCondition |= shouldShow;
|
||||
}
|
||||
countItem(null, TYPE_SPACER, hasCondition, NS_SPACER);
|
||||
for (int i = 0; mStatus != null && i < mStatus.size(); i++) {
|
||||
countItem(mStatus.get(i), TYPE_STATUS, true, NS_STATUS);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private void onExpandClick(View v) {
|
||||
if (v.getTag() == mExpandedCondition) {
|
||||
mExpandedCondition = null;
|
||||
} else {
|
||||
mExpandedCondition = (Condition) v.getTag();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link GridLayoutManager.SpanSizeLookup} that assigns column span for different item types.
|
||||
*/
|
||||
private final class SpanSizeLookup extends GridLayoutManager.SpanSizeLookup {
|
||||
@Override
|
||||
public int getSpanSize(int position) {
|
||||
final int viewType = getItemViewType(position);
|
||||
switch (viewType) {
|
||||
case TYPE_CONDITION:
|
||||
case TYPE_SPACER:
|
||||
return 2;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@link ItemDecoration} that adds padding around different types of views during layout.
|
||||
*/
|
||||
private static final class ItemDecoration extends RecyclerView.ItemDecoration {
|
||||
|
||||
private final int mItemSpacing;
|
||||
|
||||
public ItemDecoration(Context context) {
|
||||
mItemSpacing = context.getResources()
|
||||
.getDimensionPixelSize(R.dimen.dashboard_status_item_padding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
|
||||
RecyclerView.State state) {
|
||||
GridLayoutManager.LayoutParams layoutParams
|
||||
= (GridLayoutManager.LayoutParams) view.getLayoutParams();
|
||||
final int position = layoutParams.getViewLayoutPosition();
|
||||
if (position == RecyclerView.NO_POSITION) {
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
return;
|
||||
}
|
||||
final int viewType = parent.getChildViewHolder(view).getItemViewType();
|
||||
switch (viewType) {
|
||||
case TYPE_SPACER:
|
||||
// No padding for spacer.
|
||||
super.getItemOffsets(outRect, view, parent, state);
|
||||
return;
|
||||
case TYPE_CONDITION:
|
||||
// Adds padding horizontally.
|
||||
outRect.left = mItemSpacing;
|
||||
outRect.right = mItemSpacing;
|
||||
return;
|
||||
default:
|
||||
// Adds padding around status card.
|
||||
final int spanIndex = layoutParams.getSpanIndex();
|
||||
outRect.left = spanIndex == 0 ? mItemSpacing : mItemSpacing / 2;
|
||||
outRect.right = spanIndex + layoutParams.getSpanSize() == GRID_COLUMN_COUNT
|
||||
? mItemSpacing : mItemSpacing / 2;
|
||||
outRect.top = mItemSpacing;
|
||||
outRect.bottom = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class ViewHolder extends RecyclerView.ViewHolder {
|
||||
public final TextView title;
|
||||
public final ImageView icon;
|
||||
public final TextView summary;
|
||||
public final ImageView icon2;
|
||||
public final TextView summary2;
|
||||
|
||||
public ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
title = (TextView) itemView.findViewById(android.R.id.title);
|
||||
icon = (ImageView) itemView.findViewById(android.R.id.icon);
|
||||
summary = (TextView) itemView.findViewById(android.R.id.summary);
|
||||
icon2 = (ImageView) itemView.findViewById(android.R.id.icon2);
|
||||
summary2 = (TextView) itemView.findViewById(android.R.id.text2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
package com.android.settings.dashboard;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.settings.InstrumentedFragment;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.conditional.Condition;
|
||||
import com.android.settings.dashboard.conditional.ConditionAdapterUtils;
|
||||
import com.android.settings.dashboard.conditional.ConditionManager;
|
||||
import com.android.settings.dashboard.conditional.FocusRecyclerView;
|
||||
|
||||
/**
|
||||
* Dashboard fragment for showing status and suggestions.
|
||||
*/
|
||||
public final class DashboardStatusFragment extends InstrumentedFragment
|
||||
implements ConditionManager.ConditionListener, FocusRecyclerView.FocusListener {
|
||||
|
||||
private static final String TAG = "DashboardStatus";
|
||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||
|
||||
private ConditionManager mConditionManager;
|
||||
private DashboardStatusAdapter mAdapter;
|
||||
private FocusRecyclerView mRecyclerView;
|
||||
private GridLayoutManager mLayoutManager;
|
||||
|
||||
@Override
|
||||
protected int getMetricsCategory() {
|
||||
return DASHBOARD_STATUS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
mConditionManager = ConditionManager.get(getContext());
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
|
||||
final View content = inflater.inflate(R.layout.dashboard_status, parent, false);
|
||||
mRecyclerView =
|
||||
(FocusRecyclerView) content.findViewById(R.id.dashboard_status_recycler_view);
|
||||
mAdapter = new DashboardStatusAdapter(getContext());
|
||||
mAdapter.setConditions(mConditionManager.getConditions());
|
||||
mLayoutManager = new GridLayoutManager(
|
||||
getContext(), DashboardStatusAdapter.GRID_COLUMN_COUNT);
|
||||
mLayoutManager.setOrientation(GridLayoutManager.VERTICAL);
|
||||
mLayoutManager.setSpanSizeLookup(mAdapter.getSpanSizeLookup());
|
||||
mRecyclerView.setLayoutManager(mLayoutManager);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setListener(this);
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
mRecyclerView.addItemDecoration(mAdapter.getItemDecoration());
|
||||
ConditionAdapterUtils.addDismiss(mRecyclerView);
|
||||
return content;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
for (Condition c : mConditionManager.getVisibleConditions()) {
|
||||
MetricsLogger.visible(getContext(), c.getMetricsConstant());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
for (Condition c : mConditionManager.getVisibleConditions()) {
|
||||
MetricsLogger.hidden(getContext(), c.getMetricsConstant());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||
if (hasWindowFocus) {
|
||||
mConditionManager.addListener(this);
|
||||
mConditionManager.refreshAll();
|
||||
} else {
|
||||
mConditionManager.remListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConditionsChanged() {
|
||||
if (DEBUG) Log.d(TAG, "onConditionsChanged");
|
||||
mAdapter.setConditions(mConditionManager.getConditions());
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,6 @@ package com.android.settings.dashboard;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -31,7 +30,10 @@ import com.android.settings.InstrumentedFragment;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.Settings;
|
||||
import com.android.settings.SettingsActivity;
|
||||
|
||||
import com.android.settings.dashboard.conditional.Condition;
|
||||
import com.android.settings.dashboard.conditional.ConditionAdapterUtils;
|
||||
import com.android.settings.dashboard.conditional.ConditionManager;
|
||||
import com.android.settings.dashboard.conditional.FocusRecyclerView;
|
||||
import com.android.settingslib.SuggestionParser;
|
||||
import com.android.settingslib.drawer.DashboardCategory;
|
||||
import com.android.settingslib.drawer.SettingsDrawerActivity;
|
||||
@@ -40,7 +42,8 @@ import com.android.settingslib.drawer.Tile;
|
||||
import java.util.List;
|
||||
|
||||
public class DashboardSummary extends InstrumentedFragment
|
||||
implements SettingsDrawerActivity.CategoryListener {
|
||||
implements SettingsDrawerActivity.CategoryListener, ConditionManager.ConditionListener,
|
||||
FocusRecyclerView.FocusListener {
|
||||
public static final boolean DEBUG = false;
|
||||
private static final boolean DEBUG_TIMING = false;
|
||||
private static final String TAG = "DashboardSummary";
|
||||
@@ -58,9 +61,10 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
|
||||
private static final String EXTRA_SCROLL_POSITION = "scroll_position";
|
||||
|
||||
private RecyclerView mDashboard;
|
||||
private FocusRecyclerView mDashboard;
|
||||
private DashboardAdapter mAdapter;
|
||||
private SummaryLoader mSummaryLoader;
|
||||
private ConditionManager mConditionManager;
|
||||
private SuggestionParser mSuggestionParser;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
|
||||
@@ -80,7 +84,7 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
if (DEBUG_TIMING) Log.d(TAG, "onCreate took " + (System.currentTimeMillis() - startTime)
|
||||
+ " ms");
|
||||
Context context = getContext();
|
||||
|
||||
mConditionManager = ConditionManager.get(context);
|
||||
mSuggestionParser = new SuggestionParser(context,
|
||||
context.getSharedPreferences(SUGGESTIONS, 0), R.xml.suggestion_ordering);
|
||||
}
|
||||
@@ -97,6 +101,9 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
|
||||
((SettingsDrawerActivity) getActivity()).addCategoryListener(this);
|
||||
mSummaryLoader.setListening(true);
|
||||
for (Condition c : mConditionManager.getVisibleConditions()) {
|
||||
MetricsLogger.visible(getContext(), c.getMetricsConstant());
|
||||
}
|
||||
for (Tile suggestion : mSuggestionParser.getSuggestions()) {
|
||||
MetricsLogger.action(getContext(), MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION,
|
||||
DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion));
|
||||
@@ -109,12 +116,25 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
|
||||
((SettingsDrawerActivity) getActivity()).remCategoryListener(this);
|
||||
mSummaryLoader.setListening(false);
|
||||
for (Condition c : mConditionManager.getVisibleConditions()) {
|
||||
MetricsLogger.hidden(getContext(), c.getMetricsConstant());
|
||||
}
|
||||
for (Tile suggestion : mSuggestionParser.getSuggestions()) {
|
||||
MetricsLogger.action(getContext(), MetricsEvent.ACTION_HIDE_SETTINGS_SUGGESTION,
|
||||
DashboardAdapter.getSuggestionIdentifier(getContext(), suggestion));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWindowFocusChanged(boolean hasWindowFocus) {
|
||||
if (hasWindowFocus) {
|
||||
mConditionManager.addListener(this);
|
||||
mConditionManager.refreshAll();
|
||||
} else {
|
||||
mConditionManager.remListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
@@ -130,7 +150,7 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle bundle) {
|
||||
mDashboard = (RecyclerView) view.findViewById(R.id.dashboard_container);
|
||||
mDashboard = (FocusRecyclerView) view.findViewById(R.id.dashboard_container);
|
||||
mLayoutManager = new LinearLayoutManager(getContext());
|
||||
mLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
|
||||
if (bundle != null) {
|
||||
@@ -140,10 +160,13 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
mDashboard.setLayoutManager(mLayoutManager);
|
||||
mDashboard.setHasFixedSize(true);
|
||||
mDashboard.addItemDecoration(new DashboardDecorator(getContext()));
|
||||
mDashboard.setListener(this);
|
||||
mAdapter = new DashboardAdapter(getContext());
|
||||
mAdapter.setConditions(mConditionManager.getConditions());
|
||||
mAdapter.setSuggestions(mSuggestionParser);
|
||||
mDashboard.setAdapter(mAdapter);
|
||||
mSummaryLoader.setAdapter(mAdapter);
|
||||
ConditionAdapterUtils.addDismiss(mDashboard);
|
||||
|
||||
rebuildUI();
|
||||
}
|
||||
@@ -171,4 +194,10 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
public void onCategoriesChanged() {
|
||||
rebuildUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConditionsChanged() {
|
||||
Log.d(TAG, "onConditionsChanged");
|
||||
mAdapter.setConditions(mConditionManager.getConditions());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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.
|
||||
*/
|
||||
|
||||
package com.android.settings.dashboard;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.settings.R;
|
||||
|
||||
public final class SuggestionCarouselAdapter
|
||||
extends RecyclerView.Adapter<SuggestionCarouselAdapter.SuggestionCarouselViewHolder> {
|
||||
|
||||
@Override
|
||||
public SuggestionCarouselViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
final View itemView = LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.suggestion_carousel_card_view, parent,
|
||||
false /* attachToRoot */);
|
||||
return new SuggestionCarouselViewHolder(itemView);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(SuggestionCarouselViewHolder holder, int position) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public final class SuggestionCarouselViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
public ImageView mImageView;
|
||||
public TextView mTextView;
|
||||
|
||||
public SuggestionCarouselViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mImageView = (ImageView) itemView.findViewById(R.id.image);
|
||||
mTextView = (TextView) itemView.findViewById(R.id.title);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,11 +25,10 @@ import android.view.View.OnLayoutChangeListener;
|
||||
import android.view.ViewGroup.LayoutParams;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.android.internal.logging.MetricsLogger;
|
||||
import com.android.internal.logging.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.dashboard.DashboardStatusAdapter;
|
||||
import com.android.settings.dashboard.DashboardAdapter;
|
||||
|
||||
public class ConditionAdapterUtils {
|
||||
|
||||
@@ -50,7 +49,7 @@ public class ConditionAdapterUtils {
|
||||
|
||||
@Override
|
||||
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
||||
DashboardStatusAdapter adapter = (DashboardStatusAdapter) recyclerView.getAdapter();
|
||||
DashboardAdapter adapter = (DashboardAdapter) recyclerView.getAdapter();
|
||||
Object item = adapter.getItem(viewHolder.getItemId());
|
||||
if (item instanceof Condition) {
|
||||
((Condition) item).silence();
|
||||
@@ -62,7 +61,7 @@ public class ConditionAdapterUtils {
|
||||
}
|
||||
|
||||
public static void bindViews(final Condition condition,
|
||||
DashboardStatusAdapter.ViewHolder view, boolean isExpanded,
|
||||
DashboardAdapter.DashboardItemHolder view, boolean isExpanded,
|
||||
View.OnClickListener onClickListener, View.OnClickListener onExpandListener) {
|
||||
View card = view.itemView.findViewById(R.id.content);
|
||||
card.setTag(condition);
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.android.settings.dashboard.status;
|
||||
|
||||
import android.annotation.StringRes;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Icon;
|
||||
|
||||
import com.android.settings.dashboard.DashboardStatusAdapter;
|
||||
|
||||
/**
|
||||
* Data item for status category in dashboard.
|
||||
*/
|
||||
public final class StatusCategory {
|
||||
|
||||
private final String mTitle;
|
||||
|
||||
public StatusCategory(Context context, @StringRes int titleResId) {
|
||||
mTitle = context.getString(titleResId);
|
||||
}
|
||||
|
||||
public void bindToViewHolder(DashboardStatusAdapter.ViewHolder viewHolder) {
|
||||
viewHolder.title.setText(mTitle);
|
||||
viewHolder.icon.setImageIcon(getIcon());
|
||||
viewHolder.summary.setText(getSummary());
|
||||
viewHolder.icon2.setImageIcon(getSecondaryIcon());
|
||||
viewHolder.summary2.setText(getSecondarySummary());
|
||||
}
|
||||
|
||||
private Icon getIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getSummary() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Icon getSecondaryIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String getSecondarySummary() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user