Search in sources :

Example 1 with MainActivity

use of org.mozilla.focus.activity.MainActivity in project focus-android by mozilla-mobile.

the class SessionsSheetFragment method animateAndDismiss.

/* package */
Animator animateAndDismiss() {
    final Animator animator = playAnimation(true);
    animator.addListener(new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(Animator animation) {
            final MainActivity activity = (MainActivity) getActivity();
            if (activity != null) {
                activity.getSupportFragmentManager().beginTransaction().remove(SessionsSheetFragment.this).commit();
            }
        }
    });
    return animator;
}
Also used : Animator(android.animation.Animator) AnimatorListenerAdapter(android.animation.AnimatorListenerAdapter) MainActivity(org.mozilla.focus.activity.MainActivity)

Example 2 with MainActivity

use of org.mozilla.focus.activity.MainActivity in project Rocket by mozilla-tw.

the class SessionLoadedIdlingResource method isIdleNow.

@Override
public boolean isIdleNow() {
    final MainActivity mainActivity = activityWeakReference.get();
    if (mainActivity == null || mainActivity.getVisibleBrowserFragment() == null) {
        return false;
    }
    // TODO: Maybe use an interface to wait for the state is better than depending on the activity directly
    final boolean isLoading = mainActivity.getVisibleBrowserFragment().isLoading();
    if (isLoading) {
        return false;
    } else {
        invokeCallback();
        return true;
    }
}
Also used : MainActivity(org.mozilla.focus.activity.MainActivity)

Aggregations

MainActivity (org.mozilla.focus.activity.MainActivity)2 Animator (android.animation.Animator)1 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)1