autojs beautiful ui interface 4

Keywords: Javascript

General communication group 698307198 Welcome to join v group and communicate with all the great gods
Disclaimer: all content provided in this blog is for learning, sharing and communication only. We do not guarantee the correctness of the content. By using the content of this blog, the following problems have nothing to do with this blog. When you use this blog code, it means that you have accepted the disclaimer of this blog

Body part

design sketch


The interface has been desensitized for learning only

"ui";
const storage = storages.create("Coolxx");

const isShow = storage.get("show",false)
const loopNum = storage.get("loopNum",100)
const sleepTime = storage.get("sleepTime",10)
const isVip = storage.get("isVip",false)
const playName = storage.get("playName","")
const playlists = storage.get("playlists","")
const isAnti = storage.get("anti",true)
const model = storage.get("model",0)

ui.statusBarColor("#1495E7")
ui.layout(
    <frame>
            <vertical>
                <appbar>
                    <toolbar id="toolbar" bg="#1495e7 "title =" XX assistant "> < / toolbar >
                </appbar>
                <ScrollView>
                <vertical>
                    <card w="*" h="70" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                        <horizontal gravity="center_vertical">
                            <View bg="#1495E7" h="*" w="5"/>
                            <vertical padding="10 8" h="auto" w="0" layout_weight="1">
                                <horizontal>
                                    <Switch id="autoService" text="Accessibility services" checked="{{auto.service != null}}" padding="8 8 8 8" textSize="14"/>
                                    <Switch id="isShow" text="Suspension window" checked="{{isShow}}" padding="8 8 8 8" textSize="14"/>
                                </horizontal>
                            </vertical>
                        </horizontal>
                    </card>
                    <card w="*" h="270" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                        <horizontal gravity="center_vertical">
                            <View bg="#1495E7" h="*" w="5"/>
                            <vertical padding="10 8" h="auto" w="0" layout_weight="1">
                                <horizontal id="play"><text text="Song list name"/><input w="*" hint="Specify song order mode. This value is required" id="playlists"  text="{{playlists}}" /></horizontal>
                                <horizontal id="play"><text text="Song name"/><input w="*" hint="Search operation mode this value is required" id="playName"  text="{{playName}}" /></horizontal>
                                <horizontal><text text="Number of cycles"/><input w="*" id="loopNum" inputType="number" text="{{loopNum}}" /></horizontal>
                                <horizontal><text text="Cut song interval"/><input w="*" id="sleepTime"  inputType="number" text="{{sleepTime}}" /></horizontal>
                                <horizontal>
                                    <text text="Download"/><Switch id="isVip" padding="8 8 8 8" textSize="12" checked="{{isVip}}"></Switch>
                                    <text text="Prevent seal"/><Switch id="isAnti" checked="{{isAnti}}" padding = "8 8 8 8" textSize="12"></Switch>
                                </horizontal>
                                <horizontal><text text="Operation mode"/><spinner id="model" entries="Play interface operation|Search run|Play your favorite music|Specified song list" ></spinner></horizontal>
                            </vertical>
                        </horizontal>
                    </card>
                    <card w="*" h="200" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                        <horizontal gravity="center_vertical">
                            <View bg="#1495E7" h="*" w="5"/>
                            <vertical padding="10 8" h="auto" w="0" layout_weight="1">
                                <horizontal padding="0 5"><text id="title" text="[Download] Whether or not to download brush songs. After it is turned on, it will affect the song cutting interval" textSize="13sp" /></horizontal>
                                <horizontal padding="0 5"><text id="title" text="[Cut song interval] How long does a single piece of music play to switch to the next one, in seconds" textSize="13sp" /></horizontal>
                                <horizontal padding="0 5"><text id="title" text="[Operation mode] Operation of playing interface: cycle playing the current playing song, you need to enter xx Play interface" textSize="13sp" /></horizontal>
                                <horizontal padding="0 5"><text id="title" text="[Operation mode] Search operation: play the search song circularly, which is determined by the parameters[Song name]decision" textSize="13sp" /></horizontal>
                                <horizontal padding="0 5"><text id="title" text="[Operation mode] Play your favorite music: loop xx song sheet[My favorite music]" textSize="13sp" /></horizontal>  
                                <horizontal padding="0 5"><text id="title" text="[Operation mode] Specified song list: looping xx Song list, by parameter[Song list name]decision" textSize="13sp" /></horizontal>  
                            </vertical>
                        </horizontal>
                    </card>
                    <card visibility="gone" w="*" h="50" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" foreground="?selectableItemBackground">
                        <horizontal gravity="center_vertical">
                            <View bg="#1495E7" h="*" w="5"/>
                            <vertical padding="10 8" h="auto" w="0" layout_weight="1">
                                <horizontal padding="0 5"><text id="title" text="[xx assistant] Software copyright contact author: xacm02022" textColor="#1495E7" textSize="16sp" maxLines="1"/></horizontal>    
                            </vertical>
                        </horizontal>
                    </card>
                    <vertical padding="5">
                        <button id="save" style="Widget.AppCompat.Button.Colored" text="Save script settings"/>
                        <horizontal>
                            <button w="auto" id="inbtn" style="Widget.AppCompat.Button.Colored" text="View activation information"/>
                            <button text="activation" id="activate" w="auto" style="Widget.AppCompat.Button.Colored" />
                            <button w="*" id="start" style="Widget.AppCompat.Button.Colored" text="function"/>
                        </horizontal>
                    </vertical>
                </vertical>
                </ScrollView>
            </vertical>
    </frame>
)
 ui.model.setSelection(model) 
/* 
//Activation script
ui.activate.on("click", e => {
    activeScript()
})

ui.inbtn.on("click", e => {
    const privateKey = storage.get("privateKey",false);
    if(privateKey === false) {
        alert("System prompt "," script not activated ")
    }else {
        let over = storage.get("overdueDate");
        if(over == null) {
            alert("System prompt "," activation code: "+ privatekey +" \ nexpiration time: no deadline ")
        }else{
            alert("System prompt "," activation code: "+ privatekey +" \ nexpiration time: "+ formatDate(over)) 
        }
    }
})

ui.start.on("click", function() {
    if(startBtn) {
        startBtn.setChecked(true)
    }else {
        if(auto.service == null) {
            toast("Please start accessibility service first! ");
            return;
        }
        const privateKey = storage.get("privateKey",false);
        if(privateKey == false) {
            toastLog("Script is not activated! Please activate "")
            return
        }
        if(updateConfig()) {
            main();
        }
    }
}) */

Reference articles

.

Software

statement

Part of the content comes from the network
This tutorial is for learning purposes only and is prohibited for other purposes

QQ group

698307198
Scan QR code and join group chat.QQ

explain:
The code provided in this article is for reference only.
Some places may need to be modified on the latest version of Auto.js to run. If you don't understand, you can add a group to ask

Introduction to Auto.js
Auto.js uses the "auxiliary function" of Android system to realize the auxiliary work, which is similar to key wizard, touch wizard and lazy wizard. It can simulate a series of interface actions through code.
Different from the "key Wizard", its simulation action is not simply realized by using the coordinate points on the interface, but by looking for the window handle similar to win. Full resolution simulated manual click effect can be realized through control click

Auto.js uses JavaScript as the scripting language, and Rhino 1.7.7.2 is currently used as the scripting engine, supporting ES5 and some ES6 features. The new autojs pro9 series can be developed using node.js

Development documentation
Auto.js Pro development document: click here

The document is still being improved, and there may be differences between the document description and the actual behavior of the code.

Why use Auto.js Pro to develop scripts? What are the characteristics?

There are many reasons that attract me to use Auto.js Pro. The main reasons are:

  1. Auto.js Pro can develop ROOT free Android scripts. Based on node operation, auto.js Pro can develop full resolution scripts and automatically adapt to various Android models
  2. You can use mobile phone to develop, which makes developers more and have more codes to learn. Here, you are also welcome to join Jiuli's vip group. At present, more than 4000 codes have been collected or developed, covering all categories
  3. With rich UI components, Auto.js Pro can customize various styles of Android interface, and can use native xml
  4. The javascript syntax used by Pro is elegant and the code is readable. The command Library of Auto.js Pro is very rich and there are many interfaces
  5. The volume of Pro script file is relatively small. 1000 lines of code, the packaged apk file is only 3-5M, and there is no advertisement
    Related tutorials
    Click here to see more Auto.js Pro tutorials

Posted by Robin M on Tue, 12 Oct 2021 20:08:47 -0700