Commit 4d8f4ea6 by 韩飞虎

搞定时间联动

parent d935d3c2
......@@ -76,7 +76,9 @@ public class PlayActivity extends BaseActivity {
public void handleMessage(Message msg) {
super.handleMessage(msg);
LogUtils.e("定时器在走111",msg.what,mHour,mMin,mSecond);
if((mHour+mMin+mSecond)<1){
suspendAndContinue=0;
}
if(suspendAndContinue==1) {
computeTime();
String mHourStr = addZeroForNum(mHour + "", 2);
......@@ -183,7 +185,9 @@ public class PlayActivity extends BaseActivity {
@OnClick(R.id.back_but)
public void onViewClicked() {
timerManager.cancelTimer();
finish();
Intent intent = new Intent(PlayActivity.this, SetTimeActivity.class);
startActivity(intent);
}
@OnClick({R.id.cancel_but, R.id.pause_but, R.id.resume_but})
......
package com.example.blu.toys.activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
......@@ -85,6 +86,8 @@ public class SelectDeviceActivity extends BaseActivity {
@OnClick(R.id.back_but)
public void onViewClicked() {
finish();
Intent intent = new Intent(SelectDeviceActivity.this, AddDeviceActivity.class);
startActivity(intent);
}
}
\ No newline at end of file
......@@ -92,6 +92,8 @@ public class SelectTimerActivity extends BaseActivity {
@OnClick(R.id.back_but)
public void onViewClicked() {
finish();
Intent intent = new Intent(SelectTimerActivity.this, SelectDeviceActivity.class);
startActivity(intent);
}
}
\ No newline at end of file
......@@ -91,7 +91,7 @@ public class BlePlay {
public void scanBle() {
BleScanRuleConfig scanRuleConfig = new BleScanRuleConfig.Builder().setAutoConnect(false)
//.setServiceUuids(serviceIds)
.setScanTimeOut(1000).build();
.setScanTimeOut(5000).build();
BleManager.getInstance().initScanRule(scanRuleConfig);
BleManager.getInstance().scan(new BleScanCallback() {
@Override
......
package com.example.blu.toys.utils;
import com.blankj.utilcode.util.LogUtils;
public class TimeBean {
private int mHour;
private int mMin;
private int mSecond;
public int getTotalMillisecond(){
return (mHour*3600+mMin*60+mSecond)*1000;
}
public int getTotalSecond(){
return (mHour*3600+mMin*60+mSecond);
}
public void toTime(){
LogUtils.e(mHour+":"+mMin+":"+mSecond);
}
private String[] tims;
public String[] getTims() {
......
......@@ -36,13 +36,19 @@ public class TimeUtil {
timeBean.setTims(tims);
timeBean.setmHour(Integer.valueOf(tims[0].trim()));
timeBean.setmMin(Integer.valueOf(tims[1].trim()));
try {
timeBean.setmSecond(Integer.valueOf(tims[2].split(",")[0].trim()));
}catch (Exception e){
e.printStackTrace();
}
return timeBean;
}
public static void main(String[] args) {
System.out.println(Integer.valueOf("00"));
TimeBean timeBean= getTimeBeanBySecond(60l);
TimeBean timeBean= getTimeBeanBySecond(0l);
System.out.printf( timeBean.getmHour()+":"+ timeBean.getmMin()+":"+timeBean.getmSecond());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment