Search in sources :

Example 1 with FileViewFragment

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
    }
}
Also used : FragmentManager(androidx.fragment.app.FragmentManager) FragmentTransaction(androidx.fragment.app.FragmentTransaction) FileViewFragment(com.odysee.app.ui.findcontent.FileViewFragment) HashMap(java.util.HashMap) JSONObject(org.json.JSONObject) SpannableString(android.text.SpannableString) FileViewFragment(com.odysee.app.ui.findcontent.FileViewFragment) DialogFragment(androidx.fragment.app.DialogFragment) SettingsFragment(com.odysee.app.ui.other.SettingsFragment) FollowingFragment(com.odysee.app.ui.findcontent.FollowingFragment) LibraryFragment(com.odysee.app.ui.library.LibraryFragment) ContentScopeDialogFragment(com.odysee.app.dialog.ContentScopeDialogFragment) SearchFragment(com.odysee.app.ui.findcontent.SearchFragment) Fragment(androidx.fragment.app.Fragment) PublishFragment(com.odysee.app.ui.publish.PublishFragment) InvitesFragment(com.odysee.app.ui.wallet.InvitesFragment) PlaylistFragment(com.odysee.app.ui.library.PlaylistFragment) RewardsFragment(com.odysee.app.ui.wallet.RewardsFragment) WalletFragment(com.odysee.app.ui.wallet.WalletFragment) BaseFragment(com.odysee.app.ui.BaseFragment) AddToListsDialogFragment(com.odysee.app.dialog.AddToListsDialogFragment) AllContentFragment(com.odysee.app.ui.findcontent.AllContentFragment) PublishesFragment(com.odysee.app.ui.publish.PublishesFragment) BaseFragment(com.odysee.app.ui.BaseFragment) JSONException(org.json.JSONException) LbryUriException(com.odysee.app.exceptions.LbryUriException) ExecutionException(java.util.concurrent.ExecutionException) SQLiteException(android.database.sqlite.SQLiteException) LbryioRequestException(com.odysee.app.exceptions.LbryioRequestException) LbryioResponseException(com.odysee.app.exceptions.LbryioResponseException) ApiCallException(com.odysee.app.exceptions.ApiCallException) AuthTokenInvalidatedException(com.odysee.app.exceptions.AuthTokenInvalidatedException) ParseException(java.text.ParseException)

Example 2 with FileViewFragment

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;
}
Also used : FileViewFragment(com.odysee.app.ui.findcontent.FileViewFragment) PlayerView(com.google.android.exoplayer2.ui.PlayerView) SearchFragment(com.odysee.app.ui.findcontent.SearchFragment) PlayerView(com.google.android.exoplayer2.ui.PlayerView) RecyclerView(androidx.recyclerview.widget.RecyclerView) ListView(android.widget.ListView) NavigationBarView(com.google.android.material.navigation.NavigationBarView) ImageView(android.widget.ImageView) View(android.view.View) WebView(android.webkit.WebView) BottomNavigationView(com.google.android.material.bottomnavigation.BottomNavigationView) TextView(android.widget.TextView) FileViewFragment(com.odysee.app.ui.findcontent.FileViewFragment) DialogFragment(androidx.fragment.app.DialogFragment) SettingsFragment(com.odysee.app.ui.other.SettingsFragment) FollowingFragment(com.odysee.app.ui.findcontent.FollowingFragment) LibraryFragment(com.odysee.app.ui.library.LibraryFragment) ContentScopeDialogFragment(com.odysee.app.dialog.ContentScopeDialogFragment) SearchFragment(com.odysee.app.ui.findcontent.SearchFragment) Fragment(androidx.fragment.app.Fragment) PublishFragment(com.odysee.app.ui.publish.PublishFragment) InvitesFragment(com.odysee.app.ui.wallet.InvitesFragment) PlaylistFragment(com.odysee.app.ui.library.PlaylistFragment) RewardsFragment(com.odysee.app.ui.wallet.RewardsFragment) WalletFragment(com.odysee.app.ui.wallet.WalletFragment) BaseFragment(com.odysee.app.ui.BaseFragment) AddToListsDialogFragment(com.odysee.app.dialog.AddToListsDialogFragment) AllContentFragment(com.odysee.app.ui.findcontent.AllContentFragment) PublishesFragment(com.odysee.app.ui.publish.PublishesFragment)

Aggregations

DialogFragment (androidx.fragment.app.DialogFragment)2 Fragment (androidx.fragment.app.Fragment)2 AddToListsDialogFragment (com.odysee.app.dialog.AddToListsDialogFragment)2 ContentScopeDialogFragment (com.odysee.app.dialog.ContentScopeDialogFragment)2 BaseFragment (com.odysee.app.ui.BaseFragment)2 AllContentFragment (com.odysee.app.ui.findcontent.AllContentFragment)2 FileViewFragment (com.odysee.app.ui.findcontent.FileViewFragment)2 FollowingFragment (com.odysee.app.ui.findcontent.FollowingFragment)2 SearchFragment (com.odysee.app.ui.findcontent.SearchFragment)2 LibraryFragment (com.odysee.app.ui.library.LibraryFragment)2 PlaylistFragment (com.odysee.app.ui.library.PlaylistFragment)2 SettingsFragment (com.odysee.app.ui.other.SettingsFragment)2 PublishFragment (com.odysee.app.ui.publish.PublishFragment)2 PublishesFragment (com.odysee.app.ui.publish.PublishesFragment)2 InvitesFragment (com.odysee.app.ui.wallet.InvitesFragment)2 RewardsFragment (com.odysee.app.ui.wallet.RewardsFragment)2 WalletFragment (com.odysee.app.ui.wallet.WalletFragment)2 SQLiteException (android.database.sqlite.SQLiteException)1 SpannableString (android.text.SpannableString)1 View (android.view.View)1