示例#1
0
  private void bindData() {
    task = (Task) getIntent().getSerializableExtra("task");
    tv_name.setText(task.getName());
    tv_name.setSelection(tv_name.length());
    tv_time.setText(TaskUtil.getZixiTimeS(task.getTime()));
    int p = 4320 - TaskUtil.getDurationFromNow(task.getTime());
    if (p <= 0) p = 1;
    pb.setText(TaskUtil.getDescriptionTimeFromTimestamp(task.getTime()));
    if (task.getTime() <= System.currentTimeMillis()) {
      pb.setRoundWidth(0);
      pb.setText(TaskUtil.getZixiDateS(task.getTime()));
    } else {
      pb.setRoundWidth(PixelUtil.dp2px(6));
    }
    if (p < 100) p = 100; // 防止太小了
    pb.setProgressNoAnim(p);
    if (task.getImageUrl() != null) {
      iv_home_bg.setImageURI(Uri.parse(task.getImageUrl()));
    }

    materialMenu.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            onBackPressed();
          }
        });

    String path = task.getAudioUrl();
    if (path != null) {
      final ImageButton ib_play = (ImageButton) ll_audio.findViewById(R.id.ib_play);
      final ProgressBar pb = (ProgressBar) ll_audio.findViewById(R.id.pb2);
      ib_play.setTag("play");
      ib_play.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              ib_play.setOnClickListener(
                  new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                      if (ib_play.getTag().equals("play")) {
                        ib_play.setImageResource(R.drawable.pause_audio);
                        ib_play.setTag("pause");
                        NotifyUtils.palyAudio(context, ib_play, pb, task.getAudioUrl());
                      } else {
                        ib_play.setTag("play");
                        ib_play.setImageResource(R.drawable.play_audio);
                        NotifyUtils.pauseAudio(ib_play);
                      }
                    }
                  });
            }
          });
    }
    if (task.getNote() != null) {
      ((TextView) findViewById(R.id.tv_note)).setText(task.getNote());
    }
  }
示例#2
0
 private void showAnim() {
   int y = getIntent().getIntExtra("y", 0);
   int[] loc = new int[2];
   layout_task.getLocationOnScreen(loc);
   L.d("y:" + y + "," + loc[1]);
   layout_task.setVisibility(View.VISIBLE);
   layout_task.setTranslationY(y - loc[1]);
   layout_task.animate().translationY(0).setDuration(400).start();
   iv_sort.animate().alpha(0).setDuration(400).start();
   iv_search.animate().alpha(0).setDuration(400).start();
   iv_home_bg.animate().alpha(1).setDuration(400).start();
   title_bg.animate().alpha(0).setDuration(400).start();
   ll_bottom.animate().alpha(1).setDuration(400).start();
   materialMenu.animateState(MaterialMenuDrawable.IconState.ARROW);
   String path = task.getAudioUrl();
   if (path != null) {
     ll_audio.animate().alpha(1).setDuration(300).start();
   }
 }