Home | History | Annotate | Download | only in deskclock
      1 package com.android.deskclock;
      2 
      3 import android.support.annotation.NonNull;
      4 import android.view.View;
      5 import android.widget.Button;
      6 import android.widget.ImageView;
      7 
      8 /**
      9  * Implementers of this interface are able to {@link #onUpdateFab configure the fab} and associated
     10  * {@link #onUpdateFabButtons left/right buttons} including setting them {@link View#INVISIBLE} if
     11  * they are unnecessary. Implementers also attach click handler logic to the
     12  * {@link #onFabClick fab}, {@link #onLeftButtonClick left button} and
     13  * {@link #onRightButtonClick right button}.
     14  */
     15 public interface FabController {
     16 
     17     /**
     18      * Configures the display of the fab component to match the current state of this controller.
     19      *
     20      * @param fab the fab component to be configured based on current state
     21      */
     22     void onUpdateFab(@NonNull ImageView fab);
     23 
     24     /**
     25      * Called before onUpdateFab when the fab should be animated.
     26      *
     27      * @param fab the fab component to be configured based on current state
     28      */
     29     void onMorphFab(@NonNull ImageView fab);
     30 
     31     /**
     32      * Configures the display of the buttons to the left and right of the fab to match the current
     33      * state of this controller.
     34      *
     35      * @param left button to the left of the fab to configure based on current state
     36      * @param right button to the right of the fab to configure based on current state
     37      */
     38     void onUpdateFabButtons(@NonNull Button left, @NonNull Button right);
     39 
     40     /**
     41      * Handles a click on the fab.
     42      *
     43      * @param fab the fab component on which the click occurred
     44      */
     45     void onFabClick(@NonNull ImageView fab);
     46 
     47     /**
     48      * Handles a click on the button to the left of the fab component.
     49      *
     50      * @param left the button to the left of the fab component
     51      */
     52     void onLeftButtonClick(@NonNull Button left);
     53 
     54     /**
     55      * Handles a click on the button to the right of the fab component.
     56      *
     57      * @param right the button to the right of the fab component
     58      */
     59     void onRightButtonClick(@NonNull Button right);
     60 }