use of android.app.Fragment in project platform_frameworks_base by android.
the class PrintActivity method ensureProgressUiShown.
private void ensureProgressUiShown() {
if (isFinishing() || isDestroyed()) {
return;
}
if (mUiState != UI_STATE_PROGRESS) {
mUiState = UI_STATE_PROGRESS;
mPrintPreviewController.setUiShown(false);
Fragment fragment = PrintProgressFragment.newInstance();
showFragment(fragment);
}
}
use of android.app.Fragment in project platform_frameworks_base by android.
the class PrintActivity method ensureErrorUiShown.
private void ensureErrorUiShown(CharSequence message, int action) {
if (isFinishing() || isDestroyed()) {
return;
}
if (mUiState != UI_STATE_ERROR) {
mUiState = UI_STATE_ERROR;
mPrintPreviewController.setUiShown(false);
Fragment fragment = PrintErrorFragment.newInstance(message, action);
showFragment(fragment);
}
}
use of android.app.Fragment in project platform_frameworks_base by android.
the class SharedLibraryMain method ensureVersion.
/**
* Check that the library's version is at least the given minimum version,
* displaying a dialog to have the user install an update if that is not true.
* The dialog is displayed as a DialogFragment in your activity if a newer
* version is needed. If a newer version is needed, false is returned.
*/
public static boolean ensureVersion(final Activity activity, int minVersion) {
final FragmentManager fm = activity.getFragmentManager();
final String dialogTag = LIBRARY_PACKAGE + ":version";
Fragment curDialog = fm.findFragmentByTag(dialogTag);
if (getVersion(activity) >= minVersion) {
// we had shown is removed before returning.
if (curDialog != null) {
fm.beginTransaction().remove(curDialog).commitAllowingStateLoss();
}
return true;
}
// If we don't already have a version dialog displayed, display it now.
if (curDialog == null) {
curDialog = new VersionDialog();
fm.beginTransaction().add(curDialog, dialogTag).commitAllowingStateLoss();
}
// Tell the caller that the current version is not sufficient.
return false;
}
use of android.app.Fragment in project platform_frameworks_base by android.
the class BiDiTestActivity method onListItemClick.
private void onListItemClick(ListView lv, View v, int position, long id) {
// Show the test
Map<String, Object> map = (Map<String, Object>) lv.getItemAtPosition(position);
int fragmentId = (Integer) map.get(KEY_FRAGMENT_ID);
Fragment fragment = getFragmentManager().findFragmentById(fragmentId);
if (fragment == null) {
try {
// Create an instance of the test
Class<? extends Fragment> clazz = (Class<? extends Fragment>) map.get(KEY_CLASS);
fragment = clazz.newInstance();
// Replace the old test fragment with the new one
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.testframe, fragment);
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
ft.commit();
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
}
}
}
use of android.app.Fragment in project Android-CleanArchitecture by android10.
the class UserListActivityTest method testContainsUserListFragment.
public void testContainsUserListFragment() {
Fragment userListFragment = userListActivity.getFragmentManager().findFragmentById(R.id.fragmentContainer);
assertThat(userListFragment, is(notNullValue()));
}
Aggregations