Exemplo n.º 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);
  }
Exemplo n.º 2
0
  @Override
  public void setText(@Nullable CharSequence text, BufferType type) {
    if (useSystemEmoji()) {
      super.setText(text, type);
      return;
    }

    source = EmojiProvider.getInstance(getContext()).emojify(text, this);
    setTextEllipsized(source);
  }
Exemplo n.º 3
0
  private void getPic(Intent data) {
    if (null != data) {
      // 取出所选图片的路径
      Uri selectedImage = data.getData();
      String[] filePathColumn = {MediaStore.Images.Media.DATA};

      Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
      cursor.moveToFirst();

      int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
      String picuri = cursor.getString(columnIndex);
      cursor.close();

      // 将图片贴到控件上
      BitmapFactory.Options options = new BitmapFactory.Options();
      options.inJustDecodeBounds = true;
      BitmapFactory.decodeFile(picuri, options);
      int width = options.outWidth;
      int height = options.outHeight;
      if (100 > width || 40 > height) {
        // 图片分辨率太低
        Toast.makeText(this, getString(R.string.question_imagetoosmall), Toast.LENGTH_SHORT).show();
        MobclickAgent.onEvent(this, "addQP_F");
        return;
      }

      BitmapFactory.Options opts = new BitmapFactory.Options();
      opts.inJustDecodeBounds = true;
      BitmapFactory.decodeFile(picuri, opts);
      opts.inSampleSize = computeSampleSize(opts, -1, 700 * 272);
      opts.inJustDecodeBounds = false;
      try {
        bitmap = BitmapFactory.decodeFile(picuri, opts);
      } catch (OutOfMemoryError err) {
        // showNotification("图片过大!");
        MobclickAgent.onEvent(this, "addQP_F");
        Toast.makeText(this, getString(R.string.question_imagetoolarge), Toast.LENGTH_SHORT).show();
        return;
      }
      MobclickAgent.onEvent(this, "addQP_S");
      image.setScaleType(ImageView.ScaleType.FIT_CENTER);
      image.setImageBitmap(bitmap);
      hint.setText(getString(R.string.question_removeimage_hint));
    }
  }
Exemplo n.º 4
0
 private void setTextEllipsized(final @Nullable CharSequence source) {
   super.setText(
       needsEllipsizing ? ViewUtil.ellipsize(source, this) : source, BufferType.SPANNABLE);
 }