|
- require "import"9 @0 b' d5 W* {: ~* [
- import "android.app.*"
4 \6 }6 h$ O) [ R6 O - import "android.os.*"
. Q6 w+ i2 O' v) c- U6 w, A - import "android.widget.*"
6 M* N4 t$ l6 D3 @& v7 J8 m - import "android.view.*"' U7 r: E V- [2 X |
- layout={ \- u' P8 Q3 B% ]
- LinearLayout;/ z: A5 ]( X4 U: t- O8 J& A5 K" O
- orientation="vertical";
! T1 d6 \3 w0 Y/ M - layout_height="fill";$ {3 ?, g4 U, j0 ?
- layout_width="fill";
5 N( ?3 U7 G4 Y1 V( \# K - {1 E& W w6 D7 \6 L" H2 P0 I. s: X
- LinearLayout;
$ r- M5 x1 V, f. ^- k - orientation="vertical";
$ d& J2 o: H, D" v - layout_width="match_parent";7 M$ x( m f0 d/ l
- backgroundColor="0xFFF2F2F2";" w& x! e, D* c/ w/ K; g+ [0 L+ s
- layout_weight="3";
: o& X$ F) q6 d7 y7 b O0 J - layout_height="match_parent";
! C4 B3 e" V% g6 E% E! T - {+ g. q U% g; ]& @
- CardView;
+ a: f* W1 P+ c9 |% z - layout_gravity="center";
7 Z0 E2 @3 E+ ]4 A4 o - layout_margin="30dp";" D1 D8 _( x+ G
- CardElevation="1";
4 @$ u6 N) ]8 c5 c - backgroundColor="0xFFFFFFFF";& E# x! E9 d0 G; F& S
- radius="15dp";
0 z& j" m7 H( z& H" t - layout_width="match_parent";
! N1 l9 u# v& U% I1 s - layout_height="wrap_content";
, j4 w2 K% U7 f3 {4 p& Q- d - {8 U( V$ w6 L4 H7 j; {( q5 [
- LinearLayout;
0 f; k; j! E$ `1 `' l% ]; |% n - orientation="vertical";4 s+ ?# `3 e+ o# T) @! o
- layout_height="match_parent";
+ c% O. t) v, j3 I( G - layout_width="match_parent";2 _7 M5 x% a* M
- % [$ I4 Z7 q7 x- {/ B1 y' u
- {' }. l8 x. J- i
- TextView;
# o y& ]; B& n' U6 [( ] - id="舔狗日记";
+ C; K( ?( q; ?. D8 o) v3 S - layout_marginBottom="15dp";+ C& G7 o! a- p) f* @
- gravity="center|top";
" _1 @' u* E3 Q+ u/ _ - textColor="0xB2000000";' p- O" k: S- s& `' V
- textSize="16sp";
0 ]4 J; D. o+ z( ^ - layout_marginRight="20dp";- a% }! E6 e/ l+ u" v/ W
- layout_weight="1";
# O# Y- C6 Y @2 H" x; n2 X; k9 { - layout_width="match_parent";
6 @0 X4 L# V8 H, W" F - paddingTop="20dp";: M# t; U. z) u% E9 U, s
- text="舔狗日记";
# k+ y) R: E( Y) k, l - layout_marginLeft="20dp";# n$ i) y/ F9 K# k. _
- layout_height="match_parent";
! ~% c6 \% {% n$ u - };3 K1 o5 u; M3 e4 ~( U
- };
3 d% ^) |( @% x2 t4 } - };+ S9 j) F0 z5 u5 r y
- {
5 c7 |& R$ f! { S* p - LinearLayout;# y8 `$ h7 g$ j1 c. _5 o$ k5 s' Z
- layout_height="match_parent";+ Z( B. ?* B: c% T
- gravity="center|top";
; e0 Q8 c- g- ?9 ` - layout_width="match_parent";3 }4 U1 J% K1 n R4 i8 h1 q
- {# {/ R$ V0 v; ^" \8 W
- Button;- D: L0 O" F9 f* S- v( G+ i
- id="刷新";
& S, F+ Z& F0 D - text="刷新";/ \. a7 E4 Y6 Y" F1 }8 F
- layout_width="100dp";% y' K& [( d( I' i9 O4 R
- layout_marginLeft="16dp";6 F2 ~ T# [0 n9 S9 ^& z9 v$ O0 ?
- textColor="0xFFFFFFFF";* N: f$ t1 b4 \& z5 v
- };. k8 n( B& ~! Y7 a5 R0 s$ A
- {
1 U0 k J2 i6 `3 K" B/ |# } - Button;
0 A% p+ U4 R5 j- w; D7 B; M3 q. d - layout_marginRight="8dp";: q$ d" m2 k9 L% |
- id="复制";5 M- a. q$ n. [. @
- layout_width="100dp";5 t' f1 P0 h% g8 q- T; Q
- text="复制";6 s# J; R& s, i; b( P& T. d) x
- layout_marginLeft="8dp";9 Y4 v/ y% S" x0 q$ x( b% {1 {
- textColor="0xFFFFFFFF";5 e0 p% e2 I2 q( f
- };4 p2 `" D9 H* L) }' M8 l( B$ W
- {* u8 @4 J& M) F0 [8 H/ r
- Button;. [4 w( W+ c6 I9 K$ `, O# V7 a
- layout_marginRight="16dp";, w! i4 O; r, h; D E) _/ T
- id="转发";% a6 s/ |5 m& L1 B
- layout_width="100dp";
" x ^7 Z& ]9 K# Y; q2 o6 v - text="转发";
P8 c+ Y0 k, t7 f8 G; b - textColor="0xFFFFFFFF";
7 l7 q v1 d$ ~: ?2 t5 D - };
@* H5 H& i* q) W3 F" I - };
, U. j: G& ^, a+ g6 Z - };" M/ v4 _. T/ z% X; p1 p2 V: m
- };9 k3 j' ] U7 Q+ E V2 L* d
- 5 o6 V0 S9 Y' J" a ^- }
- activity.setTheme(android.R.style.Theme_DeviceDefault_Light)--设置md主题
2 }/ ^% v+ s7 ~$ y9 b+ ] - + Z6 e. f' ?& u! b, y
- activity.setTitle("舔狗日记")
9 z; t! G9 v7 @4 \ - activity.setContentView(loadlayout(layout))
: y6 l( P% |. K; e - activity.overridePendingTransition(android.R.anim.fade_in,android.R.anim.fade_out)
) q& s0 w0 l: r4 S+ Z, C( w; V - import "android.graphics.drawable.ColorDrawable"
4 A* w9 \% R1 x$ c# t8 e' J+ h - activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS).setStatusBarColor(0xFFF2F2F2);
6 `8 V1 J% ~4 u F - activity.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);& Z9 C7 K/ q) C: ^
- activity.ActionBar.hide()
/ p3 @% L0 J" N, q5 I, I
. E1 q) f( L$ l: G* _- function 控件圆角(view,InsideColor,radiu)$ x3 Y7 x8 e3 ~5 ~& x5 r8 A# m
- import "android.graphics.drawable.GradientDrawable"9 E9 y. ?$ M! \7 g2 z
- drawable = GradientDrawable()) \7 Z7 x5 I" Y" x6 A
- drawable.setShape(GradientDrawable.RECTANGLE)
/ G U) P% h6 X* o$ A( [8 { - drawable.setColor(InsideColor)
0 I7 H" b9 D3 Z; _/ X. ~ - drawable.setCornerRadii({radiu,radiu,radiu,radiu,radiu,radiu,radiu,radiu});
9 `' r+ s7 a0 Y - view.setBackgroundDrawable(drawable)
3 \" F( a4 O" ~5 v. ~! A - end
( ^% y4 x3 L$ B- @$ e( I/ p - 7 K9 q, ]% P% K0 c, x0 W5 q" n) z& X* D
- function 复制内容到剪切板(内容)
/ T* \; J K' c. n$ E; l' Z% K+ ^4 r - import "android.content.*"9 F! \9 Q8 K- ]' u2 R
- activity.getSystemService(Context.CLIPBOARD_SERVICE).setText(内容)4 l: Y& {- s3 y% {7 a
- end
3 `, ^9 m+ X$ W. i4 Z, B
: k, ^# a& X( O- function 分享内容(内容)8 e' @$ [, M2 N( m' t% k
- import "android.content.*"8 k' g: U O6 V! c, T
- intent=Intent(Intent.ACTION_SEND);
1 k S4 @: w. S, n+ I0 ^5 h - intent.setType("text/plain");
, v& i) r0 X5 |7 g6 T - intent.putExtra(Intent.EXTRA_SUBJECT, "分享");
' `4 T" u9 P/ c& h$ `* R4 [ - intent.putExtra(Intent.EXTRA_TEXT, 内容);9 m7 v1 u: a$ N9 V0 F6 i! b
- intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
: G) P- k! O; J4 H2 \, b% a- Y+ S - activity.startActivity(Intent.createChooser(intent,"分享到:"));
5 w/ w5 E/ V* J% Q( W - end
! G* m. n( f9 _2 r - 5 I# J7 i! L# d/ t5 M) e8 M/ f! }
- 控件圆角(刷新,0xAF000000,35)/ T. W+ _1 b# {2 ^" _
- 控件圆角(复制,0xAF000000,35)
1 _+ d* Z9 B6 F! Z) w - 控件圆角(转发,0xAF000000,35)
, H. y- C6 B4 d6 ]& Z
0 S8 Y4 `4 x$ ?( `" ]. E9 b% J- 刷新.onClick=function()4 @6 o/ F* Y8 `1 T
- 获取日记()$ J% Q: \5 I: k- N$ I
- end9 u$ p9 F' x, z# l; N* B# c. U
- 复制.onClick=function()
2 `' g9 p$ [# j6 S' h5 A - 复制内容到剪切板(舔狗日记.text)
6 S( ?" _2 w$ E" ]+ \& m( I, ` e) B - print("已复制到剪切板")
* h3 q2 J% N% @, u - end
& g+ ?) v4 s: W2 ^1 N - 转发.onClick=function()
7 ^* c+ o3 m6 w2 f' ~ - 分享内容(舔狗日记.text)
7 h: A' a1 z2 a) w1 M/ {1 O - end/ ~! j8 [9 m' n: M0 t
- cjson=import "cjson"3 \) W, O* c- O
- import "http"
+ I2 X7 z" Z( A$ Q `1 g" U - --api来源于网络
0 O/ f. \- ]) j - function 获取日记()5 ~8 m1 K5 Z: g
- Http.get("https://cloud.qqshabi.cn/api/tiangou/api.php",nil,"utf-8",nil,function(a,b,c,d)' F; z3 N! |% N/ f4 u
- if a==200
- p# v9 N. T: ]; T8 I5 `4 ~ - 舔狗日记.setText(b). O! g9 w2 [. ^* P; o$ d+ S3 w
- end- [ [, S1 H/ j2 ^. y0 x. F
- end)& l( }0 U5 W- U' l' t6 g( |
- end
: l+ [* g( Z% I8 U* `2 n: r - 获取日记()
复制代码 |
|