1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.android.settings.homepage.contextualcards.conditional; 18 19 import com.android.settings.homepage.contextualcards.ContextualCard; 20 21 /** 22 * Data class representing a condition footer {@link ContextualCard}. 23 * 24 * Use this class for {@link ConditionFooterContextualCardRenderer} and 25 * {@link ConditionContextualCardController}. 26 */ 27 public class ConditionFooterContextualCard extends ContextualCard { 28 ConditionFooterContextualCard(Builder builder)29 private ConditionFooterContextualCard(Builder builder) { 30 super(builder); 31 } 32 33 @Override getCardType()34 public int getCardType() { 35 return CardType.CONDITIONAL_FOOTER; 36 } 37 38 public static class Builder extends ContextualCard.Builder { 39 40 @Override setCardType(int cardType)41 public Builder setCardType(int cardType) { 42 throw new IllegalArgumentException( 43 "Cannot change card type for " + getClass().getName()); 44 } 45 build()46 public ConditionFooterContextualCard build() { 47 return new ConditionFooterContextualCard(this); 48 } 49 } 50 }