Search in sources :

Example 61 with FragmentActivity

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();
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 62 with FragmentActivity

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();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 63 with FragmentActivity

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();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction)

Example 64 with FragmentActivity

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;
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) MediaControllerCompat(android.support.v4.media.session.MediaControllerCompat)

Example 65 with FragmentActivity

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;
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) MediaControllerCompat(android.support.v4.media.session.MediaControllerCompat)

Aggregations

FragmentActivity (android.support.v4.app.FragmentActivity)84 FragmentTransaction (android.app.FragmentTransaction)16 FragmentManager (android.support.v4.app.FragmentManager)16 FragmentTransaction (android.support.v4.app.FragmentTransaction)16 Fragment (android.support.v4.app.Fragment)11 Intent (android.content.Intent)6 Bundle (android.os.Bundle)5 View (android.view.View)4 DialogFragment (android.support.v4.app.DialogFragment)3 MediaControllerCompat (android.support.v4.media.session.MediaControllerCompat)3 SearchView (android.widget.SearchView)3 TextView (android.widget.TextView)3 Fragment (android.app.Fragment)2 ActionBar (android.support.v7.app.ActionBar)2 AppCompatActivity (android.support.v7.app.AppCompatActivity)2 MediaRouteDialogFactory (android.support.v7.app.MediaRouteDialogFactory)2 RecyclerView (android.support.v7.widget.RecyclerView)2 InjectView (butterknife.InjectView)2 RequestManager (com.bumptech.glide.RequestManager)2 FacebookException (com.facebook.FacebookException)2