ncapdevi / FragNav

An Android library for managing multiple stacks of fragments
1.5k stars 220 forks source link

How to use setNavigationStrategy in java? #185

Closed webserveis closed 5 years ago

webserveis commented 5 years ago

I need to try change navigation strategy, I use java 8

    fragNavController = new FragNavController(getSupportFragmentManager(), R.id.container);
    fragNavController.setRootFragments(fragments);

    fragNavController.setNavigationStrategy(???);
    fragNavController.initialize(MyConstants.INDEX_HOME, savedInstanceState);
Ustimov commented 5 years ago

Something like this:

fragNavController.setNavigationStrategy(new UniqueTabHistoryStrategy(
  new FragNavSwitchController()  {
    @Override
    void switchTab(int index, FragNavTransactionOptions transactionOptions) {
      // TODO: some navigate action
    }
  )
);