Ejemplo n.º 1
0
 @Override
 public void initWidget() {
   setContentView(R.layout.activity_splash);
   text = findView(R.id.text);
   View decorView = getWindow().getDecorView();
   int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
   decorView.setSystemUiVisibility(uiOptions);
   text.animateText("爱生活,爱编程");
   if (BuildConfig.DEBUG) {
     UiUtils.showToast(this, "测试版");
     text.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View view) {
             //                    startActivity(new Intent(SplashActivity.this,
             // TestActivity.class));
             //                    ApiManager.getObAnycodesPdf(new MyObserver<List<AnyCodesPDF>>()
             // {
             //                        @Override
             //                        public void onNext(List<AnyCodesPDF> anyCodesPDFs) {
             //                            Logger.d("size:" + anyCodesPDFs.size());
             //                            Logger.d(anyCodesPDFs);
             //                        }
             //                    });
           }
         });
   }
 }
Ejemplo n.º 2
0
  private void calc() {
    textSize = mHTextView.getTextSize();
    paint.setTextSize(textSize);

    for (int i = 0; i < mText.length(); i++) {
      gaps[i] = paint.measureText(mText.charAt(i) + "");
    }

    oldPaint.setTextSize(textSize);

    for (int i = 0; i < mOldText.length(); i++) {
      oldGaps[i] = oldPaint.measureText(mOldText.charAt(i) + "");
    }

    oldStartX = (mHTextView.getWidth() - oldPaint.measureText(mOldText.toString())) / 2f;

    startX = (mHTextView.getWidth() - paint.measureText(mText.toString())) / 2f;
    startY = (int) ((mHTextView.getHeight() / 2) - ((paint.descent() + paint.ascent()) / 2));

    differentList.clear();
    differentList.addAll(CharacterUtils.diff(mOldText, mText));

    Rect bounds = new Rect();
    paint.getTextBounds(mText.toString(), 0, mText.length(), bounds);
    upDistance = bounds.height();
  }
Ejemplo n.º 3
0
  public void init(HTextView hTextView, AttributeSet attrs, int defStyle) {
    mHTextView = hTextView;

    mText = "";
    mOldText = "";

    paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setColor(textColor);
    paint.setStyle(Paint.Style.FILL);

    oldPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    oldPaint.setColor(textColor);
    oldPaint.setStyle(Paint.Style.FILL);

    backPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    backPaint.setColor(((ColorDrawable) mHTextView.getBackground()).getColor());
    backPaint.setStyle(Paint.Style.FILL);

    metrics = new DisplayMetrics();
    WindowManager windowManger =
        (WindowManager) hTextView.getContext().getSystemService(Context.WINDOW_SERVICE);
    windowManger.getDefaultDisplay().getMetrics(metrics);

    textSize = hTextView.getTextSize();

    sparkBitmap = BitmapFactory.decodeResource(hTextView.getResources(), R.drawable.fire);
  }
Ejemplo n.º 4
0
 @Override
 public void reset(CharSequence text) {
   progress = 1;
   calc();
   mHTextView.invalidate();
 }
  public void show() {
    mDialog = new MaterialDialog(this.mContext);
    View contentView =
        LayoutInflater.from(this.mContext).inflate(R.layout.item_homeworkmaker_dialog, null);
    final EditText homeworkTitle = (EditText) contentView.findViewById(R.id.edittxt_homework_title);
    final EditText homeworkContent =
        (EditText) contentView.findViewById(R.id.edittxt_homework_content);
    WheelDatePicker datePicker =
        (WheelDatePicker) contentView.findViewById(R.id.datepicker_homework_deadline);
    final HTextView deadlineTxt = (HTextView) contentView.findViewById(R.id.txt_homework_deadline);

    deadlineTxt.animateText(
        year
            + "年"
            + month
            + "月"
            + day_of_month
            + "日"
            + " "
            + DateUtil.getWeekStrByDateStr(
                DateUtil.getDateStr(year, month, day_of_month, "yyyyMMdd"), "yyyyMMdd"));

    datePicker.setOnWheelChangeListener(
        new AbstractWheelPicker.OnWheelChangeListener() {
          @Override
          public void onWheelScrolling(float deltaX, float deltaY) {}

          @Override
          public void onWheelSelected(int index, String data) {
            String[] date = data.split("-");
            deadlineTxt.animateText(
                date[0]
                    + "年"
                    + date[1]
                    + "月"
                    + date[2]
                    + "日"
                    + " "
                    + DateUtil.getWeekStrByDateStr(data, "yyyy-MM-dd"));
            year = Integer.valueOf(date[0]);
            month = Integer.valueOf(date[1]);
            day_of_month = Integer.valueOf(date[2]);
          }

          @Override
          public void onWheelScrollStateChanged(int state) {}
        });

    mDialog
        .setTitle("发布作业")
        .setContentView(contentView)
        .setPositiveButton(
            "发布",
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                String title = homeworkTitle.getText().toString();
                if (title.isEmpty()) {
                  homeworkTitle.setError("Title不能为空");
                  return;
                }
                String content = homeworkContent.getText().toString();
                if (content.isEmpty()) {
                  homeworkContent.setError("内容不能为空");
                  return;
                }
                if (mHomeworkEditedListener != null) {
                  mHomeworkEditedListener.onHomeworkEdited(
                      title, content, DateUtil.getDateStr(year, month, day_of_month, "yyyyMMdd"));
                }
                dismiss();
              }
            })
        .show();
  }