Search in sources :

Example 46 with Fragment

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);
}
Also used : Fragment(androidx.fragment.app.Fragment) DialogFragment(androidx.fragment.app.DialogFragment)

Example 47 with Fragment

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);
}
Also used : ServiceContainer(com.waz.zclient.ServiceContainer) Fragment(androidx.fragment.app.Fragment)

Example 48 with Fragment

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);
}
Also used : ArrayList(java.util.ArrayList) Fragment(androidx.fragment.app.Fragment) DialogFragment(androidx.fragment.app.DialogFragment)

Example 49 with Fragment

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();
}
Also used : MenuItem(android.view.MenuItem) Fragment(androidx.fragment.app.Fragment) Test(org.junit.Test)

Example 50 with Fragment

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();
}
Also used : Intent(android.content.Intent) Fragment(androidx.fragment.app.Fragment)

Aggregations

Fragment (androidx.fragment.app.Fragment)239 FragmentTransaction (androidx.fragment.app.FragmentTransaction)54 Bundle (android.os.Bundle)46 FragmentManager (androidx.fragment.app.FragmentManager)38 FileFragment (com.owncloud.android.ui.fragment.FileFragment)23 DialogFragment (androidx.fragment.app.DialogFragment)22 View (android.view.View)21 FileDetailFragment (com.owncloud.android.ui.fragment.FileDetailFragment)20 OCFileListFragment (com.owncloud.android.ui.fragment.OCFileListFragment)20 Intent (android.content.Intent)19 SortingOrderDialogFragment (com.owncloud.android.ui.dialog.SortingOrderDialogFragment)19 GalleryFragment (com.owncloud.android.ui.fragment.GalleryFragment)18 TaskRetainerFragment (com.owncloud.android.ui.fragment.TaskRetainerFragment)18 UnifiedSearchFragment (com.owncloud.android.ui.fragment.UnifiedSearchFragment)18 PreviewImageFragment (com.owncloud.android.ui.preview.PreviewImageFragment)18 PreviewMediaFragment (com.owncloud.android.ui.preview.PreviewMediaFragment)18 PreviewTextFileFragment (com.owncloud.android.ui.preview.PreviewTextFileFragment)18 PreviewTextFragment (com.owncloud.android.ui.preview.PreviewTextFragment)18 PreviewTextStringFragment (com.owncloud.android.ui.preview.PreviewTextStringFragment)18 PreviewPdfFragment (com.owncloud.android.ui.preview.pdf.PreviewPdfFragment)18