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