Example #1
0
 public void setNetClockAnimation(int h, int m, int s) {
   RotateAnimation animation_s2 =
       new RotateAnimation(
           s * 6, s * 6 + 6, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.81f);
   RotateAnimation animation_h2 =
       new RotateAnimation(
           h * 30 + m / 2,
           h * 30 + 30,
           Animation.RELATIVE_TO_SELF,
           0.5f,
           Animation.RELATIVE_TO_SELF,
           0.75f);
   RotateAnimation animation_m2 =
       new RotateAnimation(
           m * 6,
           m * 6 + 6 / 60,
           Animation.RELATIVE_TO_SELF,
           0.5f,
           Animation.RELATIVE_TO_SELF,
           0.81f);
   animation_s2.setDuration(60 * 1000);
   animation_s2.setFillAfter(true);
   animation_h2.setDuration(3600 * 1000);
   animation_h2.setFillAfter(true);
   animation_m2.setDuration(60 * 60 * 60 * 1000);
   animation_m2.setFillAfter(true);
   iv_s2.clearAnimation();
   iv_h2.clearAnimation();
   iv_m2.clearAnimation();
   iv_s2.setAnimation(animation_s2);
   iv_h2.setAnimation(animation_h2);
   iv_m2.setAnimation(animation_m2);
 }
Example #2
0
 public void setLocalAnitmation(int h, int m, int s) {
   RotateAnimation animation_s1 =
       new RotateAnimation(
           s * 6, s * 6 + 6, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.81f);
   RotateAnimation animation_h1 =
       new RotateAnimation(
           h * 30 + m / 2,
           h * 30 + 30,
           Animation.RELATIVE_TO_SELF,
           0.5f,
           Animation.RELATIVE_TO_SELF,
           0.75f);
   RotateAnimation animation_m1 =
       new RotateAnimation(
           m * 6,
           m * 6 + 6 / 60,
           Animation.RELATIVE_TO_SELF,
           0.5f,
           Animation.RELATIVE_TO_SELF,
           0.81f);
   animation_s1.setDuration(60 * 1000);
   animation_s1.setFillAfter(true);
   animation_h1.setDuration(3600 * 1000);
   animation_h1.setFillAfter(true);
   animation_m1.setDuration(60 * 60 * 60 * 1000);
   animation_m1.setFillAfter(true);
   iv_s1.clearAnimation();
   iv_h1.clearAnimation();
   iv_m1.clearAnimation();
   iv_s1.setAnimation(animation_s1);
   iv_h1.setAnimation(animation_h1);
   iv_m1.setAnimation(animation_m1);
 }
Example #3
0
        @Override
        public void handleMessage(Message msg) {
          if (msg.what == 0) {
            // 加载成功
            if (_appList.size() == 0) {
              // 没有数据
              _loadingTextView.setText("暂时没有数据!");
              _loadingAnimation.cancel();
              _loadingImageView.setAnimation(null);
              _loadingImageView.setVisibility(View.GONE);
            } else {
              // TODO: update
              _adapter.notifyDataSetChanged();
              _listView.setVisibility(View.VISIBLE);

              _loadingAnimation.cancel();
              _loadingImageView.setAnimation(null);
              _loadingLayer.setVisibility(View.INVISIBLE);
            }
          } else {
            _loadingAnimation.cancel();
            _loadingImageView.setAnimation(null);
            _loadingImageView.setVisibility(View.GONE);
            _loadingTextView.setText("加载数据失败,请稍后再试一次!");
          }
        }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bicycle);

    wheel1 = (ImageView) findViewById(R.id.wheel1);
    wheel2 = (ImageView) findViewById(R.id.wheel2);

    bicycleWheel = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.whell_round);
    wheel1.setAnimation(bicycleWheel);
    wheel2.setAnimation(bicycleWheel);
  }
Example #5
0
  /** 下拉刷新 */
  public int setStartRefresh() {
    arrows.setVisibility(View.VISIBLE);
    tvRefresh.setVisibility(View.VISIBLE);
    tvDate.setVisibility(View.VISIBLE);
    progressBar.setVisibility(View.GONE);
    tvRefresh.setText("下拉刷新");

    if (!isArrowsUp) {
      RotateAnimation mReverseFlipAnimation =
          new RotateAnimation(
              -180,
              0,
              RotateAnimation.RELATIVE_TO_SELF,
              0.5f,
              RotateAnimation.RELATIVE_TO_SELF,
              0.5f);
      mReverseFlipAnimation.setInterpolator(new LinearInterpolator());
      mReverseFlipAnimation.setDuration(250);
      mReverseFlipAnimation.setFillAfter(true);

      arrows.clearAnimation();
      arrows.setAnimation(mReverseFlipAnimation);
    }

    isArrowsUp = true;
    return PullScrollView.PULL_DOWN_STATE;
  }
  @Override
  public void init() {
    // 设置是否显示比例尺控件
    mapView.showScaleControl(true);
    // 设置是否显示缩放控件
    mapView.showZoomControls(false);
    baiduMap = mapView.getMap();
    // 设置监听
    baiduMap.setOnMapClickListener(
        new OnMapClickListener() {
          @Override
          public boolean onMapPoiClick(MapPoi mapPoi) {
            return false;
          }

          @Override
          public void onMapClick(final LatLng latLng) {
            System.out.println(latLng.latitude + "--" + latLng.longitude);
            geoCoder.reverseGeoCode(new ReverseGeoCodeOption().location(latLng));
            showWaiting(true);
            ok.setEnabled(false);
            markFirstLocation();
            markClickLocation(latLng);
          }
        });
    // 检索
    geoCoder = GeoCoder.newInstance();
    geoCoder.setOnGetGeoCodeResultListener(getGeoCoderResultListener);
    // 开始定位
    client = new LocationClient(getApplicationContext());
    client.setLocOption(getDefaultLocationClientOption());
    client.registerLocationListener(dbListener);
    client.start();
    // waiting的layout的初始化
    waitingAnimation =
        AnimationUtils.loadAnimation(SelectLocationActivity.this, R.anim.anim_waiting);
    waitingIcon.setAnimation(waitingAnimation);
    showWaiting(true);
    // 位置列表初始化
    adapter = new LocationAdapter();
    locationListView.setAdapter(adapter);
    locationListView.setOnItemClickListener(
        new OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            locationList.get(currentLocation).setSelected(false);
            locationList.get(position).setSelected(true);
            currentLocation = position;
            adapter.notifyDataSetChanged();
            // 重置标志
            markFirstLocation();
            markClickLocation(locationList.get(position).getLatLng());
          }
        });
    // 按钮
    back.setOnClickListener(clickListener);
    ok.setOnClickListener(clickListener);
    ok.setEnabled(false);
    Log.e("tag", "---------------------create---------------------------");
  }
Example #7
0
  private void init() {
    try {
      // --
      BitmapFactory.Options options = new BitmapFactory.Options();
      options.inSampleSize = 2; // ͼƬѹËõ±¶Êý
      bitmap_logo = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher, options);

      // --
      animation_show_logo = new AlphaAnimation(0.0f, 1.0f);
      animation_show_logo.setDuration(5000);
      animation_show_logo.setAnimationListener(new listener_activity_logo_animation(handler));
      // --
      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(200, 200);
      cmd_imageview_logo_container =
          (ImageView) findViewById(R.id.activity_logo_imageview_logo_container);
      cmd_imageview_logo_container.setLayoutParams(params);
      cmd_imageview_logo_container.setImageBitmap(bitmap_logo);
      cmd_imageview_logo_container.setAnimation(animation_show_logo);
      // --
      cmd_textview_app_version = (TextView) findViewById(R.id.activity_logo_textview_app_version);
      cmd_textview_app_version.setText("ÕÆÉÏ°®±¦±´V2.0");
      cmd_textview_app_version.setTextSize(20);
      cmd_textview_app_version.setTextColor(Color.GREEN);
      cmd_textview_app_version.setAnimation(animation_show_logo);
      // --

    } catch (Exception e) {
      // TODO: handle exception
    }
  }
Example #8
0
  /** 松开手刷新 */
  public int releaseFreshing() {
    arrows.setVisibility(View.VISIBLE);
    tvRefresh.setVisibility(View.VISIBLE);
    tvDate.setVisibility(View.VISIBLE);
    progressBar.setVisibility(View.GONE);
    tvRefresh.setText("松开手刷新");

    if (isArrowsUp) {
      RotateAnimation animationUp =
          new RotateAnimation(
              0,
              -180,
              RotateAnimation.RELATIVE_TO_SELF,
              0.5f,
              RotateAnimation.RELATIVE_TO_SELF,
              0.5f);
      animationUp.setInterpolator(new LinearInterpolator());
      animationUp.setDuration(250);
      animationUp.setFillAfter(true);

      arrows.clearAnimation();
      arrows.setAnimation(animationUp);
    }

    isArrowsUp = false;
    return PullScrollView.RELEASE_TO_REFRESH;
  }
Example #9
0
  private void init() {
    // 设置点击屏幕外不消失
    setCanceledOnTouchOutside(false);
    // 设置是否可通过返回键关闭
    this.setCancelable(cancelable);

    View view = LayoutInflater.from(context).inflate(R.layout.my_load_progress, null); // 加载自己定义的布局
    // 文字提示
    TextView my_progress_msg = (TextView) view.findViewById(R.id.my_progress_msg);
    img_loading = (ImageView) view.findViewById(R.id.my_progress_load_img);
    RelativeLayout img_close = (RelativeLayout) view.findViewById(R.id.my_progress_img_cancel);
    // 设置文字提示
    my_progress_msg.setText(msg);
    // 加载自定义动画
    rotateAnimation =
        (RotateAnimation) AnimationUtils.loadAnimation(context, R.anim.progress_refresh);
    // 开始动画
    img_loading.setAnimation(rotateAnimation);
    // 为Dialoge设置自己定义的布局
    setContentView(view);
    // 为close按钮添加事件
    img_close.setOnClickListener(
        new View.OnClickListener() {
          public void onClick(View v) {
            dismiss();
          }
        });
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.activity_qrokut, container, false);

    mydecoderview = (QRCodeReaderView) rootView.findViewById(R.id.qrdecoderview);
    mydecoderview.setOnQRCodeReadListener(this);

    line_image = (ImageView) rootView.findViewById(R.id.red_line_image);

    TranslateAnimation mAnimation =
        new TranslateAnimation(
            TranslateAnimation.ABSOLUTE,
            0f,
            TranslateAnimation.ABSOLUTE,
            0f,
            TranslateAnimation.RELATIVE_TO_PARENT,
            0f,
            TranslateAnimation.RELATIVE_TO_PARENT,
            0.5f);
    mAnimation.setDuration(1000);
    mAnimation.setRepeatCount(-1);
    mAnimation.setRepeatMode(Animation.REVERSE);
    mAnimation.setInterpolator(new LinearInterpolator());
    line_image.setAnimation(mAnimation);

    return rootView;
  }
Example #11
0
 /**
  * 旋转箭头方向
  *
  * @param orit
  */
 private void rotateArrow(int orit) {
   switch (orit) {
     case ROTATE_DOWN:
       if (!mIsArrowDown) {
         headerArrow.setAnimation(mRotationAnimDown);
         mRotationAnimDown.start();
         mIsArrowDown = true;
       }
       break;
     case ROTATE_UP:
       headerArrow.setAnimation(mRotationAnimUp);
       mRotationAnimUp.start();
       mIsArrowDown = false;
       break;
   }
 }
  @Override
  protected void onDestroy() {
    // fb
    try {
      uiHelper.onDestroy();
    } catch (Exception e) {
      e.printStackTrace(); // altrimenti crashava
    }
    // Rilascio l'animazione sulla faccia di Jhonny
    if (findViewById(R.id.facejhonny) != null) {
      ImageView faceJhonny = ((ImageView) findViewById(R.id.facejhonny));
      if (faceJhonny != null) {
        faceJhonny.clearAnimation();
        faceJhonny.setAnimation(null);
      }
    }

    // Rilascio tutte le risorse audio del SoundPool
    SoundManager.finalizeSounds();
    // AnimationFactory.releaseAllAnimation();
    // Log.d("Sound finalized!","### Sound finalized! ###");
    if (mReceiver != null) {
      unregisterReceiver(mReceiver);
    }
    // Log.e("MenuActivity","DESTROY MenuActivity ####################");
    super.onDestroy();
  }
Example #13
0
  private void showOrHideEmptyView() {
    final boolean show = cryptoCustomerCommunityInformationList.isEmpty();
    final int animationResourceId = show ? android.R.anim.fade_in : android.R.anim.fade_out;

    Animation anim = AnimationUtils.loadAnimation(getActivity(), animationResourceId);
    if (show
        && (noUsers.getVisibility() == View.GONE || noUsers.getVisibility() == View.INVISIBLE)) {
      noUsers.setAnimation(anim);
      noUsers.setVisibility(View.VISIBLE);
      recyclerView.setVisibility(View.INVISIBLE);

    } else if (!show && noUsers.getVisibility() == View.VISIBLE) {
      noUsers.setAnimation(anim);
      noUsers.setVisibility(View.GONE);
      recyclerView.setVisibility(View.VISIBLE);
    }
  }
 public void show() {
   super.show();
   RotateAnimation localRotateAnimation = new RotateAnimation(0.0F, 360.0F, 1, 0.5F, 1, 0.5F);
   localRotateAnimation.setInterpolator(new LinearInterpolator());
   localRotateAnimation.setRepeatCount(-1);
   localRotateAnimation.setDuration(1000L);
   iv.setAnimation(localRotateAnimation);
   iv.startAnimation(localRotateAnimation);
 }
 public void animateRegion() {
   if (regionIV != null) {
     Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.fade_in);
     regionIV.setAnimation(anim);
     regionTV.setAnimation(anim);
     anim.setStartOffset(1500);
     anim.setFillAfter(true);
     anim.start();
   }
 }
  static void doAnimation(ImageView imageView, Animation animation, int animationResource) {
    if (imageView == null) return;
    if (animation == null && animationResource != 0)
      animation = AnimationUtils.loadAnimation(imageView.getContext(), animationResource);
    if (animation == null) {
      imageView.setAnimation(null);
      return;
    }

    imageView.startAnimation(animation);
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_well_come);
   imageView = (ImageView) findViewById(R.id.welcome_image_view);
   alphaAnimation = AnimationUtils.loadAnimation(this, R.anim.welcome_alpha);
   alphaAnimation.setFillEnabled(true); // 启动Fill保持
   alphaAnimation.setFillAfter(true); // 设置动画的最后一帧是保持在View上面
   imageView.setAnimation(alphaAnimation);
   alphaAnimation.setAnimationListener(this); // 为动画设置监听
 }
  protected void stopCounter(int restCir, int restBackgroundText, boolean retry) {
    if (!counterStopped) counterStopped = true;
    try {
      imageCir.setAnimation(null);
      imageCir.setBackgroundDrawable(getResources().getDrawable(restCir));
      imageCir.setAnimation(
          AnimationUtils.loadAnimation(getContext(), R.anim.anim_circle_rotation_2));
    } catch (Exception e) {
      Log.d(TAG, "", e);
    }

    try {
      counterText.setText("");
      if (restBackgroundText > 0)
        counterText.setBackgroundDrawable(getResources().getDrawable(restBackgroundText));

    } catch (Exception e) {
      Log.e(TAG, "", e);
    }
    this.retry = retry;
  }
 @Override
 public void show() {
   super.show();
   RotateAnimation anim =
       new RotateAnimation(
           0.0f, 360.0f, Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
   anim.setInterpolator(new LinearInterpolator());
   anim.setRepeatCount(Animation.INFINITE);
   anim.setDuration(3000);
   iv.setAnimation(anim);
   iv.startAnimation(anim);
 }
  /**
   * The function responsible for fade-in fade-out effect
   *
   * @imageView <-- The View which displays the images
   * @images[] <-- Holds R references to the images to display
   * @imageIndex <-- index of the first image to show in images[]
   * @forever <-- If equals true then after the last image it starts all over again with the first
   *     image resulting in an infinite loop. You have been warned.
   */
  private void animate(
      final ImageView imageView, final int images[], final int imageIndex, final boolean forever) {

    int fadeInDuration = 800; // Configure time values here
    int timeBetween = 200;
    int fadeOutDuration = 400;

    // imageView.setVisibility(View.INVISIBLE);    //Visible or invisible by default - this will
    // apply when the animation ends
    imageView.setImageResource(images[imageIndex]);

    Animation fadeIn = new AlphaAnimation((float) 0.1, (float) 1.0);
    fadeIn.setInterpolator(new DecelerateInterpolator()); // add this
    fadeIn.setDuration(fadeInDuration);
    Animation fadeOut = new AlphaAnimation((float) 1.0, (float) 1.0);
    fadeOut.setInterpolator(new AccelerateInterpolator()); // and this
    fadeOut.setStartOffset(fadeInDuration + timeBetween);
    fadeOut.setDuration(fadeOutDuration);

    AnimationSet animation = new AnimationSet(false); // change to false
    animation.addAnimation(fadeIn);
    animation.addAnimation(fadeOut);
    animation.setRepeatCount(1);
    imageView.setAnimation(animation);

    animation.setAnimationListener(
        new Animation.AnimationListener() {
          public void onAnimationEnd(Animation animation) {
            if (images.length - 1 > imageIndex) {
              animate(
                  imageView,
                  images,
                  imageIndex + 1,
                  forever); // Calls itself until it gets to the end of the array
            } else {
              if (forever == true) {
                animate(
                    imageView, images, 0,
                    forever); // Calls itself to start the animation all over again in a loop if
                // forever = true
              }
            }
          }

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

          public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub
          }
        });
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_android4_chapt08__example_04);
   objshow_CH08_EX04_ImageView01OBJ = (ImageView) findViewById(R.id.show_CH08_EX04_ImageView01);
   // ********** 設定動畫使用: 動畫設定檔 **************
   // *************************************************
   Animation objSetAnimationOBJ =
       AnimationUtils.loadAnimation(this, R.anim.activity_android4_chapt08__example_04_anim);
   objshow_CH08_EX04_ImageView01OBJ.setAnimation(objSetAnimationOBJ);
   objSetAnimationOBJ.startNow();
 }
  /**
   * Code from http://stackoverflow.com/a/10471479/3399351
   *
   * <p>Cycles through an array of images in one ImageView, sequentially fading them out and fading
   * the new photo in.
   *
   * @param imageView ImageView : The View which displays the images
   * @param images int[] : Holds R references to the images to display
   * @param imageIndex int : index of the first image to show in images[]
   * @param forever boolean : If equals true than it loops back to the first image
   */
  public static void animate(
      final ImageView imageView, final int images[], final int imageIndex, final boolean forever) {
    // TODO: Smooth fade between images instead of fade through white
    int fadeInDuration = 500; // Configure time values here
    int timeBetween = 5000;
    int fadeOutDuration = 1000;

    imageView.setVisibility(View.VISIBLE);
    // Visible or invisible by default - this will apply when the animation ends
    imageView.setImageResource(images[imageIndex]);

    // Initialize the fade in animation
    Animation fadeIn = new AlphaAnimation(0, 1);
    fadeIn.setInterpolator(new DecelerateInterpolator());
    fadeIn.setDuration(fadeInDuration);

    // Initialize the fade out animation
    Animation fadeOut = new AlphaAnimation(1, 0);
    fadeOut.setInterpolator(new AccelerateInterpolator());
    fadeOut.setStartOffset(fadeInDuration + timeBetween);
    fadeOut.setDuration(fadeOutDuration);

    // Apply the animation set
    AnimationSet animation = new AnimationSet(false);
    animation.addAnimation(fadeIn);
    animation.addAnimation(fadeOut);
    animation.setRepeatCount(1);
    imageView.setAnimation(animation);

    // Overriding this function causes the animations to loop
    animation.setAnimationListener(
        new Animation.AnimationListener() {
          public void onAnimationEnd(Animation animation) {
            if (images.length - 1 > imageIndex) {
              animate(imageView, images, imageIndex + 1, forever);
              // Calls itself until it gets to the end of the array
              if (forever) {
                animate(imageView, images, 0, forever);
                // Calls itself to start the animation
                // all over again in a loop, if forever = true
              }
            }
          }

          public void onAnimationRepeat(Animation animation) {}

          public void onAnimationStart(Animation animation) {}
        });
  }
Example #23
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.load_image);

    ImageView loadImage = (ImageView) findViewById(R.id.loadImage);

    // 透明度渐变动画
    AlphaAnimation alphaAnimation = new AlphaAnimation(1.0f, 1.0f); // 从微弱显示到完全显示
    // 动画时间
    alphaAnimation.setDuration(1500);
    // 将组件和动画进行关联
    loadImage.setAnimation(alphaAnimation);

    alphaAnimation.setAnimationListener(
        new AnimationListener() {

          // 动画开始
          @Override
          public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub
            // Toast.makeText(LoadActivity.this, "欢迎使用随手", Toast.LENGTH_SHORT).show();
            // NetWork.isNetworkAvailable(LoadActivity.this);

            // NetWork.setNetWork(LoadActivity.this);
          }

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

          }

          // 动画结束
          @Override
          public void onAnimationEnd(Animation animation) {
            // TODO Auto-generated method stub

            Intent mainIntent = new Intent(LoadActivity.this, MainActivity.class);
            startActivity(mainIntent);
            LoadActivity.this.finish();
          }
        });
  }
Example #24
0
  /**
   * 代码实现旋转的菊花效果
   *
   * @author [email protected] 2014-2-21 下午5:09:58
   * @param imageView 需要旋转的图片
   * @param drawable 旋转菊花
   * @return void
   */
  public static void startAnim(ImageView imageView, int drawable) {
    try {
      imageView.setScaleType(ImageView.ScaleType.CENTER);
      imageView.setImageResource(drawable);
      AnimationSet animationSet = new AnimationSet(false);
      RotateAnimation rotateAnimation =
          new RotateAnimation(
              0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
      rotateAnimation.setDuration(2000);
      rotateAnimation.setInterpolator(new LinearInterpolator());
      rotateAnimation.setRepeatMode(Animation.RESTART);
      rotateAnimation.setRepeatCount(Animation.INFINITE);
      animationSet.addAnimation(rotateAnimation);
      imageView.setAnimation(animationSet);
    } catch (Exception e) {

    }
  }
Example #25
0
 private void initAnimation() {
   // 设置扫描线动作
   ImageView mQrLineView = (ImageView) findViewById(R.id.activity_scan_code_capture_scan_line);
   TranslateAnimation mAnimation =
       new TranslateAnimation(
           Animation.ABSOLUTE,
           0f,
           Animation.ABSOLUTE,
           0f,
           Animation.RELATIVE_TO_PARENT,
           0f,
           Animation.RELATIVE_TO_PARENT,
           0.9f);
   mAnimation.setDuration(1500);
   mAnimation.setRepeatCount(-1);
   mAnimation.setRepeatMode(Animation.REVERSE);
   mAnimation.setInterpolator(new LinearInterpolator());
   mQrLineView.setAnimation(mAnimation);
 }
Example #26
0
  private void initAnimation() {
    AlphaAnimation alphaAnimation = new AlphaAnimation((float) 0.1, 1);
    alphaAnimation.setDuration(5000); // 设定动画时间
    alphaAnimation.setAnimationListener(
        new AnimationListener() {
          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationRepeat(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            mImage.setVisibility(View.GONE);
          }
        });

    mImage.setAnimation(alphaAnimation);
  }
Example #27
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.activity_logo);

    /*Animation分类:
    1. Alpha:        淡入淡出效果
    2.Scale:           缩放效果
    3.Rotate:        旋转效果
    4.Translate:移动效果*/
    ImageView imageView = (ImageView) findViewById(R.id.logo);
    AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1.0f);
    alphaAnimation.setDuration(2500); // 设置动画持续时间

    alphaAnimation.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) {
            // 动画结束后跳转到MainActivity
            Intent intent = new Intent(LogoActivity.this, MainActivity.class);
            startActivity(intent);
            LogoActivity.this.finish();
          }
        });
    imageView.setAnimation(alphaAnimation); // 使用控件对象(imageView)开始执行AnimationSet
  }
  public void setState(int state) {
    if (state == mState) return;

    if (state == STATE_REFRESHING) { // 显示进度
      mArrowImageView.clearAnimation();
      mArrowImageView.setVisibility(View.INVISIBLE);
      mProgressBar.setVisibility(View.VISIBLE);
      mProgressBar.setAnimation(mLoadingAni);
      mLoadingAni.startNow();
    } else { // 显示箭头图片
      mArrowImageView.setVisibility(View.VISIBLE);
      mProgressBar.setVisibility(View.GONE);
      mProgressBar.clearAnimation();
    }

    switch (state) {
      case STATE_NORMAL:
        if (mState == STATE_READY) {
          mArrowImageView.startAnimation(mRotateDownAnim);
        }
        if (mState == STATE_REFRESHING) {
          mArrowImageView.clearAnimation();
        }
        mHintTextView.setText(R.string.xlistview_header_hint_normal);
        break;
      case STATE_READY:
        if (mState != STATE_READY) {
          mArrowImageView.clearAnimation();
          mArrowImageView.startAnimation(mRotateUpAnim);
          mHintTextView.setText(R.string.xlistview_header_hint_ready);
        }
        break;
      case STATE_REFRESHING:
        mHintTextView.setText(R.string.xlistview_header_hint_loading);
        break;
      default:
    }

    mState = state;
  }
    private void animateIcon(final ItemTO itemTO, final ImageView imagem) {

      imagem.clearAnimation();
      imagem.setAnimation(animation1);
      imagem.startAnimation(animation1);

      Animation.AnimationListener animListner =
          new Animation.AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
              if (animation == animation1) {
                if (itemTO.getChecked()) {
                  imagem.setImageResource(R.drawable.ic_avatar);
                } else {
                  imagem.setImageResource(R.drawable.ic_checked);
                }
                imagem.clearAnimation();
                imagem.setAnimation(animation2);
                imagem.startAnimation(animation2);
              } else {
                if (itemTO.getChecked()) {
                  imagem.setImageResource(R.drawable.ic_checked);
                } else {
                  imagem.setImageResource(R.drawable.ic_avatar);
                }
              }
            }

            @Override
            public void onAnimationRepeat(Animation arg0) {}

            @Override
            public void onAnimationEnd(Animation arg0) {}
          };

      animation1.setAnimationListener(animListner);
      animation2.setAnimationListener(animListner);
    }
 protected void onCreate(Bundle paramBundle) {
   super.onCreate(paramBundle);
   setContentView(2130903114);
   setResult(-1, getIntent());
   paramBundle = (Button) findViewById(2131689715);
   paramBundle.setVisibility(0);
   paramBundle.setOnClickListener(
       new View.OnClickListener() {
         public void onClick(View paramAnonymousView) {
           finish();
         }
       });
   paramBundle = getWindow().getAttributes();
   width = -1;
   getWindow().setAttributes(paramBundle);
   b = ((RelativeLayout) findViewById(2131689908));
   c = ((ImageView) findViewById(2131689907));
   if (c != null) {
     paramBundle = new AnimationSet(false);
     paramBundle.addAnimation(AnimationUtils.loadAnimation(this, 2130968607));
     paramBundle.addAnimation(AnimationUtils.loadAnimation(this, 2130968601));
     c.setAnimation(paramBundle);
   }
   d = ((TextView) findViewById(2131689906));
   e = findViewById(2131689909);
   paramBundle = (ViewStub) findViewById(2131689904);
   TypedValue localTypedValue = new TypedValue();
   getTheme().resolveAttribute(2130772156, localTypedValue, true);
   paramBundle.setLayoutResource(resourceId);
   paramBundle.inflate();
   a = findViewById(2131689905);
   paramBundle = new TypedValue();
   getTheme().resolveAttribute(2130772155, paramBundle, true);
   if (resourceId != 0) {
     setTitle(resourceId);
   }
 }