Skip to content

Commit

Permalink
加入webview信息
Browse files Browse the repository at this point in the history
  • Loading branch information
matrix3d committed Feb 22, 2024
1 parent 615f328 commit f1903c9
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions app/src/main/java/com/eanyatonic/cctvViewer/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public class MainActivity extends AppCompatActivity {
private boolean doubleMenuPressedTwice = false;

final int[] g = {0,0};
String ua;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand All @@ -80,7 +81,7 @@ protected void onCreate(Bundle savedInstanceState) {

// 初始化 WebView
webView = findViewById(R.id.webView);
var ua= webView.getSettings().getUserAgentString();
ua= webView.getSettings().getUserAgentString();
// 直接传入函数
webView.addJavascriptInterface(new Object() {

Expand Down Expand Up @@ -245,7 +246,7 @@ public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {


ListView lv3=findViewById(R.id.list2);
var arr3=new String[]{"刷新","添加自定义"};
var arr3=new String[]{"刷新","添加自定义","关于"};
var ldad3=new ArrayAdapter<>(this,
//android.R.layout.simple_list_item_1
R.layout.custom_list_item
Expand Down Expand Up @@ -295,6 +296,18 @@ public void onClick(DialogInterface dialog, int which) {

builder.show();
break;
case 2:
AlertDialog.Builder builder2 = new AlertDialog.Builder(cxt);
builder2.setTitle("关于");
builder2.setMessage(""+ua+"\n\nhttps://github.com/matrix3d/CCTV_Viewer");
builder2.setPositiveButton("确定", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// 点击确定按钮后的操作
dialog.dismiss(); // 关闭对话框
}
});
builder2.show();
break;
}
restartHideTimer();
}
Expand Down

0 comments on commit f1903c9

Please sign in to comment.