android.os.Handler.sendMessageAtTime()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(237)

本文整理了Java中android.os.Handler.sendMessageAtTime()方法的一些代码示例,展示了Handler.sendMessageAtTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Handler.sendMessageAtTime()方法的具体详情如下:
包路径:android.os.Handler
类名称:Handler
方法名:sendMessageAtTime

Handler.sendMessageAtTime介绍

暂无

代码示例

代码示例来源:origin: bumptech/glide

@Override
 public void onResourceReady(@NonNull Bitmap resource,
   @Nullable Transition<? super Bitmap> transition) {
  this.resource = resource;
  Message msg = handler.obtainMessage(FrameLoaderCallback.MSG_DELAY, this);
  handler.sendMessageAtTime(msg, targetTime);
 }
}

代码示例来源:origin: bumptech/glide

@Test
public void testDelayTargetSendsMessageWithHandlerDelayed() {
 long targetTime = 1234;
 DelayTarget delayTarget = new DelayTarget(handler, 1, targetTime);
 delayTarget.onResourceReady(Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888), null
 /*glideAnimation*/);
 verify(handler).sendMessageAtTime(isA(Message.class), eq(targetTime));
}

代码示例来源:origin: robolectric/robolectric

@Test
public void sendMessageAtTime_sendsMessageAtCorrectTime() {
 ShadowLooper.pauseMainLooper();
 Handler handler = new Handler();
 Message message = handler.obtainMessage(123);
 handler.sendMessageAtTime(message, 500);
 assertThat(handler.hasMessages(123)).isTrue();
 ShadowLooper.idleMainLooper(100);
 assertThat(handler.hasMessages(123)).isTrue();
 ShadowLooper.idleMainLooper(400);
 assertThat(handler.hasMessages(123)).isFalse();
}

代码示例来源:origin: guolindev/giffun

@Override
  public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
    this.resource = resource;
    Message msg = handler.obtainMessage(FrameLoaderCallback.MSG_DELAY, this);
    handler.sendMessageAtTime(msg, targetTime);
  }
}

代码示例来源:origin: CarGuo/RecordWave

@Override
public void onCompletion(MediaPlayer mp) {
  if (mRemoteHandler != null) {
    Message msg = new Message();
    msg.what = 0;
    mRemoteHandler.sendMessageAtTime(msg, 0);
  }
}

代码示例来源:origin: CarGuo/RecordWave

@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
  if (mRemoteHandler != null) {
    Message msg = new Message();
    msg.what = -28;
    mRemoteHandler.sendMessageAtTime(msg, 0);
  }
  return false;
}

代码示例来源:origin: CarGuo/RecordWave

@Override
public void onPrepared(MediaPlayer mp) {
  if (mRemoteHandler != null) {
    Message msg = new Message();
    msg.obj = mMediaPlayer.getDuration();
    msg.what = 2;
    mRemoteHandler.sendMessageAtTime(msg, 0);
  }
  mp.start();
}

代码示例来源:origin: CarGuo/RecordWave

@Override
  public void run() {
    if (mMediaPlayer == null || !mMediaPlayer.isPlaying()) {
      return;
    }
    Message msg = new Message();
    msg.obj = mMediaPlayer.getCurrentPosition();
    msg.what = 1;
    mRemoteHandler.sendMessageAtTime(msg, 0);
  }
};

代码示例来源:origin: derry/delion

@Override
public boolean sendMessageAtTime(Message msg, long uptimeMillis) {
  Messenger client = msg.replyTo;
  if (!mClientTrustMap.containsKey(client)) mClientTrustMap.put(client, checkCallerIsValid());
  if (!mClientTrustMap.get(client)) return false;
  return super.sendMessageAtTime(msg, uptimeMillis);
}

代码示例来源:origin: ksvc/KSYMediaPlayer_Android

@Override
  public void run() {
    if ((!cap_stop) && (progress <= 15000)) {
      progress += 10;
      cap_progress.setProgress(progress);
      if (progress > 3000) {
        Message message = new Message();
        message.what = REMOVE_TIPS;
        mHandler.sendMessageAtTime(message, 0);
      }
    } else {
      mMediaRecorder.stop();
      if (progress >= 3000) {
        Message message = new Message();
        message.what = CAP_FINISHED;
        mHandler.sendMessageAtTime(message, 0);
      }
      cap_timer.cancel();
    }
  }
};

代码示例来源:origin: ksvc/KSYMediaPlayer_Android

@Override
  public void run() {
    if (isLooping) {
      toEnd = FloatingPlayer.getInstance().getKSYTextureView().getCurrentPosition() + 1000 >= FloatingPlayer.getInstance().getKSYTextureView().getDuration();
    }
    if ((!cap_stop) && (progress <= 15000) && !toEnd) {
      progress += 10;
      cap_progress.setProgress(progress);
      if (progress > 3000) {
        Message message = new Message();
        message.what = REMOVE_TIPS;
        mHandler.sendMessageAtTime(message, 0);
      }
    } else {
      mMediaRecorder.stop();
      if (progress >= 3000) {
        Message message = new Message();
        message.what = CAP_FINISHED;
        mHandler.sendMessageAtTime(message, 0);
      }
      toEnd = false;
      cap_timer.cancel();
    }
  }
};

代码示例来源:origin: ksvc/KSYMediaPlayer_Android

Message message = new Message();
  message.what = DELETE_CAP;
  mHandler.sendMessageAtTime(message, 0);
} else if (id == R.id.save_cap) {
  save_video.setVisibility(View.VISIBLE);

相关文章