Search in sources :

Example 1 with NowPlayingView

use of org.gateshipone.malp.application.views.NowPlayingView in project malp by gateship-one.

the class MainActivity method showAlbumsForPath.

@Override
public void showAlbumsForPath(String path) {
    if (mNowPlayingDragStatus == DRAG_STATUS.DRAGGED_UP) {
        NowPlayingView nowPlayingView = findViewById(R.id.now_playing_layout);
        if (nowPlayingView != null) {
            View coordinatorLayout = findViewById(R.id.main_coordinator_layout);
            coordinatorLayout.setVisibility(View.VISIBLE);
            nowPlayingView.minimize();
        }
    }
    // Create fragment and give it an argument for the selected article
    AlbumsFragment newFragment = new AlbumsFragment();
    Bundle args = new Bundle();
    args.putString(AlbumsFragment.BUNDLE_STRING_EXTRA_PATH, path);
    newFragment.setArguments(args);
    android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    newFragment.setEnterTransition(new Slide(GravityCompat.getAbsoluteGravity(GravityCompat.START, getResources().getConfiguration().getLayoutDirection())));
    newFragment.setExitTransition(new Slide(GravityCompat.getAbsoluteGravity(GravityCompat.END, getResources().getConfiguration().getLayoutDirection())));
    // Replace whatever is in the fragment_container view with this
    // fragment,
    // and add the transaction to the back stack so the user can navigate
    // back
    transaction.replace(R.id.fragment_container, newFragment, AlbumsFragment.TAG);
    transaction.addToBackStack("DirectoryAlbumsFragment");
    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setCheckedItem(R.id.nav_library);
    // Commit the transaction
    transaction.commit();
}
Also used : NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) NavigationView(android.support.design.widget.NavigationView) Slide(android.transition.Slide) Bundle(android.os.Bundle) AlbumsFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CurrentPlaylistView(org.gateshipone.malp.application.views.CurrentPlaylistView) TextView(android.widget.TextView) NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 2 with NowPlayingView

use of org.gateshipone.malp.application.views.NowPlayingView in project malp by gateship-one.

the class MainActivity method onAlbumSelected.

@Override
public void onAlbumSelected(MPDAlbum album, Bitmap bitmap) {
    if (mNowPlayingDragStatus == DRAG_STATUS.DRAGGED_UP) {
        NowPlayingView nowPlayingView = findViewById(R.id.now_playing_layout);
        if (nowPlayingView != null) {
            View coordinatorLayout = findViewById(R.id.main_coordinator_layout);
            coordinatorLayout.setVisibility(View.VISIBLE);
            nowPlayingView.minimize();
        }
    }
    // Create fragment and give it an argument for the selected article
    AlbumTracksFragment newFragment = new AlbumTracksFragment();
    Bundle args = new Bundle();
    args.putParcelable(AlbumTracksFragment.BUNDLE_STRING_EXTRA_ALBUM, album);
    if (bitmap != null) {
        args.putParcelable(AlbumTracksFragment.BUNDLE_STRING_EXTRA_BITMAP, bitmap);
    }
    newFragment.setArguments(args);
    android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    // Replace whatever is in the fragment_container view with this
    // fragment,
    // and add the transaction to the back stack so the user can navigate
    // back
    newFragment.setEnterTransition(new Slide(Gravity.BOTTOM));
    newFragment.setExitTransition(new Slide(Gravity.TOP));
    transaction.replace(R.id.fragment_container, newFragment, AlbumTracksFragment.TAG);
    transaction.addToBackStack("AlbumTracksFragment");
    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setCheckedItem(R.id.nav_library);
    // Commit the transaction
    transaction.commit();
}
Also used : NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) NavigationView(android.support.design.widget.NavigationView) Slide(android.transition.Slide) Bundle(android.os.Bundle) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CurrentPlaylistView(org.gateshipone.malp.application.views.CurrentPlaylistView) TextView(android.widget.TextView) NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) FragmentTransaction(android.support.v4.app.FragmentTransaction) AlbumTracksFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumTracksFragment)

Example 3 with NowPlayingView

use of org.gateshipone.malp.application.views.NowPlayingView in project malp by gateship-one.

the class MainActivity method onResume.

@Override
protected void onResume() {
    super.onResume();
    final NowPlayingView nowPlayingView = findViewById(R.id.now_playing_layout);
    if (nowPlayingView != null) {
        nowPlayingView.registerDragStatusReceiver(this);
        /*
             * Check if the activity got an extra in its intend to show the nowplayingview directly.
             * If yes then pre set the dragoffset of the draggable helper.
             */
        Intent resumeIntent = getIntent();
        if (resumeIntent != null && resumeIntent.getExtras() != null && resumeIntent.getExtras().getString(MAINACTIVITY_INTENT_EXTRA_REQUESTEDVIEW) != null && resumeIntent.getExtras().getString(MAINACTIVITY_INTENT_EXTRA_REQUESTEDVIEW).equals(MAINACTIVITY_INTENT_EXTRA_REQUESTEDVIEW_NOWPLAYINGVIEW)) {
            nowPlayingView.setDragOffset(0.0f);
            getIntent().removeExtra(MAINACTIVITY_INTENT_EXTRA_REQUESTEDVIEW);
        } else {
            // set drag status
            if (mSavedNowPlayingDragStatus == DRAG_STATUS.DRAGGED_UP) {
                nowPlayingView.setDragOffset(0.0f);
            } else if (mSavedNowPlayingDragStatus == DRAG_STATUS.DRAGGED_DOWN) {
                nowPlayingView.setDragOffset(1.0f);
            }
            mSavedNowPlayingDragStatus = null;
            // set view switcher status
            if (mSavedNowPlayingViewSwitcherStatus != null) {
                nowPlayingView.setViewSwitcherStatus(mSavedNowPlayingViewSwitcherStatus);
                mNowPlayingViewSwitcherStatus = mSavedNowPlayingViewSwitcherStatus;
            }
            mSavedNowPlayingViewSwitcherStatus = null;
        }
        nowPlayingView.onResume();
    }
}
Also used : NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) Intent(android.content.Intent)

Example 4 with NowPlayingView

use of org.gateshipone.malp.application.views.NowPlayingView in project malp by gateship-one.

the class MainActivity method onArtistSelected.

@Override
public void onArtistSelected(MPDArtist artist, Bitmap bitmap) {
    if (mNowPlayingDragStatus == DRAG_STATUS.DRAGGED_UP) {
        NowPlayingView nowPlayingView = findViewById(R.id.now_playing_layout);
        if (nowPlayingView != null) {
            View coordinatorLayout = findViewById(R.id.main_coordinator_layout);
            coordinatorLayout.setVisibility(View.VISIBLE);
            nowPlayingView.minimize();
        }
    }
    // Create fragment and give it an argument for the selected article
    AlbumsFragment newFragment = new AlbumsFragment();
    Bundle args = new Bundle();
    args.putString(AlbumsFragment.BUNDLE_STRING_EXTRA_ARTISTNAME, artist.getArtistName());
    args.putParcelable(AlbumsFragment.BUNDLE_STRING_EXTRA_ARTIST, artist);
    // Transfer the bitmap to the next fragment
    if (bitmap != null) {
        args.putParcelable(AlbumsFragment.BUNDLE_STRING_EXTRA_BITMAP, bitmap);
    }
    newFragment.setArguments(args);
    android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    newFragment.setEnterTransition(new Slide(Gravity.BOTTOM));
    newFragment.setExitTransition(new Slide(Gravity.TOP));
    // Replace whatever is in the fragment_container view with this
    // fragment,
    // and add the transaction to the back stack so the user can navigate
    // back
    transaction.replace(R.id.fragment_container, newFragment, AlbumsFragment.TAG);
    transaction.addToBackStack("ArtistAlbumsFragment");
    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setCheckedItem(R.id.nav_library);
    // Commit the transaction
    transaction.commit();
}
Also used : NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) NavigationView(android.support.design.widget.NavigationView) Slide(android.transition.Slide) Bundle(android.os.Bundle) AlbumsFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CurrentPlaylistView(org.gateshipone.malp.application.views.CurrentPlaylistView) TextView(android.widget.TextView) NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 5 with NowPlayingView

use of org.gateshipone.malp.application.views.NowPlayingView in project malp by gateship-one.

the class MainActivity method onNavigationItemSelected.

@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    View coordinatorLayout = findViewById(R.id.main_coordinator_layout);
    coordinatorLayout.setVisibility(View.VISIBLE);
    NowPlayingView nowPlayingView = findViewById(R.id.now_playing_layout);
    if (nowPlayingView != null) {
        nowPlayingView.minimize();
    }
    FragmentManager fragmentManager = getSupportFragmentManager();
    // clear backstack
    fragmentManager.popBackStackImmediate("", FragmentManager.POP_BACK_STACK_INCLUSIVE);
    Fragment fragment = null;
    String fragmentTag = "";
    if (id == R.id.nav_library) {
        // Handle the camera action
        fragment = new MyMusicTabsFragment();
        fragmentTag = MyMusicTabsFragment.TAG;
    } else if (id == R.id.nav_saved_playlists) {
        fragment = new SavedPlaylistsFragment();
        fragmentTag = SavedPlaylistsFragment.TAG;
    } else if (id == R.id.nav_files) {
        fragment = new FilesFragment();
        fragmentTag = FilesFragment.TAG;
        Bundle args = new Bundle();
        args.putString(FilesFragment.EXTRA_FILENAME, "");
    } else if (id == R.id.nav_search) {
        fragment = new SearchFragment();
        fragmentTag = SearchFragment.TAG;
    } else if (id == R.id.nav_profiles) {
        fragment = new ProfilesFragment();
        fragmentTag = ProfilesFragment.TAG;
    } else if (id == R.id.nav_app_settings) {
        fragment = new SettingsFragment();
        fragmentTag = SettingsFragment.TAG;
    } else if (id == R.id.nav_server_properties) {
        fragment = new ServerPropertiesFragment();
        fragmentTag = ServerPropertiesFragment.TAG;
    } else if (id == R.id.nav_information) {
        fragment = new InformationSettingsFragment();
        fragmentTag = InformationSettingsFragment.class.getSimpleName();
    }
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    // Do the actual fragment transaction
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.replace(R.id.fragment_container, fragment, fragmentTag);
    transaction.commit();
    return true;
}
Also used : InformationSettingsFragment(org.gateshipone.malp.application.fragments.InformationSettingsFragment) NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) Bundle(android.os.Bundle) FilesFragment(org.gateshipone.malp.application.fragments.serverfragments.FilesFragment) SearchFragment(org.gateshipone.malp.application.fragments.serverfragments.SearchFragment) ServerPropertiesFragment(org.gateshipone.malp.application.fragments.serverfragments.ServerPropertiesFragment) ProfilesFragment(org.gateshipone.malp.application.fragments.ProfilesFragment) NavigationView(android.support.design.widget.NavigationView) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) CurrentPlaylistView(org.gateshipone.malp.application.views.CurrentPlaylistView) TextView(android.widget.TextView) NowPlayingView(org.gateshipone.malp.application.views.NowPlayingView) AlbumTracksFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumTracksFragment) ArtworkSettingsFragment(org.gateshipone.malp.application.fragments.ArtworkSettingsFragment) ServerPropertiesFragment(org.gateshipone.malp.application.fragments.serverfragments.ServerPropertiesFragment) FilesFragment(org.gateshipone.malp.application.fragments.serverfragments.FilesFragment) ProfilesFragment(org.gateshipone.malp.application.fragments.ProfilesFragment) Fragment(android.support.v4.app.Fragment) ArtistsFragment(org.gateshipone.malp.application.fragments.serverfragments.ArtistsFragment) SettingsFragment(org.gateshipone.malp.application.fragments.SettingsFragment) InformationSettingsFragment(org.gateshipone.malp.application.fragments.InformationSettingsFragment) AlbumsFragment(org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment) SearchFragment(org.gateshipone.malp.application.fragments.serverfragments.SearchFragment) SavedPlaylistsFragment(org.gateshipone.malp.application.fragments.serverfragments.SavedPlaylistsFragment) MyMusicTabsFragment(org.gateshipone.malp.application.fragments.serverfragments.MyMusicTabsFragment) EditProfileFragment(org.gateshipone.malp.application.fragments.EditProfileFragment) PlaylistTracksFragment(org.gateshipone.malp.application.fragments.serverfragments.PlaylistTracksFragment) FragmentManager(android.support.v4.app.FragmentManager) ArtworkSettingsFragment(org.gateshipone.malp.application.fragments.ArtworkSettingsFragment) SettingsFragment(org.gateshipone.malp.application.fragments.SettingsFragment) InformationSettingsFragment(org.gateshipone.malp.application.fragments.InformationSettingsFragment) FragmentTransaction(android.support.v4.app.FragmentTransaction) MyMusicTabsFragment(org.gateshipone.malp.application.fragments.serverfragments.MyMusicTabsFragment) DrawerLayout(android.support.v4.widget.DrawerLayout) SavedPlaylistsFragment(org.gateshipone.malp.application.fragments.serverfragments.SavedPlaylistsFragment)

Aggregations

NowPlayingView (org.gateshipone.malp.application.views.NowPlayingView)7 NavigationView (android.support.design.widget.NavigationView)5 View (android.view.View)5 AdapterView (android.widget.AdapterView)5 ImageView (android.widget.ImageView)5 TextView (android.widget.TextView)5 CurrentPlaylistView (org.gateshipone.malp.application.views.CurrentPlaylistView)5 Bundle (android.os.Bundle)4 FragmentTransaction (android.support.v4.app.FragmentTransaction)4 Slide (android.transition.Slide)3 AlbumsFragment (org.gateshipone.malp.application.fragments.serverfragments.AlbumsFragment)3 FragmentManager (android.support.v4.app.FragmentManager)2 DrawerLayout (android.support.v4.widget.DrawerLayout)2 AlbumTracksFragment (org.gateshipone.malp.application.fragments.serverfragments.AlbumTracksFragment)2 Intent (android.content.Intent)1 Fragment (android.support.v4.app.Fragment)1 ArtworkSettingsFragment (org.gateshipone.malp.application.fragments.ArtworkSettingsFragment)1 EditProfileFragment (org.gateshipone.malp.application.fragments.EditProfileFragment)1 InformationSettingsFragment (org.gateshipone.malp.application.fragments.InformationSettingsFragment)1 ProfilesFragment (org.gateshipone.malp.application.fragments.ProfilesFragment)1