Loading res/layout/suggestion_tile.xml +8 −7 Original line number Diff line number Diff line Loading @@ -40,7 +40,8 @@ android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@android:id/title" <TextView android:id="@android:id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" Loading @@ -48,11 +49,11 @@ android:ellipsize="marquee" android:fadingEdge="horizontal" /> <TextView android:id="@android:id/summary" <TextView android:id="@android:id/summary" android:textAppearance="@style/TextAppearance.SuggestionSummary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.Small" android:textColor="?android:attr/textColorSecondary"/> android:layout_height="wrap_content" /> </LinearLayout> Loading res/layout/suggestion_tile_with_button.xml 0 → 100644 +72 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2017 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:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:clipChildren="false" android:clipToPadding="false" android:paddingStart="16dp" android:paddingEnd="12dp" android:paddingBottom="20dp" android:paddingTop="16dp" android:orientation="horizontal" android:minHeight="@dimen/dashboard_tile_minimum_height"> <ImageView android:id="@android:id/icon" android:layout_width="@dimen/dashboard_tile_image_size" android:layout_height="@dimen/dashboard_tile_image_size" android:contentDescription="@null" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="start" android:layout_marginStart="18dp" android:layout_marginTop="2dp" android:clipChildren="false" android:clipToPadding="false" android:orientation="vertical"> <TextView style="@style/TextAppearance.SuggestionTitle" android:id="@android:id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="6dp" /> <TextView android:id="@android:id/summary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:layout_marginStart="6dp" android:layout_marginEnd="50dp" android:textAppearance="@style/TextAppearance.SuggestionSummary" /> <Button android:id="@android:id/primary" style="@style/SuwGlifButton.Primary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:text="@string/suggestion_button_text" /> </LinearLayout> </LinearLayout> No newline at end of file res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -7321,6 +7321,8 @@ settings button --> <string name="notification_app_settings_button">Notification settings</string> <!-- Generic label for suggestion card's ok button [CHAR LIMIT=20] --> <string name="suggestion_button_text">Ok</string> <!-- [CHAR LIMIT=35] Feedback on the device --> <string name="device_feedback">Send feedback about this device</string> res/values/styles.xml +4 −1 Original line number Diff line number Diff line Loading @@ -318,7 +318,10 @@ <style name="TextAppearance.SuggestionTitle" parent="@android:style/TextAppearance.Material.Subhead"> <item name="android:fontFamily">sans-serif-medium</item> <item name="android:textSize">14sp</item> </style> <style name="TextAppearance.SuggestionSummary" parent="TextAppearance.Small"> <item name="android:textColor">?android:attr/textColorSecondary</item> </style> <style name="TextAppearance.FingerprintErrorText" Loading src/com/android/settings/dashboard/suggestions/SuggestionAdapter.java +16 −27 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> private final Context mContext; private final MetricsFeatureProvider mMetricsFeatureProvider; private final SuggestionFeatureProvider mSuggestionFeatureProvider; @Deprecated // in favor of mNewSuggestions @Deprecated // in favor of mSuggestionsV2 private final List<Tile> mSuggestions; private final List<Suggestion> mSuggestionsV2; private final IconCache mCache; Loading Loading @@ -88,14 +88,7 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> mContext, MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION, id); mSuggestionsShownLogged.add(id); } // TODO: Add remote view field in Suggestion, and enable this. // if (suggestion.remoteViews != null) { // final ViewGroup itemView = (ViewGroup) holder.itemView; // itemView.removeAllViews(); // itemView.addView(suggestion.remoteViews.apply(itemView.getContext(), // itemView)); // } else { holder.icon.setImageDrawable(mCache.getIcon(suggestion.getIcon())); holder.title.setText(suggestion.getTitle()); final CharSequence summary = suggestion.getSummary(); Loading @@ -105,7 +98,6 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> } else { holder.summary.setVisibility(View.GONE); } } final View divider = holder.itemView.findViewById(R.id.divider); if (divider != null) { divider.setVisibility(position < mSuggestionsV2.size() - 1 ? View.VISIBLE : View.GONE); Loading @@ -116,8 +108,6 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> final View primaryAction = holder.itemView.findViewById(android.R.id.primary); if (primaryAction != null) { clickHandler = primaryAction; // set the item view to disabled to remove any touch effects holder.itemView.setEnabled(false); } clickHandler.setOnClickListener(v -> { mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_SUGGESTION, id); Loading Loading @@ -198,13 +188,12 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> ? R.layout.suggestion_tile_remote_container : R.layout.suggestion_tile; } else { final Suggestion suggestion = getSuggestionsV2(position); if ((suggestion.getFlags() & Suggestion.FLAG_HAS_BUTTON) != 0) { return R.layout.suggestion_tile_with_button; } else { return R.layout.suggestion_tile; // TODO: Add remote view field in Suggestion, and enable this. // Suggestion suggestion = getSuggestionsV2(position); // return suggestion.remoteViews != null // ? R.layout.suggestion_tile_remote_container // : R.layout.suggestion_tile; } } } Loading Loading
res/layout/suggestion_tile.xml +8 −7 Original line number Diff line number Diff line Loading @@ -40,7 +40,8 @@ android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:id="@android:id/title" <TextView android:id="@android:id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" Loading @@ -48,11 +49,11 @@ android:ellipsize="marquee" android:fadingEdge="horizontal" /> <TextView android:id="@android:id/summary" <TextView android:id="@android:id/summary" android:textAppearance="@style/TextAppearance.SuggestionSummary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.Small" android:textColor="?android:attr/textColorSecondary"/> android:layout_height="wrap_content" /> </LinearLayout> Loading
res/layout/suggestion_tile_with_button.xml 0 → 100644 +72 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright (C) 2017 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:layout_width="match_parent" android:layout_height="wrap_content" android:background="@android:color/white" android:clipChildren="false" android:clipToPadding="false" android:paddingStart="16dp" android:paddingEnd="12dp" android:paddingBottom="20dp" android:paddingTop="16dp" android:orientation="horizontal" android:minHeight="@dimen/dashboard_tile_minimum_height"> <ImageView android:id="@android:id/icon" android:layout_width="@dimen/dashboard_tile_image_size" android:layout_height="@dimen/dashboard_tile_image_size" android:contentDescription="@null" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="start" android:layout_marginStart="18dp" android:layout_marginTop="2dp" android:clipChildren="false" android:clipToPadding="false" android:orientation="vertical"> <TextView style="@style/TextAppearance.SuggestionTitle" android:id="@android:id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="6dp" /> <TextView android:id="@android:id/summary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:layout_marginStart="6dp" android:layout_marginEnd="50dp" android:textAppearance="@style/TextAppearance.SuggestionSummary" /> <Button android:id="@android:id/primary" style="@style/SuwGlifButton.Primary" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:text="@string/suggestion_button_text" /> </LinearLayout> </LinearLayout> No newline at end of file
res/values/strings.xml +2 −0 Original line number Diff line number Diff line Loading @@ -7321,6 +7321,8 @@ settings button --> <string name="notification_app_settings_button">Notification settings</string> <!-- Generic label for suggestion card's ok button [CHAR LIMIT=20] --> <string name="suggestion_button_text">Ok</string> <!-- [CHAR LIMIT=35] Feedback on the device --> <string name="device_feedback">Send feedback about this device</string>
res/values/styles.xml +4 −1 Original line number Diff line number Diff line Loading @@ -318,7 +318,10 @@ <style name="TextAppearance.SuggestionTitle" parent="@android:style/TextAppearance.Material.Subhead"> <item name="android:fontFamily">sans-serif-medium</item> <item name="android:textSize">14sp</item> </style> <style name="TextAppearance.SuggestionSummary" parent="TextAppearance.Small"> <item name="android:textColor">?android:attr/textColorSecondary</item> </style> <style name="TextAppearance.FingerprintErrorText" Loading
src/com/android/settings/dashboard/suggestions/SuggestionAdapter.java +16 −27 Original line number Diff line number Diff line Loading @@ -44,7 +44,7 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> private final Context mContext; private final MetricsFeatureProvider mMetricsFeatureProvider; private final SuggestionFeatureProvider mSuggestionFeatureProvider; @Deprecated // in favor of mNewSuggestions @Deprecated // in favor of mSuggestionsV2 private final List<Tile> mSuggestions; private final List<Suggestion> mSuggestionsV2; private final IconCache mCache; Loading Loading @@ -88,14 +88,7 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> mContext, MetricsEvent.ACTION_SHOW_SETTINGS_SUGGESTION, id); mSuggestionsShownLogged.add(id); } // TODO: Add remote view field in Suggestion, and enable this. // if (suggestion.remoteViews != null) { // final ViewGroup itemView = (ViewGroup) holder.itemView; // itemView.removeAllViews(); // itemView.addView(suggestion.remoteViews.apply(itemView.getContext(), // itemView)); // } else { holder.icon.setImageDrawable(mCache.getIcon(suggestion.getIcon())); holder.title.setText(suggestion.getTitle()); final CharSequence summary = suggestion.getSummary(); Loading @@ -105,7 +98,6 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> } else { holder.summary.setVisibility(View.GONE); } } final View divider = holder.itemView.findViewById(R.id.divider); if (divider != null) { divider.setVisibility(position < mSuggestionsV2.size() - 1 ? View.VISIBLE : View.GONE); Loading @@ -116,8 +108,6 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> final View primaryAction = holder.itemView.findViewById(android.R.id.primary); if (primaryAction != null) { clickHandler = primaryAction; // set the item view to disabled to remove any touch effects holder.itemView.setEnabled(false); } clickHandler.setOnClickListener(v -> { mMetricsFeatureProvider.action(mContext, MetricsEvent.ACTION_SETTINGS_SUGGESTION, id); Loading Loading @@ -198,13 +188,12 @@ public class SuggestionAdapter extends RecyclerView.Adapter<DashboardItemHolder> ? R.layout.suggestion_tile_remote_container : R.layout.suggestion_tile; } else { final Suggestion suggestion = getSuggestionsV2(position); if ((suggestion.getFlags() & Suggestion.FLAG_HAS_BUTTON) != 0) { return R.layout.suggestion_tile_with_button; } else { return R.layout.suggestion_tile; // TODO: Add remote view field in Suggestion, and enable this. // Suggestion suggestion = getSuggestionsV2(position); // return suggestion.remoteViews != null // ? R.layout.suggestion_tile_remote_container // : R.layout.suggestion_tile; } } } Loading