Search in sources :

Example 11 with BrowserFragment

use of org.mozilla.focus.fragment.BrowserFragment in project Rocket by mozilla-tw.

the class CaptureRunnable method promptScreenshotResult.

private void promptScreenshotResult(final boolean success) {
    Context context = refContext.get();
    if (context == null) {
        return;
    }
    if (refBrowserFragment != null) {
        final BrowserFragment browserFragment = refBrowserFragment.get();
        if (browserFragment != null && browserFragment.getCaptureStateListener() != null) {
            browserFragment.getCaptureStateListener().onPromptScreenshotResult();
        }
        if (browserFragment != null && success && !Settings.getInstance(context).getEventHistory().contains(Settings.Event.ShowMyShotOnBoardingDialog)) {
            // My shot on boarding didn't show before and capture is succeed, skip to show toast
            browserFragment.checkToShowMyShotOnBoarding();
            return;
        }
    }
    Toast.makeText(context, success ? R.string.screenshot_saved : R.string.screenshot_failed, Toast.LENGTH_SHORT).show();
}
Also used : Context(android.content.Context) BrowserFragment(org.mozilla.focus.fragment.BrowserFragment)

Aggregations

BrowserFragment (org.mozilla.focus.fragment.BrowserFragment)11 FragmentManager (android.support.v4.app.FragmentManager)4 Context (android.content.Context)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 ScreenCaptureDialogFragment (org.mozilla.focus.fragment.ScreenCaptureDialogFragment)1 UrlInputFragment (org.mozilla.focus.fragment.UrlInputFragment)1 Session (org.mozilla.focus.session.Session)1 SessionsSheetFragment (org.mozilla.focus.session.ui.SessionsSheetFragment)1