--[[测试账号000000
账号123456密码]]
require "import"
import "android.widget.*"
import "android.view.*"
import "android.graphics.*"
import "android.os.Build"
import "com.androlua.Http"
import "cjson"
local window = activity.getWindow()
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
local decorView = window.getDecorView()
local flags = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + View.SYSTEM_UI_FLAG_LAYOUT_STABLE
if Build.VERSION.SDK_INT >= 23 then
flags = flags + View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
end
decorView.setSystemUiVisibility(flags)
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
window.setStatusBarColor(Color.TRANSPARENT)
local layout = {
LinearLayout,
orientation = "vertical",
layout_width = "fill",
layout_height = "fill",
padding = "60dp",
gravity="top|center";
background = "#FFFFFFFF",
{
EditText,
id = "输入",
layout_width = "fill",
layout_height = "wrap",
hint = "请输入 QQ 号",
inputType = 2,
singleLine = true,
},
{
Button,
id = "按钮",
layout_width = "fill",
layout_height = "wrap",
text = "查询",
layout_marginTop = "12dp",
},
{
LinearLayout,
orientation = "horizontal",
layout_width = "fill",
layout_height = "wrap",
layout_marginTop = "24dp",
gravity = "center",
{
id = "头像",
CircleImageView,
layout_width = "80dp",
layout_height = "80dp",
},
{
TextView,
id = "昵称",
layout_width = "wrap",
layout_height = "wrap",
textSize = "18sp",
layout_marginLeft = "16dp",
},
},
}
activity.setContentView(loadlayout(layout))
头像.setScaleType(ImageView.ScaleType.CENTER_CROP)
按钮.onClick = function()
local qq = 输入.getText().toString()
if qq == "" then
昵称.setText("请输入 QQ 号")
return
end
local url = "https://app.jishiben.site/?key=3d1d9d570158c491&qq=" .. qq
Http.get(url, nil, "UTF-8", nil, function(code, content)
if code == 200 and content then
local ok, data = pcall(cjson.decode, content)
if ok and data and data.code == 0 then
local nickname = data.data.nickname or "未知昵称"
local avatar = data.data.avatar or ""
activity.runOnUiThread(function()
昵称.setText(nickname)
if avatar ~= "" then
local bmp = loadbitmap(avatar)
if bmp then
头像.setImageBitmap(bmp)
else
头像.setImageDrawable(nil)
end
else
头像.setImageDrawable(nil)
end
end)
else
local errMsg = (data and data.msg) or "数据解析失败"
activity.runOnUiThread(function()
昵称.setText("查询失败")
头像.setImageDrawable(nil)
end)
end
else
activity.runOnUiThread(function()
昵称.setText("网络请求失败")
头像.setImageDrawable(nil)
end)
end
end)
end资源密码:yghy
本站资源,均来自网络,版权归原作者,所有资源和文章仅限用于学习和研究目的。
不得用于商业或非法用途,否则,一切责任由该用户承担!
您必须在下载后的24个小时之内,从您的电脑&手机中彻底删除下载的资源
资源失效,举报投诉,建议意见等,都可以来反馈。综合反馈