Search in sources :

Example 96 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project AndroidChromium by JackyAndroid.

the class RemoteMediaPlayerController method showMediaRouteDialog.

private void showMediaRouteDialog(MediaStateListener player, MediaRouteController controller, Activity activity) {
    FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
    if (fm == null) {
        throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
    }
    MediaRouteDialogFactory factory = new MediaRouteChooserDialogFactory(player, controller, activity);
    if (fm.findFragmentByTag("android.support.v7.mediarouter:MediaRouteChooserDialogFragment") != null) {
        Log.w(TAG, "showDialog(): Route chooser dialog already showing!");
        return;
    }
    MediaRouteChooserDialogFragment f = factory.onCreateChooserDialogFragment();
    f.setRouteSelector(controller.buildMediaRouteSelector());
    f.show(fm, "android.support.v7.mediarouter:MediaRouteChooserDialogFragment");
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) MediaRouteDialogFactory(android.support.v7.app.MediaRouteDialogFactory) FragmentActivity(android.support.v4.app.FragmentActivity) MediaRouteChooserDialogFragment(android.support.v7.app.MediaRouteChooserDialogFragment)

Example 97 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project AndroidChromium by JackyAndroid.

the class InvalidStartupDialog method show.

/**
     * Shows the invalid startup dialog for a given error code.
     *
     * @param activity The activity showing the dialog.
     * @param errorCode The error code that triggered the failure.
     */
@SuppressFBWarnings("DM_EXIT")
public static void show(Activity activity, int errorCode) {
    int msg;
    switch(errorCode) {
        case LoaderErrors.LOADER_ERROR_NATIVE_LIBRARY_LOAD_FAILED:
            msg = R.string.os_version_missing_features;
            break;
        case LoaderErrors.LOADER_ERROR_NATIVE_LIBRARY_WRONG_VERSION:
            msg = R.string.incompatible_libraries;
            break;
        default:
            msg = R.string.native_startup_failed;
    }
    final String message = activity.getResources().getString(msg);
    if (!(activity instanceof FragmentActivity)) {
        Log.e(TAG, "Unable to start chrome due to: " + msg);
        System.exit(-1);
        return;
    }
    Bundle dialogArgs = new Bundle();
    dialogArgs.putString(MESSAGE_KEY, message);
    InvalidStartupDialog dialog = new InvalidStartupDialog();
    dialog.setArguments(dialogArgs);
    dialog.show(((FragmentActivity) activity).getSupportFragmentManager(), "InvalidStartupDialog");
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) Bundle(android.os.Bundle) SuppressFBWarnings(org.chromium.base.annotations.SuppressFBWarnings)

Example 98 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project AndroidChromium by JackyAndroid.

the class RemoteMediaPlayerController method showMediaRouteControlDialog.

private void showMediaRouteControlDialog(Activity activity) {
    FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
    if (fm == null) {
        throw new IllegalStateException("The activity must be a subclass of FragmentActivity");
    }
    MediaRouteDialogFactory factory = new MediaRouteControllerDialogFactory();
    if (fm.findFragmentByTag("android.support.v7.mediarouter:MediaRouteControllerDialogFragment") != null) {
        Log.w(TAG, "showDialog(): Route controller dialog already showing!");
        return;
    }
    MediaRouteControllerDialogFragment f = factory.onCreateControllerDialogFragment();
    f.show(fm, "android.support.v7.mediarouter:MediaRouteControllerDialogFragment");
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) MediaRouteDialogFactory(android.support.v7.app.MediaRouteDialogFactory) FragmentActivity(android.support.v4.app.FragmentActivity) MediaRouteControllerDialogFragment(android.support.v7.app.MediaRouteControllerDialogFragment)

Example 99 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project AndroidChromium by JackyAndroid.

the class BaseMediaRouteDialogManager method openDialog.

@Override
public void openDialog() {
    if (mAndroidMediaRouter == null) {
        mDelegate.onDialogCancelled();
        return;
    }
    FragmentActivity currentActivity = (FragmentActivity) ApplicationStatus.getLastTrackedFocusedActivity();
    if (currentActivity == null) {
        mDelegate.onDialogCancelled();
        return;
    }
    FragmentManager fm = currentActivity.getSupportFragmentManager();
    if (fm == null) {
        mDelegate.onDialogCancelled();
        return;
    }
    mDialogFragment = openDialogInternal(fm);
    if (mDialogFragment == null) {
        mDelegate.onDialogCancelled();
        return;
    }
}
Also used : FragmentManager(android.support.v4.app.FragmentManager) FragmentActivity(android.support.v4.app.FragmentActivity)

Example 100 with FragmentActivity

use of android.support.v4.app.FragmentActivity in project ActionBarSherlock by JakeWharton.

the class ActionBarImpl method selectTab.

@Override
public void selectTab(Tab tab) {
    if (getNavigationMode() != NAVIGATION_MODE_TABS) {
        mSavedTabPosition = tab != null ? tab.getPosition() : INVALID_POSITION;
        return;
    }
    FragmentTransaction trans = null;
    if (mActivity instanceof FragmentActivity) {
        trans = ((FragmentActivity) mActivity).getSupportFragmentManager().beginTransaction().disallowAddToBackStack();
    }
    if (mSelectedTab == tab) {
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabReselected(mSelectedTab, trans);
            mTabScrollView.animateToTab(tab.getPosition());
        }
    } else {
        mTabScrollView.setTabSelected(tab != null ? tab.getPosition() : Tab.INVALID_POSITION);
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabUnselected(mSelectedTab, trans);
        }
        mSelectedTab = (TabImpl) tab;
        if (mSelectedTab != null) {
            mSelectedTab.getCallback().onTabSelected(mSelectedTab, trans);
        }
    }
    if (trans != null && !trans.isEmpty()) {
        trans.commit();
    }
}
Also used : FragmentActivity(android.support.v4.app.FragmentActivity) FragmentTransaction(android.support.v4.app.FragmentTransaction)

Aggregations

FragmentActivity (android.support.v4.app.FragmentActivity)91 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 MediaControllerCompat (android.support.v4.media.session.MediaControllerCompat)11 Intent (android.content.Intent)7 Bundle (android.os.Bundle)5 View (android.view.View)5 TextView (android.widget.TextView)4 DialogFragment (android.support.v4.app.DialogFragment)3 SearchView (android.widget.SearchView)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 ImageView (android.widget.ImageView)2 InjectView (butterknife.InjectView)2 RequestManager (com.bumptech.glide.RequestManager)2