예제 #1
0
  public void startTextAnimation() {

    mTxtTitle.setText(mConfigSplash.getTitleSplash());
    mSubTxtTitle.setText(mConfigSplash.getSubTitleSplash());
    mTxtTitle.setTextSize(mConfigSplash.getTitleTextSize());
    mTxtTitle.setTextColor(getResources().getColor(mConfigSplash.getTitleTextColor()));
    if (!mConfigSplash.getTitleFont().isEmpty()) setFont(mConfigSplash.getTitleFont());

    if (!mConfigSplash.getSubTitleFont().isEmpty()) setSubFont(mConfigSplash.getSubTitleFont());

    RelativeLayout.LayoutParams params =
        new RelativeLayout.LayoutParams(
            RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.BELOW, R.id.flCentral);
    params.addRule(RelativeLayout.CENTER_HORIZONTAL);
    mTxtTitle.setLayoutParams(params);
    mTxtTitle.setVisibility(View.VISIBLE);
    mSubTxtTitle.setVisibility(View.VISIBLE);
    YoYo.with(mConfigSplash.getAnimTitleTechnique())
        .withListener(
            new Animator.AnimatorListener() {
              @Override
              public void onAnimationStart(Animator animation) {}

              @Override
              public void onAnimationEnd(Animator animation) {
                animationsFinished();
              }

              @Override
              public void onAnimationCancel(Animator animation) {}

              @Override
              public void onAnimationRepeat(Animator animation) {}
            })
        .duration(mConfigSplash.getAnimTitleDuration())
        .playOn(mTxtTitle);

    YoYo.with(mConfigSplash.getAnimTitleTechnique())
        .withListener(
            new Animator.AnimatorListener() {
              @Override
              public void onAnimationStart(Animator animation) {}

              @Override
              public void onAnimationEnd(Animator animation) {
                animationsFinished();
              }

              @Override
              public void onAnimationCancel(Animator animation) {}

              @Override
              public void onAnimationRepeat(Animator animation) {}
            })
        .duration(mConfigSplash.getAnimTitleDuration())
        .playOn(mSubTxtTitle);
  }
예제 #2
0
 @UiThread
 void showAnimation(View view) {
   if (view.getVisibility() == View.INVISIBLE) {
     view.setVisibility(View.VISIBLE);
     YoYo.with(Techniques.Landing).duration(300).playOn(view);
   }
 }
예제 #3
0
 public void clear(int i) {
   switch (i) {
     case 0:
       button0.setChecked(false);
       break;
     case 1:
       button1.setChecked(false);
       break;
     case 2:
       button2.setChecked(false);
       break;
     case 3:
       button3.setChecked(false);
       break;
     case 4:
       YoYo.with(Techniques.Shake).duration(700).playOn(ly);
       button0.setChecked(false);
       button1.setChecked(false);
       button2.setChecked(false);
       button3.setChecked(false);
       break;
     default:
       break;
   }
 }
  @Override
  public void onBindViewHolder(MyViewHolder myViewHolder, int position) {

    myViewHolder.tvModel.setText(mList.get(position).getModel());
    myViewHolder.tvBrand.setText(mList.get(position).getBrand());

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      myViewHolder.ivCar.setImageResource(mList.get(position).getPhoto());
    } else {
      Bitmap bitmap =
          BitmapFactory.decodeResource(mContext.getResources(), mList.get(position).getPhoto());
      bitmap = Bitmap.createScaledBitmap(bitmap, width, height, false);

      bitmap =
          ImageHelper.getRoundedCornerBitmap(
              mContext, bitmap, 4, width, height, false, false, true, true);
      myViewHolder.ivCar.setImageBitmap(bitmap);
    }

    if (withAnimation) {
      try {
        YoYo.with(Techniques.Tada).duration(700).playOn(myViewHolder.itemView);
      } catch (Exception e) {
      }
    }
  }
예제 #5
0
  private void FeedBack() {
    String Content = mEd_Content.getText().toString();
    String Contact = mEd_Contact.getText().toString();

    if (TextUtils.isEmpty(Content)) {
      YoYo.with(Techniques.Shake).playOn(mEd_Content);
      showShortToast("反馈内容不能为空");
      return;
    }
    if (TextUtils.isEmpty(Contact)) {
      YoYo.with(Techniques.Shake).playOn(mEd_Contact);
      showShortToast("联系方式不能为空");
      return;
    }
    new RequestTask(this, ReturnAL.FeedBack(Content, Contact), listener, false, true, "数据提交中")
        .execute(Httpurl.URL);
  }
 @Override
 public void onPatternDetected(List<Cell> pattern) {
   mPasswordView.post(mClearPatternRunnable);
   if (TextUtils.isEmpty(password)) {
     password = LockPatternUtils.patternToString(pattern);
     mTVDrawPattern.setText(R.string.try_again);
   } else if (TextUtils.equals(password, LockPatternUtils.patternToString(pattern))) {
     mBtnDone.setEnabled(true);
   } else {
     mTVDrawPattern.setText(R.string.password_not_equal);
     YoYo.with(Techniques.Shake).duration(1000).playOn(mTVDrawPattern);
   }
 }
예제 #7
0
 public void set(int i) {
   switch (i) {
     case 0:
       button0.setChecked(true);
       YoYo.with(Techniques.Bounce).delay(0).duration(1000).playOn(button0);
       break;
     case 1:
       button1.setChecked(true);
       YoYo.with(Techniques.Bounce).delay(0).duration(1000).playOn(button1);
       break;
     case 2:
       button2.setChecked(true);
       YoYo.with(Techniques.Bounce).delay(0).duration(1000).playOn(button2);
       break;
     case 3:
       button3.setChecked(true);
       YoYo.with(Techniques.Bounce).delay(0).duration(1000).playOn(button3);
       break;
     default:
       break;
   }
 }
예제 #8
0
  @Override
  public void onBindViewHolder(MyViewHolder viewHolder, int position) {
    viewHolder.imagem.setImageResource(listaMotos.get(position).getFoto());
    viewHolder.modelo.setText(listaMotos.get(position).getModelo());
    viewHolder.marca.setText(listaMotos.get(position).getMarca());

    // Evento
    try {
      YoYo.with(Techniques.Tada).duration(700).playOn(viewHolder.itemView);

    } catch (Exception e) {

    }
  }
 /**
  * Checks the username and password edit boxes for valid entries, if not valid, does an animation
  * hint ont he invalid view using YoYo
  *
  * @return true if both edit texts are valid, false if not valid
  */
 private boolean _isInputValid(
     EditText usernameField, EditText passwordField, RadioGroup institutionRadio) {
   if (usernameField != null && passwordField != null && institutionRadio != null) {
     String usernameInput = usernameField.getText().toString();
     String passwordInput = passwordField.getText().toString();
     int institutionInput = institutionRadio.getCheckedRadioButtonId();
     boolean inputValid = true;
     if (usernameInput.trim().isEmpty()) {
       YoYo.with(Techniques.Shake).duration(1000).playOn(usernameField);
       inputValid = false;
     }
     if (passwordInput.trim().isEmpty()) {
       YoYo.with(Techniques.Shake).delay(100).duration(900).playOn(passwordField);
       inputValid = false;
     }
     if (institutionInput < 0) {
       YoYo.with(Techniques.Shake).delay(200).duration(800).playOn(institutionRadio);
       inputValid = false;
     }
     return inputValid;
   }
   return false;
 }
예제 #10
0
  private boolean checkParams() {
    boolean result = false;
    if (null != mQuestion.getTitle()
        && TOPIC_LENGTH_MIN <= mQuestion.getTitle().trim().length()
        && TOPIC_LENGTH_MAX >= mQuestion.getTitle().trim().length()) {
      if (null != mQuestion.getAnswerOne()
          && OPTION_LENGTH_MIN <= mQuestion.getAnswerOne().trim().length()
          && OPTION_LENGTH_MAX >= mQuestion.getAnswerOne().trim().length()) {
        if (mQuestion.getQuestionType().equals("judge")) {
          if (mQuestion.getAnswerOne().equals(getString(R.string.wrong))
              || mQuestion.getAnswerOne().equals(getString(R.string.correct))) {
            return true;
          } else {
            option_a.getEditText().requestFocus();
            YoYo.with(Techniques.Shake).playOn(option_a);
            return false;
          }
        } else {
          if (null != mQuestion.getAnswerTwo()
              && OPTION_LENGTH_MIN <= mQuestion.getAnswerTwo().trim().length()
              && TOPIC_LENGTH_MAX >= mQuestion.getAnswerTwo().trim().length()) {
            if (null != mQuestion.getAnswerThree()
                && OPTION_LENGTH_MIN <= mQuestion.getAnswerThree().trim().length()
                && TOPIC_LENGTH_MAX >= mQuestion.getAnswerThree().trim().length()) {
              if (null != mQuestion.getAnswerFour()
                  && OPTION_LENGTH_MIN <= mQuestion.getAnswerFour().trim().length()
                  && TOPIC_LENGTH_MAX >= mQuestion.getAnswerFour().trim().length()) {
                result = true;
              } else {
                // D
                option_d.getEditText().requestFocus();
                YoYo.with(Techniques.Shake).playOn(option_d);
              }
            } else {
              // C
              option_c.getEditText().requestFocus();
              YoYo.with(Techniques.Shake).playOn(option_c);
            }
          } else {
            // B
            option_b.getEditText().requestFocus();
            YoYo.with(Techniques.Shake).playOn(option_b);
          }
        }
      } else {
        // 答案A长度不正确
        option_a.getEditText().requestFocus();
        YoYo.with(Techniques.Shake).playOn(option_a);
      }

    } else {
      // 标题长度不正确
      topic.getEditText().requestFocus();
      YoYo.with(Techniques.Shake).playOn(topic);
    }
    return result;
  }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View v = convertView;
      if (v == null) {
        LayoutInflater i =
            (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        v = i.inflate(R.layout.sponsors_row, parent, false);
      }

      YoYo.with(Techniques.FlipInX).duration(700).playOn(v.findViewById(R.id.img_sponsors));

      ImageView i = (ImageView) v.findViewById(R.id.img_sponsors);
      i.setImageResource(imageArray[position]);

      return v;
    }
  private boolean validaForm() {

    String nome = editNome.getText().toString();
    String data = editData.getText().toString();
    String email = editEmail.getText().toString();
    String endereco = editEndereco.getText().toString();
    String senha = editSenha.getText().toString();
    String confirmaSenha = editConfirmarSenha.getText().toString();
    boolean error = false;

    if (TextUtils.isEmpty(nome)) {
      editNome.setError(getString(R.string.required_nome));
      error = true;
      YoYo.with(Techniques.Shake).duration(300).playOn(editNome);
    }

    if (TextUtils.isEmpty(data)) {
      editData.setError(getString(R.string.required_data_nascimento));
      error = true;
      YoYo.with(Techniques.Shake).duration(300).playOn(editData);
    }

    if (TextUtils.isEmpty(email)) {
      editEmail.setError(getString(R.string.required_email));
      error = true;
      YoYo.with(Techniques.Shake).duration(300).playOn(editEmail);
    }

    if (TextUtils.isEmpty(endereco)) {
      editEndereco.setError(getString(R.string.required_endereco));
      error = true;
      YoYo.with(Techniques.Shake).duration(300).playOn(editEndereco);
    }

    if (TextUtils.isEmpty(senha)) {
      editSenha.setError(getString(R.string.required_senha));
      YoYo.with(Techniques.Shake).duration(300).playOn(editSenha);
      error = true;
    }

    if (TextUtils.isEmpty(confirmaSenha)) {
      editConfirmarSenha.setError(getString(R.string.required_confirmacao_senha));
      YoYo.with(Techniques.Shake).duration(300).playOn(editConfirmarSenha);
      error = true;
    }

    if (!TextUtils.isEmpty(senha)
        && !TextUtils.isEmpty(confirmaSenha)
        && !senha.equals(confirmaSenha)) {
      editConfirmarSenha.setError(getString(R.string.confirmacao_senha_errada));
      error = true;
    }

    return error;
  }
예제 #13
0
  public void startLogoAnimation() {
    mImgLogo.setVisibility(View.VISIBLE);
    mImgLogo.setImageResource(mConfigSplash.getLogoSplash());

    YoYo.with(mConfigSplash.getAnimLogoSplashTechnique())
        .withListener(
            new Animator.AnimatorListener() {
              @Override
              public void onAnimationStart(Animator animation) {}

              @Override
              public void onAnimationEnd(Animator animation) {
                startTextAnimation();
              }

              @Override
              public void onAnimationCancel(Animator animation) {}

              @Override
              public void onAnimationRepeat(Animator animation) {}
            })
        .duration(mConfigSplash.getAnimLogoSplashDuration())
        .playOn(mImgLogo);
  }
예제 #14
0
  @UiThread
  void hideAnimation(final View view) {
    if (view.getVisibility() == View.VISIBLE) {
      YoYo.with(Techniques.TakingOff)
          .duration(300)
          .withListener(
              new Animator.AnimatorListener() {
                @Override
                public void onAnimationStart(Animator animation) {}

                @Override
                public void onAnimationEnd(Animator animation) {
                  view.setVisibility(View.INVISIBLE);
                }

                @Override
                public void onAnimationCancel(Animator animation) {}

                @Override
                public void onAnimationRepeat(Animator animation) {}
              })
          .playOn(view);
    }
  }
예제 #15
0
  @Override
  protected void initView(Bundle savedInstanceState) {
    leftAdapter = new BluetoothDeviceAdapter(this);
    rightAdapter = new BluetoothDeviceAdapter(this);
    mViewHolder.r(R.id.leftRecyclerView).setAdapter(leftAdapter);
    mViewHolder.r(R.id.rightRecyclerView).setAdapter(rightAdapter);

    fixRecyclerViewWidth(mViewHolder.r(R.id.leftRecyclerView));
    fixRecyclerViewWidth(mViewHolder.r(R.id.rightRecyclerView));

    // test drawable
    //        mViewHolder.v(R.id.supportBluetoothView).setBackground(new CircleAnimDrawable());
    mViewHolder
        .v(R.id.leftButtonView)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                v.setBackground(
                    new CircleAnimDrawable(BluetoothDemoActivity.this)
                        .setPosition(CircleAnimDrawable.POS_LEFT));

                textTextClock();
              }
            });
    //        mViewHolder.v(R.id.centerButtonView).setOnClickListener(new View.OnClickListener() {
    //            @Override
    //            public void onClick(View v) {
    //                v.setBackground(new
    // CircleAnimDrawable().setPosition(CircleAnimDrawable.POS_CENTER));
    //            }
    //        });
    mViewHolder
        .v(R.id.centerButtonView)
        .setBackground(new CircleAnimDrawable(this).setPosition(CircleAnimDrawable.POS_CENTER));
    mViewHolder
        .v(R.id.rightButtonView)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                v.setBackground(
                    new CircleAnimDrawable(BluetoothDemoActivity.this)
                        .setPosition(CircleAnimDrawable.POS_RIGHT));
              }
            });

    mViewHolder
        .v(R.id.leftRadioView)
        .setBackground(createRadioBackground(CircleAnimDrawable.POS_LEFT));
    mViewHolder
        .v(R.id.centerRadioView)
        .setBackground(createRadioBackground(CircleAnimDrawable.POS_CENTER));
    mViewHolder
        .v(R.id.rightRadioView)
        .setBackground(createRadioBackground(CircleAnimDrawable.POS_RIGHT));

    YoYo.with(Techniques.Landing).delay(300).playOn(mViewHolder.v(R.id.centerButtonView));

    // TextClock测试
    //        textTextClock();
  }
        public void run() {
          YoYo.with(Techniques.Bounce).duration(800).playOn(rewardRateTextView);

          handler.postDelayed(this, 1000); // postDelayed(this,1000)方法安排一个Runnable对象到主线程队列中
        }
예제 #17
0
        @Override
        public void onClick(DialogPlus dialogPlus, View view) {
          int id = view.getId();

          switch (id) {
            case R.id.btn_login:
              boolean err = false;
              View holder = dialogPlus.getHolderView();

              EditText edPinNovo = (EditText) holder.findViewById(R.id.edPinNovo);
              EditText edPinAtual = (EditText) holder.findViewById(R.id.edPinAtual);
              EditText edPinRedigitar = (EditText) holder.findViewById(R.id.edPinRedigitar);

              String pinNovo = edPinNovo.getText().toString();
              String pinAtual = edPinAtual.getText().toString();
              String pinRedigitar = edPinRedigitar.getText().toString();

              if (pinNovo.equals("") || pinNovo.length() < 4) {
                vibrator.vibrate(200);
                YoYo.with(Techniques.Shake).duration(500).playOn(edPinNovo);
                err = true;
              }
              if (pinAtual.equals("") || pinNovo.length() < 4) {
                vibrator.vibrate(200);
                YoYo.with(Techniques.Shake).duration(500).playOn(edPinAtual);
                err = true;
              }

              if (!pinAtual.equals(AndroidSystemUtil.getPinCode(context)) || pinNovo.length() < 4) {
                YoYo.with(Techniques.Shake).duration(500).playOn(edPinRedigitar);

                Toast.makeText(context, "Codigo PIN Incorreto.", Toast.LENGTH_LONG).show();

                err = true;
              } else if (!pinRedigitar.equals(pinNovo)) {
                YoYo.with(Techniques.Shake).duration(500).playOn(edPinRedigitar);

                Toast.makeText(context, "Codigo PIN verificador incorreto.", Toast.LENGTH_LONG)
                    .show();

                err = true;
              }

              if (!err) {

                HttpPost httpPost = new HttpPost(context);

                JSONObject changePwJson = new JSONObject();

                try {
                  changePwJson.put("regid", AndroidSystemUtil.getRegistrationId(context));
                  changePwJson.put("pwOld", pinAtual);
                  changePwJson.put("pwNew", pinNovo);

                } catch (JSONException e) {
                  e.printStackTrace();
                }

                httpPost.execute(
                    AndroidSystemUtil.getHostAdress(context) + "/changeUserPw",
                    changePwJson.toString());
                dialogPlus.dismiss();
              }

              break;

            case R.id.btn_cadastrar:
              dialogPlus.dismiss();
              break;
          }
        }