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

Commit 7f050853 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add conditional cards to the new homepage."

parents d6d4c168 307d2093
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
<!--
     Copyright (C) 2018 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.
-->

<androidx.cardview.widget.CardView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    style="@style/SuggestionConditionStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cardUseCompatPadding="true"
    app:cardElevation="@dimen/condition_card_elevation"
    app:cardCornerRadius="@dimen/suggestion_card_corner_radius">

    <include layout="@layout/condition_tile"/>

</androidx.cardview.widget.CardView>
+3 −0
Original line number Diff line number Diff line
@@ -312,6 +312,9 @@
    <dimen name="suggestion_card_button_top_margin">16dp</dimen>
    <dimen name="suggestion_card_button_bottom_margin">18dp</dimen>

    <!-- Condition cards size and padding -->
    <dimen name="condition_card_elevation">2dp</dimen>

    <!-- Padding for the reset screens -->
    <dimen name="reset_checkbox_padding_end">8dp</dimen>
    <dimen name="reset_checkbox_title_padding_top">12dp</dimen>
+6 −6
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@ import android.util.Log;

import androidx.collection.ArraySet;

import com.android.settings.homepage.conditional.ConditionHomepageCardController;
import com.android.settings.homepage.conditional.ConditionHomepageCardRenderer;

import java.util.Set;

/**
@@ -80,19 +83,16 @@ public class ControllerRendererPool {

    private HomepageCardController createCardController(Context context,
            Class<? extends HomepageCardController> clz) {
        /*
        if (ConditionHomepageCardController.class == clz) {
            return new ConditionHomepageCardController(context);
        }
        */
        return null;
    }

    private HomepageCardRenderer createCardRenderer(Context context, Class<?> clz) {
        //if (ConditionHomepageCardRenderer.class == clz) {
        //    return new ConditionHomepageCardRenderer(context, this /*controllerRendererPool*/);
        //}

        if (ConditionHomepageCardRenderer.class == clz) {
            return new ConditionHomepageCardRenderer(context, this /*controllerRendererPool*/);
        }
        return null;
    }

+20 −20
Original line number Diff line number Diff line
@@ -65,79 +65,79 @@ public class HomepageCard {
        return mName;
    }

    int getCardType() {
    public int getCardType() {
        return mCardType;
    }

    double getRankingScore() {
    public double getRankingScore() {
        return mRankingScore;
    }

    String getTextSliceUri() {
    public String getTextSliceUri() {
        return mSliceUri;
    }

    Uri getSliceUri() {
    public Uri getSliceUri() {
        return Uri.parse(mSliceUri);
    }

    int getCategory() {
    public int getCategory() {
        return mCategory;
    }

    String getLocalizedToLocale() {
    public String getLocalizedToLocale() {
        return mLocalizedToLocale;
    }

    String getPackageName() {
    public String getPackageName() {
        return mPackageName;
    }

    String getAppVersion() {
    public String getAppVersion() {
        return mAppVersion;
    }

    String getTitleResName() {
    public String getTitleResName() {
        return mTitleResName;
    }

    String getTitleText() {
    public String getTitleText() {
        return mTitleText;
    }

    String getSummaryResName() {
    public String getSummaryResName() {
        return mSummaryResName;
    }

    String getSummaryText() {
    public String getSummaryText() {
        return mSummaryText;
    }

    String getIconResName() {
    public String getIconResName() {
        return mIconResName;
    }

    int getIconResId() {
    public int getIconResId() {
        return mIconResId;
    }

    int getCardAction() {
    public int getCardAction() {
        return mCardAction;
    }

    long getExpireTimeMS() {
    public long getExpireTimeMS() {
        return mExpireTimeMS;
    }

    Drawable getIconDrawable() {
    public Drawable getIconDrawable() {
        return mIconDrawable;
    }

    boolean isHalfWidth() {
    public boolean isHalfWidth() {
        return mIsHalfWidth;
    }

    HomepageCard(Builder builder) {
    public HomepageCard(Builder builder) {
        mName = builder.mName;
        mCardType = builder.mCardType;
        mRankingScore = builder.mRankingScore;
@@ -179,7 +179,7 @@ public class HomepageCard {
        return TextUtils.equals(mName, that.mName);
    }

    static class Builder {
    public static class Builder {
        private String mName;
        private int mCardType;
        private double mRankingScore;
+0 −2
Original line number Diff line number Diff line
@@ -18,8 +18,6 @@ package com.android.settings.homepage;

import java.util.List;

//TODO(b/111821137): add test cases

/**
 * Data controller for {@link HomepageCard}.
 */
Loading