Search in sources :

Example 1 with IsMasterView

use of com.example.stackmasterdetailfrag.application.IsMasterView in project simple-stack by Zhuinden.

the class SinglePaneRoot method handleStateChange.

@Override
public void handleStateChange(StateChange stateChange, Callback completionCallback) {
    singlePaneFragmentStateChanger.handleStateChange(stateChange);
    FragmentManager fragmentManager = FragmentManagerService.get(getContext());
    Fragment fragment = fragmentManager.findFragmentById(R.id.fragment_container);
    if (fragment != null && fragment.getView() != null && fragment.getView() instanceof IsMasterView) {
        ((IsMasterView) fragment.getView()).updateSelection(stateChange.<MasterDetailPath>topNewState());
    }
    completionCallback.stateChangeComplete();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Fragment(android.support.v4.app.Fragment) IsMasterView(com.example.stackmasterdetailfrag.application.IsMasterView)

Example 2 with IsMasterView

use of com.example.stackmasterdetailfrag.application.IsMasterView in project simple-stack by Zhuinden.

the class TabletMasterDetailRoot method handleStateChange.

@Override
public void handleStateChange(final StateChange stateChange, StateChanger.Callback callback) {
    masterDetailFragmentStateChanger.handleStateChange(stateChange);
    FragmentManager fragmentManager = FragmentManagerService.get(getContext());
    Fragment fragment = fragmentManager.findFragmentById(R.id.master);
    if (fragment != null && fragment.getView() != null && fragment.getView() instanceof IsMasterView) {
        ((IsMasterView) fragment.getView()).updateSelection(stateChange.<MasterDetailPath>topNewState());
    }
    callback.stateChangeComplete();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) Fragment(android.support.v4.app.Fragment) IsMasterView(com.example.stackmasterdetailfrag.application.IsMasterView)

Aggregations

Fragment (android.support.v4.app.Fragment)2 FragmentManager (android.support.v4.app.FragmentManager)2 IsMasterView (com.example.stackmasterdetailfrag.application.IsMasterView)2