summaryrefslogtreecommitdiff
path: root/library/src/main/java/moe/yuuta/flow/PageFragment.java
blob: dcc9f21af7023a42fa878e25fefa90207657c1b4 (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
package moe.yuuta.flow;

import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;

public abstract class PageFragment extends Fragment {
    private IFlowFragment mHostFragment;

    /**
     * Once mInfo is changed, you should call {@link IFlowFragment#notifyCurrentFlowInfoUpdated()} to publish it.
     * Note: it will be permanently change the recorded info.
     */
    protected FlowInfo mInfo;

    final void setHostFragment(@NonNull IFlowFragment hostFragment) {
        this.mHostFragment = hostFragment;
    }

    @NonNull
    protected final IFlowFragment getHostFragment() {
        return mHostFragment;
    }

    /**
     * @return true: the fragment handled this event and you do not need to call super. false: call super.
     */
    public boolean onBackPressed() {
        return false;
    }
}