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 android.content.Context; 20 21 import com.android.settings.homepage.contextualcards.ContextualCard; 22 23 /** 24 * Data controller for a {@link ConditionalContextualCard}. 25 */ 26 public interface ConditionalCardController { 27 28 /** 29 * A stable ID for this card. 30 */ getId()31 long getId(); 32 33 /** 34 * Whether or not the card is displayable on the ui. 35 */ isDisplayable()36 boolean isDisplayable(); 37 38 /** 39 * Handler when the card is clicked. 40 */ onPrimaryClick(Context context)41 void onPrimaryClick(Context context); 42 43 /** 44 * Handler when the card action is clicked. 45 */ onActionClick()46 void onActionClick(); 47 48 /** 49 * Creates a UI model suitable for display, controlled by this controller. 50 */ buildContextualCard()51 ContextualCard buildContextualCard(); 52 startMonitoringStateChange()53 void startMonitoringStateChange(); 54 stopMonitoringStateChange()55 void stopMonitoringStateChange(); 56 } 57