diff --git a/.DS_Store b/.DS_Store index 68ab25e..b5c08ab 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 894a44c..3277328 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,4 @@ venv.bak/ # mypy .mypy_cache/ +.DS_Store diff --git a/EveryDay/.DS_Store b/EveryDay/.DS_Store index 57d97b7..24908e1 100644 Binary files a/EveryDay/.DS_Store and b/EveryDay/.DS_Store differ diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/exec_js_summary.iml" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/exec_js_summary.iml" new file mode 100644 index 0000000..7c9d48f --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/exec_js_summary.iml" @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/misc.xml" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/misc.xml" new file mode 100644 index 0000000..8656114 --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/misc.xml" @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/modules.xml" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/modules.xml" new file mode 100644 index 0000000..bc1a7a0 --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/workspace.xml" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/workspace.xml" new file mode 100644 index 0000000..94dc021 --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/.idea/workspace.xml" @@ -0,0 +1,410 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1595339185159 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + file://$PROJECT_DIR$/js2py_demo.py + 60 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/js2py_demo.py" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/js2py_demo.py" new file mode 100644 index 0000000..5d94530 --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/js2py_demo.py" @@ -0,0 +1,61 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: js2py_demo.py +@time: 2020-07-22 17:49 +@description:js2py +""" + +# 依赖 +# pip3 install js2py + +import js2py + +from js_code import * + + +def test_simple(): + """ + 简单 + :return: + """ + # 将js代码转为python + add = js2py.eval_js(js_simple()) + + # 当做python函数调用 + result = add(1, 2) + + print(result) + + +def test_js_from_file(): + """ + 从文件中读取js进行执行 + :return: + """ + + # 从文件中读取js代码 + js_content = js_from_file('./norm.js') + + # 使用获取上下js2py生成一个上下文环境 + context = js2py.EvalJs() + + # 执行整段JS代码 + context.execute(js_content) + + # 使用context调用具体的函数 + result = context.add(1, 2) + + print(result) + + +if __name__ == '__main__': + # test_simple() + test_js_from_file() diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/js_code.py" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/js_code.py" new file mode 100644 index 0000000..cd3a113 --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/js_code.py" @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: js_code.py +@time: 2020-07-22 13:30 +@description:待执行的JS代码 +""" + + +def js_simple(): + """ + 返回简单的js代码 + :return: + """ + return """ + function add(num1 , num2){ + return num1 + num2; + } + """ + + +def js_from_file(file_name): + """ + 读取js文件 + :return: + """ + with open(file_name, 'r', encoding='UTF-8') as file: + result = file.read() + + return result diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/node_demo.py" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/node_demo.py" new file mode 100644 index 0000000..31e80f0 --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/node_demo.py" @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: node_demo.py +@time: 2020-07-22 22:19 +@description:使用node命令调用js +""" + +import os + + +def func1(): + # 组成调用js的命令 + cmd = 'node -e "require(\\"%s\\").init(%s,%s)"' % ('./norm1', 3, 5) + + pipeline = os.popen(cmd) + + # 读取结果 + result = pipeline.read() + + print('结果是:', result) + + +if __name__ == '__main__': + func1() diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/norm.js" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/norm.js" new file mode 100644 index 0000000..ce69ffe --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/norm.js" @@ -0,0 +1,4 @@ +//计算两个数的和 +function add(num1, num2) { + return num1 + num2; +} diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/norm1.js" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/norm1.js" new file mode 100644 index 0000000..b625346 --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/norm1.js" @@ -0,0 +1,10 @@ +//计算两个数的和 +function add(num1, num2) { + return num1 + num2; +} + +//新增一个导出函数(node方式) +module.exports.init = function (arg1, arg2) { + //调用函数 + console.log(add(arg1, arg2)); +}; \ No newline at end of file diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/py_exec_js_demo.py" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/py_exec_js_demo.py" new file mode 100644 index 0000000..8b0b778 --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/py_exec_js_demo.py" @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: py_exec_js_demo.py +@time: 2020-07-22 13:24 +@description:使用PyExecJS调用JS代码 +""" + +# 依赖 +# pip3 install PyExecJS + +import execjs + +from js_code import * + +# 1、简单的JS字符串 +# 编译并加载 js 文件内容,方便执行里面的方法 +context = execjs.compile(js_simple()) + +# 使用call()函数调用js内部函数 +result = context.call("add", 2, 3) + +print(result) + +# 2、js文件 +# 编译加载js字符串 +context1 = execjs.compile(js_from_file('./norm.js')) + +# 调用js代码中的add()方法,参数为2和3 +result1 = context1.call("add", 2, 3) + +print(result1) diff --git "a/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/py_v8_demo.py" "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/py_v8_demo.py" new file mode 100644 index 0000000..6113fe7 --- /dev/null +++ "b/Python\346\211\247\350\241\214JS\346\200\273\347\273\223/py_v8_demo.py" @@ -0,0 +1,24 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: py_v8_demo.py +@time: 2020-07-22 14:53 +@description:PyV8调用JS +""" + +import PyV8 +from js_code import js_from_file + +with PyV8.JSContext() as ctx: + ctx.eval(js_from_file('./norm.js')) + +# 调用js函数,指定参数 +ctx.locals.add(1, 2) + diff --git a/README.md b/README.md index 63da7b4..c2f7236 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,30 @@ -# tools_python +# Tools Python + +## 详细教程 + +如果想查看详细教程,请关注微信公众号:**AirPython** + + + +![](./raw/qr.jpeg) + + + +## 文章列表 + +* [制作截图快捷翻译](./截图快捷翻译) +* [朋友圈防折叠](./朋友圈防折叠/) +* [批量生成手机号码](./批量生成手机号码) +* [短视频二次创作](./video_auto/二次剪辑) +* [使用 Python 制作 GIF 动画视频](./video_auto/制作GIF视频/) +* [使用 Python 制作一个卡点视频](./video_auto/卡点视频/readme.md) * [替换 `apk` 的资源并重新打包](./android/replace_apk_resource/readme.md) * [替换 `apk` 的资源并重新打包全解析](./android/replace_apk_resource_pro/readme.md) * [`appium` 配合压力测试 `app` 应用](./android/appium_demo/) * [每天固定时间发送天气、笑话给微信个人和群,并部署到云服务器](./EveryDay/) -* [使用 Python 制作一个卡点视频](./video_auto/卡点视频/readme.md) -* [使用 Python 制作 GIF 动画视频](./video_auto/制作GIF视频/) - +* [视频特殊处理,保证唯一性](./视频特殊处理.py) +* [发送邮件的几种方式](./发送邮件) +* [Python 调用 JS 的 4 种方式](./Python执行JS总结) +* [批处理脚本](./批处理脚本) +* [生成九宫格视频+生成九宫格朋友圈图片](./图片视频九宫格/) diff --git a/raw/qr.jpeg b/raw/qr.jpeg new file mode 100644 index 0000000..1e66f85 Binary files /dev/null and b/raw/qr.jpeg differ diff --git a/video_auto/.DS_Store b/video_auto/.DS_Store index 1e89194..7dd1e34 100644 Binary files a/video_auto/.DS_Store and b/video_auto/.DS_Store differ diff --git "a/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.DS_Store" "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.DS_Store" new file mode 100644 index 0000000..752209c Binary files /dev/null and "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.DS_Store" differ diff --git "a/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/misc.xml" "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/misc.xml" new file mode 100644 index 0000000..8656114 --- /dev/null +++ "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/misc.xml" @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git "a/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/modules.xml" "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/modules.xml" new file mode 100644 index 0000000..9a413c3 --- /dev/null +++ "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/vcs.xml" "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/vcs.xml" new file mode 100644 index 0000000..c2365ab --- /dev/null +++ "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/vcs.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/workspace.xml" "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/workspace.xml" new file mode 100644 index 0000000..ac07554 --- /dev/null +++ "b/video_auto/\344\272\214\346\254\241\345\211\252\350\276\221/.idea/workspace.xml" @@ -0,0 +1,839 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + fadein + concatenate_videoclips + video_clip + audio + temp.mp + video_path + get_frame_from_video + + + $PROJECT_DIR$ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1594295709801 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\345\217\221\351\200\201\351\202\256\344\273\266/.idea/\345\217\221\351\200\201\351\202\256\344\273\266.iml" "b/\345\217\221\351\200\201\351\202\256\344\273\266/.idea/\345\217\221\351\200\201\351\202\256\344\273\266.iml" new file mode 100644 index 0000000..7c9d48f --- /dev/null +++ "b/\345\217\221\351\200\201\351\202\256\344\273\266/.idea/\345\217\221\351\200\201\351\202\256\344\273\266.iml" @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git "a/\345\217\221\351\200\201\351\202\256\344\273\266/attachments/report.png" "b/\345\217\221\351\200\201\351\202\256\344\273\266/attachments/report.png" new file mode 100644 index 0000000..74ae740 Binary files /dev/null and "b/\345\217\221\351\200\201\351\202\256\344\273\266/attachments/report.png" differ diff --git "a/\345\217\221\351\200\201\351\202\256\344\273\266/email_by_smtplib.py" "b/\345\217\221\351\200\201\351\202\256\344\273\266/email_by_smtplib.py" new file mode 100644 index 0000000..9fb68d4 --- /dev/null +++ "b/\345\217\221\351\200\201\351\202\256\344\273\266/email_by_smtplib.py" @@ -0,0 +1,102 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: email_by_smtplib.py +@time: 2020-07-09 21:30 +@description:smtplib发送邮件 +""" + +import os +import smtplib +from email.mime.multipart import MIMEMultipart +from email.mime.text import MIMEText + + +class SmtplibObject(object): + + def __init__(self): + # 初始化 + self.smtp = smtplib.SMTP() + # 连接邮箱服务器地址 + self.smtp.connect('smtp.126.com') + + # 加入主题和附件,邮件体 + self.email_body = MIMEMultipart('mixed') + + # 发件人地址及授权码 + self.email_from_username = '**@126.com' + self.email_from_password = '授权码' + + def send_email(self, email_to_list, email_title, email_content, attchment_path, files): + """ + 发送邮件 + :return: + """ + # 组成邮件体 + self.generate_email_body(email_to_list, email_title, email_content, attchment_path, files) + + # 登录邮箱 + # 参数为账号和密码(授权码) + self.smtp.login(self.email_from_username, self.email_from_password) + + # 发送邮件 + # 注意:此处必须同时指定发件人与收件人,否则会当作垃圾邮件处理掉 + self.smtp.sendmail(self.email_from_username, email_to_list, self.email_body.as_string()) + + def generate_email_body(self, email_to_list, email_title, email_content, attchment_path, files): + """ + 组成邮件体 + :param email_to_list:收件人列表 + :param email_title:邮件标题 + :param email_content:邮件正文内容 + :param attchment_path:附件的路径 + :param files:附件文件名列表 + :return: + """ + self.email_body['Subject'] = email_title + self.email_body['From'] = self.email_from_username + self.email_body['To'] = ",".join(email_to_list) + + for file in files: + file_path = attchment_path + '/' + file + if os.path.isfile(file_path): + # 构建一个附件对象 + att = MIMEText(open(file_path, 'rb').read(), 'base64', 'utf-8') + att["Content-Type"] = 'application/octet-stream' + att.add_header("Content-Disposition", "attachment", filename=("gbk", "", file)) + self.email_body.attach(att) + + text_plain = MIMEText(email_content, 'plain', 'utf-8') + self.email_body.attach(text_plain) + + def exit(self): + """ + 退出服务 + :return: + """ + self.smtp.quit() + + +if __name__ == '__main__': + # 收件人列表 + email_to_list = ['**@qq.com'] + email_title = "测试报告" + email_content = '这是测试报告具体内容' + # 附件路径 + attchment_path = './attachments/' + # 附件文件列表 + attchment_files = ['report.png', 'config.json'] + + # 发送邮件 + smtplib_object = SmtplibObject() + smtplib_object.send_email(email_to_list, email_title, email_content, attchment_path, attchment_files) + + # 退出 + smtplib_object.exit() diff --git "a/\345\217\221\351\200\201\351\202\256\344\273\266/email_by_yagmail.py" "b/\345\217\221\351\200\201\351\202\256\344\273\266/email_by_yagmail.py" new file mode 100644 index 0000000..7552ae3 --- /dev/null +++ "b/\345\217\221\351\200\201\351\202\256\344\273\266/email_by_yagmail.py" @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: email_by_yagmail.py +@time: 2020-07-09 21:07 +@description:yagmail发送/接受邮件 +""" + +# 依赖:pip3 install yagmail +# 公众号:AirPython + +import yagmail + +# 连接服务器 +# 用户名、授权码、服务器地址 +yag_server = yagmail.SMTP(user='**@126.com', password='授权码', host='smtp.126.com') + +# 发送邮件 +# 发送对象列表 +email_to = ['**@qq.com', ] +email_title = '测试报告' +email_content = "这是测试报告的具体内容" +# 附件列表 +email_attachments = ['./attachments/report.png', ] +yag_server.send(email_to, email_title, email_content, email_attachments) + +# 关闭连接 +yag_server.close() diff --git "a/\345\217\221\351\200\201\351\202\256\344\273\266/email_by_zmail.py" "b/\345\217\221\351\200\201\351\202\256\344\273\266/email_by_zmail.py" new file mode 100644 index 0000000..3d5fb5b --- /dev/null +++ "b/\345\217\221\351\200\201\351\202\256\344\273\266/email_by_zmail.py" @@ -0,0 +1,96 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: email_by_zmail.py +@time: 2020-07-09 19:57 +@description:zmail发送邮件 +""" + +# 依赖 +# pip3 install zmail +# 公众号:AirPython + +import zmail + + +class ZMailObject(object): + + def __init__(self): + # 邮箱账号 + self.username = '**@126.com' + + # 邮箱授权码 + self.authorization_code = '授权码' + + # 构建一个邮箱服务对象 + self.server = zmail.server(self.username, self.authorization_code) + + def send_email(self, mail_to, mail_body): + """ + 发送邮件 + :param mail_to 发送对象 + :param mail: 发送主题、内容及附件 + :return: + """ + + if self.__check_pop_enable() and self.__check_smtp_enable(): + self.server.send_mail(mail_to, mail_body) + else: + pass + + def receive_email(self): + """ + 接受邮件 + :return: + """ + try: + # 接受邮件 + last_mail = self.server.get_latest() + # last_mail = self.server.get_mail(2) + # zmail.show(last_mail) + for k, v in last_mail.items(): + print(k, v) + except Exception as e: + # 收件箱为空,则会报错 + print('接受异常异常') + + def __check_smtp_enable(self): + """ + 检查smtp是否正常 + :return: + """ + return self.server.smtp_able() + + def __check_pop_enable(self): + """ + 检查pop功能是否正常 + :return: + """ + return self.server.pop_able() + + +if __name__ == '__main__': + zmail_obj = ZMailObject() + + # 发送内容及附件 + mail_to = '**@qq.com' + + # 邮件主体 + mail_body = { + 'subject': '测试报告', + 'content_text': '这是一个测试报告', # 纯文本或者HTML内容 + 'attachments': ['./attachments/report.png'], + } + + # 发送邮件 + zmail_obj.send_email(mail_to, mail_body) + + # 接受邮件 + # zmail_obj.receive_email() diff --git "a/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/inspectionProfiles/Project_Default.xml" "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/inspectionProfiles/Project_Default.xml" new file mode 100644 index 0000000..d962dec --- /dev/null +++ "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/inspectionProfiles/Project_Default.xml" @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git "a/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/misc.xml" "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/misc.xml" new file mode 100644 index 0000000..8656114 --- /dev/null +++ "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/misc.xml" @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git "a/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/modules.xml" "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/modules.xml" new file mode 100644 index 0000000..da76fd2 --- /dev/null +++ "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/modules.xml" @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git "a/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/vcs.xml" "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/vcs.xml" new file mode 100644 index 0000000..c2365ab --- /dev/null +++ "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/vcs.xml" @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git "a/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/workspace.xml" "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/workspace.xml" new file mode 100644 index 0000000..0962a99 --- /dev/null +++ "b/\345\233\276\347\211\207\350\247\206\351\242\221\344\271\235\345\256\253\346\240\274/.idea/workspace.xml" @@ -0,0 +1,573 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1584494973510 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221/.idea/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221.iml" "b/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221/.idea/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221.iml" new file mode 100644 index 0000000..7c9d48f --- /dev/null +++ "b/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221/.idea/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221.iml" @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git "a/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221/main.py" "b/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221/main.py" new file mode 100644 index 0000000..1c3ce28 --- /dev/null +++ "b/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221/main.py" @@ -0,0 +1,74 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: main.py +@time: 2020-03-18 09:29 +@description:TODO +""" + +import tkinter.messagebox +from tkinter import * + +import pytesseract +from PIL import Image +from PIL import ImageGrab +from googletrans import Translator + + +def get_clip_image(): + """ + 从剪切板获取图片,保存到本地 + :return: + """ + image_result = None + img = ImageGrab.grabclipboard() + if img and isinstance(img, Image.Image): + print(img.size) + print(img.mode) + image_result = './temp.png' + img.save(image_result) + return image_result + + +def image_ocr(image_path): + """ + 识别图像中的英文 + :return: + """ + # 英文:lang='eng' + # 中文:lang='chi_sim' + return pytesseract.image_to_string(Image.open(image_path), lang='eng') + + +def trans_eng(content_eng): + """ + 英文-中文 + :param content: + :return: + """ + translator = Translator(service_urls=['translate.google.cn']) + return translator.translate(content_eng, src='en', dest='zh-cn').text + + +image_path = get_clip_image() + +if image_path: + # 获取文本 + content_eng = image_ocr(image_path).replace("\r", " ").replace("\n", " ") + + # 翻译 + if content_eng: + content_chinese = trans_eng(content_eng) + print(content_chinese) + + # 实现主窗口隐藏 + root = Tk() + root.withdraw() + tkinter.messagebox.showinfo('翻译结果', content_chinese) \ No newline at end of file diff --git "a/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221/trans.py" "b/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221/trans.py" new file mode 100644 index 0000000..e412396 --- /dev/null +++ "b/\346\210\252\345\233\276\345\277\253\346\215\267\347\277\273\350\257\221/trans.py" @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: trans.py +@time: 2020-03-18 21:55 +@description:截屏快速翻译 +""" + +import tkinter.messagebox +from tkinter import * + +import pytesseract +from PIL import Image +from PIL import ImageGrab +from googletrans import Translator + +# 1、从剪切板获取图片,保存到本地 +img = ImageGrab.grabclipboard() +if img and isinstance(img, Image.Image): + image_result = './temp.png' + img.save(image_result) + + # 2、OCR识别 + content_eng = pytesseract.image_to_string(Image.open(image_result), lang='eng') + + # 3、翻译 + translator = Translator(service_urls=['translate.google.cn']) + + content_chinese = translator.translate(content_eng, src='en', dest='zh-cn').text + + # 4、显示 + root = Tk() + root.withdraw() + tkinter.messagebox.showinfo('翻译结果', content_chinese) diff --git "a/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/del_all_build.bat" "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/del_all_build.bat" new file mode 100755 index 0000000..310baeb --- /dev/null +++ "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/del_all_build.bat" @@ -0,0 +1,12 @@ +@echo off +:: ´򿪵½µ±ǰĿ¼Ï +cd /d "%~dp0" + +:: ɾ³ýbuildÎļþ¼Ð +echo ¿ªʼɾ³ý + +for /r /D %%i in (*build*) do rd /s /q "%%i" + +echo ɾ³ýÍê³É + +pause \ No newline at end of file diff --git "a/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/del_system_gc.bat" "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/del_system_gc.bat" new file mode 100755 index 0000000..b1ee62c --- /dev/null +++ "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/del_system_gc.bat" @@ -0,0 +1,28 @@ +@echo off +:: ÅäÖà +title Alic Feng batTool for Clean +color 03 +mode con cols=42 lines=20 + +echo executes cleaning,Please waiting... + +::³ÌÐòɾ³ýϵͳÎÞÓÃÎļþ¿ªʼ +del /f /s /q %systemdrive%\*.tmp 1>nul 2>nul +del /f /s /q %systemdrive%\*._mp 1>nul 2>nul +del /f /s /q %systemdrive%\*.log 1>nul 2>nul +del /f /s /q %systemdrive%\*.gid 1>nul 2>nul +del /f /s /q %systemdrive%\*.chk 1>nul 2>nul +del /f /s /q %systemdrive%\*.old 1>nul 2>nul +del /f /s /q %systemdrive%\recycled\*.* 1>nul 2>nul +del /f /s /q %windir%\*.bak 1>nul 2>nul +del /f /s /q %windir%\prefetch\*.* 1>nul 2>nul +del /f /s /q %windir%\temp\*.* 1>nul 2>nul +del /f /q %userprofile%\cookies\*.* 1>nul 2>nul +del /f /q %userprofile%\recent\*.* 1>nul 2>nul +del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*" 1>nul 2>nul +del /f /s /q "%userprofile%\Local Settings\Temp\*.*" 1>nul 2>nul +del /f /s /q "%userprofile%\recent\*.*" 1>nul 2>nul +::³ÌÐòɾ³ýϵͳÎÞÓÃÎļþ½áÊø + +echo Çå³ýϵͳÍê³É +echo. & pause \ No newline at end of file diff --git "a/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/documents_classifying.bat" "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/documents_classifying.bat" new file mode 100755 index 0000000..f9dbc5a --- /dev/null +++ "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/documents_classifying.bat" @@ -0,0 +1,8 @@ +@echo off +:: 当前目录下的文件进行分类,放到不同的文件夹内 +:: md 用于创建文件夹 +:: %%~xi将%%i解开扩展名,也就是取%%i的扩展名部分 +for %%i in (*) do (md %%~xi +move *%%~xi %%~xi) + +pause \ No newline at end of file diff --git "a/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/raw/Bat_To_Exe_Converter.exe" "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/raw/Bat_To_Exe_Converter.exe" new file mode 100755 index 0000000..1ed4e4a Binary files /dev/null and "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/raw/Bat_To_Exe_Converter.exe" differ diff --git "a/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/run_python_loop.bat" "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/run_python_loop.bat" new file mode 100755 index 0000000..f5c8d44 --- /dev/null +++ "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/run_python_loop.bat" @@ -0,0 +1,22 @@ +@echo off + +title ѭ»·ÔËÐÐPython´úÂë + +:: 5·ÖÖÓִÐÐһ´Σ¬µ¥λΪs +set INTERVAL=300 + +:: ÌáǰִÐÐһ´Σ¬°ÑִÐÐʱ¼ä´òӡ³öÀ´ +echo ¿ªʼִÐÐ - %time% +python C:/test.py + +:: ʹÓÃtimeout½øÐе¹¼Æʱ +timeout %INTERVAL% + +:: н¨һ¸öÈÎÎñ +:Task +echo ¿ªʼִÐÐ - %time% +python C:/test.py +timeout %INTERVAL% + +:: ʹÓÃgotoÃüÁ¿ªʼÌøתµ½ÉÏÃæµÄÈÎÎ񣬿ªʼִÐÐ +goto Task \ No newline at end of file diff --git "a/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/\346\217\220\344\272\244\344\273\243\347\240\201/\346\217\220\344\272\244\344\273\243\347\240\201.bat" "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/\346\217\220\344\272\244\344\273\243\347\240\201/\346\217\220\344\272\244\344\273\243\347\240\201.bat" new file mode 100755 index 0000000..9607674 --- /dev/null +++ "b/\346\211\271\345\244\204\347\220\206\350\204\232\346\234\254/\346\217\220\344\272\244\344\273\243\347\240\201/\346\217\220\344\272\244\344\273\243\347\240\201.bat" @@ -0,0 +1,20 @@ +@echo off +title �ύ���� +echo �ύ���룬�򻯲��� + +:: ����״̬ +git status + +:: set���ȴ����룬��ֵ������msg +set /p commit_msg=�����ύע�ͣ� + +:: �ύ�����4������ +git add . +git commit -m %commit_msg% +git pull +git push + +echo �ύ�ɹ� +pause + + diff --git "a/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/.DS_Store" "b/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/.DS_Store" new file mode 100644 index 0000000..73fb940 Binary files /dev/null and "b/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/.DS_Store" differ diff --git "a/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/generate_area_phone_util.py" "b/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/generate_area_phone_util.py" new file mode 100644 index 0000000..0420c1a --- /dev/null +++ "b/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/generate_area_phone_util.py" @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: generate_area_phone_util.py +@time: 2020-01-05 20:16 +@description:生成区域的电话号码 +""" + +from utils.addr_utils import * + +def generate_phones(num, areas): + """ + 生成随机号码 + :param num:数目 + :param areas: 区域 + :return: + """ + + headers = { + 'authority': 'api.uukit.com', + 'pragma': 'no-cache', + 'cache-control': 'no-cache', + 'accept': 'enote_app/json, text/javascript, */*; q=0.01', + 'origin': 'https://uutool.cn', + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', + 'sec-fetch-site': 'cross-site', + 'sec-fetch-mode': 'cors', + 'referer': 'https://uutool.cn/phone-generate/', + 'accept-encoding': 'gzip, deflate, br', + 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8', + } + + data = { + 'phone_num': num, + 'area': areas, + 'segment': '133,153,189,180,181,177,173,139,138,137,136,135,134,159,158,157,150,151,152,147,188,187,182,183,184,178,130,131,132,156,155,186,185,145,176' + } + + response = requests.post('https://api.uukit.com/phone/generate_batch', headers=headers, data=data) + + phones = json.loads(response.text).get('data').get('rows') + + return phones + + +if __name__ == '__main__': + # 手机号码个数 + num = 100 + + # 全国所有城市名称和id编号 + citys = get_all_citys() + + city_name = input('请输入手机归属地:') + + if city_name not in citys.keys(): + city_name = '北京' + + # 获取城市id + city_id = citys.get(city_name) + + # 请输入要获取手机号码的归属地 + phones = generate_phones(num, city_id) + print(phones) diff --git "a/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/utils/.DS_Store" "b/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/utils/.DS_Store" new file mode 100644 index 0000000..5008ddf Binary files /dev/null and "b/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/utils/.DS_Store" differ diff --git "a/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/utils/addr_utils.py" "b/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/utils/addr_utils.py" new file mode 100644 index 0000000..53dcd5f --- /dev/null +++ "b/\346\211\271\351\207\217\347\224\237\346\210\220\346\211\213\346\234\272\345\217\267\347\240\201/utils/addr_utils.py" @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +@version: v1.0 +@author: xag +@license: Apache Licence +@contact: xinganguo@gmail.com +@site: http://www.xingag.top +@software: PyCharm +@file: addr_utils.py +@time: 2020-01-06 22:24 +@description:TODO +""" + +import json +import re + +import requests + + +# 所有的id和城市名称数据 + +def get_all_citys(): + """ + 获取所有的城市数据 + :return: + """ + + headers = { + 'authority': 'uutool.cn', + 'pragma': 'no-cache', + 'cache-control': 'no-cache', + 'upgrade-insecure-requests': '1', + 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36', + 'sec-fetch-user': '?1', + 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', + 'sec-fetch-site': 'none', + 'sec-fetch-mode': 'navigate', + 'accept-encoding': 'gzip, deflate, br', + 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8', + 'cookie': 'UM_distinctid=16f759fe6bd24b-0322efd0d180d8-1d376b5b-1aeaa0-16f759fe6beb69; CNZZDATA1275106188=191793625-1578225029-https%253A%252F%252Fwww.google.com%252F%7C1578316721', + } + + resp = requests.get('https://uutool.cn/phone-generate/', headers=headers).text + + re_rule = r'areaArr:(.+?)segmentArr:' + + # 匹配换行符 + result_data = re.findall(re_rule, resp, re.S)[0].strip()[:-1] + + result = json.loads(result_data) + + # 获取所有的省份 + provices = result.keys() + + # 所有的城市 + citys = {} + + for provice in provices: + current_citys = result.get(provice) + # citys.extend(current_citys) + for item in current_citys: + citys[item.get('name')] = item.get('id') + + return citys + +# get_all_citys() diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/.DS_Store" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/.DS_Store" new file mode 100644 index 0000000..ae82168 Binary files /dev/null and "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/.DS_Store" differ diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.gitignore" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.gitignore" new file mode 100644 index 0000000..b3293a4 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.gitignore" @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +.DS_Store diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/codeStyles/Project.xml" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/codeStyles/Project.xml" new file mode 100644 index 0000000..ae78c11 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/codeStyles/Project.xml" @@ -0,0 +1,113 @@ + + + + + +
+ + + + xmlns:android + + ^$ + + + +
+
+ + + + xmlns:.* + + ^$ + + + BY_NAME + +
+
+ + + + .*:id + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + .*:name + + http://schemas.android.com/apk/res/android + + + +
+
+ + + + name + + ^$ + + + +
+
+ + + + style + + ^$ + + + +
+
+ + + + .* + + ^$ + + + BY_NAME + +
+
+ + + + .* + + http://schemas.android.com/apk/res/android + + + ANDROID_ATTRIBUTE_ORDER + +
+
+ + + + .* + + .* + + + BY_NAME + +
+
+
+
+
+
\ No newline at end of file diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/gradle.xml" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/gradle.xml" new file mode 100644 index 0000000..674414f --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/gradle.xml" @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/misc.xml" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/misc.xml" new file mode 100644 index 0000000..703e5d4 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/misc.xml" @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/runConfigurations.xml" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/runConfigurations.xml" new file mode 100644 index 0000000..7f68460 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.idea/runConfigurations.xml" @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.project" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.project" new file mode 100644 index 0000000..aec280f --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.project" @@ -0,0 +1,17 @@ + + + NoCollapseInput + Project NoCollapseInput created by Buildship. + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.buildship.core.gradleprojectnature + + diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.settings/org.eclipse.buildship.core.prefs" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.settings/org.eclipse.buildship.core.prefs" new file mode 100644 index 0000000..e889521 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.settings/org.eclipse.buildship.core.prefs" @@ -0,0 +1,2 @@ +connection.project.dir= +eclipse.preferences.version=1 diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.vscode/settings.json" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.vscode/settings.json" new file mode 100644 index 0000000..e0f15db --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/.vscode/settings.json" @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "automatic" +} \ No newline at end of file diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.classpath" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.classpath" new file mode 100644 index 0000000..eb19361 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.classpath" @@ -0,0 +1,6 @@ + + + + + + diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.gitignore" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.gitignore" new file mode 100644 index 0000000..796b96d --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.gitignore" @@ -0,0 +1 @@ +/build diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.project" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.project" new file mode 100644 index 0000000..ac485d7 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.project" @@ -0,0 +1,23 @@ + + + app + Project app created by Buildship. + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.buildship.core.gradleprojectbuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.buildship.core.gradleprojectnature + + diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.settings/org.eclipse.buildship.core.prefs" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.settings/org.eclipse.buildship.core.prefs" new file mode 100644 index 0000000..b1886ad --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/.settings/org.eclipse.buildship.core.prefs" @@ -0,0 +1,2 @@ +connection.project.dir=.. +eclipse.preferences.version=1 diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/build.gradle" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/build.gradle" new file mode 100644 index 0000000..0bf342f --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/build.gradle" @@ -0,0 +1,44 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 28 + defaultConfig { + applicationId "com.xingag.preventrubbishapp" + minSdkVersion 21 + targetSdkVersion 28 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } } + } + + buildTypes { + + debug { + minifyEnabled false + } + + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } + +} + + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation 'androidx.appcompat:appcompat:1.0.2' + implementation 'androidx.constraintlayout:constraintlayout:1.1.3' + testImplementation 'junit:junit:4.12' + androidTestImplementation 'androidx.test.ext:junit:1.1.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1' + implementation 'com.wuhenzhizao:titlebar:1.1.4' + implementation 'com.google.android.material:material:1.0.0' + implementation 'com.google.code.gson:gson:2.8.6' +} diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/proguard-rules.pro" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/proguard-rules.pro" new file mode 100644 index 0000000..f1b4245 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/proguard-rules.pro" @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/androidTest/java/com/xingag/preventrubbishapp/ExampleInstrumentedTest.java" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/androidTest/java/com/xingag/preventrubbishapp/ExampleInstrumentedTest.java" new file mode 100644 index 0000000..05797e4 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/androidTest/java/com/xingag/preventrubbishapp/ExampleInstrumentedTest.java" @@ -0,0 +1,29 @@ +package com.xingag.preventrubbishapp; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest +{ + @Test + public void useAppContext() + { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("com.xingag.preventrubbishapp", appContext.getPackageName()); + } +} diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/AndroidManifest.xml" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/AndroidManifest.xml" new file mode 100644 index 0000000..6546f04 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/AndroidManifest.xml" @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/preventrubbishapp/App.java" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/preventrubbishapp/App.java" new file mode 100644 index 0000000..787a3b0 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/preventrubbishapp/App.java" @@ -0,0 +1,24 @@ +package com.xingag.preventrubbishapp; + +import android.app.Application; +import android.content.Context; + +public class App extends Application +{ + private static App instance = null; + + public static int phone_type = 0; + + public static App getInstance() + { + return instance; + } + + @Override + public void onCreate() + { + super.onCreate(); + instance = this; + phone_type = BuildConfig.phone_type; + } +} diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/preventrubbishapp/MainActivity.java" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/preventrubbishapp/MainActivity.java" new file mode 100644 index 0000000..0d00f89 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/preventrubbishapp/MainActivity.java" @@ -0,0 +1,82 @@ +package com.xingag.preventrubbishapp; + +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.CheckBox; +import android.widget.CompoundButton; +import android.widget.TextView; + +import androidx.appcompat.app.ActionBar; +import androidx.appcompat.app.AppCompatActivity; + +import com.xingag.utils.AccessibilityUtil; + +public class MainActivity extends AppCompatActivity implements View.OnClickListener +{ + + //包名和服务名称 + private static final String PACKAGE_NAME = "com.xingag.preventrubbishapp"; + private static final String SERVICE_NAME = "com.xingag.service.PreventService"; + + private AccessibilityUtil accessibilityUtil = null; + + //状态 + private TextView status_tv = null; + + private Button open_service_btn = null; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + status_tv = findViewById(R.id.status_tv); + open_service_btn = findViewById(R.id.open_service_btn); + open_service_btn.setOnClickListener(this); + + accessibilityUtil = new AccessibilityUtil(MainActivity.this, + PACKAGE_NAME, SERVICE_NAME); + + //设置标题 + ActionBar actionBar = getSupportActionBar(); + if (actionBar != null) + { + actionBar.setTitle("不折叠服务"); + } + + //判断状态,如果没有开启,就跳到设置界面 + openAccessibilityMet(); + } + + public void openAccessibilityMet() + { + //服务状态 + boolean status = AccessibilityUtil.isAccessibilitySettingsOn(this, SERVICE_NAME); + if (!status) + { + accessibilityUtil.openSettingDialog(); + } + } + + + @Override + protected void onResume() + { + super.onResume(); + //判断服务状态 + boolean status = AccessibilityUtil.isAccessibilitySettingsOn(this, SERVICE_NAME); + status_tv.setText(status ? "开启" : "关闭"); + } + + @Override + public void onClick(View view) + { + if (view.getId() == R.id.open_service_btn) + { + accessibilityUtil.openSettingPage(); + } + } +} + diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/service/BaseService.java" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/service/BaseService.java" new file mode 100644 index 0000000..2bb0f5a --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/service/BaseService.java" @@ -0,0 +1,89 @@ +package com.xingag.service; + +import android.accessibilityservice.AccessibilityService; +import android.accessibilityservice.AccessibilityServiceInfo; +import android.annotation.SuppressLint; +import android.annotation.TargetApi; +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; +import android.os.Build; +import android.os.Bundle; +import android.text.TextUtils; +import android.util.Log; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityManager; +import android.view.accessibility.AccessibilityNodeInfo; + + +import java.util.List; + +/*** + * 无障碍服务的基类 + */ + + +public class BaseService extends AccessibilityService +{ + + @SuppressLint("StaticFieldLeak") + private static BaseService mInstance = null; + + + public static BaseService getInstance() + { + if (mInstance == null) + { + mInstance = new BaseService(); + } + return mInstance; + } + + + @Override + public void onAccessibilityEvent(AccessibilityEvent event) + { + + } + + @Override + public void onInterrupt() + { + + } + + + /** + * 模拟输入 + * + * @param nodeInfo nodeInfo + * @param text text + */ + public void inputText(AccessibilityNodeInfo nodeInfo, String text) + { + ClipboardManager clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); + + Log.d("xag", "字符个数为:" + text.length()); + for (int i = 0; i < text.length(); i++) + { + String temp = text.substring(0, i + 1); + Log.e("xag", "输入一次,输入内容是:" + temp); + + //输入内容 + Bundle arguments = new Bundle(); + arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, temp); + nodeInfo.performAction(AccessibilityNodeInfo.ACTION_SET_TEXT, arguments); + + //下面可以控制输入的速度,这里设置间隔为0.1s + try + { + Thread.sleep(100); + } catch (InterruptedException e) + { + e.printStackTrace(); + } + } + } + + +} diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/service/PreventService.java" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/service/PreventService.java" new file mode 100644 index 0000000..cabf382 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/service/PreventService.java" @@ -0,0 +1,131 @@ +package com.xingag.service; + +import android.accessibilityservice.AccessibilityService; +import android.annotation.TargetApi; +import android.content.Intent; +import android.os.Build; +import android.text.TextUtils; +import android.util.Log; +import android.view.accessibility.AccessibilityEvent; +import android.view.accessibility.AccessibilityNodeInfo; +import android.widget.Toast; + +import com.xingag.utils.AppUtil; + +import java.util.ArrayList; +import java.util.List; + +public class PreventService extends BaseService +{ + //所有的节点 + public static List nodes = new ArrayList<>(); + + private static final String CLASS_NAME_SNS_UPLOAD = "com.tencent.mm.plugin.sns.ui.SnsUploadUI"; + + /** + * 连接服务成功后回调该方法 + */ + @Override + protected void onServiceConnected() + { + super.onServiceConnected(); + //缓存中获取数据 + Toast.makeText(PreventService.this, "连接服务成功", + Toast.LENGTH_SHORT).show(); + + stopSelf(); + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) + { + return super.onStartCommand(intent, flags, startId); + } + + @Override + public void onAccessibilityEvent(AccessibilityEvent event) + { + //如果是朋友圈发布界面 + String className = event.getClassName().toString(); + + Log.d("xag", "className:" + className); + + if (TextUtils.equals(CLASS_NAME_SNS_UPLOAD, className)) + { + Log.e("xag", "朋友圈发布界面"); + + //获取剪切板的内容 + String content = AppUtil.getClipBoardContent(getApplicationContext()); + + if (!TextUtils.isEmpty(content)) + { + Log.d("xag", "剪切板内容是:" + content); + inputContent(event, content); + } else + { + Log.d("xag", "剪切板内容为空"); + } + } + + } + + + /*** + * 回复消息 + * @param event + */ + private void inputContent(AccessibilityEvent event, String content) + { + //获取输入框元素 + //方式一 +// AccessibilityNodeInfo chat_edit = findViewByID("com.tencent.mm:id/d41"); + + //方式二 + nodes.clear(); + AppUtil.getAllNodes(getRootInActiveWindow()); + AccessibilityNodeInfo chat_edit = findNodeInfoByClassName("android.widget.EditText"); + + //把文本输入到输入框内 + inputText(chat_edit, content); + } + + + /*** + * 通过类名查找元素 + * @param className + * @return + */ + public AccessibilityNodeInfo findNodeInfoByClassName(String className) + { + for (int i = 0; i < nodes.size(); i++) + { + //当前节点元素及classname + AccessibilityNodeInfo currentNode = nodes.get(i); + String tagClassName = currentNode.getClassName().toString(); + + Log.d("xag", "tagClassName:" + tagClassName); + if (TextUtils.equals(tagClassName, className)) + { + Log.d("xag", "元素找到了"); + return currentNode; + } + } + Log.d("xag", "元素没找到"); + return null; + } + + + @Override + public void onInterrupt() + { + Log.d("xag", "无障碍服务被打断"); + } + + + @Override + public void onDestroy() + { + super.onDestroy(); + Log.d("xag", "无障碍服务销毁"); + } +} diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/utils/AccessibilityUtil.java" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/utils/AccessibilityUtil.java" new file mode 100644 index 0000000..94c0378 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/utils/AccessibilityUtil.java" @@ -0,0 +1,141 @@ +package com.xingag.utils; + +import android.app.ActivityManager; +import android.app.AlertDialog; +import android.content.ComponentName; +import android.content.Context; +import android.content.DialogInterface; +import android.content.Intent; +import android.provider.Settings; +import android.text.TextUtils; + +import com.xingag.preventrubbishapp.R; + +import java.util.List; + +public class AccessibilityUtil +{ + private Context mContext; + private String locPackageName; + private String accessibilityClassAbsolutePath; + + /** + * 构造方法 + * + * @param mContext + * @param accessibilityClassAbsolutePath + */ + public AccessibilityUtil(Context mContext, String locPackageName, + String accessibilityClassAbsolutePath + ) + { + this.mContext = mContext; + this.locPackageName = locPackageName; + this.accessibilityClassAbsolutePath = accessibilityClassAbsolutePath; + } + + + /** + * 判断是否有辅助功能权限 + * + * @return 是否开启服务 + */ + public static boolean isAccessibilitySettingsOn(Context context, String className) + { + if (context == null) + { + return false; + } + ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); + // 获取正在运行的服务列表 + List runningServices = + activityManager.getRunningServices(300); + for (int i = 0; i < runningServices.size(); i++) + { + ComponentName service = runningServices.get(i).service; + if (service.getClassName().equals(className)) + { + return true; + } + } + return false; + } + + public boolean isAccessibilitySettingsOn() + { + boolean isAccessibilityOn = false; + try + { + int accessibilityEnabled = Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_ENABLED); + TextUtils.SimpleStringSplitter mStringColonSplitter = new TextUtils.SimpleStringSplitter(':'); + if (accessibilityEnabled == 1) + { + String settingValue = Settings.Secure.getString(mContext.getContentResolver(), Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES); + if (settingValue != null) + { + TextUtils.SimpleStringSplitter splitter = mStringColonSplitter; + splitter.setString(settingValue); + while (splitter.hasNext()) + { + String accessabilityService = splitter.next(); + //辅助服务关键路径,格式如"com.corget/com.corget.service.UnAccessibilityService" + String service = locPackageName + "/" + accessibilityClassAbsolutePath; + if (accessabilityService.equalsIgnoreCase(service)) + { + isAccessibilityOn = true; + } + } + } + } + } catch (Settings.SettingNotFoundException e) + { + e.printStackTrace(); + } + return isAccessibilityOn; + } + + + public void openSettingDialog() + { + AlertDialog.Builder mDialogBuilder = new AlertDialog.Builder(mContext); + + mDialogBuilder.setIcon(R.mipmap.ic_launcher); + mDialogBuilder.setTitle("警告"); + mDialogBuilder.setMessage("防折叠服务没有开启,请先开启服务"); + mDialogBuilder.setCancelable(false); + mDialogBuilder.setPositiveButton("Sure", + new DialogInterface.OnClickListener() + { + @Override + public void onClick(DialogInterface dialog, int which) + { + dialog.dismiss(); + openSettingPage(); + } + }); + mDialogBuilder.setNegativeButton("Cancel", + new DialogInterface.OnClickListener() + { + @Override + public void onClick(DialogInterface dialog, int which) + { + dialog.dismiss(); + } + }); + mDialogBuilder.create().show(); + } + + /*** + * 打开设置界面 + */ + public void openSettingPage() + { + Intent startIntent = new Intent( + Settings.ACTION_ACCESSIBILITY_SETTINGS); + mContext.startActivity(startIntent); + mContext.sendBroadcast(new Intent() + .setAction("com.xingag.setting.dialog")); + } + + +} diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/utils/AppUtil.java" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/utils/AppUtil.java" new file mode 100644 index 0000000..74253f2 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/java/com/xingag/utils/AppUtil.java" @@ -0,0 +1,56 @@ +package com.xingag.utils; + +import android.content.ClipData; +import android.content.ClipboardManager; +import android.content.Context; +import android.util.Log; +import android.view.accessibility.AccessibilityNodeInfo; + +import com.xingag.service.PreventService; + +import static android.content.Context.CLIPBOARD_SERVICE; + + +public class AppUtil +{ + + /*** + * 获取剪切板上的内容 + * @return + */ + public static String getClipBoardContent(Context context) + { + ClipboardManager cm = (ClipboardManager) context.getSystemService(CLIPBOARD_SERVICE); + ClipData cd2 = cm.getPrimaryClip(); + String result = ""; + try + { + result = cd2.getItemAt(0).getText().toString(); + } catch (Exception e) + { + //pass + Log.d("xag", "产生异常了。。。。"); + } + return result; + } + + /*** + * 获取当前页面所有的元素 + * @param node + */ + public static void getAllNodes(AccessibilityNodeInfo node) + { + int count = node.getChildCount(); + + if (count == 0) + { + PreventService.nodes.add(node); + } else + { + for (int i = 0; i < count; i++) + { + getAllNodes(node.getChild(i)); + } + } + } +} diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" new file mode 100644 index 0000000..1f6bb29 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" @@ -0,0 +1,34 @@ + + + + + + + + + + + diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/drawable/btn_bg.xml" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/drawable/btn_bg.xml" new file mode 100644 index 0000000..1f6bdb7 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/drawable/btn_bg.xml" @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/drawable/ic_launcher_background.xml" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/drawable/ic_launcher_background.xml" new file mode 100644 index 0000000..0d025f9 --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/drawable/ic_launcher_background.xml" @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/layout/activity_main.xml" "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/layout/activity_main.xml" new file mode 100644 index 0000000..143762a --- /dev/null +++ "b/\346\234\213\345\217\213\345\234\210\351\230\262\346\212\230\345\217\240/NoCollapseInput/app/src/main/res/layout/activity_main.xml" @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + +