use of com.odysee.app.ui.findcontent.FileViewFragment in project odysee-android by OdyseeTeam.
the class MainActivity method openFragment.
public void openFragment(Class fragmentClass, boolean allowNavigateBack, @Nullable Map<String, Object> params) {
try {
Fragment fragment = (Fragment) fragmentClass.newInstance();
if (fragment instanceof BaseFragment) {
((BaseFragment) fragment).setParams(params);
}
Fragment currentFragment = getCurrentFragment();
if (currentFragment != null && currentFragment.equals(fragment)) {
return;
}
if (currentFragment != null && ((BaseFragment) currentFragment).getParams() != null && ((BaseFragment) currentFragment).getParams().containsKey("source") && ((BaseFragment) currentFragment).getParams().get("source").equals("notification")) {
Map<String, Object> currentParams = new HashMap<>(1);
if (((BaseFragment) currentFragment).getParams().containsKey("url"))
currentParams.put("url", ((BaseFragment) currentFragment).getParams().get("url"));
((BaseFragment) currentFragment).setParams(currentParams);
}
// fragment.setRetainInstance(true);
FragmentManager manager = getSupportFragmentManager();
if (fragment instanceof FileViewFragment || fragment instanceof ChannelFragment)
findViewById(R.id.fragment_container_search).setVisibility(View.GONE);
FragmentTransaction transaction;
if (fragment instanceof FileViewFragment) {
transaction = manager.beginTransaction().replace(R.id.main_activity_other_fragment, fragment, FILE_VIEW_TAG);
} else {
transaction = manager.beginTransaction().replace(R.id.main_activity_other_fragment, fragment);
}
if (allowNavigateBack) {
transaction.addToBackStack(null);
}
getSupportActionBar().setDisplayHomeAsUpEnabled(!(fragment instanceof FileViewFragment) && allowNavigateBack);
transaction.commit();
currentDisplayFragment = fragment;
findViewById(R.id.main_activity_other_fragment).setVisibility(View.VISIBLE);
findViewById(R.id.fragment_container_main_activity).setVisibility(View.GONE);
findViewById(R.id.bottom_navigation).setVisibility(View.GONE);
findViewById(R.id.toolbar_balance_and_tools_layout).setVisibility(View.GONE);
} catch (Exception ex) {
// pass
}
}
use of com.odysee.app.ui.findcontent.FileViewFragment in project odysee-android by OdyseeTeam.
the class MainActivity method renderFullMode.
private void renderFullMode() {
if (!inFullscreenMode) {
showActionBar();
} else {
View v = findViewById(R.id.appbar);
if (v != null) {
v.setFitsSystemWindows(false);
}
}
Fragment fragment = getCurrentFragment();
boolean inMainView = currentDisplayFragment == null;
boolean inFileView = fragment instanceof FileViewFragment;
boolean inChannelView = fragment instanceof ChannelFragment;
boolean inSearchView = fragment instanceof SearchFragment;
findViewById(R.id.main_activity_other_fragment).setVisibility(!inMainView ? View.VISIBLE : View.GONE);
findViewById(R.id.content_main).setVisibility(View.VISIBLE);
findViewById(R.id.fragment_container_main_activity).setVisibility(inMainView ? View.VISIBLE : View.GONE);
if (inMainView) {
showBottomNavigation();
}
findViewById(R.id.appbar).setVisibility(inMainView || inSearchView ? View.VISIBLE : View.GONE);
if (!inFileView && !inFullscreenMode && nowPlayingClaim != null) {
findViewById(R.id.miniplayer).setVisibility(View.VISIBLE);
setPlayerForMiniPlayerView();
}
View pipPlayerContainer = findViewById(R.id.pip_player_container);
PlayerView pipPlayer = findViewById(R.id.pip_player);
pipPlayer.setPlayer(null);
pipPlayerContainer.setVisibility(View.GONE);
playerReassigned = true;
}
Aggregations