/**
   * 初始化
   *
   * @param context context
   */
  private void init(Context context) {
    mHeaderContainer = (RelativeLayout) findViewById(R.id.pull_to_refresh_header_content);
    mArrowImageView = (ImageView) findViewById(R.id.pull_to_refresh_header_arrow);
    mHintTextView = (TextView) findViewById(R.id.pull_to_refresh_header_hint_textview);
    mHeaderTimeView = (TextView) findViewById(R.id.pull_to_refresh_header_time);
    mHeaderTimeViewTitle = (TextView) findViewById(R.id.pull_to_refresh_last_update_time_text);

    mArrowImageView.setScaleType(ScaleType.CENTER);
    mArrowImageView.setImageResource(R.drawable.default_ptr_rotate);

    float pivotValue = 0.5f; // SUPPRESS CHECKSTYLE
    float toDegree = 720.0f; // SUPPRESS CHECKSTYLE
    mRotateAnimation =
        new RotateAnimation(
            0.0f,
            toDegree,
            Animation.RELATIVE_TO_SELF,
            pivotValue,
            Animation.RELATIVE_TO_SELF,
            pivotValue);
    mRotateAnimation.setFillAfter(true);
    mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
  }
  private void initView(Context context) {
    // 初始情况,设置下拉刷新view高度为0
    LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, 0);
    mContainer =
        (LinearLayout) LayoutInflater.from(context).inflate(R.layout.xlistview_header, null);
    addView(mContainer, lp);
    setGravity(Gravity.BOTTOM);

    mArrowImageView = (ImageView) findViewById(R.id.xlistview_header_arrow);
    mHintTextView = (TextView) findViewById(R.id.xlistview_header_hint_textview);
    mProgressBar = (ImageView) findViewById(R.id.xlistview_header_progressbar);
    mProgressBar.setVisibility(View.GONE);

    mRotateUpAnim =
        new RotateAnimation(
            0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateUpAnim.setFillAfter(true);
    mRotateDownAnim =
        new RotateAnimation(
            -180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
    mRotateDownAnim.setFillAfter(true);

    mLoadingAni =
        new RotateAnimation(
            0f, 359f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mLoadingAni.setDuration(1000);
    mLoadingAni.setRepeatCount(Animation.INFINITE);
    mLoadingAni.setRepeatMode(Animation.RESTART);
    mLoadingAni.setInterpolator(new LinearInterpolator());
  }
  // para animar el imageButton
  public void startAnimation(ImageView ivDH) {

    Animation rotateAnim = new RotateAnimation(0, 360);
    rotateAnim.setDuration(5000);
    rotateAnim.setRepeatCount(1);
    rotateAnim.setInterpolator(new AccelerateInterpolator());
    rotateAnim.setRepeatMode(Animation.REVERSE);
    ivDH.startAnimation(rotateAnim);
  }
  public Animation getBlinkAnimation() {
    Animation animation = new AlphaAnimation(1, 0); // Change alpha from fully visible to invisible
    animation.setDuration(600); // duration - half a second
    animation.setInterpolator(new LinearInterpolator()); // do not alter animation rate
    animation.setRepeatCount(Animation.INFINITE); // Repeat animation infinitely
    animation.setRepeatMode(
        Animation.REVERSE); // Reverse animation at the end so the button will fade back in

    return animation;
  }
 public void balance() {
   Animation an =
       new RotateAnimation(
           0,
           -1 * parent.get_pinnded_childs_rotation_angle(),
           this.getHeight() / 2,
           this.getWidth() / 2);
   an.setDuration(300); // duration in ms
   an.setRepeatCount(0); // -1 = infinite repeated
   an.setRepeatMode(Animation.REVERSE); // reverses each repeat
   an.setFillAfter(true);
   this.setAnimation(an);
 }
 private void setupAnimations() {
   mAnimation =
       new Animation() {
         @Override
         public void applyTransformation(float interpolatedTime, Transformation t) {
           setRotate(interpolatedTime);
         }
       };
   mAnimation.setRepeatCount(Animation.INFINITE);
   mAnimation.setRepeatMode(Animation.RESTART);
   mAnimation.setInterpolator(LINEAR_INTERPOLATOR);
   mAnimation.setDuration(ANIMATION_DURATION);
 }
  @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;
  }
  /** 初始化 */
  public void init() {
    baseGestureLockView = (BaseGestureLockView) findViewById(R.id.gestureLockView);
    gesture_set_textview = (TextView) findViewById(R.id.gesture_set_textview);
    animation = new TranslateAnimation(-20, 20, 0, 0);
    animation.setDuration(50);
    animation.setRepeatCount(2);
    animation.setRepeatMode(Animation.REVERSE);
    TextView login_by_text = (TextView) findViewById(R.id.login_by_text);
    login_by_text.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            // TODO 自动生成的方法存根
            Intent intent2 = new Intent();
            intent2.setClass(mContext, BaseLoginActivity.class);
            startActivity(intent2);
            finish();
          }
        });

    //
    final String handPassword = SharePreferenceUtil.getString(mContext, "handpassword", "");
    final String loginName = SharePreferenceUtil.getString(mContext, "loginName", "");
    final String password = SharePreferenceUtil.getString(mContext, "password", "");

    // 设置密码
    baseGestureLockView.setKey(handPassword);
    // 手势完成后回调
    baseGestureLockView.setOnGestureFinishListener(
        new OnGestureFinishListener() {
          @Override
          public void OnGestureFinish(boolean success, String key) {
            baseGestureLockView.clearPassWord();
            if (success) {

              mdialog = UtilsTool.initProgressDialog(mContext, "请稍等.....");
              mdialog.show();
              UserLoginResult userloginresult = new UserLoginResult();
              userloginresult.execute(mdialog, loginName, password);

            } else {
              gesture_set_textview.setTextColor(Color.parseColor("#FF2525"));
              gesture_set_textview.setVisibility(View.VISIBLE);
              gesture_set_textview.setText("密码错误!");
              gesture_set_textview.startAnimation(animation);
            }
          }
        });
  }
  private void setStartMode(Animation animation) {
    String repeat = (String) repeatModes.getSelectedItem();

    switch (repeat) {
      case "restart":
        animation.setRepeatCount(1);
        break;
      case "infinite":
        animation.setRepeatCount(Animation.INFINITE);
        break;
      case "reverse":
        animation.setRepeatMode(Animation.REVERSE);
        animation.setRepeatCount(1);
        break;
    }
  }
  public RotateLoadingLayout(
      Context context, Mode mode, Orientation scrollDirection, TypedArray attrs) {
    super(context, mode, scrollDirection, attrs);

    mRotateDrawableWhilePulling =
        attrs.getBoolean(R.styleable.PullToRefresh_ptrRotateDrawableWhilePulling, true);

    mHeaderImage.setScaleType(ScaleType.MATRIX);
    mHeaderImageMatrix = new Matrix();
    mHeaderImage.setImageMatrix(mHeaderImageMatrix);

    mRotateAnimation =
        new RotateAnimation(
            0, 720, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    mRotateAnimation.setInterpolator(ANIMATION_INTERPOLATOR);
    mRotateAnimation.setDuration(ROTATION_ANIMATION_DURATION);
    mRotateAnimation.setRepeatCount(Animation.INFINITE);
    mRotateAnimation.setRepeatMode(Animation.RESTART);
  }
  private void setupAnimators() {
    final Ring ring = mRing;
    final Animation animation =
        new Animation() {
          @Override
          public void applyTransformation(float interpolatedTime, Transformation t) {
            if (mFinishing) {
              applyFinishTranslation(interpolatedTime, ring);
            } else {
              // The minProgressArc is calculated from 0 to create an
              // angle that
              // matches the stroke width.
              final float minProgressArc =
                  (float)
                      Math.toRadians(
                          ring.getStrokeWidth() / (2 * Math.PI * ring.getCenterRadius()));
              final float startingEndTrim = ring.getStartingEndTrim();
              final float startingTrim = ring.getStartingStartTrim();
              final float startingRotation = ring.getStartingRotation();

              // Offset the minProgressArc to where the endTrim is
              // located.
              final float minArc = MAX_PROGRESS_ARC - minProgressArc;
              final float endTrim =
                  startingEndTrim
                      + (minArc * START_CURVE_INTERPOLATOR.getInterpolation(interpolatedTime));
              ring.setEndTrim(endTrim);

              final float startTrim =
                  startingTrim
                      + (MAX_PROGRESS_ARC
                          * END_CURVE_INTERPOLATOR.getInterpolation(interpolatedTime));
              ring.setStartTrim(startTrim);

              final float rotation = startingRotation + (0.25f * interpolatedTime);
              ring.setRotation(rotation);

              float groupRotation =
                  ((720.0f / NUM_POINTS) * interpolatedTime)
                      + (720.0f * (mRotationCount / NUM_POINTS));
              setRotation(groupRotation);
            }
          }
        };
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.RESTART);
    animation.setInterpolator(LINEAR_INTERPOLATOR);
    animation.setAnimationListener(
        new Animation.AnimationListener() {

          @Override
          public void onAnimationStart(Animation animation) {
            mRotationCount = 0;
          }

          @Override
          public void onAnimationEnd(Animation animation) {
            // do nothing
          }

          @Override
          public void onAnimationRepeat(Animation animation) {
            ring.storeOriginals();
            ring.goToNextColor();
            ring.setStartTrim(ring.getEndTrim());
            if (mFinishing) {
              // finished closing the last ring from the swipe gesture; go
              // into progress mode
              mFinishing = false;
              animation.setDuration(ANIMATION_DURATION);
              ring.setShowArrow(false);
            } else {
              mRotationCount = (mRotationCount + 1) % (NUM_POINTS);
            }
          }
        });
    mAnimation = animation;
  }
  public MaterialProgressDrawable(Context paramContext, View paramView) {
    this.mParent = paramView;
    this.mResources = paramContext.getResources();
    this.mRing = new Ring(this.mCallback);
    this.mRing.setColors(this.COLORS);
    updateSizes(1);
    final Ring localRing = this.mRing;
    Animation local1 =
        new Animation() {
          public final void applyTransformation(
              float paramAnonymousFloat, Transformation paramAnonymousTransformation) {
            if (MaterialProgressDrawable.this.mFinishing) {
              MaterialProgressDrawable.access$000(
                  MaterialProgressDrawable.this, paramAnonymousFloat, localRing);
              return;
            }
            float f1 = MaterialProgressDrawable.access$100$6f9943cf(localRing);
            float f2 = localRing.mStartingEndTrim;
            float f3 = localRing.mStartingStartTrim;
            float f4 = localRing.mStartingRotation;
            MaterialProgressDrawable.updateRingColor(
                MaterialProgressDrawable.this, paramAnonymousFloat, localRing);
            if (paramAnonymousFloat <= 0.5F) {
              float f10 = paramAnonymousFloat / 0.5F;
              float f11 =
                  f3
                      + (0.8F - f1)
                          * MaterialProgressDrawable.MATERIAL_INTERPOLATOR.getInterpolation(f10);
              localRing.setStartTrim(f11);
            }
            if (paramAnonymousFloat > 0.5F) {
              float f7 = 0.8F - f1;
              float f8 = (paramAnonymousFloat - 0.5F) / 0.5F;
              float f9 =
                  f2 + f7 * MaterialProgressDrawable.MATERIAL_INTERPOLATOR.getInterpolation(f8);
              localRing.setEndTrim(f9);
            }
            float f5 = f4 + 0.25F * paramAnonymousFloat;
            localRing.setRotation(f5);
            float f6 =
                216.0F * paramAnonymousFloat
                    + 1080.0F * (MaterialProgressDrawable.this.mRotationCount / 5.0F);
            MaterialProgressDrawable.this.setRotation(f6);
          }
        };
    local1.setRepeatCount(-1);
    local1.setRepeatMode(1);
    local1.setInterpolator(LINEAR_INTERPOLATOR);
    local1.setAnimationListener(
        new Animation.AnimationListener() {
          public final void onAnimationEnd(Animation paramAnonymousAnimation) {}

          public final void onAnimationRepeat(Animation paramAnonymousAnimation) {
            localRing.storeOriginals();
            MaterialProgressDrawable.Ring localRing = localRing;
            localRing.setColorIndex(localRing.getNextColorIndex());
            localRing.setStartTrim(localRing.mEndTrim);
            if (MaterialProgressDrawable.this.mFinishing) {
              MaterialProgressDrawable.this.mFinishing = false;
              paramAnonymousAnimation.setDuration(1332L);
              localRing.setShowArrow(false);
              return;
            }
            MaterialProgressDrawable.access$402(
                MaterialProgressDrawable.this,
                (1.0F + MaterialProgressDrawable.this.mRotationCount) % 5.0F);
          }

          public final void onAnimationStart(Animation paramAnonymousAnimation) {
            MaterialProgressDrawable.access$402(MaterialProgressDrawable.this, 0.0F);
          }
        });
    this.mAnimation = local1;
  }
  private void setupAnimators() {
    final Ring ring = mRing;
    final Animation finishRingAnimation =
        new Animation() {
          public void applyTransformation(float interpolatedTime, Transformation t) {
            // shrink back down and complete a full rotation before starting other circles
            // Rotation goes between [0..1].
            float targetRotation =
                (float) (Math.floor(ring.getStartingRotation() / MAX_PROGRESS_ARC) + 1f);
            final float startTrim =
                ring.getStartingStartTrim()
                    + (ring.getStartingEndTrim() - ring.getStartingStartTrim()) * interpolatedTime;
            ring.setStartTrim(startTrim);
            final float rotation =
                ring.getStartingRotation()
                    + ((targetRotation - ring.getStartingRotation()) * interpolatedTime);
            ring.setRotation(rotation);
            ring.setArrowScale(1 - interpolatedTime);
          }
        };
    finishRingAnimation.setInterpolator(EASE_INTERPOLATOR);
    finishRingAnimation.setDuration(ANIMATION_DURATION / 2);
    finishRingAnimation.setAnimationListener(
        new Animation.AnimationListener() {

          @Override
          public void onAnimationStart(Animation animation) {}

          @Override
          public void onAnimationEnd(Animation animation) {
            ring.goToNextColor();
            ring.storeOriginals();
            ring.setShowArrow(false);
            mParent.startAnimation(mAnimation);
          }

          @Override
          public void onAnimationRepeat(Animation animation) {}
        });
    final Animation animation =
        new Animation() {
          @Override
          public void applyTransformation(float interpolatedTime, Transformation t) {
            // The minProgressArc is calculated from 0 to create an angle that
            // matches the stroke width.
            final float minProgressArc =
                (float)
                    Math.toRadians(ring.getStrokeWidth() / (2 * Math.PI * ring.getCenterRadius()));
            final float startingEndTrim = ring.getStartingEndTrim();
            final float startingTrim = ring.getStartingStartTrim();
            final float startingRotation = ring.getStartingRotation();

            // Offset the minProgressArc to where the endTrim is located.
            final float minArc = MAX_PROGRESS_ARC - minProgressArc;
            final float endTrim =
                startingEndTrim
                    + (minArc * START_CURVE_INTERPOLATOR.getInterpolation(interpolatedTime));
            ring.setEndTrim(endTrim);

            final float startTrim =
                startingTrim
                    + (MAX_PROGRESS_ARC
                        * END_CURVE_INTERPOLATOR.getInterpolation(interpolatedTime));
            ring.setStartTrim(startTrim);

            final float rotation = startingRotation + (0.25f * interpolatedTime);
            ring.setRotation(rotation);

            float groupRotation =
                ((720.0f / NUM_POINTS) * interpolatedTime)
                    + (720.0f * (mRotationCount / NUM_POINTS));
            setRotation(groupRotation);
          }
        };
    animation.setRepeatCount(Animation.INFINITE);
    animation.setRepeatMode(Animation.RESTART);
    animation.setInterpolator(LINEAR_INTERPOLATOR);
    animation.setDuration(ANIMATION_DURATION);
    animation.setAnimationListener(
        new Animation.AnimationListener() {

          @Override
          public void onAnimationStart(Animation animation) {
            mRotationCount = 0;
          }

          @Override
          public void onAnimationEnd(Animation animation) {
            // do nothing
          }

          @Override
          public void onAnimationRepeat(Animation animation) {
            ring.storeOriginals();
            ring.goToNextColor();
            ring.setStartTrim(ring.getEndTrim());
            mRotationCount = (mRotationCount + 1) % (NUM_POINTS);
          }
        });
    mFinishAnimation = finishRingAnimation;
    mAnimation = animation;
  }
Exemple #14
0
    @Override
    protected void onPostExecute(Void result) {
      vBody = textResult.split("<body>");
      for (int i = 0; i < vBody.length; i++) {
        if (i == 1) {
          auxcad = vBody[1];
          vBr = auxcad.split("<br>");
        }
      }
      if (vBr.length >= 4) {

        for (int j = 0; j < 8; j++) {
          if (j == 0) {
            v2p = vBr[j].split(":");

            scodqr = v2p[1];
          } else if (j == 1) {
            v2p = vBr[j].split(":");
            cConcepto = v2p[1];
            byte[] bytes = new byte[] {};
            try {
              bytes = cConcepto.getBytes("UTF-8");
            } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
            }
            try {
              cConcepto = new String(bytes, "UTF-8");
            } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
            }

            sconcepto = cConcepto;
          } else if (j == 2) {
            v2p = vBr[j].split(":");
            cCanal = v2p[1];
          } else if (j == 3) {
            v2p = vBr[j].split(":");

            if (v2p.length > 2) {
              cResumen = v2p[1] + ":" + v2p[2];
            }
          } else if (j == 4) {
            v2p = vBr[j].split(":");

            if (v2p.length > 2) {
              cDDetallada = v2p[1] + ":" + v2p[2];
            }
          } else if (j == 5) {
            v2p = vBr[j].split(":");

            if (v2p.length > 2) {
              cImagen = v2p[1] + ":" + v2p[2];

              imgManager.fetchDrawableOnThread(cImagen, img);
            }
          }
        }

        masinf.setVisibility(Button.VISIBLE);
        ira.setVisibility(Button.VISIBLE);
        Animation mAnimation = new AlphaAnimation(1, 0);
        mAnimation.setDuration(400);
        mAnimation.setInterpolator(new LinearInterpolator());
        mAnimation.setRepeatCount(Animation.INFINITE);
        mAnimation.setRepeatMode(Animation.REVERSE);
        masinf.startAnimation(mAnimation);
        ira.startAnimation(mAnimation);

        mAnimation.setRepeatCount(3);

        if (!cURL.equals("")) {
          // new LeeConceptoTexto().execute(cURL);
        } else {
          tv2.setText("Estás en: " + "\n" + cConcepto);
        }
        if (!cResumen.equals("")) {
          new LeeResumenTexto().execute(cResumen);
        } else {
          tv3.setText("No se encontró información asociada al resumen");
        }

      } else {

        tv3.setText("No se encontró información");
      }
      Dialog.dismiss();
      super.onPostExecute(result);
    }