Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1b0fbfea authored by Jason Chiu's avatar Jason Chiu
Browse files

Remove the specific UX of Deferred Setup card

Bug: 142927894
Test: visual, robotests
Change-Id: If93506fb11c6417967fab3d082b19947adef0d61
parent 09f634ed
Loading
Loading
Loading
Loading
+0 −72
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2019 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.google.android.material.card.MaterialCardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="@style/ContextualCardStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <LinearLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="start"
        android:orientation="vertical"
        android:paddingEnd="@dimen/contextual_card_padding_end"
        android:paddingTop="@dimen/contextual_deferred_setup_card_padding_top"
        android:paddingBottom="@dimen/contextual_deferred_setup_card_padding_bottom">

        <ImageView
            android:id="@android:id/icon"
            android:layout_width="@dimen/contextual_card_icon_size"
            android:layout_height="@dimen/contextual_card_icon_size"
            android:layout_marginStart="@dimen/contextual_card_icon_padding_start"/>

        <TextView
            android:id="@android:id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/contextual_card_text_padding_start"
            android:layout_marginTop="@dimen/contextual_deferred_setup_card_title_margin_top"
            android:ellipsize="end"
            android:maxLines="2"
            android:minLines="1"
            android:textAppearance="@style/TextAppearance.DeferredSetupCardTitle"/>

        <TextView
            android:id="@android:id/summary"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/contextual_card_text_padding_start"
            android:layout_marginTop="@dimen/contextual_deferred_setup_card_summary_margin_top"
            android:ellipsize="end"
            android:maxLines="2"
            android:minLines="1"
            android:textAppearance="@style/TextAppearance.DeferredSetupCardSummary"/>

        <Button
            android:id="@+id/finish_setup"
            style="@style/DeferredSetupCardButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginStart="@dimen/contextual_card_text_padding_start"
            android:layout_marginTop="@dimen/contextual_deferred_setup_card_button_margin_top"
            android:text="@string/suggestion_button_text"/>

    </LinearLayout>
</com.google.android.material.card.MaterialCardView>
 No newline at end of file
+0 −9
Original line number Diff line number Diff line
@@ -342,15 +342,6 @@
    <dimen name="contextual_half_card_padding_top">12dp</dimen>
    <dimen name="contextual_half_card_padding_bottom">16dp</dimen>
    <dimen name="contextual_half_card_title_margin_top">12dp</dimen>
    <dimen name="contextual_deferred_setup_card_padding_top">16dp</dimen>
    <dimen name="contextual_deferred_setup_card_padding_bottom">12dp</dimen>
    <dimen name="contextual_deferred_setup_card_title_margin_top">12dp</dimen>
    <dimen name="contextual_deferred_setup_card_summary_margin_top">2dp</dimen>
    <dimen name="contextual_deferred_setup_card_button_margin_top">8dp</dimen>
    <dimen name="contextual_deferred_setup_card_button_padding_top">8dp</dimen>
    <dimen name="contextual_deferred_setup_card_button_padding_bottom">8dp</dimen>
    <dimen name="contextual_deferred_setup_card_button_padding_start">24dp</dimen>
    <dimen name="contextual_deferred_setup_card_button_padding_end">24dp</dimen>

    <!-- Homepage dismissal cards size and padding -->
    <dimen name="contextual_card_dismissal_margin_top">12dp</dimen>
+0 −20
Original line number Diff line number Diff line
@@ -462,26 +462,6 @@
        <item name="rowStyle">@style/SliceRowStyle.Settings</item>
    </style>

    <style name="TextAppearance.DeferredSetupCardTitle">
        <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
        <item name="android:textSize">16sp</item>
    </style>

    <style name="TextAppearance.DeferredSetupCardSummary"
           parent="@*android:style/TextAppearance.DeviceDefault.Body1">
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>

    <style name="DeferredSetupCardButton" parent="android:Widget.DeviceDefault.Button.Colored">
        <item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
        <item name="android:paddingBottom">@dimen/contextual_deferred_setup_card_button_padding_bottom</item>
        <item name="android:paddingEnd">@dimen/contextual_deferred_setup_card_button_padding_end</item>
        <item name="android:paddingStart">@dimen/contextual_deferred_setup_card_button_padding_start</item>
        <item name="android:paddingTop">@dimen/contextual_deferred_setup_card_button_padding_top</item>
        <item name="android:textAllCaps">false</item>
        <item name="android:textSize">14sp</item>
    </style>

    <style name="SliceViewStyle">
        <item name="rowStyle">@style/SliceRowStyle</item>
        <item name="android:background">?android:attr/colorBackgroundFloating</item>
+0 −4
Original line number Diff line number Diff line
@@ -79,10 +79,6 @@ public class ContextualCardLookupTable {
                        LegacySuggestionContextualCardRenderer.VIEW_TYPE,
                        LegacySuggestionContextualCardController.class,
                        LegacySuggestionContextualCardRenderer.class));
                add(new ControllerRendererMapping(CardType.SLICE,
                        SliceContextualCardRenderer.VIEW_TYPE_DEFERRED_SETUP,
                        SliceContextualCardController.class,
                        SliceContextualCardRenderer.class));
                add(new ControllerRendererMapping(CardType.SLICE,
                        SliceContextualCardRenderer.VIEW_TYPE_FULL_WIDTH,
                        SliceContextualCardController.class,
+1 −20
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.settings.homepage.contextualcards;

import static com.android.settings.homepage.contextualcards.ContextualCardLoader.CARD_CONTENT_LOADER_ID;
import static com.android.settings.intelligence.ContextualCardProto.ContextualCard.Category.DEFERRED_SETUP_VALUE;
import static com.android.settings.intelligence.ContextualCardProto.ContextualCard.Category.SUGGESTION_VALUE;

import static java.util.stream.Collectors.groupingBy;
@@ -309,9 +308,7 @@ public class ContextualCardManager implements ContextualCardLoader.CardContentLo
        if (cards.isEmpty()) {
            return cards;
        }

        final List<ContextualCard> result = getCardsWithDeferredSetupViewType(cards);
        return getCardsWithSuggestionViewType(result);
        return getCardsWithSuggestionViewType(cards);
    }

    @VisibleForTesting
@@ -341,22 +338,6 @@ public class ContextualCardManager implements ContextualCardLoader.CardContentLo
        return result;
    }

    private List<ContextualCard> getCardsWithDeferredSetupViewType(List<ContextualCard> cards) {
        // Find the deferred setup card and assign it with proper view type.
        // Reason: The returned card list will mix deferred setup card and other suggestion cards
        // after device running 1 days.
        final List<ContextualCard> result = new ArrayList<>(cards);
        for (int index = 0; index < result.size(); index++) {
            final ContextualCard card = cards.get(index);
            if (card.getCategory() == DEFERRED_SETUP_VALUE) {
                result.set(index, card.mutate().setViewType(
                        SliceContextualCardRenderer.VIEW_TYPE_DEFERRED_SETUP).build());
                return result;
            }
        }
        return result;
    }

    @VisibleForTesting
    List<ContextualCard> getCardsToKeep(List<ContextualCard> cards) {
        if (mSavedCards != null) {
Loading