summaryrefslogtreecommitdiff
path: root/src/com/android/deskclock/FabController.java
blob: 8a121bf87efdf2dcdbc5b80fcf8820c403be06b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.android.deskclock;

import androidx.annotation.NonNull;
import android.view.View;
import android.widget.ImageView;

/**
 * Implementers of this interface are able to {@link #onUpdateFab configure the fab} and associated
 * {@link #onUpdateFabButtons left/right buttons} including setting them {@link View#INVISIBLE} if
 * they are unnecessary. Implementers also attach click handler logic to the
 * {@link #onFabClick fab}, {@link #onLeftButtonClick left button} and
 * {@link #onRightButtonClick right button}.
 */
public interface FabController {

    /**
     * Configures the display of the fab component to match the current state of this controller.
     *
     * @param fab the fab component to be configured based on current state
     */
    void onUpdateFab(@NonNull ImageView fab);

    /**
     * Called before onUpdateFab when the fab should be animated.
     *
     * @param fab the fab component to be configured based on current state
     */
    void onMorphFab(@NonNull ImageView fab);

    /**
     * Configures the display of the buttons to the left and right of the fab to match the current
     * state of this controller.
     *
     * @param left button to the left of the fab to configure based on current state
     * @param right button to the right of the fab to configure based on current state
     */
    void onUpdateFabButtons(@NonNull ImageView left, @NonNull ImageView right);

    /**
     * Handles a click on the fab.
     *
     * @param fab the fab component on which the click occurred
     */
    void onFabClick(@NonNull ImageView fab);

    /**
     * Handles a click on the button to the left of the fab component.
     *
     * @param left the button to the left of the fab component
     */
    void onLeftButtonClick(@NonNull ImageView left);

    /**
     * Handles a click on the button to the right of the fab component.
     *
     * @param right the button to the right of the fab component
     */
    void onRightButtonClick(@NonNull ImageView right);

    /**
     *
     * @return the target visibility of the FAB component
     */
    int getFabTargetVisibility();
}