Minor improvements
Этот коммит содержится в:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
|
* Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.traccar.manager;
|
package org.traccar.manager;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
@@ -64,15 +65,14 @@ public class MainFragment extends WebViewFragment {
|
|||||||
broadcastManager = LocalBroadcastManager.getInstance(getActivity());
|
broadcastManager = LocalBroadcastManager.getInstance(getActivity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("SetJavaScriptEnabled")
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
if ((getActivity().getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
|
if ((getActivity().getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
|
||||||
WebView.setWebContentsDebuggingEnabled(true);
|
WebView.setWebContentsDebuggingEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
getWebView().setWebChromeClient(webChromeClient);
|
getWebView().setWebChromeClient(webChromeClient);
|
||||||
getWebView().addJavascriptInterface(new AppInterface(), "appInterface");
|
getWebView().addJavascriptInterface(new AppInterface(), "appInterface");
|
||||||
@@ -89,7 +89,7 @@ public class MainFragment extends WebViewFragment {
|
|||||||
getWebView().loadUrl(url);
|
getWebView().loadUrl(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
|
private final BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
String token = intent.getStringExtra(KEY_TOKEN);
|
String token = intent.getStringExtra(KEY_TOKEN);
|
||||||
@@ -129,12 +129,7 @@ public class MainFragment extends WebViewFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebChromeClient webChromeClient = new WebChromeClient() {
|
private final WebChromeClient webChromeClient = new WebChromeClient() {
|
||||||
|
|
||||||
// Android 3.0+
|
|
||||||
public void openFileChooser(ValueCallback uploadMessage, String acceptType) {
|
|
||||||
openFileChooser(uploadMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Android 4.1+
|
// Android 4.1+
|
||||||
protected void openFileChooser(ValueCallback<Uri> uploadMessage, String acceptType, String capture) {
|
protected void openFileChooser(ValueCallback<Uri> uploadMessage, String acceptType, String capture) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 - 2020 Anton Tananaev (anton@traccar.org)
|
* Copyright 2016 - 2021 Anton Tananaev (anton@traccar.org)
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -43,7 +43,7 @@ public class StartFragment extends Fragment implements View.OnClickListener {
|
|||||||
|
|
||||||
private static final String TAG = StartFragment.class.getSimpleName();
|
private static final String TAG = StartFragment.class.getSimpleName();
|
||||||
|
|
||||||
private static int MAX_REDIRECTS = 5;
|
private static final int MAX_REDIRECTS = 5;
|
||||||
|
|
||||||
private EditText serverField;
|
private EditText serverField;
|
||||||
private Button startButton;
|
private Button startButton;
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user