use of androidx.fragment.app.Fragment in project wire-android by wireapp.
the class BaseDialogFragment method onAttach.
@Override
public final void onAttach(Activity activity) {
super.onAttach(activity);
Fragment fragment = getParentFragment();
if (fragment != null) {
container = (T) fragment;
} else {
container = (T) activity;
}
onPostAttach(activity);
}
use of androidx.fragment.app.Fragment in project wire-android by wireapp.
the class BaseFragment method onAttach.
@Override
public final void onAttach(Activity activity) {
super.onAttach(activity);
if (activity instanceof ServiceContainer) {
controllerFactory = ((ServiceContainer) activity).getControllerFactory();
}
Fragment fragment = getParentFragment();
if (fragment != null) {
container = (T) fragment;
} else {
container = (T) activity;
}
onPostAttach(activity);
}
use of androidx.fragment.app.Fragment in project android-styled-dialogs by avast.
the class BaseDialogFragment method getDialogListeners.
/**
* Utility method for acquiring all listeners of some type for current instance of DialogFragment
*
* @param listenerInterface Interface of the desired listeners
* @return Unmodifiable list of listeners
* @since 2.1.0
*/
@SuppressWarnings("unchecked")
protected <T> List<T> getDialogListeners(Class<T> listenerInterface) {
final Fragment targetFragment = getTargetFragment();
List<T> listeners = new ArrayList<T>(2);
if (targetFragment != null && listenerInterface.isAssignableFrom(targetFragment.getClass())) {
listeners.add((T) targetFragment);
}
if (getActivity() != null && listenerInterface.isAssignableFrom(getActivity().getClass())) {
listeners.add((T) getActivity());
}
return Collections.unmodifiableList(listeners);
}
use of androidx.fragment.app.Fragment in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothDeviceDetailsFragmentTest method editMenu_clicked_showDialog.
@Test
public void editMenu_clicked_showDialog() {
mFragment.onCreateOptionsMenu(mMenu, mInflater);
final MenuItem item = mMenu.getItem(0);
ArgumentCaptor<Fragment> captor = ArgumentCaptor.forClass(Fragment.class);
mFragment.onOptionsItemSelected(item);
assertThat(item.getItemId()).isEqualTo(BluetoothDeviceDetailsFragment.EDIT_DEVICE_NAME_ITEM_ID);
verify(mFragmentTransaction).add(captor.capture(), eq(RemoteDeviceNameDialogFragment.TAG));
RemoteDeviceNameDialogFragment dialog = (RemoteDeviceNameDialogFragment) captor.getValue();
assertThat(dialog).isNotNull();
}
use of androidx.fragment.app.Fragment in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiSettingsUiTest method launchActivity.
/**
* Launch the activity via an Intent with a String extra.
*/
private void launchActivity(String extraName, String extraValue) {
Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS);
if (extraName != null && extraValue != null) {
intent.putExtra(extraName, extraValue);
}
mActivityRule.launchActivity(intent);
verify(mWifiTracker).getManager();
List<Fragment> fragments = mActivityRule.getActivity().getSupportFragmentManager().getFragments();
assertThat(fragments.size()).isEqualTo(1);
mWifiListener = (WifiSettings) fragments.get(0);
assertThat(mWifiListener).isNotNull();
}
Aggregations