薅羊毛专业版第三十四次更新

APK下载地址:https://wwa.lanzoui.com/ifNk7t54i9a

源代码下载地址:https://wwa.lanzoui.com/ihLgyt573nc

本次主要是增加了2个方法,最主要的是点击偏移坐标的方法,非常使用按键精灵和Python的都有围堵AJ没有于是我就自己封装了一个,用起来还是不错的分享给大家。我先把更新内容放一下在后面把代码贴出来。

1、更新快手点击back的问题优化快手极速版签到
2、拼多多的大视频修改成多多视频
3、增加今日头条极速版(不同手机可能不一样)
4、优化推荐模块

这个推荐是动态读取服务器上的代码我分享一下:

<text w="auto" color="#111111" size="26" text="相关软件推荐" textColor="black" padding="8 8 8 8" />
                                                <list id="reItemList" padding="25 0 8 8"  >
                                                    <horizontal h="40">
                                                        <text id="appIndex" text="{
   
   {this.ProductIndex}}、" inputType="number" w="40" gravity="center" textColor="#228B22" />
                                                        <text id="txtSoftName" textSize="18sp" textColor="#000000" text="{
   
   {SoftName}}" textColor="#228B22" />
                                                        <button text="下载" id="btnDownLoad" style="Widget.AppCompat.Button.Borderless" w="52" textColor="#FF7F50" />
                                                        <button text="访问" id="btnVistorWeb" style="Widget.AppCompat.Button.Borderless" w="52" textColor="#FF7F50" />
                                                    </horizontal>
                                                </list>

UI的代码有缩进看起来费劲点不过复制出来就可以了。

    try {
        var result_threads = threads.disposable();
        threads.start(function () {
            let dict_result = []
            try {
                var url_address = rootUrl + "/api/AppFindRecommendSoft?type=1";
                response = http.post(url_address, { "type": "1" });
                if (response.statusCode == 200) {
                    var product_json = response.body.json();
                    if (product_json.success == "true") {
                        var ProducCloudList = [];
                        let recProductList = JSON.parse(product_json.data)
                        for (let i = 0; i < recProductList.length; i++) {
                            let row = { ProductIndex: (i + 1), SoftName: recProductList[i].PRODUCT_NAME, DownURL: recProductList[i].DOWNLOAD_URL, VistorURL: recProductList[i].VISTOR_URL };
                            ProducCloudList.push(row);
                        }
                        dict_result = [true, ProducCloudList]
                        result_threads.setAndNotify(dict_result);
                    } else {
                        dict_result = [false, "读取云端信息出现问题:" + json.message]
                        result_threads.setAndNotify(dict_result);
                    }
                } else if (response.statusCode == 404) {
                    dict_result = [false, "读取云端信息出现问题访问服务器出现错误404错误请稍后重试"]
                    result_threads.setAndNotify(dict_result);
                } else {
                    dict_result = [false, "读取云端信息出现问题无法连接服务器"]
                    result_threads.setAndNotify(dict_result);
                }
            } catch (error) {
                dict_result = [false, "读取云端脚本出现问题:" + error]
                result_threads.setAndNotify(dict_result);
            }
        });
        result_threads = result_threads.blockedGet()
        if (result_threads[0] == false) {
            toastLog(result_threads[1])
        }
        else {
            ui.reItemList.setDataSource(result_threads[1]);
        }
    } catch (error) {
        toastLog("initializeReItemList构建推荐脚本出现错误:" + error)
    }

    ui.reItemList.on("item_bind", function (itemView, itemHolder) {
        itemView.btnDownLoad.on("click", function () {
            try {
                let item = itemHolder.item;
                let url = item.DownURL
                app.openUrl(url);
            } catch (e) {
                //悬浮窗爱出错On Windows   Shift + Alt + F 代码格式
                console.show()
                toastLog("btnDownLoad执行脚本出错...请将此页面截图联系攻城狮" + e)
            }
        });
        itemView.btnVistorWeb.on("click", function () {
            try {
                let item = itemHolder.item;
                let url = item.VistorURL
                app.openUrl(url);
            } catch (e) {
                //悬浮窗爱出错On Windows   Shift + Alt + F 代码格式
                console.show()
                toastLog("btnVistorWeb执行脚本出错...请将此页面截图联系攻城狮" + e)
            }
        });
    });

主要是服务器代码才是核心,安卓访问URL必须是多线程,这里采用多线程的回调是个技术点大家可以多看看。


5、增加快音关闭听歌通知clickControlBounds(id("iv_close_top"))
6、增加刷宝短视频关闭ad功能
7、增加快看点评论功能和清理缓存功能
8、增加查找元素并点击元素偏移坐标的方法。  getControlBounds(element) 获取元素
clickControOffsetCoordinates(element,cordinates) 点击元素
9、恢复番茄小说阅读功能 在侧栏单独功能
10、增加友情提醒弹窗

获取UI界面上元素坐标位置的方法:

/**
 * 获取UI上元素的坐标
 * @param {UI上的元素} element 
 * @returns 元素存在则返回坐标不存在则返回Null值
 */
function getControlBounds(element){
    if (element == null) {
        return null;
    }
    try {
        if (element.exists()) {
            let b = element.findOnce().bounds();
            let result_json={x:b.centerX(),y: b.centerY()}
            return result_json
        } else {
            return null;
        }
    } catch (error) {
        toastLog("getControlBounds方法出现错误:" + error)
        return null;
    }
}

返回的是Json对象,接收后直接。x和。y就可以了。

这个就是核心方法,点击元素的便宜坐标。

/**
 * 点击UI上元素的偏移坐标
 * @param {查找的元素} element 
 * @param {偏移的坐标} cordinates 
 * @returns 成功返回True失败错误等返回False
 */
function clickControOffsetCoordinates(element,cordinates){
    try {
        let resultJson=getControlBounds(element)
        if(resultJson==null || resultJson== undefined){
            return false
        }else{
            if (cordinates instanceof Array) {
                let x=parseInt(resultJson.x)+parseInt(cordinates[0])
                let y=parseInt(resultJson.y)+parseInt(cordinates[1])
                return click(x, y);
            }
            return false
        }
    } catch (error) {
        toastLog("clickControOffsetCoordinates方法出现错误:" + error)
        return false
    }
}

给大家个示例

偏移量是个数组。 向下便宜150个像素。

APK下载地址:https://wwa.lanzoui.com/ifNk7t54i9a

APK下载地址:https://wwa.lanzoui.com/ifNk7t54i9a

源代码下载地址:https://wwa.lanzoui.com/ihLgyt573nc

猜你喜欢

转载自blog.csdn.net/zy0412326/article/details/119909085