use of android.support.v4.app.FragmentActivity in project Android-ObservableScrollView by ksoichiro.
the class FragmentTransitionDefaultFragment method showNextFragment.
private void showNextFragment() {
FragmentActivity activity = getActivity();
if (activity == null) {
return;
}
FragmentManager fm = activity.getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.replace(R.id.fragment, new FragmentTransitionSecondFragment(), FragmentTransitionSecondFragment.FRAGMENT_TAG);
ft.addToBackStack(null);
ft.commit();
fm.executePendingTransactions();
}
use of android.support.v4.app.FragmentActivity in project photo-picker-plus-android by chute.
the class FragmentUtil method replaceContentWithSingleFragment.
public static void replaceContentWithSingleFragment(FragmentActivity activity, AccountModel account, String folderId, List<Integer> selectedItemPositions) {
FragmentTransaction fragmentTransaction = activity.getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.gcFragments, FragmentSingle.newInstance(account, folderId, selectedItemPositions), TAG_FRAGMENT_FILES);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}
use of android.support.v4.app.FragmentActivity in project photo-picker-plus-android by chute.
the class FragmentUtil method replaceContentWithRootFragment.
public static void replaceContentWithRootFragment(FragmentActivity activity, AccountModel account, PhotoFilterType filterType, List<Integer> accountItemPositions, List<Integer> imageItemPositions, List<Integer> videoItemPositions) {
FragmentTransaction fragmentTransaction = activity.getSupportFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.gcFragments, FragmentRoot.newInstance(account, filterType, accountItemPositions, imageItemPositions, videoItemPositions), TAG_FRAGMENT_FOLDER);
fragmentTransaction.commit();
}
use of android.support.v4.app.FragmentActivity in project android-UniversalMusicPlayer by googlesamples.
the class MediaIDHelper method isMediaItemPlaying.
/**
* Determine if media item is playing (matches the currently playing media item).
*
* @param context for retrieving the {@link MediaControllerCompat}
* @param mediaItem to compare to currently playing {@link MediaBrowserCompat.MediaItem}
* @return boolean indicating whether media item matches currently playing media item
*/
public static boolean isMediaItemPlaying(Context context, MediaBrowserCompat.MediaItem mediaItem) {
// Media item is considered to be playing or paused based on the controller's current
// media id
MediaControllerCompat controller = ((FragmentActivity) context).getSupportMediaController();
if (controller != null && controller.getMetadata() != null) {
String currentPlayingMediaId = controller.getMetadata().getDescription().getMediaId();
String itemMusicId = MediaIDHelper.extractMusicIDFromMediaID(mediaItem.getDescription().getMediaId());
if (currentPlayingMediaId != null && TextUtils.equals(currentPlayingMediaId, itemMusicId)) {
return true;
}
}
return false;
}
use of android.support.v4.app.FragmentActivity in project android-UniversalMusicPlayer by googlesamples.
the class QueueHelper method isQueueItemPlaying.
/**
* Determine if queue item matches the currently playing queue item
*
* @param context for retrieving the {@link MediaControllerCompat}
* @param queueItem to compare to currently playing {@link MediaSessionCompat.QueueItem}
* @return boolean indicating whether queue item matches currently playing queue item
*/
public static boolean isQueueItemPlaying(Context context, MediaSessionCompat.QueueItem queueItem) {
// Queue item is considered to be playing or paused based on both the controller's
// current media id and the controller's active queue item id
MediaControllerCompat controller = ((FragmentActivity) context).getSupportMediaController();
if (controller != null && controller.getPlaybackState() != null) {
long currentPlayingQueueId = controller.getPlaybackState().getActiveQueueItemId();
String currentPlayingMediaId = controller.getMetadata().getDescription().getMediaId();
String itemMusicId = MediaIDHelper.extractMusicIDFromMediaID(queueItem.getDescription().getMediaId());
if (queueItem.getQueueId() == currentPlayingQueueId && currentPlayingMediaId != null && TextUtils.equals(currentPlayingMediaId, itemMusicId)) {
return true;
}
}
return false;
}
Aggregations