-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain6.lua
53 lines (50 loc) · 1.7 KB
/
main6.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import "lj"
import "android.graphics.drawable.ColorDrawable"
import "android.graphics.drawable.StateListDrawable"
import "android.graphics.PorterDuffColorFilter"
import "android.graphics.PorterDuff"
import "android.graphics.drawable.GradientDrawable"
import "toast"
import "android.graphics.Typeface"
local Text_Type=Typeface.defaultFromStyle(Typeface.BOLD)
local sd = StateListDrawable()
import "android.graphics.Color"
import "android.content.res.ColorStateList"
import "android.graphics.drawable.RippleDrawable"
import "android.content.Context"
local a=io.open(activity.getLuaDir().."/Verify/set4.XY"):read("*a")
local ip=a:match("2(.-)"..'"')
if ip=="开" then
颜色1=0xff303030
else
颜色1=0x5FFFFFFF
end
appt={C_Bacgg=function(mBinding,radiu,InsideColor,S,S2,T1)
local drawable = GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM,{});
drawable.setCornerRadius(radiu);
drawable.setColor(颜色1)
drawable.setStroke(3, 0xCFB0B0B0)
drawable.setGradientType(GradientDrawable.RECTANGLE);
mBinding.setTextColor(T1)
mBinding.setTypeface(Text_Type)
return drawable
end}
美化按钮=function(mBinding,radiu,InsideColor,T1)
stateList = {
{android.R.attr.state_pressed},
{android.R.attr.state_focused},
{android.R.attr.state_activated},
{android.R.attr.selectableItemBackground},
};
sd.addState({ android.R.attr.state_enabled}, appt.C_Bacgg(mBinding,radiu,InsideColor,S,S2,T1))
pressedColor =InsideColor
stateColorList ={
pressedColor,
pressedColor,
pressedColor,
normalColor
};
colorStateList = ColorStateList(stateList, stateColorList);
rippleDrawable = RippleDrawable(colorStateList,sd,nil);
mBinding.setBackground(rippleDrawable);
end