每隔几秒就提醒的软件+计数器+科研狗福利

这个安卓应用使用Autojs编写,提供循环计时提醒和计数功能。用户可设置间隔时间进行震动提醒,并记录每次操作的历史。应用包含计时器和计数器两个模块,适用于实验室定时操作或需要频繁计数的情景。软件还支持删除历史记录和自定义字体大小。
摘要由CSDN通过智能技术生成

软件简介

本软件为安卓应用,基于Autojs搞的(快且简单)。主要功能如下:

  1. 循环计时提醒(震动)。这针对短时间内需要循环提醒的用户(比如我需要每隔1分钟加A试剂到B溶液中),并可提示循环提醒次数(比如我加了几次样进去LOL),有详细的操作记录。
  2. 计数,有详细操作记录。

软件autojs源码

// 禁止转载 禁止转载


"ui";

var count_num = 0;
var content = "";
var time_his = 0;
var thread = "";
var set_time_global = 0;
var daojishi_his="";
var d = [];
var content = [];
var color = "#009688";
var ColoredButton = (function() {
    //继承ui.Widget
    util.extend(ColoredButton, ui.Widget);

    function ColoredButton() {
        //调用父类构造函数
        ui.Widget.call(this);
        //自定义属性color,定义按钮颜色
        this.defineAttr("color", (view, name, defaultGetter) => {
            return this._color;
        }, (view, name, value, defaultSetter) => {
            this._color = value;
            view.attr("backgroundTint", value);
        });
        //自定义属性onClick,定义被点击时执行的代码
        this.defineAttr("onClick", (view, name, defaultGetter) => {
            return this._onClick;
        }, (view, name, value, defaultSetter) => {
            this._onClick = value;
        });
    }
    ColoredButton.prototype.render = function() {
        return (
            <button textSize="16sp" style="Widget.AppCompat.Button.Colored" w="auto"/>
        );
    }
    ColoredButton.prototype.onViewCreated = function(view) {
        view.on("click", () => {
            if (this._onClick) {
                eval(this._onClick);
            }
        });
    }
    ui.registerWidget("colored-button", ColoredButton);
    return ColoredButton;
})();

// 禁止转载 禁止转载

function shanchu() {
    count_num = 0;
    time_his = 0;
    content = [];
    ui.jia_l.setText(count_num+"");
    ui.ShowResult.setText("")
}
// 禁止转载 禁止转载
function hisCon(){
    var today1 = new Date();
    var h1 = today1.getHours();
    var m1 = today1.getMinutes();
    var s1 = today1.getSeconds();
    var time_now = today1.getTime()
    if(time_his == 0){var time_delta = 0}else{td = (time_now-time_his)/1000;time_delta = td.toFixed(2)}
    content.push({"时间":h1+":"+m1+":"+s1,"间隔":time_delta,"计数":count_num})
    time_his = time_now
    cj = JSON.stringify(content).replace(/\},/g,"},\n")
    return cj;
}
// 禁止转载 禁止转载
function show_result(){
    text_font_size();
    var settime = ui.daojishi.getText();
    if (settime!=""){
        ui.state.setText("")
        set_time_global = settime
        ui.daojishi.setText("");
        thread = threads.start(function(){
            while (true){
                for (var i=set_time_global;i>=0;i--){
                    ui.daojishi_show.setText(i+"");
                    sleep(1000);
                }
                threads.start(function(){
                    try{HisJishiCon(d)}catch(e){toast("Hello")}
                    for (var j=0;j<=1;j++){
                        device.vibrate(1000);
                        sleep(500);
                }})
            }
        })
    }else(toast("请设定时间后再开始"))
}
// 禁止转载 禁止转载
function cancel_jishi(){
    ui.daojishi_show.setText("0");
    set_time_global = 0;
    threads.shutDownAll();
    ui.state.setText("")
    ui.ShowDaojishiResult.setText("")
    ui.his_time_count.setText("0")
    d = []
}
// 禁止转载 禁止转载
function HisJishiCon(dd){
    var today = new Date();
    var h = today.getHours();
    var m = today.getMinutes();
    var s = today.getSeconds();
    var n = dd.length+1;
    ui.his_time_count.setText(n+"")
    dd.push({"time":h+":"+m+":"+s,"n":n+"次"});
    ui.ShowDaojishiResult.setText(JSON.stringify(dd));
}
// 禁止转载 禁止转载
function text_font_size(){
    var numT = ui.daojishi.getText()
    var setTextSize1 = 200;
    if (numT !=""){
        var num = parseInt(numT);
        if (num<=999){
            setTextSize1 = 200;
        }else if(num>999 && num<9999){
            setTextSize1 = 150;
        }else{
            setTextSize1 = 100;}
    }else{setTextSize1 = 200;}
    ui.daojishi_show.setTextSize(setTextSize1);
}
// 禁止转载 禁止转载
ui.layout(
    <drawer id="drawer">
        <vertical>
            <appbar>
                <toolbar id="toolbar" title="Mention Countor"/>
                <tabs id="tabs"/>
            </appbar>
            <viewpager id="viewpager">
                <frame>
                    <vertical>
                    <horizontal>
                        <input id="daojishi" hint="输入倒计时间隔(秒)" textColor="black" textSize="16sp" marginTop="16" w="200" />
                        <colored-button id = "start" text="开始执行" color="#3399ff"  marginTop="13" onClick="show_result()"/>
                        <colored-button id = "finish" text="终止执行" color="#F5658E"  marginTop="13" onClick="cancel_jishi()"/>
                    </horizontal>
                    <button id = 'daojishi_show' text = "0" textSize="200sp" style="Widget.AppCompat.Button.Colored" w= '*' />
                    <text id = "state" textSize = "15sp" textColor="red" marginLeft="10"/>
                    <horizontal>
                        <text text = "提醒次数: " textSize = "20sp" textColor="black" marginLeft="10" gravity="right" w="180"/>
                        <text id = "his_time_count" text = "0" textSize = "50sp" textColor="black" textStyle = "bold" padding="0" w="*" gravity="left" marginLeft="20"/>
                    </horizontal>
                    <text text="History Record (每轮停止时间 || 已循环次数 )" textColor="black" textSize="16sp" marginTop="5" marginLeft="10"/>
                    <input id = "ShowDaojishiResult" textSize="16sp"  marginLeft="10" lines="10" />
                    </vertical>
                </frame>
                <frame>
                    <vertical>
                    <colored-button text="删除" color="#ff5722" onClick="shanchu()"/>
                    <button id = 'jia' text="+" textSize="50sp" style="Widget.AppCompat.Button.Colored" w="*" h="auto" />
                    <button id = 'jia_l' text = "0" textSize="200sp" style="Widget.AppCompat.Button.Borderless" w= '*'/>
                    <button id = 'jian' text="-" textSize="50sp" style="Widget.AppCompat.Button.Colored" w="*" h="auto"/>
                    <text text="History Record (操作时间 || 时间间隔s || 计数记录)" textColor="black" textSize="16sp" marginTop="5" marginLeft="10"/>
                    <input id = "ShowResult" textSize="16sp"  marginLeft="10" lines="5" />
                    </vertical>
                </frame>
            </viewpager>
        </vertical>
        <vertical layout_gravity="left" bg="#ffffff" w="280">
            <img w="280" h="200" scaleType="fitXY" src="http://images.shejidaren.com/wp-content/uploads/2014/10/023746fki.jpg"/>
            <list id="menu">
                <horizontal bg="?selectableItemBackground" w="*">
                    <img w="50" h="50" padding="16" src="{{this.icon}}" tint="{{color}}"/>
                    <text textColor="black" textSize="15sp" text="{{this.title}}" layout_gravity="center"/>
                </horizontal>
            </list>
        </vertical>
    </drawer>
);
// 禁止转载 禁止转载
ui.daojishi_show.on("click",()=>{
    if(thread != ""){
        if(thread.isAlive()){ //正在执行中
            threads.shutDownAll();
            ui.state.setText("已暂停")
        }else{ // 已终止
            var settime = ui.daojishi_show.getText();
            ui.state.setText("")
            if (settime>0){
                thread = threads.start(function(){
                    for (var i=settime;i>=0;i--){
                        ui.daojishi_show.setText(i+"");
                        sleep(1000);}
                    threads.start(function(){
                        // toast('本轮计时结束');
                        try{HisJishiCon(d)}catch(e){toast("Hello")}
                        for (var j=0;j<=1;j++){
                            device.vibrate(1000);
                            sleep(500);
                    }})
                    while (true){
                        for (var i=set_time_global;i>=0;i--){
                            ui.daojishi_show.setText(i+"");
                            sleep(1000);
                        }
                        threads.start(function(){
                            try{HisJishiCon(d)}catch(e){toast("Hello")}
                            for (var j=0;j<=1;j++){
                                device.vibrate(1000);
                                sleep(500);
                        }})
                    }
                })
            }
        }
    }
})
// 禁止转载 禁止转载
ui.jia.on("click", ()=>{
    count_num = count_num+1;
    ui.jia_l.setText(count_num+"")
    ui.ShowResult.setText(hisCon())
});
// 禁止转载 禁止转载
ui.jia_l.on("click", ()=>{
    // toast("+1");
    count_num = count_num+1;
    ui.jia_l.setText(count_num+"")
    ui.ShowResult.setText(hisCon())
});
// 禁止转载 禁止转载
ui.jian.on("click", ()=>{
    // if (count_num >1){count_num = count_num-1;
    // }
    // else{count_num=0;}
    count_num = count_num-1;
    ui.jia_l.setText(count_num+"")
    ui.ShowResult.setText(hisCon())
});
activity.setSupportActionBar(ui.toolbar);

//设置滑动页面的标题
ui.viewpager.setTitles(["计时器", "计数器"]);
//让滑动页面和标签栏联动
ui.tabs.setupWithViewPager(ui.viewpager);

//让工具栏左上角可以打开侧拉菜单
ui.toolbar.setupWithDrawer(ui.drawer);

ui.menu.setDataSource([
  {
      title: "计时器",
      icon: "@drawable/ic_favorite_black_48dp"
  },
  {
      title: "计数器",
      icon: "@drawable/ic_favorite_black_48dp"
  },
  {
      title: "退出",
      icon: "@drawable/ic_exit_to_app_black_48dp"
  }
]);

ui.menu.on("item_click", item => {
    switch(item.title){
        case "退出":
            ui.finish();
            break;
    }
})
// 禁止转载 禁止转载 
// autojs 真香啊

软件截图

 

 

 实验摸鱼两不误

 下载链接

https://wwd.lanzouh.com/iB3P60489dwh

 提取码 ezet

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值