Exemple #1
0
  private void exitFullscreenAnimated(boolean animated) {
    if (!isVideoFullScreen()) return;

    swipeRefreshLayout.setVisibility(View.VISIBLE);

    // reset the values correctly
    viewer.setRotation(0.f);
    viewer.setScaleX(1.f);
    viewer.setScaleY(1.f);
    viewer.setTranslationX(0.f);

    // simulate scrolling to fix the clipping and translationY
    simulateScroll();

    // go back to normal!
    FragmentActivity activity = getActivity();
    activity.supportInvalidateOptionsMenu();

    if (activity instanceof ToolbarActivity) {
      // show the toolbar again
      ((ToolbarActivity) activity).getScrollHideToolbarListener().reset();
    }

    Screen.unlockOrientation(activity);
  }
Exemple #2
0
  @Override
  public void onDestroyView() {
    content.removeOnScrollListener(scrollHandler);

    // restore orientation if the user closes this view
    Screen.unlockOrientation(getActivity());

    adapter = null;

    super.onDestroyView();
  }
Exemple #3
0
  @OnOptionsItemSelected(R.id.action_zoom)
  public void enterFullscreen() {
    FragmentActivity activity = getActivity();
    if (activity == null) return;

    if (isStaticImage(feedItem)) {
      boolean hq = settings.loadHqInZoomView();
      Intent intent = ZoomViewActivity.newIntent(activity, feedItem, hq);
      startActivity(intent);

    } else {
      FullscreenParams params = new FullscreenParams();

      ObjectAnimator.ofPropertyValuesHolder(
              viewer,
              ofFloat(View.ROTATION, params.rotation),
              ofFloat(View.TRANSLATION_Y, params.trY),
              ofFloat(View.SCALE_X, params.scale),
              ofFloat(View.SCALE_Y, params.scale))
          .setDuration(500)
          .start();

      repostHint.setVisibility(View.GONE);

      // hide content below
      swipeRefreshLayout.setVisibility(View.GONE);

      if (activity instanceof ToolbarActivity) {
        // hide the toolbar if required necessary
        ((ToolbarActivity) activity).getScrollHideToolbarListener().hide();
      }

      viewer.setClipBoundsCompat(null);

      activity.supportInvalidateOptionsMenu();
      registerExitFullscreenListener();

      // forbid orientation changes while in fullscreen
      Screen.lockOrientation(activity);
    }
  }