1 /*
2  * Copyright (C) 2020 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.car.carlauncher.homescreen;
18 
19 import androidx.annotation.IdRes;
20 import androidx.lifecycle.ViewModelProvider;
21 
22 import com.android.car.carlauncher.homescreen.HomeCardInterface.Presenter;
23 import com.android.car.carlauncher.homescreen.HomeCardInterface.View;
24 
25 import java.util.List;
26 
27 /**
28  * A HomeCardModule creates and provides the Model-View-Presenter structure that underlies cards
29  * on the home screen.
30  *
31  * The class should construct the {@link HomeCardInterface} View, Presenter, and Model(s) needed
32  * for the card and call their appropriate set methods. For the View: {@link
33  * View#setPresenter(Presenter)}. For the Presenter:
34  * {@link Presenter#setView(HomeCardInterface.View)},
35  * {@link Presenter#setModels(List)}
36  */
37 public interface HomeCardModule {
38 
39     /**
40      * Sets the {@link ViewModelProvider}. which provides {@link androidx.lifecycle.ViewModel}s for
41      * the scope of the {@link androidx.lifecycle.ViewModelStoreOwner} specified when constructed.
42      */
setViewModelProvider(ViewModelProvider viewModelProvider)43     void setViewModelProvider(ViewModelProvider viewModelProvider);
44 
45     /**
46      * Returns the id of the container view that will hold this card.
47      */
48     @IdRes
getCardResId()49     int getCardResId();
50 
51     /**
52      * Returns the card's {@link Presenter}
53      */
getCardPresenter()54     CardPresenter getCardPresenter();
55 
56 
57     /**
58      * Returns the card's {@link View}
59      */
getCardView()60     HomeCardFragment getCardView();
61 
62 }
63