atom
This commit is contained in:
@@ -43,6 +43,12 @@ public class ControlWindow {
|
||||
public void showRunInfo(String str){
|
||||
controlBean.setContent(str);
|
||||
}
|
||||
/**
|
||||
* 显示运行时间
|
||||
*/
|
||||
public void showRunTimeInfo(String str){
|
||||
controlBean.setRuntime(str);
|
||||
}
|
||||
/**
|
||||
* 显示控制系统运行的浮窗
|
||||
*
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.fisherbone.fuzhu.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
@@ -12,10 +13,15 @@ import com.fisherbone.fuzhu.entity.RedEnvBean;
|
||||
import com.fisherbone.fuzhu.utils.ProfileSpUtils;
|
||||
import com.fisherbone.fuzhu.widget.TitleBar;
|
||||
import com.jakewharton.rxbinding2.view.RxView;
|
||||
import com.jeremyliao.liveeventbus.LiveEventBus;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
import io.reactivex.Flowable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Action;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
public class HongBaoActivity extends BaseActivity {
|
||||
@@ -37,9 +43,45 @@ public class HongBaoActivity extends BaseActivity {
|
||||
.subscribe(new Consumer<Object>() {
|
||||
@Override
|
||||
public void accept(Object o) throws Exception {
|
||||
// daojishitwo(Integer.parseInt(redEnvBean.getRuntime()) * 60);
|
||||
ProfileSpUtils.getInstance().saveRedEnvBean(redEnvBean);
|
||||
EventBus.getDefault().post(new FourEvent("success", "10"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟结束任务
|
||||
*
|
||||
* @param a
|
||||
*/
|
||||
private void daojishitwo(final int a) {
|
||||
|
||||
//启动计时器
|
||||
//从0开始发射11个数字为:0-10依次输出,延时0s执行,每1s发射一次。
|
||||
Disposable mdDisposable = Flowable.intervalRange(0, a + 1, 0, 1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnNext(new Consumer<Long>() {
|
||||
@Override
|
||||
public void accept(Long aLong) throws Exception {
|
||||
long b = a - aLong;
|
||||
long c = 0 + aLong;
|
||||
Log.w("TIAOSHI###运行剩余时长", b + "");
|
||||
runLog("任务运行时长"+c+"s");
|
||||
}
|
||||
})
|
||||
.doOnComplete(new Action() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
Log.e("TIAOSHI###", "运行时间已到,停止自动加关");
|
||||
runLog("任务运行即将结束");
|
||||
|
||||
}
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
public void runLog(String str) {
|
||||
LiveEventBus.get("some_key").post(str);
|
||||
Log.e("TIAOSHI###", str);
|
||||
}
|
||||
}
|
||||
@@ -202,6 +202,12 @@ public class MainActivity extends BaseActivity implements InfoMessage {
|
||||
controlWindow.showRunInfo((String) o);
|
||||
}
|
||||
});
|
||||
LiveEventBus.get("run_time", String.class).observe(this, new Observerlife<String>() {
|
||||
@Override
|
||||
public void onChanged(Object o) {
|
||||
controlWindow.showRunTimeInfo((String) o);
|
||||
}
|
||||
});
|
||||
LiveEventBus.get("success", String.class).observe(this, new Observerlife<String>() {
|
||||
@Override
|
||||
public void onChanged(Object o) {
|
||||
@@ -728,7 +734,9 @@ public class MainActivity extends BaseActivity implements InfoMessage {
|
||||
@Override
|
||||
public void potgegin(String str) {
|
||||
if ("停止".equals(str)) {
|
||||
mdDisposable.dispose();
|
||||
if(mdDisposable!=null) {
|
||||
mdDisposable.dispose();
|
||||
}
|
||||
AblStepHandler.getInstance().setStop(true);
|
||||
controlWindow.stutas(true);
|
||||
controlWindow.closedWin();
|
||||
|
||||
@@ -22,6 +22,17 @@ public class ControlBean extends BaseObservable {
|
||||
}
|
||||
|
||||
String content = "";
|
||||
@Bindable
|
||||
public String getRuntime() {
|
||||
return runtime;
|
||||
}
|
||||
|
||||
public void setRuntime(String runtime) {
|
||||
this.runtime = runtime;
|
||||
notifyPropertyChanged(BR.runtime);
|
||||
}
|
||||
|
||||
String runtime = "";
|
||||
|
||||
public ControlBean() {
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.os.Message;
|
||||
import android.util.Log;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
||||
import com.blankj.utilcode.util.ToastUtils;
|
||||
import com.fisherbone.fuzhu.ChangLiang;
|
||||
import com.fisherbone.fuzhu.abllib.AblService;
|
||||
import com.fisherbone.fuzhu.abllib.AblStepHandler;
|
||||
@@ -35,6 +36,13 @@ import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Flowable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Action;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
||||
public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, RedEnv.TimeFunc, RedEnv.MoveFunc {
|
||||
private List<String> jiluBeans;
|
||||
@@ -70,6 +78,9 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
|
||||
AblViewUtil.mySleep(3);
|
||||
allowed();
|
||||
AblStepHandler.sendMsg(AblSteps.STEP_250);
|
||||
//开启运行倒计时
|
||||
|
||||
daojishitwo(Integer.parseInt(redEnvBean.getRuntime()) * 60);
|
||||
break;
|
||||
case AblSteps.STEP_250:
|
||||
closedtjDialog(AblService.getInstance());
|
||||
@@ -279,7 +290,7 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
|
||||
recordDoubi(DateUtils.getNowString());
|
||||
Log.e("TIAOSHI###", "初始时间" + redEnvBean.getLivetimefir());
|
||||
Log.e("TIAOSHI###", "当前时间" + redEnvBean.getLivetime());
|
||||
|
||||
// runLog("当前运行时长"+ redEnvBean.getLivetime()+"s");
|
||||
boolean redswitchone = ProfileSpUtils.getInstance().getSetBean().isRedswitchone();
|
||||
Log.e("TIAOSHI###", "当前sp==" + redswitchone);
|
||||
if(redswitchone){
|
||||
@@ -1109,6 +1120,37 @@ public class TestAblStep34 extends HongbaoBase implements RedEnv.RedEnvFunc, Red
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 模拟结束任务
|
||||
*
|
||||
* @param a
|
||||
*/
|
||||
private void daojishitwo(final int a) {
|
||||
|
||||
//启动计时器
|
||||
//从0开始发射11个数字为:0-10依次输出,延时0s执行,每1s发射一次。
|
||||
Disposable mdDisposable = Flowable.intervalRange(0, a + 1, 0, 1, TimeUnit.SECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.doOnNext(new Consumer<Long>() {
|
||||
@Override
|
||||
public void accept(Long aLong) throws Exception {
|
||||
long b = a - aLong;
|
||||
long c = 0 + aLong;
|
||||
Log.w("TIAOSHI###运行剩余时长", b + "");
|
||||
LiveEventBus.get("run_time").post("任务已运行"+c/60+"分钟");
|
||||
}
|
||||
})
|
||||
.doOnComplete(new Action() {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
Log.e("TIAOSHI###", "运行时间已到,停止自动加关");
|
||||
runLog("任务运行即将结束");
|
||||
|
||||
}
|
||||
})
|
||||
.subscribe();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -105,6 +105,15 @@
|
||||
android:textColor="#02F78E"
|
||||
android:visibility="@{controlBean.phonetype == 3 ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:textSize="8sp"
|
||||
android:text="@={controlBean.runtime}"
|
||||
android:textColor="#02F78E"
|
||||
android:visibility="@{controlBean.phonetype == 3 ? View.VISIBLE : View.GONE}" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
Reference in New Issue
Block a user