1
1
package cn .rrg .rdv .activities .tools ;
2
2
3
- import android .content .DialogInterface ;
4
- import android .content .Intent ;
5
3
import android .content .pm .PackageInfo ;
6
4
import android .content .pm .PackageManager ;
7
- import android .net .Uri ;
8
5
import android .os .Bundle ;
6
+
9
7
import androidx .annotation .Nullable ;
10
- import androidx .appcompat .app .AlertDialog ;
11
8
12
9
import android .view .View ;
13
- import android .webkit .WebView ;
14
10
import android .widget .Button ;
15
11
import android .widget .TextView ;
16
- import android .widget .Toast ;
17
-
18
- import java .io .File ;
19
12
20
- import cn .dxl .common .util .AppUtil ;
21
- import cn .dxl .common .util .FileUtils ;
22
- import cn .dxl .common .widget .FilesSelectorDialog ;
23
13
import cn .rrg .rdv .R ;
24
14
import cn .rrg .rdv .activities .main .BaseActivity ;
25
15
import cn .rrg .rdv .util .Commons ;
26
- import cn .rrg .rdv .util .Paths ;
27
- import cn .dxl .common .util .RestartUtils ;
28
- import cn .dxl .common .widget .ToastUtil ;
29
16
30
17
public class AboutActicity extends BaseActivity {
31
18
32
- private TextView txtUserHelp = null ;
33
- private TextView txtDisclaimer = null ;
34
- private TextView txtJoinGroup = null ;
35
- private TextView txtContactDev = null ;
36
19
private TextView txtShowVersion = null ;
37
- private TextView txtSendLogFile = null ;
38
- private TextView txtCleanData = null ;
39
-
40
20
private Button btnGo2ProxgrindWebsite ;
41
21
private Button btnGo2RRGWebsite ;
42
22
@@ -51,105 +31,13 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
51
31
}
52
32
53
33
private void initViews () {
54
- txtUserHelp = findViewById (R .id .txtUserHelp );
55
- txtDisclaimer = findViewById (R .id .txtDisclaimer );
56
- txtJoinGroup = findViewById (R .id .txtJoinQQGroup );
57
- txtContactDev = findViewById (R .id .txtContactDev );
58
34
txtShowVersion = findViewById (R .id .txtShowAppVersion );
59
- txtSendLogFile = findViewById (R .id .txtSendLogFile );
60
- txtCleanData = findViewById (R .id .txtCleanData );
61
35
62
36
btnGo2ProxgrindWebsite = findViewById (R .id .btnGo2ProxgrindWebsite );
63
37
btnGo2RRGWebsite = findViewById (R .id .btnGo2RRGWebsite );
64
38
}
65
39
66
40
private void initActions () {
67
- txtUserHelp .setOnClickListener (new View .OnClickListener () {
68
- @ Override
69
- public void onClick (View v ) {
70
- //建立视图
71
- WebView wv = new WebView (AboutActicity .this );
72
- //加载文件
73
- wv .loadUrl ("file:///android_asset/help.html" );
74
- //加载进对话框中
75
- new AlertDialog .Builder (AboutActicity .this )
76
- .setView (wv ).show ();
77
- }
78
- });
79
-
80
- txtDisclaimer .setOnClickListener (new View .OnClickListener () {
81
- @ Override
82
- public void onClick (View v ) {
83
- }
84
- });
85
-
86
- txtJoinGroup .setOnClickListener (new View .OnClickListener () {
87
- @ Override
88
- public void onClick (View v ) {
89
- boolean result = joinQQGroup ("4QQrqUHKMNZDNWLvi4kEWeEDHYMekp7x" );
90
- if (!result ) {
91
- Toast .makeText (AboutActicity .this , "未安装手Q或安装的版本不支持!" , Toast .LENGTH_SHORT ).show ();
92
- }
93
- }
94
- });
95
-
96
- txtContactDev .setOnClickListener (new View .OnClickListener () {
97
- @ Override
98
- public void onClick (View v ) {
99
- Commons .callQQ (AboutActicity .this , "64101226" , new Runnable () {
100
- @ Override
101
- public void run () {
102
- ToastUtil .show (context , getString (R .string .error ), false );
103
- }
104
- });
105
- }
106
- });
107
-
108
- txtSendLogFile .setOnClickListener (new View .OnClickListener () {
109
- @ Override
110
- public void onClick (View v ) {
111
- new FilesSelectorDialog .Builder (AboutActicity .this )
112
- .setPathOnLoad (Paths .LOG_DIRECTORY )
113
- .setTitle (R .string .logList )
114
- .setOnSelectListener (new FilesSelectorDialog .OnSelectListener () {
115
- @ Override
116
- public void selected (File file ) {
117
- FileUtils .shareFile (file );
118
- }
119
- })
120
- .create ().show ();
121
- }
122
- });
123
-
124
- txtCleanData .setOnClickListener (new View .OnClickListener () {
125
- @ Override
126
- public void onClick (View v ) {
127
- new AlertDialog .Builder (AboutActicity .this )
128
- .setTitle (R .string .warning )
129
- .setMessage (R .string .tipls_clearData )
130
- .setPositiveButton (getString (R .string .clear ), new DialogInterface .OnClickListener () {
131
- @ Override
132
- public void onClick (DialogInterface dialog , int which ) {
133
- Toast .makeText (AboutActicity .this , getString (R .string .cleaning ), Toast .LENGTH_SHORT ).show ();
134
- FileUtils .delete (new File (Paths .TOOLS_DIRECTORY ));
135
- Toast .makeText (AboutActicity .this , getString (R .string .clearFinish ), Toast .LENGTH_SHORT ).show ();
136
- //必须重启APP
137
- RestartUtils .restartAPP (AboutActicity .this , 1000 , new RestartUtils .OnExitAction () {
138
- @ Override
139
- public boolean usingSystemExit () {
140
- //调用act管理器结束所有的活动!
141
- AppUtil .getInstance ().finishAll ();
142
- return false ;
143
- }
144
- });
145
- AppUtil .getInstance ().finishAll ();
146
- }
147
- })
148
- .setNegativeButton (R .string .cancel , null )
149
- .show ();
150
- }
151
- });
152
-
153
41
btnGo2ProxgrindWebsite .setOnClickListener (new View .OnClickListener () {
154
42
@ Override
155
43
public void onClick (View v ) {
@@ -177,27 +65,6 @@ private void showVersion() {
177
65
}
178
66
}
179
67
180
- /****************
181
- *
182
- * 发起添加群流程。群号:NFC PN532 计算机 单片机(573359551) 的 key 为: 4QQrqUHKMNZDNWLvi4kEWeEDHYMekp7x
183
- * 调用 joinQQGroup(4QQrqUHKMNZDNWLvi4kEWeEDHYMekp7x) 即可发起手Q客户端申请加群 NFC PN532 计算机 单片机(573359551)
184
- *
185
- * @param key 由官网生成的key
186
- * @return 返回true表示呼起手Q成功,返回fals表示呼起失败
187
- ******************/
188
- public boolean joinQQGroup (String key ) {
189
- Intent intent = new Intent ();
190
- intent .setData (Uri .parse ("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + key ));
191
- // 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面 //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
192
- try {
193
- startActivity (intent );
194
- return true ;
195
- } catch (Exception e ) {
196
- // 未安装手Q或安装的版本不支持
197
- return false ;
198
- }
199
- }
200
-
201
68
@ Override
202
69
protected void onDestroy () {
203
70
super .onDestroy ();
0 commit comments