private void showAnimatedPortraitCallOptions() {
    Animation animation = slideInRightToLeft;
    animation.setAnimationListener(
        new AnimationListener() {
          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationRepeat(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            options.setBackgroundResource(R.drawable.options_alt);
            if (isTransferAllowed) {
              transfer.setVisibility(View.VISIBLE);
            }
            addCall.setVisibility(View.VISIBLE);
            animation.setAnimationListener(null);
          }
        });
    if (isTransferAllowed) {
      transfer.startAnimation(animation);
    }
    addCall.startAnimation(animation);
  }
Example #2
0
  private void findUI() {

    devDialog = new AlertDialog.Builder(ForecastActivity.this, R.style.AppCompatAlertDialogStyle);
    devDialog.setTitle("Печеньку?");
    devDialog.setMessage("К сожалению раздел находится в разработке...");
    devDialog.setPositiveButton(
        "ОК",
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialogInterface, int i) {
            dialogInterface.dismiss();
          }
        });

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    drawerLayout = (DrawerLayoutWithViewPager) findViewById(R.id.drawer_layout);
    navigationView = (NavigationView) findViewById(R.id.nav_view);
    b_cities = navigationView.getHeaderView(0).findViewById(R.id.b_cities);
    pagerMaterial = (ViewPager) navigationView.getHeaderView(0).findViewById(R.id.pager_material);
    pagerCity = (ViewPager) navigationView.getHeaderView(0).findViewById(R.id.pager_city);

    topbar = (LinearLayout) drawerLayout.findViewById(R.id.topbar);
    summary_box = (LinearLayout) drawerLayout.findViewById(R.id.summary_box);
    summary_city = (TextView) drawerLayout.findViewById(R.id.city);
    summary_daily = (TextView) drawerLayout.findViewById(R.id.summary);
    // summary_hourly = (TextView) drawerLayout.findViewById(R.id.summary_hourly);
    summary_city.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fadein));
    summary_daily.startAnimation(AnimationUtils.loadAnimation(this, R.anim.fadein));

    scroll = (SwipeRefreshLayout) drawerLayout.findViewById(R.id.scroll);
    scroll.setProgressViewOffset(false, -100, 100);
  }
  private boolean PopupTouchEvent(final MotionEvent event) {
    switch (event.getActionMasked()) {
      case MotionEvent.ACTION_DOWN:
        if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB)
          // mScrollIndicatorText.setVisibility(View.VISIBLE);
          toggleVisibilityCompat(false);
        else mScrollIndicatorText.startAnimation(mFadeIn);
        mScrolling = true;
        scroll(event.getY());
        return true;
      case MotionEvent.ACTION_MOVE:
        scroll(event.getY());
        return true;
      case MotionEvent.ACTION_UP:
        if (mType == TYPE_INDICATOR_WITH_HANDLE || mType == TYPE_POPUP_WITH_HANDLE)
          mHandlebar.setSelected(false);

        if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
          mScrolling = false;
          toggleVisibilityCompat(true);
        } else mScrollIndicatorText.startAnimation(mFadeOut);
        return true;
      default:
        break;
    }
    return false;
  }
  private void hideAnimatedLandscapeCallOptions() {
    Animation animation = slideOutTopToBottom;
    if (isTransferAllowed) {
      animation.setAnimationListener(
          new AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {}

            @Override
            public void onAnimationRepeat(Animation animation) {}

            @Override
            public void onAnimationEnd(Animation animation) {
              transfer.setAnimation(null);
              transfer.setVisibility(View.INVISIBLE);
              animation =
                  AnimationUtils.loadAnimation(
                      InCallActivity.this,
                      R.anim
                          .slide_out_top_to_bottom); // Reload animation to prevent transfer button
              // to blink
              animation.setAnimationListener(
                  new AnimationListener() {
                    @Override
                    public void onAnimationStart(Animation animation) {}

                    @Override
                    public void onAnimationRepeat(Animation animation) {}

                    @Override
                    public void onAnimationEnd(Animation animation) {
                      addCall.setVisibility(View.INVISIBLE);
                    }
                  });
              addCall.startAnimation(animation);
            }
          });
      transfer.startAnimation(animation);
    } else {
      animation.setAnimationListener(
          new AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {}

            @Override
            public void onAnimationRepeat(Animation animation) {}

            @Override
            public void onAnimationEnd(Animation animation) {
              addCall.setVisibility(View.INVISIBLE);
            }
          });
      addCall.startAnimation(animation);
    }
  }
Example #5
0
  public void playAnimation() {
    mMenu0.setRotationX(180);
    mMenu1.setRotationX(180);
    mMenu2.setRotationX(180);
    mMenu3.setRotationX(180);

    mMenu0.startAnimation(mAnimation0);
    mMenu1.startAnimation(mAnimation1);
    mMenu2.startAnimation(mAnimation2);
    mMenu3.startAnimation(mAnimation3);
  }
  private void remainingSecondsChanged(int newVal) {
    mRemainingSecs = newVal;
    if (newVal == 0) {
      // Countdown has finished
      setVisibility(View.INVISIBLE);
      if (mListener != null) mListener.onCountDownFinished();
    } else {
      Locale locale = getResources().getConfiguration().locale;
      String localizedValue = String.format(locale, "%d", newVal);
      mRemainingSecondsView.setText(localizedValue);
      // Fade-out animation
      mCountDownAnim.reset();
      mRemainingSecondsView.clearAnimation();
      mRemainingSecondsView.startAnimation(mCountDownAnim);

      // Play sound effect for the last 3 seconds of the countdown
      //			if (mPlaySound) {
      //				if (newVal == 1) {
      //					mSoundPool.play(mBeepTwice, 1.0f, 1.0f, 0, 0, 1.0f);
      //				} else if (newVal <= 3) {
      //					mSoundPool.play(mBeepOnce, 1.0f, 1.0f, 0, 0, 1.0f);
      //				}
      //			}
      // Schedule the next remainingSecondsChanged() call in 1 second
      mHandler.sendEmptyMessageDelayed(SET_TIMER_TEXT, 1000);
    }
  }
  private void showAnimatedLandscapeCallOptions() {
    Animation animation = slideInBottomToTop;
    animation.setAnimationListener(
        new AnimationListener() {
          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationRepeat(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            addCall.setAnimation(null);
            options.setBackgroundResource(R.drawable.options_alt);
            addCall.setVisibility(View.VISIBLE);
            if (isTransferAllowed) {
              animation.setAnimationListener(
                  new AnimationListener() {
                    @Override
                    public void onAnimationStart(Animation animation) {}

                    @Override
                    public void onAnimationRepeat(Animation animation) {}

                    @Override
                    public void onAnimationEnd(Animation animation) {
                      transfer.setVisibility(View.VISIBLE);
                    }
                  });
              transfer.startAnimation(animation);
            }
          }
        });
    addCall.startAnimation(animation);
  }
  private void rotate(int degree) {
    ImageButton[] btns = {mButton, mMaskButton, mFocusButton};

    int target = 0;
    // TODO:for tablet
    if (degree == 0) {
      target = 0;
    } else if (degree == 90) {
      target = -90;
    } else if (degree == 180) {
      target = 180;
    } else if (degree == 270) {
      target = 90;
    }

    for (ImageButton btn : btns) {
      if (btn.equals(mMaskButton) && mMode == 1) {
        continue;
      }
      RotateAnimation rotate =
          new RotateAnimation(mPrevTarget, target, btn.getWidth() / 2, btn.getHeight() / 2);
      rotate.setDuration(500);
      rotate.setFillAfter(true);
      btn.startAnimation(rotate);
    }

    RotateAnimation rotate =
        new RotateAnimation(mPrevTarget, target, mText.getWidth() / 2, mText.getHeight() / 2);
    rotate.setDuration(500);
    rotate.setFillAfter(true);
    mText.startAnimation(rotate);

    RotateAnimation rotateZoomIn =
        new RotateAnimation(mPrevTarget, target, mZoomIn.getWidth() / 2, mZoomIn.getHeight() / 2);
    rotateZoomIn.setDuration(500);
    rotateZoomIn.setFillAfter(true);
    mZoomIn.startAnimation(rotateZoomIn);

    RotateAnimation rotateZoomOut =
        new RotateAnimation(mPrevTarget, target, mZoomOut.getWidth() / 2, mZoomOut.getHeight() / 2);
    rotateZoomOut.setDuration(500);
    rotateZoomOut.setFillAfter(true);
    mZoomOut.startAnimation(rotateZoomOut);

    // 回転時、表示がズレるので、断念
    /*
    if(mWebView != null){
        int x = mWebView.getWidth()/2;
        int y = mWebView.getHeight()/2;
        Log.d(TAG, "x,y = " + x + "," + y);
        RotateAnimation rotateWeb = new RotateAnimation(mPrevTarget, target, 100, 100);
        rotateWeb.setDuration(0);
        rotateWeb.setFillAfter(true);
        mWebView.startAnimation(rotate);
    }
    */

    mPrevTarget = target;
  }
Example #9
0
  public void unlockSpeech() {

    speech_btn.startAnimation(animZoomIn);
    logo_img.startAnimation(animFadeOut);
    instruction_tv.startAnimation(animFadeOut);

    // textEngine.speak(myoInput, TextToSpeech.QUEUE_FLUSH, null);
  }
Example #10
0
 private void toggleVisibilityCompat(final boolean visible) {
   if (mScrollIndicatorText != null) {
     mScrollIndicatorText.startAnimation(visible ? mFadeOut : mFadeIn);
   }
   if (mScrollIndicator != null) {
     mScrollIndicator.startAnimation(visible ? mFadeOut : mFadeIn);
   }
 }
 private void fadePage() {
   if (eink || pageNumberAnim == null) {
     pageNumberTextView.setVisibility(View.GONE);
   } else {
     pageNumberAnim.setStartOffset(0);
     pageNumberAnim.setFillAfter(true);
     pageNumberTextView.startAnimation(pageNumberAnim);
   }
 }
Example #12
0
 private void hideIndicatorCompat() {
   if (mScrollIndicatorText != null) {
     mScrollIndicatorText.setVisibility(View.INVISIBLE);
     mScrollIndicatorText.startAnimation(mFadeOut);
   }
   if (mScrollIndicator != null) {
     mScrollIndicator.findViewById(ID_PIN).setVisibility(View.INVISIBLE);
     mScrollIndicator.startAnimation(mFadeOut);
   }
 }
 /** stop refresh, reset header view. */
 public void stopRefresh() {
   if (mPullRefreshing == true) {
     mPullRefreshing = false;
     if (mIsAnimation) {
       infoHint.setText(String.format("更新了%s条数据", count));
       infoHint.startAnimation(animationDown);
     }
     resetHeaderHeight();
   }
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.winner);

    // doBindService();

    final Animation animRotate = AnimationUtils.loadAnimation(this, R.anim.rotate);
    final Animation animRotate2 = AnimationUtils.loadAnimation(this, R.anim.rotatetwo);
    final Animation animRotate3 = AnimationUtils.loadAnimation(this, R.anim.rotate3);

    final Animation textAnimation = AnimationUtils.loadAnimation(this, R.anim.textanimation);

    String time = getIntent().getStringExtra("time");

    String click = getIntent().getStringExtra("click");

    TextView maintext = (TextView) findViewById(R.id.maintext);
    maintext.startAnimation(textAnimation);

    ObjectAnimator a;
    a = ObjectAnimator.ofInt(maintext, "textColor", Color.RED, Color.BLUE, Color.CYAN, Color.GREEN);
    a.setRepeatMode(ObjectAnimator.REVERSE);
    a.setRepeatCount(ObjectAnimator.INFINITE);
    a.setDuration(1500000);

    a.start();

    final TextView exit = (TextView) findViewById(R.id.texttime);
    final TextView records = (TextView) findViewById(R.id.clicktext);

    exit.startAnimation(animRotate);
    records.startAnimation(animRotate2);

    final TextView tvTime = (TextView) findViewById(R.id.time);
    final TextView tvClick = (TextView) findViewById(R.id.click);

    tvClick.setText(click);
    tvTime.setText(time);
  }
  private void animateTooltip(long fadeDuration, long startFadeTime, LinearInterpolator linInter) {
    AlphaAnimation mAlAnimation = new AlphaAnimation(0, 1);
    mAlAnimation.setDuration(fadeDuration);
    mAlAnimation.setStartOffset(startFadeTime);
    mAlAnimation.setInterpolator(linInter);

    watchProgressArrow.startAnimation(mAlAnimation);
    watchProgressText.startAnimation(mAlAnimation);
    watchProgressArrow.setVisibility(View.VISIBLE);
    watchProgressText.setVisibility(View.VISIBLE);
  }
 private void displayMissedCalls(final int missedCallsCount) {
   if (missedCallsCount > 0) {
     missedCalls.setText(missedCallsCount + "");
     missedCalls.setVisibility(View.VISIBLE);
     if (!isAnimationDisabled) {
       missedCalls.startAnimation(
           AnimationUtils.loadAnimation(LinphoneActivity.this, R.anim.bounce));
     }
   } else {
     missedCalls.clearAnimation();
     missedCalls.setVisibility(View.GONE);
   }
 }
  private void initAnim() {

    long duration = 300;
    long durationS = 160;
    float alpha = 0.3f;
    AccelerateInterpolator accInterpolator = new AccelerateInterpolator();

    tab_left = new TranslateAnimation(tabW, 0, 0, 0);
    tab_right = new TranslateAnimation(0, tabW, 0, 0);
    tab_alpha_1 = new AlphaAnimation(1.0f, alpha);
    tab_alpha_2 = new AlphaAnimation(alpha, 1.0f);
    pop_in =
        new ScaleAnimation(
            0, 1, 0, 1, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0);
    pop_out =
        new ScaleAnimation(
            1, 0, 1, 0, Animation.RELATIVE_TO_SELF, 1, Animation.RELATIVE_TO_SELF, 0);

    pop_in.setDuration(durationS);
    pop_in.setInterpolator(accInterpolator);
    pop_in.setAnimationListener(new PopListener(popView, PopListener.TYPE_IN));

    pop_out.setDuration(durationS);
    pop_out.setInterpolator(accInterpolator);
    pop_out.setAnimationListener(new PopListener(popView, PopListener.TYPE_OUT));

    tab_left.setFillAfter(true);
    tab_left.setFillEnabled(true);
    tab_left.setDuration(duration);
    tab_left.setInterpolator(accInterpolator);

    tab_right.setFillAfter(true);
    tab_right.setFillEnabled(true);
    tab_right.setDuration(duration);
    tab_right.setInterpolator(accInterpolator);

    tab_alpha_1.setFillAfter(true);
    tab_alpha_1.setFillEnabled(true);
    tab_alpha_1.setDuration(duration);
    tab_alpha_1.setInterpolator(accInterpolator);

    tab_alpha_2.setFillAfter(true);
    tab_alpha_2.setFillEnabled(true);
    tab_alpha_2.setDuration(duration);
    tab_alpha_2.setInterpolator(accInterpolator);

    AlphaAnimation alphaInit = new AlphaAnimation(alpha, alpha);
    alphaInit.setFillAfter(true);
    alphaInit.setFillEnabled(true);
    tv_tab_box.startAnimation(alphaInit);
  }
Example #18
0
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;
    if (convertView == null) {
      v = inflater.inflate(R.layout.list_radio_item, null);
    }

    ImageView stt = (ImageView) v.findViewById(R.id.imageViewRadioStat);
    TextView tvNama = (TextView) v.findViewById(R.id.textViewNamaRadio);
    TextView tvKota = (TextView) v.findViewById(R.id.textViewKota);
    ImageView blink = (ImageView) v.findViewById(R.id.imageViewRadioBlink);
    TextView tvStat = (TextView) v.findViewById(R.id.textViewStatus);

    Radio r = data.get(position);
    Animation anim = new AlphaAnimation(0.0f, 1.0f);
    anim.setDuration(500);
    anim.setStartOffset(200);
    anim.setRepeatMode(Animation.REVERSE);
    anim.setRepeatCount(Animation.INFINITE);

    if (url.equals(r.getUrl()) && isPlayed && serviceRunning && onRadio) {
      r.setPlayedAtm(true);
      r.setStatusMessage("Menjalankan");
      isPlayed = false;
    }

    tvNama.setText(r.getNamaRadio());
    //		int c = tvNama.getTextColors().getDefaultColor();
    tvKota.setText(r.getKota());
    if (r.isPlayedAtm()) {
      tvNama.setTextColor(_ac.getResources().getColor(R.color.hijau_1));
      stt.setImageResource(R.drawable.ic_radio_on);
      blink.setImageResource(R.drawable.lingkaran_kecil);
      blink.startAnimation(anim);
      tvStat.setText(r.getStatusMessage());
      tvStat.startAnimation(anim);
    } else {
      tvNama.setTextColor(Color.WHITE);
      stt.setImageResource(R.drawable.ic_radio_off);
      blink.setImageResource(android.R.color.transparent);
      blink.clearAnimation();
      if (r.getStatusMessage().equalsIgnoreCase("Error")) {
        tvStat.setText("Tidak ada koneksi.");
      } else {
        tvStat.setText("");
      }
      tvStat.clearAnimation();
    }

    return v;
  }
Example #19
0
  public void resetSecondBottomLayoutWithAnimation() {

    mBackMainView.setVisibility(View.VISIBLE);
    AlphaAnimation backAlphaAnimation = new AlphaAnimation(0f, 1f);
    backAlphaAnimation.setDuration(PGEditConstants.EFFECT_ANIMATION_TIME);
    mBackMainView.startAnimation(backAlphaAnimation);

    AlphaAnimation nameAlphaAnimation = new AlphaAnimation(1f, 0f);
    nameAlphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
    nameAlphaAnimation.setAnimationListener(
        new AnimationAdapter() {
          @Override
          public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(
                new Runnable() {
                  @Override
                  public void run() {
                    if (null != mMenuListener) {
                      mMenuListener.onResetSecondBottomLayoutWithAnimationFinish();
                    }

                    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
                    alphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
                    mSecondBottomName.startAnimation(alphaAnimation);
                  }
                });
          }
        });
    mSecondBottomName.startAnimation(nameAlphaAnimation);

    AlphaAnimation savePhotoAlphaAnimation = new AlphaAnimation(1f, 0f);
    savePhotoAlphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
    savePhotoAlphaAnimation.setAnimationListener(
        new AnimationAdapter() {
          @Override
          public void onAnimationEnd(Animation animation) {
            mActivity.runOnUiThread(
                new Runnable() {
                  @Override
                  public void run() {

                    AlphaAnimation alphaAnimation = new AlphaAnimation(0f, 1f);
                    alphaAnimation.setDuration(PGEditConstants.EFFECT_BOTTOM_ANIMATION_TIME);
                    mSaveEffectView.startAnimation(alphaAnimation);
                  }
                });
          }
        });
    mSaveEffectView.startAnimation(savePhotoAlphaAnimation);
  }
  private void hideAnimatedPortraitCallOptions() {
    Animation animation = slideOutLeftToRight;
    animation.setAnimationListener(
        new AnimationListener() {
          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationRepeat(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            if (isTransferAllowed) {
              transfer.setVisibility(View.INVISIBLE);
            }
            addCall.setVisibility(View.INVISIBLE);
            animation.setAnimationListener(null);
          }
        });
    if (isTransferAllowed) {
      transfer.startAnimation(animation);
    }
    addCall.startAnimation(animation);
  }
    void show(boolean animate) {
      text.setVisibility(View.VISIBLE);
      tab.setVisibility(View.VISIBLE);
      // target.setVisibility(View.INVISIBLE);
      if (animate) {
        boolean horiz = alignment == ALIGN_LEFT || alignment == ALIGN_RIGHT;
        int dx = horiz ? (alignment == ALIGN_LEFT ? tab.getWidth() : -tab.getWidth()) : 0;
        int dy = horiz ? 0 : (alignment == ALIGN_TOP ? tab.getHeight() : -tab.getHeight());

        Animation trans = new TranslateAnimation(-dx, 0, -dy, 0);
        trans.setDuration(ANIM_DURATION);
        tab.startAnimation(trans);
        text.startAnimation(trans);
      }
    }
Example #22
0
  private void animateName() {
    name.setVisibility(View.VISIBLE);
    int self = Animation.RELATIVE_TO_PARENT;
    TranslateAnimation animRight = new TranslateAnimation(self, -1, self, 0, self, 0, self, 0);
    animRight.setInterpolator(i);
    animRight.setDuration(700);
    TranslateAnimation animLeft = new TranslateAnimation(self, 1, self, 0, self, 0, self, 0);
    animLeft.setAnimationListener(
        new AnimationListener() {

          @Override
          public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub
            name.setVisibility(View.VISIBLE);
          }

          @Override
          public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationEnd(Animation animation) {
            // TODO Auto-generated method stub
            startRotation();
            //				ImageView iv = (ImageView) findViewById(R.id.sds);
            //				iv.setVisibility(View.VISIBLE);
          }
        });
    animLeft.setInterpolator(i);
    animLeft.setDuration(700);
    mobile.startAnimation(animRight);
    development.startAnimation(animLeft);
    group.startAnimation(animRight);
  }
Example #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.startpage);
    logo = (ImageView) findViewById(R.id.logo_iv);
    logo_tv = (TextView) findViewById(R.id.logo_tv);
    appAnim = AnimationUtils.loadAnimation(this, R.anim.set);
    tv_Anim = AnimationUtils.loadAnimation(this, R.anim.fistpage_enter);

    appAnim.setAnimationListener(
        new AnimationListener() {

          @Override
          public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

          }

          @Override
          public void onAnimationEnd(Animation animation) {
            // TODO Auto-generated method stub
            Intent i = new Intent(getApplicationContext(), MainActivity.class);
            startActivity(i);
            int version = Integer.valueOf(android.os.Build.VERSION.SDK);
            if (version >= 5) {
              overridePendingTransition(R.anim.activity_enter, R.anim.activity_exit);
              // overridePendingTransition(android.R.anim.decelerate_interpolator,android.R.anim.decelerate_interpolator);
              // overridePendingTransition(android.R.anim.overshoot_interpolator,android.R.anim.linear_interpolator);
            }
            StartPage.this.finish();
          }
        });
    logo.startAnimation(appAnim);
    logo_tv.startAnimation(tv_Anim);
  }
  @Override
  public void onExpanded() {
    AlphaAnimation alphaAnimation = new AlphaAnimation(0.0f, 1.0f);
    alphaAnimation.setDuration(200);
    alphaAnimation.setAnimationListener(
        new Animation.AnimationListener() {
          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            mStartScanView.setVisibility(View.VISIBLE);
            shouldStartAnim = true;
          }

          @Override
          public void onAnimationRepeat(Animation animation) {}
        });
    mStartScanView.startAnimation(alphaAnimation);
  }
  @Override
  public void onPullChange(int cur, int max) {
    if (shouldStartAnim) {
      shouldStartAnim = false;
      AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 0.0f);
      alphaAnimation.setDuration(200);
      alphaAnimation.setAnimationListener(
          new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
              mStartScanView.setVisibility(View.INVISIBLE);
            }

            @Override
            public void onAnimationEnd(Animation animation) {}

            @Override
            public void onAnimationRepeat(Animation animation) {}
          });
      mStartScanView.startAnimation(alphaAnimation);
    }
  }
    void hide() {
      boolean horiz = alignment == ALIGN_LEFT || alignment == ALIGN_RIGHT;
      int dx =
          horiz
              ? (alignment == ALIGN_LEFT
                  ? alignment_value - tab.getRight()
                  : alignment_value - tab.getLeft())
              : 0;
      int dy =
          horiz
              ? 0
              : (alignment == ALIGN_TOP
                  ? alignment_value - tab.getBottom()
                  : alignment_value - tab.getTop());

      Animation trans = new TranslateAnimation(0, dx, 0, dy);
      trans.setDuration(ANIM_DURATION);
      trans.setFillAfter(true);
      tab.startAnimation(trans);
      text.startAnimation(trans);
      target.setVisibility(View.INVISIBLE);
    }
 void reset(boolean animate) {
   setState(STATE_NORMAL);
   text.setVisibility(View.VISIBLE);
   text.setTextAppearance(text.getContext(), R.style.TextAppearance_SlidingTabNormal);
   tab.setVisibility(View.VISIBLE);
   target.setVisibility(View.INVISIBLE);
   final boolean horiz = alignment == ALIGN_LEFT || alignment == ALIGN_RIGHT;
   int dx =
       horiz
           ? (alignment == ALIGN_LEFT
               ? alignment_value - tab.getLeft()
               : alignment_value - tab.getRight())
           : 0;
   int dy =
       horiz
           ? 0
           : (alignment == ALIGN_TOP
               ? alignment_value - tab.getTop()
               : alignment_value - tab.getBottom());
   if (animate) {
     TranslateAnimation trans = new TranslateAnimation(0, dx, 0, dy);
     trans.setDuration(ANIM_DURATION);
     trans.setFillAfter(false);
     text.startAnimation(trans);
     tab.startAnimation(trans);
   } else {
     if (horiz) {
       text.offsetLeftAndRight(dx);
       tab.offsetLeftAndRight(dx);
     } else {
       text.offsetTopAndBottom(dy);
       tab.offsetTopAndBottom(dy);
     }
     text.clearAnimation();
     tab.clearAnimation();
     target.clearAnimation();
   }
 }
  @Override
  public Object instantiateItem(ViewGroup container, int position) {
    layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View itemView = layoutInflater.inflate(R.layout.photo_view_pager_item, container, false);
    Animation animation = AnimationUtils.loadAnimation(context, R.anim.activity_open_translate);

    final Photos data = mData.get(position);
    String image = data.getPhoto();

    description = (TextView) itemView.findViewById(R.id.description);
    description.setText(data.getDescription());
    description.startAnimation(animation);
    currentItem = (TextView) itemView.findViewById(R.id.currentItem);
    currentItem.setText(String.valueOf(position + 1));
    totalItem = (TextView) itemView.findViewById(R.id.totalItem);
    totalItem.setText(String.valueOf(mData.size()));
    photo = (ImageView) itemView.findViewById(R.id.photo);
    loadImages(image);

    container.addView(itemView);

    return itemView;
  }
Example #29
0
  @Override
  public boolean onTouchEvent(MotionEvent event) {
    if (mList.getAdapter() == null) return false;
    mItemCount = mList.getAdapter().getCount();
    if (mItemCount == 0) return false;

    if (event.getActionMasked() == MotionEvent.ACTION_CANCEL) {
      if (mType == TYPE_POPUP || mType == TYPE_POPUP_WITH_HANDLE) {
        if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
          mScrolling = false;
          mScrollIndicatorText.setVisibility(View.GONE);
        } else mScrollIndicatorText.startAnimation(mFadeOut);
      } else {
        if (mType == TYPE_INDICATOR_WITH_HANDLE || mType == TYPE_POPUP_WITH_HANDLE)
          mHandlebar.setSelected(false);

        if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
          mScrolling = false;
          toggleVisibilityCompat(true);
        } else mScrollIndicator.startAnimation(mFadeOut);
      }
    }

    switch (mType) {
      case TYPE_POPUP:
        return PopupTouchEvent(event);
      case TYPE_POPUP_WITH_HANDLE:
        return PopupTouchEvent(event);
      case TYPE_INDICATOR:
        return IndicatorTouchEvent(event);
      case TYPE_INDICATOR_WITH_HANDLE:
        return IndicatorTouchEvent(event);
      default:
        break;
    }
    return false;
  }
  // ----------------------------------------------------------------------------------------------
  // startShotAnimation
  // ----------------------------------------------------------------------------------------------
  public void startShotCountdown(final int seconds, final Runnable cb) {

    if (mShotTimer != null) mShotTimer.cancel();

    mShotTimer =
        new CountDownTimer((seconds) * 1000, 1000) {
          int lastSecondsLeft = 0;

          public void onTick(long ms) {

            int secondsLeft = Math.round(ms / 1000);
            mTimerView.startAnimation(mCountdownAnimation);
            mTimerView.setText("" + secondsLeft);
          }

          public void onFinish() {

            mTimerView.setText("");
            cb.run();
          }
        };

    mTimerView.startAnimation(mCountdownAnimation);
    mTimerView.setText("" + seconds);

    Runnable task =
        new Runnable() {
          @Override
          public void run() {
            LangHelper.sleep(1000);
            if (mShotTimer != null) mShotTimer.start();
          }
        };

    new Thread(task).start();
  }