androidx.fragment.app.FragmentManager Java Examples

The following examples show how to use androidx.fragment.app.FragmentManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: googleads-mobile-android-examples   Author: googleads   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onNavigationDrawerItemSelected(int position) {
    // update the main content by replacing fragments
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction trans = fragmentManager.beginTransaction();

    switch (position) {
        case 0: trans.replace(R.id.container, new AdMobAdListenerFragment()); break;
        case 1: trans.replace(R.id.container, new AdMobAdTargetingFragment()); break;
        case 2: trans.replace(R.id.container, new AdMobBannerSizesFragment()); break;
        case 3: trans.replace(R.id.container, new AdMobCustomMuteThisAdFragment()); break;
        case 4: trans.replace(R.id.container, new DFPFluidSizeFragment()); break;
        case 5: trans.replace(R.id.container, new DFPPPIDFragment()); break;
        case 6: trans.replace(R.id.container, new DFPCustomTargetingFragment()); break;
        case 7: trans.replace(R.id.container, new DFPCategoryExclusionFragment()); break;
        case 8: trans.replace(R.id.container, new DFPMultipleAdSizesFragment()); break;
        case 9: trans.replace(R.id.container, new DFPAppEventsFragment()); break;
        case 10: trans.replace(R.id.container, new DFPCustomControlsFragment()); break;
    }

    trans.commit();
}
 
Example #2
Source Project: Applozic-Android-SDK   Author: AppLozic   File: ConversationActivity.java    License: BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void showAudioRecordingDialog() {

        if (Utils.hasMarshmallow() && PermissionsUtils.checkSelfPermissionForAudioRecording(this)) {
            new ApplozicPermissions(this, layout).requestAudio();
        } else if (PermissionsUtils.isAudioRecordingPermissionGranted(this)) {

            FragmentManager supportFragmentManager = getSupportFragmentManager();
            DialogFragment fragment = AudioMessageFragment.newInstance();

            FragmentTransaction fragmentTransaction = supportFragmentManager
                    .beginTransaction().add(fragment, "AudioMessageFragment");

            fragmentTransaction.addToBackStack(null);
            fragmentTransaction.commitAllowingStateLoss();
        } else {

            if (alCustomizationSettings.getAudioPermissionNotFoundMsg() == null) {
                showSnackBar(R.string.applozic_audio_permission_missing);
            } else {
                snackbar = Snackbar.make(layout, alCustomizationSettings.getAudioPermissionNotFoundMsg(),
                        Snackbar.LENGTH_SHORT);
                snackbar.show();
            }

        }
    }
 
Example #3
Source Project: hipda   Author: GreenSkinMonster   File: SimpleListActivity.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void showFragment() {
    FragmentManager fragmentManager = getSupportFragmentManager();
    Bundle arguments = getIntent().getExtras();

    BaseFragment fragment;
    if (arguments.getInt(SimpleListFragment.ARG_TYPE) == SimpleListJob.TYPE_SEARCH) {
        fragment = new SearchFragment();
    } else {
        updateAppBarScrollFlag();
        fragment = new SimpleListFragment();
    }

    fragment.setArguments(arguments);
    fragmentManager.beginTransaction()
            .replace(R.id.main_frame_container, fragment).commit();
}
 
Example #4
Source Project: AndroidNavigation   Author: listenzz   File: FragmentHelper.java    License: MIT License 6 votes vote down vote up
public static void handleDismissFragment(@NonNull AwesomeFragment target, @NonNull AwesomeFragment presented, @Nullable AwesomeFragment top) {
    FragmentManager fragmentManager = target.requireFragmentManager();
    target.setAnimation(PresentAnimation.Modal);

    if (top == null) {
        top = (AwesomeFragment) fragmentManager.findFragmentById(target.getContainerId());
    }

    if (top == null) {
        return;
    }

    top.setAnimation(PresentAnimation.Modal);
    fragmentManager.beginTransaction().setMaxLifecycle(presented, Lifecycle.State.STARTED).commit();
    fragmentManager.popBackStack(presented.getSceneId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
    FragmentHelper.executePendingTransactionsSafe(fragmentManager);
    target.onFragmentResult(top.getRequestCode(), top.getResultCode(), top.getResultData());
}
 
Example #5
Source Project: HaoReader   Author: Invinciblelee   File: MainBookListFragment.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
    if (savedInstanceState != null) {
        FragmentManager manager = getChildFragmentManager();
        fragments[0] = (BookListFragment) manager.findFragmentByTag(getString(BOOK_GROUPS[0]));
        fragments[1] = (BookListFragment) manager.findFragmentByTag(getString(BOOK_GROUPS[1]));
        fragments[2] = (BookListFragment) manager.findFragmentByTag(getString(BOOK_GROUPS[2]));
        fragments[3] = (BookListFragment) manager.findFragmentByTag(getString(BOOK_GROUPS[3]));

        for (Fragment fragment : fragments) {
            if (fragment instanceof BookListFragment) {
                ((BookListFragment) fragment).setItemClickListenerTwo(getAdapterListener());
            }
        }
    } else {
        showFragment(this.group);
    }

}
 
Example #6
Source Project: ColorPickerDialog   Author: fennifith   File: ImagePickerView.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void onRestoreInstanceState(Parcelable state) {
    super.onRestoreInstanceState(state);

    new Handler(Looper.getMainLooper()).post(new Runnable() {
        @Override
        public void run() {
            FragmentManager manager = requestFragmentManager();
            if (manager != null) {
                Fragment fragment = manager.findFragmentByTag(TAG_CHILD_IMAGE_PICKER);
                if (fragment instanceof ImageColorPickerDialog)
                    ((ImageColorPickerDialog) fragment).withListener(listener);
            }
        }
    });
}
 
Example #7
Source Project: DeviceConnect-Android   Author: DeviceConnect   File: IRKitSettingActivity.java    License: MIT License 6 votes vote down vote up
/**
 * getFragments()とgetViewPager().getCurrentItem()の紐付けを行う。
 * 表示していたFragmentを返す。
 * @return 表示していたFragment
 */
private Fragment getCurrentFragment(final int current) {
    FragmentManager fm = getSupportFragmentManager();
    Fragment f = null;
    List<Fragment> list = fm.getFragments();

    if (list.size() == 0) {
        return f;
    }

    String className = PAGES[current].getSimpleName();
    for (Fragment fragment : list) {
        if (fragment.getClass().getSimpleName().equals(className)) {
            f = fragment;
        }
    }
    return f;
}
 
Example #8
Source Project: material-components-android   Author: material-components   File: MaterialDatePickerPagesTest.java    License: Apache License 2.0 6 votes vote down vote up
@Before
public void setupDatePickerDialogForSwiping() {
  CalendarConstraints calendarConstraints =
      new CalendarConstraints.Builder()
          .setStart(START.timeInMillis)
          .setEnd(END.timeInMillis)
          .setOpenAt(OPEN_AT.timeInMillis)
          .build();
  FragmentManager fragmentManager = activityTestRule.getActivity().getSupportFragmentManager();
  String tag = "Date DialogFragment";

  dialogFragment =
      MaterialDatePicker.Builder.datePicker().setCalendarConstraints(calendarConstraints).build();
  dialogFragment.show(fragmentManager, tag);
  InstrumentationRegistry.getInstrumentation().waitForIdleSync();
  IdlingRegistry.getInstance()
      .register(
          new RecyclerIdlingResource(
              dialogFragment.getView().findViewWithTag(MaterialCalendar.MONTHS_VIEW_GROUP_TAG)));
  listenerIdlingResource = new ListenerIdlingResource();
}
 
Example #9
Source Project: Passbook   Author: zhuqianqian   File: MainActivity.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onBackPressed() {
    setStatusBarColor(0, 0, true);
    Fragment edit = getSupportFragmentManager().findFragmentByTag("edit");
    if(edit != null) {
        getSupportFragmentManager().popBackStack("edit",
                FragmentManager.POP_BACK_STACK_INCLUSIVE);
        mAds.setVisibility(View.VISIBLE);
        return;
    }
    Fragment detail = getSupportFragmentManager().findFragmentByTag("detail");
    if(detail!=null) {
        getSupportFragmentManager().popBackStack("detail",
                FragmentManager.POP_BACK_STACK_INCLUSIVE);
        return;
    }
    super.onBackPressed();
}
 
Example #10
Source Project: SendBird-Android   Author: sendbird   File: OpenChannelActivity.java    License: MIT License 6 votes vote down vote up
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_open_channel);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_open_channel);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_arrow_left_white_24_dp);
    }

    if (savedInstanceState == null) {
        // Load list of Open Channels
        Fragment fragment = OpenChannelListFragment.newInstance();

        FragmentManager manager = getSupportFragmentManager();
        manager.popBackStack();

        manager.beginTransaction()
                .replace(R.id.container_open_channel, fragment)
                .commit();
    }
}
 
Example #11
Source Project: tindroid   Author: tinode   File: ImageLoader.java    License: Apache License 2.0 6 votes vote down vote up
ImageLoader(int imageSize, FragmentManager fm) {
    // mResources = context.getResources();
    mImageSize = imageSize > 0 ? imageSize : DEFAULT_IMAGE_SIZE;

    final RetainFragment retainFragment = findOrCreateRetainFragment(fm);
    // See if we already have an ImageCache stored in RetainFragment
    //noinspection unchecked
    mBitmapCache = (LruCache<String, Bitmap>) retainFragment.getObject();
    // No existing ImageCache, create one and store it in RetainFragment
    if (mBitmapCache == null) {
        int maxSize = Math.round(MEMORY_PERCENT * Runtime.getRuntime().maxMemory() / 1024);
        mBitmapCache = new LruCache<String, Bitmap>(maxSize) {
            /**
             * Measure item size in kilobytes rather than units which is more practical
             * for a bitmap cache
             */
            @Override
            protected int sizeOf(@NonNull String key, @NonNull Bitmap bitmap) {
                final int bitmapSize = bitmap.getByteCount() / 1024;
                return bitmapSize == 0 ? 1 : bitmapSize;
            }
        };
        retainFragment.saveObject(mBitmapCache);
    }
}
 
Example #12
Source Project: CommonUtils   Author: devgianlu   File: AskPermission.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    if (listener != null && code == requestCode) {
        for (int i = 0; i < permissions.length; i++) {
            if (grantResults[i] == PackageManager.PERMISSION_GRANTED)
                listener.permissionGranted(permissions[i]);
            else
                listener.permissionDenied(permissions[i]);
        }
    }

    try {
        if (getActivity() != null) {
            FragmentManager manager = getActivity().getSupportFragmentManager();
            manager.executePendingTransactions();
            manager.beginTransaction()
                    .remove(this)
                    .commitAllowingStateLoss();
        }
    } catch (IllegalStateException ex) {
        Log.w(TAG, ex);
    }
}
 
Example #13
Source Project: commcare-android   Author: dimagi   File: CommCareSetupActivity.java    License: Apache License 2.0 5 votes vote down vote up
private void persistCommCareAppState() {
    FragmentManager fm = this.getSupportFragmentManager();

    containerFragment = (ContainerFragment<CommCareApp>)fm.findFragmentByTag("cc-app");

    if (containerFragment == null) {
        containerFragment = new ContainerFragment<>();
        fm.beginTransaction().add(containerFragment, "cc-app").commit();
    } else {
        ccApp = containerFragment.getData();
    }
}
 
Example #14
Source Project: Bluefruit_LE_Connect_Android_V2   Author: adafruit   File: MainActivity.java    License: MIT License 5 votes vote down vote up
private void popFragmentsIfNoPeripheralsConnected() {
    final int numConnectedPeripherals = BleManager.getInstance().getConnectedDevices().size();
    final boolean isLastConnectedPeripheral = numConnectedPeripherals == 0;

    if (isLastConnectedPeripheral && (!kAvoidPoppingFragmentsWhileOnDfu || !isIsDfuInProgress())) {
        Log.d(TAG, "No peripherals connected. Pop all fragments");
        FragmentManager fragmentManager = getSupportFragmentManager();
        fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
        fragmentManager.executePendingTransactions();
    }
}
 
Example #15
Source Project: AndroidAPS   Author: MilosKozak   File: TriggerConnector.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void generateDialog(LinearLayout root, FragmentManager fragmentManager) {
    final int padding = MainApp.dpToPx(5);

    root.setPadding(padding, padding, padding, padding);
    root.setBackgroundResource(R.drawable.border_automation_unit);

    LinearLayout triggerListLayout = new LinearLayout(root.getContext());
    triggerListLayout.setOrientation(LinearLayout.VERTICAL);
    triggerListLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    root.addView(triggerListLayout);

    adapter = new TriggerListAdapter(fragmentManager, root.getContext(), triggerListLayout, this);
}
 
Example #16
Source Project: prayer-times-android   Author: metinkale38   File: BaseActivity.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void onBackStackChanged() {
    FragmentManager fm = getSupportFragmentManager();
    if (fm.getBackStackEntryCount() > 0) {
        mToolbar.setNavigationIcon(
                MaterialDrawableBuilder.with(this).setIcon(MaterialDrawableBuilder.IconValue.ARROW_LEFT).setColorResource(R.color.white)
                        .setToActionbarSize().build());
    } else {
        mToolbar.setNavigationIcon(
                MaterialDrawableBuilder.with(this).setIcon(MaterialDrawableBuilder.IconValue.MENU).setColorResource(R.color.white)
                        .setToActionbarSize().build());
    }
}
 
Example #17
Source Project: ArchPackages   Author: rascarlo   File: MainActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * callback from {@link SearchFragment}
 * inflate the settings {@link SettingsFragment}
 * REPLACE the fragment, not add
 */
@Override
public void onSearchFragmentCallbackOnMenuActionSettingsClicked() {
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    SettingsFragment settingsFragment = new SettingsFragment();
    fragmentTransaction.replace(R.id.content_main_fragment_container, settingsFragment);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commit();
}
 
Example #18
Source Project: candybar   Author: zixpo   File: LicensesFragment.java    License: Apache License 2.0 5 votes vote down vote up
public static void showLicensesDialog(FragmentManager fm) {
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);
    }

    try {
        DialogFragment dialog = LicensesFragment.newInstance();
        dialog.show(ft, TAG);
    } catch (IllegalArgumentException | IllegalStateException ignored) {
    }
}
 
Example #19
Source Project: AndroidNavigation   Author: listenzz   File: AwesomeActivity.java    License: MIT License 5 votes vote down vote up
protected void setRootFragmentInternal(AwesomeFragment fragment) {
    clearFragmentsInternal();
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction transaction = fragmentManager.beginTransaction();
    transaction.setReorderingAllowed(true);
    transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    fragment.setAnimation(PresentAnimation.None);
    transaction.add(android.R.id.content, fragment, fragment.getSceneId());
    transaction.addToBackStack(fragment.getSceneId());
    transaction.commit();
    FragmentHelper.executePendingTransactionsSafe(fragmentManager);
}
 
Example #20
Source Project: YImagePicker   Author: yangpeixing   File: PLauncher.java    License: Apache License 2.0 5 votes vote down vote up
private PRouter getRouterFragment(Activity activity) {
    PRouter routerFragment = findRouterFragment(activity);
    if (routerFragment == null) {
        routerFragment = PRouter.newInstance();
        android.app.FragmentManager fragmentManager = activity.getFragmentManager();
        fragmentManager
                .beginTransaction()
                .add(routerFragment, TAG)
                .commitAllowingStateLoss();
        fragmentManager.executePendingTransactions();
    }
    return routerFragment;
}
 
Example #21
Source Project: mlkit-material-android   Author: firebase   File: BarcodeResultFragment.java    License: Apache License 2.0 5 votes vote down vote up
public static void show(
    FragmentManager fragmentManager, ArrayList<BarcodeField> barcodeFieldArrayList) {
  BarcodeResultFragment barcodeResultFragment = new BarcodeResultFragment();
  Bundle bundle = new Bundle();
  bundle.putParcelableArrayList(ARG_BARCODE_FIELD_LIST, barcodeFieldArrayList);
  barcodeResultFragment.setArguments(bundle);
  barcodeResultFragment.show(fragmentManager, TAG);
}
 
Example #22
Source Project: AndroidAnimationExercise   Author: REBOOTERS   File: MultiFragmentsActivity.java    License: Apache License 2.0 5 votes vote down vote up
public SectionsPagerAdapter(FragmentManager fm) {
    super(fm);

    mFragments.add(new OneFragment());
    mFragments.add(new TwoFragment());
    mFragments.add(new ThreeFragment());
    mFragments.add(new FourFragment());
    mFragments.add(new CommunicationFragment());

    mTitles.add("one");
    mTitles.add("two");
    mTitles.add("three");
    mTitles.add("four");
    mTitles.add("five");
}
 
Example #23
Source Project: CommonUtils   Author: devgianlu   File: DialogUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static void showDialog(@Nullable Fragment fragment, @NonNull DialogFragment dialog, @Nullable String tag) {
    if (fragment == null) return;

    FragmentManager manager = fragment.getChildFragmentManager();
    try {
        dialog.show(manager, tag);
    } catch (IllegalStateException ex) {
        Log.e(TAG, "Failed showing dialog.", ex); // We can't do nothing
    }
}
 
Example #24
Source Project: mimi-reader   Author: MimiReader   File: PrivacyPolicyFragment.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Builds and displays a licenses fragment for you. Requires "/res/raw/licenses.html" and
 * "/res/layout/licenses_fragment.xml" to be present.
 *
 * @param fm A fragment manager instance used to display this LicensesFragment.
 */
public static void displayLicensesFragment(FragmentManager fm) {
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    DialogFragment newFragment = PrivacyPolicyFragment.newInstance();
    newFragment.show(ft, FRAGMENT_TAG);
}
 
Example #25
Source Project: Jockey   Author: marverenic   File: SongSection.java    License: Apache License 2.0 5 votes vote down vote up
public SongSection(@NonNull List<Song> data, Context context, PlayerController playerController,
                   MusicStore musicStore, PlaylistStore playlistStore, FragmentManager fragmentManager,
                   @Nullable OnSongSelectedListener songSelectedListener) {
    super(data);
    mContext = context;
    mMusicStore = musicStore;
    mPlaylistStore = playlistStore;
    mPlayerController = playerController;
    mFragmentManager = fragmentManager;
    mSongListener = songSelectedListener;

    mCurrentSong = BehaviorSubject.create();
}
 
Example #26
Source Project: prayer-times-android   Author: metinkale38   File: BaseActivity.java    License: Apache License 2.0 5 votes vote down vote up
@SuppressLint("RtlHardcoded")
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
    if (item.getItemId() == android.R.id.home) {
        FragmentManager fm = getSupportFragmentManager();
        if (fm.getBackStackEntryCount() > 0) {
            onBackPressed();
        } else {
            mDrawerLayout.openDrawer(isRTL() ? Gravity.RIGHT : Gravity.LEFT);
        }
        return true;
    }
    return super.onOptionsItemSelected(item);
}
 
Example #27
Source Project: AirMapView   Author: airbnb   File: AirMapView.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Used for initialization of the underlying map provider.
 *
 * @param fragmentManager required for initialization
 */
public void initialize(FragmentManager fragmentManager) {
  AirMapInterface mapInterface = (AirMapInterface)
      fragmentManager.findFragmentById(R.id.map_frame);

  if (mapInterface != null) {
    initialize(fragmentManager, mapInterface);
  } else {
    initialize(fragmentManager, new DefaultAirMapViewBuilder(getContext()).builder().build());
  }
}
 
Example #28
Source Project: Instagram-Profile-Downloader   Author: beNitinhere   File: StoryViewPagerAdapter.java    License: MIT License 5 votes vote down vote up
public StoryViewPagerAdapter(FragmentManager fm, List<StoryModel> models, Boolean isFromNet, List<String> list,Boolean isDownloadPostImage,
                             boolean isAlreadyDownloaded,boolean isFromDownloadScreen){
    super(fm);

    this.modelList = models;
    this.isFromNet = isFromNet;
    this.list = list;
    this.isDownloadPostImage = isDownloadPostImage;
    this.isAlreadyDownloaded=isAlreadyDownloaded;
    this.isFromDownloadScreen =isFromDownloadScreen;

}
 
Example #29
Source Project: ArchPackages   Author: rascarlo   File: MainActivity.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * callback from {@link DetailsFragment}
 * inflate a new {@link FilesFragment}
 *
 * @param files: the {@link Files} to bind dirs and files count
 */
@Override
public void onDetailsFragmentCallbackOnFilesClicked(Files files) {
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
    FilesFragment filesFragment = FilesFragment.newInstance(files);
    fragmentTransaction.add(R.id.content_main_fragment_container, filesFragment);
    fragmentTransaction.addToBackStack(null);
    fragmentTransaction.commit();
}
 
Example #30
Source Project: adamant-android   Author: Adamant-im   File: LoginUINetworkTest.java    License: GNU General Public License v3.0 5 votes vote down vote up
@Test
@LargeTest
public void uiNetSuccessLogin() throws Exception {

    LoginScreen activity = activityRule.getActivity();
    FragmentManager supportFragmentManager = activity.getSupportFragmentManager();

    FragmentIdlingResource dialogFragmentIdlingResource = new FragmentIdlingResource(
            LoginScreen.BOTTOM_LOGIN_TAG,
            supportFragmentManager
    );

    onView(withId(R.id.activity_login_btn_login)).perform(click());

    idlingBlock(dialogFragmentIdlingResource, () -> {
        onView(withId(R.id.fragment_login_et_passphrase))
                .check(matches(isDisplayed()));

        onView(withId(R.id.fragment_login_et_passphrase))
                .perform(typeText(InstrumentedTestConstants.PASSPHRASE))
                .perform(closeSoftKeyboard());

        onView(withId(R.id.fragment_login_btn_enter)).perform(click());
    });

    String mainActivity = MainScreen.class.getName();
    ActivityIdlingResosurce activityIdlingResosurce = new ActivityIdlingResosurce(mainActivity);

    idlingBlock(activityIdlingResosurce, () -> {
        intended(hasComponent(MainScreen.class.getName()));
    });
}