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();
}
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();
}
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();
}
}
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();
}
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;
}
Aggregations