Home | History | Annotate | Download | only in items
      1 /*
      2  * Copyright (C) 2015 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.setupwizardlib.items;
     18 
     19 import android.view.View;
     20 
     21 /**
     22  * Representation of an item in an {@link ItemHierarchy}.
     23  */
     24 public interface IItem {
     25 
     26     /**
     27      * Get the Android resource ID for locating the layout for this item.
     28      *
     29      * @return Resource ID for the layout of this item. This layout will be used to inflate the View
     30      *         passed to {@link #onBindView(android.view.View)}.
     31      */
     32     int getLayoutResource();
     33 
     34     /**
     35      * Called by items framework to display the data specified by this item. This method should
     36      * update {@code view} to reflect its data.
     37      *
     38      * @param view A view inflated from {@link #getLayoutResource()}, which should be updated to
     39      *             display data from this item. This view may be recycled from other items with the
     40      *             same layout resource.
     41      */
     42     void onBindView(View view);
     43 
     44     /**
     45      * @return True if this item is enabled.
     46      */
     47     boolean isEnabled();
     48 }
     49