use of androidx.fragment.app.FragmentActivity in project android by nextcloud.
the class ActivityInjector method onActivityCreated.
@Override
public final void onActivityCreated(Activity activity, Bundle savedInstanceState) {
if (activity instanceof Injectable) {
AndroidInjection.inject(activity);
}
if (activity instanceof FragmentActivity) {
final FragmentManager fm = ((FragmentActivity) activity).getSupportFragmentManager();
fm.registerFragmentLifecycleCallbacks(new FragmentInjector(), true);
}
}
use of androidx.fragment.app.FragmentActivity in project collect by opendatakit.
the class ServerPreferencesAdderTest method whenAPreferenceHasAnIncorrectType_returnsFalse_andShowsToastError.
@Test
public void whenAPreferenceHasAnIncorrectType_returnsFalse_andShowsToastError() {
FragmentActivity activity = Robolectric.setupActivity(FragmentActivity.class);
PreferenceFragmentCompat fragment = mock(PreferenceFragmentCompat.class);
doThrow(ClassCastException.class).when(fragment).addPreferencesFromResource(R.xml.odk_server_preferences);
when(fragment.getActivity()).thenReturn(activity);
ServerPreferencesAdder loader = new ServerPreferencesAdder(fragment);
boolean result = loader.add();
assertFalse(result);
String toastText = ShadowToast.getTextOfLatestToast();
assertEquals(toastText, getString(R.string.corrupt_imported_preferences_error));
}
use of androidx.fragment.app.FragmentActivity in project EhViewer by seven332.
the class SceneFragment method onDestroyView.
@Override
public void onDestroyView() {
super.onDestroyView();
// Notify
FragmentActivity activity = getActivity();
if (activity instanceof StageActivity) {
((StageActivity) activity).onSceneViewDestroyed(this);
}
}
use of androidx.fragment.app.FragmentActivity in project EhViewer by seven332.
the class SceneFragment method onDestroy.
@Override
public void onDestroy() {
super.onDestroy();
FragmentActivity activity = getActivity();
if (activity instanceof StageActivity) {
((StageActivity) activity).onSceneDestroyed(this);
}
}
use of androidx.fragment.app.FragmentActivity in project iterable-android-sdk by Iterable.
the class IterableInAppHTMLNotificationTest method testDoNotCrashOnResizeAfterDismiss.
@Test
public void testDoNotCrashOnResizeAfterDismiss() {
ActivityController<FragmentActivity> controller = Robolectric.buildActivity(FragmentActivity.class).create().start().resume();
FragmentActivity activity = controller.get();
IterableInAppDisplayer.showIterableFragmentNotificationHTML(activity, "", "", null, 0.0, new Rect(), true, new IterableInAppMessage.InAppBgColor(null, 0.0f), false, IterableInAppLocation.IN_APP);
IterableInAppFragmentHTMLNotification notification = IterableInAppFragmentHTMLNotification.getInstance();
notification.dismiss();
notification.resize(500.0f);
}
Aggregations