Ejemplo n.º 1
0
 @Override
 public void onDestroy() {
   super.onDestroy();
   if (getActivity() instanceof SetDispatchTouchEventListener) {
     ((SetDispatchTouchEventListener) getActivity()).setDispatchTouchEventListener(null);
   }
 }
Ejemplo n.º 2
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    SpannableString string = new SpannableString("(点击查看示例)");
    string.setSpan(
        new ClickableSpan() {
          @Override
          public void onClick(View widget) {
            if (togglePageListener != null) {
              togglePageListener.onToggleToGifSample();
            }
          }

          @Override
          public void updateDrawState(TextPaint ds) {
            ds.setColor(Color.parseColor("#0000ff"));
            super.updateDrawState(ds);
          }
        },
        0,
        string.length(),
        Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

    gifIntroTextView.setMovementMethod(LinkMovementMethod.getInstance());
    gifIntroTextView.append(string);
  }
Ejemplo n.º 3
0
  @Override
  public void onAttach(Activity activity) {
    super.onAttach(activity);

    if (activity instanceof TogglePageListener) {
      togglePageListener = (TogglePageListener) activity;
    }
  }
Ejemplo n.º 4
0
  @Override
  public void onResume() {
    super.onResume();

    if (recoverPlay && !viewPagerPlayer.isPlaying()) {
      handler.postDelayed(startPlay, 1000);
    }
  }
Ejemplo n.º 5
0
 @Override
 public void onPause() {
   super.onPause();
   if (viewPagerPlayer.isPlaying()) {
     viewPagerPlayer.stop();
     recoverPlay = true;
   }
   handler.removeCallbacks(startPlay);
 }
Ejemplo n.º 6
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    handler = new Handler();
    startPlay = new StartPlay();
    singleTapDetector = new SingleTapDetector(getActivity(), this);

    if (getActivity() instanceof SetDispatchTouchEventListener) {
      ((SetDispatchTouchEventListener) getActivity())
          .setDispatchTouchEventListener(
              new DispatchTouchEventListener() {
                @Override
                public void dispatchTouchEvent(MotionEvent ev) {
                  singleTapDetector.onTouchEvent(ev);
                }
              });
    }
  }
Ejemplo n.º 7
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    numberLayout.setVisibility(View.GONE);
    shareButton.setVisibility(View.INVISIBLE);
    applyWallpaperButton.setVisibility(View.INVISIBLE);
    playButton.setVisibility(View.INVISIBLE);
    saveButton.setVisibility(View.INVISIBLE);
    toolbarLayout.setVisibility(View.GONE);

    animationBatchExecutor =
        new AnimationBatchExecutor(
            getActivity(),
            R.anim.action_show,
            R.anim.action_hidden,
            70,
            shareButton,
            applyWallpaperButton,
            playButton,
            saveButton);
    viewPagerPlayer = new ViewPagerPlayer(viewPager);
    new PageNumberSetter(currentItemTextView, viewPager);
    viewPager.setPageTransformer(true, new DepthPageTransformer());

    shareButton.setOnClickListener(this);
    applyWallpaperButton.setOnClickListener(this);
    playButton.setOnClickListener(this);
    saveButton.setOnClickListener(this);

    if (uris != null) {
      viewPager.setAdapter(new ImageFragmentAdapter(getChildFragmentManager(), uris));
      viewPager.setCurrentItem(position);
      currentItemTextView.setText(position + 1 + "");
      countTextView.setText(uris.size() + "");
    }
  }