master
parent
05a7d6bdff
commit
9d36282b14
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="deploymentTargetDropDown">
|
||||||
|
<runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<Target>
|
||||||
|
<type value="RUNNING_DEVICE_TARGET" />
|
||||||
|
<deviceKey>
|
||||||
|
<Key>
|
||||||
|
<type value="SERIAL_NUMBER" />
|
||||||
|
<value value="R5CT20CJY5V" />
|
||||||
|
</Key>
|
||||||
|
</deviceKey>
|
||||||
|
</Target>
|
||||||
|
</runningDeviceTargetSelectedWithDropDown>
|
||||||
|
<timeTargetWasSelectedWithDropDown value="2023-08-07T03:40:58.879605600Z" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -1,75 +1,76 @@
|
||||||
package com.cmx.hydrology.activity;
|
package com.cmx.hydrology.activity
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.graphics.Bitmap
|
||||||
import android.webkit.WebResourceError;
|
import android.os.Bundle
|
||||||
import android.webkit.WebResourceRequest;
|
import android.webkit.WebResourceError
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebResourceRequest
|
||||||
import android.webkit.WebViewClient;
|
import android.webkit.WebSettings
|
||||||
|
import android.webkit.WebView
|
||||||
|
import android.webkit.WebViewClient
|
||||||
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import com.cmx.hydrology.utils.AndroidtoJs
|
||||||
|
import com.cmx.hydrology.view.BaseLoadingDialog
|
||||||
|
import com.lsxiao.apollo.core.Apollo
|
||||||
|
import com.lsxiao.apollo.core.contract.ApolloBinder
|
||||||
|
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
open class BaseActivity : AppCompatActivity() {
|
||||||
|
private var mBaseLoadingDialog: BaseLoadingDialog? = null
|
||||||
import com.cmx.hydrology.view.BaseLoadingDialog;
|
private var mApolloBinder: ApolloBinder? = null
|
||||||
import com.lsxiao.apollo.core.Apollo;
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
import com.lsxiao.apollo.core.contract.ApolloBinder;
|
super.onCreate(savedInstanceState)
|
||||||
|
mBaseLoadingDialog = BaseLoadingDialog(this)
|
||||||
public class BaseActivity extends AppCompatActivity {
|
mApolloBinder = Apollo.bind(this)
|
||||||
|
|
||||||
private static final String TAG = "BaseActivity";
|
|
||||||
private BaseLoadingDialog mBaseLoadingDialog;
|
|
||||||
private ApolloBinder mApolloBinder;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
mBaseLoadingDialog = new BaseLoadingDialog(this);
|
|
||||||
mApolloBinder = Apollo.bind(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun showDialog() {
|
||||||
public void showDialog() {
|
if (!mBaseLoadingDialog!!.isShowing) {
|
||||||
if (!mBaseLoadingDialog.isShowing()) {
|
mBaseLoadingDialog!!.show()
|
||||||
mBaseLoadingDialog.show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun disDialog() {
|
||||||
public void disDialog() {
|
if (mBaseLoadingDialog!!.isShowing) {
|
||||||
if (mBaseLoadingDialog.isShowing()) {
|
mBaseLoadingDialog!!.dismiss()
|
||||||
mBaseLoadingDialog.dismiss();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWeb(WebView mWebView) {
|
fun setWeb(mWebView: WebView) {
|
||||||
mWebView.setWebViewClient(new WebViewClient() {
|
val webSettings = mWebView!!.settings
|
||||||
@Override
|
webSettings.javaScriptEnabled = true
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
webSettings.cacheMode = WebSettings.LOAD_NO_CACHE
|
||||||
//使用WebView加载显示url
|
webSettings.domStorageEnabled = true
|
||||||
view.loadUrl(url);
|
mWebView!!.addJavascriptInterface(AndroidtoJs(), "AndroidtoJs")
|
||||||
//返回true
|
mWebView.webViewClient = object : WebViewClient() {
|
||||||
return true;
|
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
|
||||||
}
|
super.onPageStarted(view, url, favicon)
|
||||||
|
showDialog()
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
||||||
public void onPageFinished(WebView view, String url) {
|
//使用WebView加载显示url
|
||||||
disDialog();
|
view.loadUrl(url)
|
||||||
}
|
//返回true
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
override fun onPageFinished(view: WebView, url: String) {
|
||||||
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) {
|
disDialog()
|
||||||
disDialog();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
override fun onReceivedError(view: WebView, request: WebResourceRequest, error: WebResourceError) {
|
||||||
|
disDialog()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroy() {
|
||||||
@Override
|
super.onDestroy()
|
||||||
protected void onDestroy() {
|
|
||||||
super.onDestroy();
|
|
||||||
if (mApolloBinder != null) {
|
if (mApolloBinder != null) {
|
||||||
mApolloBinder.unbind();
|
mApolloBinder!!.unbind()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val TAG = "BaseActivity"
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -60,8 +60,8 @@ class LoginActivity : BaseActivity() {
|
||||||
LoginBean.username = binding!!.edtUsername.text.toString().trim { it <= ' ' }
|
LoginBean.username = binding!!.edtUsername.text.toString().trim { it <= ' ' }
|
||||||
LoginBean.password = binding!!.edtPassword.text.toString().trim { it <= ' ' }
|
LoginBean.password = binding!!.edtPassword.text.toString().trim { it <= ' ' }
|
||||||
val call = RetrofitAPIManager.provideClientApi().login(LoginBean)
|
val call = RetrofitAPIManager.provideClientApi().login(LoginBean)
|
||||||
call.enqueue(object : Callback<LoginRes> {
|
call!!.enqueue(object : Callback<LoginRes?> {
|
||||||
override fun onResponse(call: Call<LoginRes>, response: Response<LoginRes>) {
|
override fun onResponse(call: Call<LoginRes?>, response: Response<LoginRes?>) {
|
||||||
disDialog()
|
disDialog()
|
||||||
if (response.isSuccessful && response.body()!!.code == 0) {
|
if (response.isSuccessful && response.body()!!.code == 0) {
|
||||||
SpUtils.putString(this@LoginActivity, "token", response.body()!!.access_token)
|
SpUtils.putString(this@LoginActivity, "token", response.body()!!.access_token)
|
||||||
|
@ -69,11 +69,11 @@ class LoginActivity : BaseActivity() {
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
finish()
|
finish()
|
||||||
} else {
|
} else {
|
||||||
Toasty.error(this@LoginActivity, response.body()!!.message).show()
|
Toasty.error(this@LoginActivity, response.body()!!.message!!).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure(call: Call<LoginRes>, t: Throwable) {
|
override fun onFailure(call: Call<LoginRes?>, t: Throwable) {
|
||||||
disDialog()
|
disDialog()
|
||||||
Toasty.info(this@LoginActivity, "登录失败").show()
|
Toasty.info(this@LoginActivity, "登录失败").show()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +1,35 @@
|
||||||
package com.cmx.hydrology.activity;
|
package com.cmx.hydrology.activity
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application
|
||||||
import android.content.Context;
|
import android.content.Context
|
||||||
|
import com.lsxiao.apollo.core.Apollo
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
|
||||||
import com.lsxiao.apollo.core.Apollo;
|
class MyApplication : Application() {
|
||||||
|
override fun onCreate() {
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
super.onCreate()
|
||||||
|
mInstance = this
|
||||||
public class MyApplication extends Application {
|
Apollo.init(AndroidSchedulers.mainThread(), this)
|
||||||
private static MyApplication mInstance;
|
|
||||||
|
|
||||||
private static String mToken;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
super.onCreate();
|
|
||||||
mInstance = this;
|
|
||||||
Apollo.init(AndroidSchedulers.mainThread(), this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun attachBaseContext(base: Context) {
|
||||||
@Override
|
super.attachBaseContext(base)
|
||||||
protected void attachBaseContext(Context base) {
|
|
||||||
super.attachBaseContext(base);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private var mInstance: MyApplication? = null
|
||||||
|
private var mToken: String? = null
|
||||||
|
@JvmStatic
|
||||||
|
fun getmInstance(): MyApplication? {
|
||||||
|
return mInstance
|
||||||
|
}
|
||||||
|
|
||||||
public static MyApplication getmInstance() {
|
fun getmToken(): String? {
|
||||||
return mInstance;
|
return mToken
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getmToken() {
|
fun setmToken(mToken: String?) {
|
||||||
return mToken;
|
Companion.mToken = mToken
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void setmToken(String mToken) {
|
|
||||||
MyApplication.mToken = mToken;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,179 +1,50 @@
|
||||||
package com.cmx.hydrology.activity;
|
package com.cmx.hydrology.activity
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.content.ClipData
|
||||||
import android.content.ClipData;
|
import android.content.Intent
|
||||||
import android.content.Intent;
|
import android.net.Uri
|
||||||
import android.net.Uri;
|
import android.os.Bundle
|
||||||
import android.os.Bundle;
|
import android.os.Environment
|
||||||
import android.os.Environment;
|
import android.provider.MediaStore
|
||||||
import android.provider.MediaStore;
|
import android.util.Log
|
||||||
import android.util.Log;
|
import android.webkit.ValueCallback
|
||||||
import android.webkit.ValueCallback;
|
import android.webkit.WebChromeClient
|
||||||
import android.webkit.WebChromeClient;
|
import android.webkit.WebSettings
|
||||||
import android.webkit.WebSettings;
|
import android.webkit.WebView
|
||||||
import android.webkit.WebView;
|
import com.cmx.hydrology.constant.Events
|
||||||
|
import com.cmx.hydrology.databinding.ActivityWebBinding
|
||||||
|
import com.cmx.hydrology.utils.AndroidtoJs
|
||||||
|
import com.cmx.hydrology.utils.L
|
||||||
|
import com.lsxiao.apollo.core.annotations.Receive
|
||||||
|
import java.io.File
|
||||||
|
import java.io.IOException
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
class WebActivity : BaseActivity() {
|
||||||
|
private var mWebView: WebView? = null
|
||||||
|
private var binding: ActivityWebBinding? = null
|
||||||
|
private var url: String? = null
|
||||||
|
private var mUploadMessage: ValueCallback<Array<Uri>>? = null
|
||||||
|
private var mCameraPhotoPath: String? = null
|
||||||
|
private var size: Long = 0
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
binding = ActivityWebBinding.inflate(layoutInflater)
|
||||||
|
setContentView(binding!!.root)
|
||||||
|
url = intent.getStringExtra("url")
|
||||||
|
mWebView = binding!!.wvRegister
|
||||||
|
setWeb(mWebView!!)
|
||||||
|
mWebView!!.loadUrl(url!!)
|
||||||
|
}
|
||||||
|
|
||||||
import com.cmx.hydrology.databinding.ActivityWebBinding;
|
@Receive(Events.JS_OPEN_CLOSE_WEB)
|
||||||
import com.cmx.hydrology.utils.AndroidtoJs;
|
fun fin() {
|
||||||
import com.cmx.hydrology.utils.L;
|
finish();
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
public class WebActivity extends BaseActivity {
|
|
||||||
|
|
||||||
private WebView mWebView;
|
|
||||||
private ActivityWebBinding binding;
|
|
||||||
private String url;
|
|
||||||
public static final int REQUEST_CODE_LIVENESS = 209;
|
|
||||||
public static final int TRUST_LEVEL = 50;
|
|
||||||
private ValueCallback<Uri[]> mUploadMessage;
|
|
||||||
private String mCameraPhotoPath = null;
|
|
||||||
private long size = 0;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
binding = ActivityWebBinding.inflate(getLayoutInflater());
|
|
||||||
setContentView(binding.getRoot());
|
|
||||||
url = getIntent().getStringExtra("url");
|
|
||||||
// MyUtils.setFullscreen(this, true, true);//影响键盘 模式 页面遮挡
|
|
||||||
// MyUtils.setAndroidNativeLightStatusBar(this, true);//影响键盘 模式 页面遮挡
|
|
||||||
mWebView = binding.wvRegister;
|
|
||||||
WebSettings webSettings = mWebView.getSettings();
|
|
||||||
webSettings.setJavaScriptEnabled(true);
|
|
||||||
webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
|
|
||||||
webSettings.setDomStorageEnabled(true);
|
|
||||||
mWebView.addJavascriptInterface(new AndroidtoJs(), "AndroidtoJs");
|
|
||||||
mWebView.loadUrl(url);
|
|
||||||
showDialog();
|
|
||||||
setWeb(mWebView);
|
|
||||||
mWebView.setWebChromeClient(new PQChromeClient());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Receive(Events.JS_OPEN_CLOSE_WEB)
|
companion object {
|
||||||
// public void fin() {
|
|
||||||
// finish();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
if (requestCode == 101 && mUploadMessage != null) {
|
|
||||||
try {
|
|
||||||
String file_path = mCameraPhotoPath.replace("file:", "");
|
|
||||||
File file = new File(file_path);
|
|
||||||
size = file.length();
|
|
||||||
if (!(data != null || size > 0)) {
|
|
||||||
mUploadMessage.onReceiveValue(null);
|
|
||||||
mUploadMessage = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (data != null || mCameraPhotoPath != null) {
|
|
||||||
Integer count = 1;
|
|
||||||
ClipData images = null;
|
|
||||||
try {
|
|
||||||
images = data.getClipData();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("Error11!", e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
if (images == null && data != null && data.getDataString() != null) {
|
|
||||||
count = data.getDataString().length();
|
|
||||||
} else if (images != null) {
|
|
||||||
count = images.getItemCount();
|
|
||||||
}
|
|
||||||
Uri[] results = new Uri[count];
|
|
||||||
// Check that the response is a good one
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
if (size != 0) {
|
|
||||||
// If there is not data, then we may have taken a photo
|
|
||||||
if (mCameraPhotoPath != null) {
|
|
||||||
results = new Uri[]{Uri.parse(mCameraPhotoPath)};
|
|
||||||
}
|
|
||||||
} else if (data.getClipData() == null) {
|
|
||||||
results = new Uri[]{Uri.parse(data.getDataString())};
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < images.getItemCount(); i++) {
|
|
||||||
results[i] = images.getItemAt(i).getUri();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mUploadMessage.onReceiveValue(results);
|
|
||||||
mUploadMessage = null;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("Error22!", "Error while opening image file" + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PQChromeClient extends WebChromeClient {
|
|
||||||
// For Android 5.0+
|
|
||||||
public boolean onShowFileChooser(WebView view, ValueCallback<Uri[]> filePath, WebChromeClient.FileChooserParams fileChooserParams) {
|
|
||||||
L.e("点击》》", "11");
|
|
||||||
// Double check that we don't have any existing callbacks
|
|
||||||
if (mUploadMessage != null) {
|
|
||||||
L.e("点击》》", "22");
|
|
||||||
mUploadMessage.onReceiveValue(null);
|
|
||||||
}
|
|
||||||
mUploadMessage = filePath;
|
|
||||||
Log.e("FileCooserParams => ", filePath.toString());
|
|
||||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
|
||||||
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
|
|
||||||
// Create the File where the photo should go
|
|
||||||
File photoFile = null;
|
|
||||||
try {
|
|
||||||
photoFile = createImageFile();
|
|
||||||
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
// Error occurred while creating the File
|
|
||||||
Log.e("test", "Unable to create Image File", ex);
|
|
||||||
}
|
|
||||||
// Continue only if the File was successfully created
|
|
||||||
if (photoFile != null) {
|
|
||||||
mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
|
|
||||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
|
|
||||||
} else {
|
|
||||||
takePictureIntent = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
||||||
contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
|
|
||||||
contentSelectionIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
||||||
contentSelectionIntent.setType("image/*");
|
|
||||||
Intent[] intentArray;
|
|
||||||
if (takePictureIntent != null) {
|
|
||||||
intentArray = new Intent[]{takePictureIntent};
|
|
||||||
} else {
|
|
||||||
intentArray = new Intent[2];
|
|
||||||
}
|
|
||||||
Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
|
|
||||||
startActivityForResult(Intent.createChooser(chooserIntent, "Select images"), 101);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private File createImageFile() throws IOException {
|
|
||||||
// Create an image file name
|
|
||||||
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
|
||||||
String imageFileName = "JPEG_" + timeStamp + "_";
|
|
||||||
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
|
|
||||||
File imageFile = File.createTempFile(imageFileName, /* prefix */
|
|
||||||
".jpg", /* suffix */
|
|
||||||
storageDir /* directory */);
|
|
||||||
return imageFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,22 +1,6 @@
|
||||||
package com.cmx.hydrology.model;
|
package com.cmx.hydrology.model
|
||||||
|
|
||||||
public class LoginBean {
|
class LoginBean {
|
||||||
String username;
|
var username: String? = null
|
||||||
String password;
|
var password: String? = null
|
||||||
|
}
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,42 +1,12 @@
|
||||||
package com.cmx.hydrology.model;
|
package com.cmx.hydrology.model
|
||||||
|
|
||||||
|
|
||||||
public class LoginRes {
|
|
||||||
|
|
||||||
|
|
||||||
|
class LoginRes {
|
||||||
/**
|
/**
|
||||||
* code : 0
|
* code : 0
|
||||||
* message : 登录成功
|
* message : 登录成功
|
||||||
* access_token : 1914936f8c87fddd11836ebebb65317bb7f57506
|
* access_token : 1914936f8c87fddd11836ebebb65317bb7f57506
|
||||||
*/
|
*/
|
||||||
|
var code = 0
|
||||||
|
var message: String? = null
|
||||||
private int code;
|
var access_token: String? = null
|
||||||
private String message;
|
}
|
||||||
private String access_token;
|
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCode(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMessage(String message) {
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAccess_token() {
|
|
||||||
return access_token;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccess_token(String access_token) {
|
|
||||||
this.access_token = access_token;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,47 +1,42 @@
|
||||||
package com.cmx.hydrology.retrofit;
|
package com.cmx.hydrology.retrofit
|
||||||
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import okhttp3.ResponseBody
|
||||||
|
import org.json.JSONException
|
||||||
|
import org.json.JSONObject
|
||||||
|
import retrofit2.Call
|
||||||
|
import retrofit2.Callback
|
||||||
|
import retrofit2.Response
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
import org.json.JSONException;
|
class ApiRequtest<T>(
|
||||||
import org.json.JSONObject;
|
call: Call<ResponseBody?>,
|
||||||
|
private val mResultType: TypeToken<T>,
|
||||||
import java.io.IOException;
|
listener: ApiResponse.Listener<ApiResult<T>?>,
|
||||||
|
errorListener: ApiResponse.ErrorListener
|
||||||
import okhttp3.ResponseBody;
|
) {
|
||||||
import retrofit2.Call;
|
init {
|
||||||
import retrofit2.Callback;
|
call.enqueue(object : Callback<ResponseBody?> {
|
||||||
|
override fun onResponse(call: Call<ResponseBody?>, response: Response<ResponseBody?>) {
|
||||||
|
|
||||||
public class ApiRequtest<T> {
|
|
||||||
private static final String TAG = ApiRequtest.class.getSimpleName();
|
|
||||||
|
|
||||||
private TypeToken<T> mResultType;
|
|
||||||
|
|
||||||
public ApiRequtest (Call<ResponseBody> call, TypeToken<T> resultType, final ApiResponse.Listener<ApiResult<T>> listener, final ApiResponse.ErrorListener errorListener){
|
|
||||||
mResultType = resultType;
|
|
||||||
call.enqueue(new Callback<ResponseBody>() {
|
|
||||||
@Override
|
|
||||||
public void onResponse(Call<ResponseBody> call, retrofit2.Response<ResponseBody> response) {
|
|
||||||
try {
|
try {
|
||||||
ResponseBody responseBody = response.body();
|
val responseBody = response.body()
|
||||||
if(responseBody != null){
|
if (responseBody != null) {
|
||||||
String jsonString = response.body().string();
|
val jsonString = response.body()!!.string()
|
||||||
final ApiResult<T> result = new ApiResult<>(new JSONObject(jsonString), mResultType);
|
val result = ApiResult(JSONObject(jsonString), mResultType)
|
||||||
listener.onResponse(result);
|
listener.onResponse(result)
|
||||||
}
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
}catch (IOException e){
|
} catch (e: JSONException) {
|
||||||
}catch (JSONException e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
override fun onFailure(call: Call<ResponseBody?>, t: Throwable) {
|
||||||
public void onFailure(Call<ResponseBody> call, Throwable t) {
|
errorListener.onErrorResponse(t)
|
||||||
errorListener.onErrorResponse(t);
|
|
||||||
}
|
}
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val TAG = ApiRequtest::class.java.simpleName
|
||||||
}
|
}
|
||||||
|
}
|
|
@ -1,19 +1,18 @@
|
||||||
package com.cmx.hydrology.retrofit;
|
package com.cmx.hydrology.retrofit
|
||||||
|
|
||||||
public class ApiResponse<T> {
|
|
||||||
|
|
||||||
|
class ApiResponse<T> {
|
||||||
/**
|
/**
|
||||||
* network request error response
|
* network request error response
|
||||||
*/
|
*/
|
||||||
public interface ErrorListener {
|
interface ErrorListener {
|
||||||
void onErrorResponse(Throwable requestError);
|
fun onErrorResponse(requestError: Throwable?)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* network request success response result
|
* network request success response result
|
||||||
* @param <T> data result
|
* @param <T> data result
|
||||||
*/
|
</T> */
|
||||||
public interface Listener<T> {
|
interface Listener<T> {
|
||||||
void onResponse(T result);
|
fun onResponse(result: T)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,104 +1,65 @@
|
||||||
package com.cmx.hydrology.retrofit;
|
package com.cmx.hydrology.retrofit
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
|
||||||
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import org.json.JSONObject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ApiResult<T> {
|
class ApiResult<T> {
|
||||||
|
var success = true
|
||||||
|
var code = OK
|
||||||
|
var msg = ""
|
||||||
|
var result: T? = null
|
||||||
|
private set
|
||||||
|
val msgJson: String? = null
|
||||||
|
|
||||||
private final static String TAG = ApiResult.class.getSimpleName();
|
constructor() : super() { // TODO Auto-generated constructor stub
|
||||||
|
|
||||||
public static final int OK = 0;
|
|
||||||
|
|
||||||
public Boolean success = true;
|
|
||||||
private Integer code = OK;
|
|
||||||
private String msg="";
|
|
||||||
private T result;
|
|
||||||
private String msgJson;
|
|
||||||
private static Gson gson = new Gson();
|
|
||||||
|
|
||||||
|
|
||||||
public ApiResult() {
|
|
||||||
super();
|
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiResult(JSONObject jsonObject, TypeToken<T> typeToken) {
|
constructor(jsonObject: JSONObject, typeToken: TypeToken<T>) : super() {
|
||||||
super();
|
try {
|
||||||
try{
|
if (jsonObject.has("errcode")) {
|
||||||
if (jsonObject.has("errcode")){
|
code = jsonObject.getInt("errcode")
|
||||||
code = jsonObject.getInt("errcode");
|
|
||||||
if (code != OK) {
|
if (code != OK) {
|
||||||
if (jsonObject.has("errmsg")) {
|
if (jsonObject.has("errmsg")) {
|
||||||
msg = jsonObject.getString("errmsg");
|
msg = jsonObject.getString("errmsg")
|
||||||
}
|
}
|
||||||
|
success = false
|
||||||
success = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (code == OK) {
|
||||||
if (code == OK){
|
|
||||||
try {
|
try {
|
||||||
result = gson.fromJson(jsonObject.toString(), typeToken.getType());
|
result = gson.fromJson(jsonObject.toString(), typeToken.type)
|
||||||
}catch (Exception ex){
|
} catch (ex: Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}catch (Exception e) {
|
} catch (e: Exception) {
|
||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
private T testDefault(String msg){
|
|
||||||
Gson gson = new Gson();
|
|
||||||
result = gson.fromJson(msg,new TypeToken<T>(){}.getType());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
private T test(String msg, TypeToken<T> typeToken){
|
|
||||||
Gson gson = new Gson();
|
|
||||||
result = gson.fromJson(msg,typeToken.getType());
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getCode() {
|
private fun testDefault(msg: String): T? {
|
||||||
return code;
|
val gson = Gson()
|
||||||
}
|
result = gson.fromJson(msg, object : TypeToken<T>() {}.type)
|
||||||
public void setCode(Integer code) {
|
return result
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
public String getMsg() {
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
public void setMsg(String msg) {
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public T getResult() {
|
private fun test(msg: String, typeToken: TypeToken<T>): T? {
|
||||||
return result;
|
val gson = Gson()
|
||||||
|
result = gson.fromJson(msg, typeToken.type)
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResult(T result) {
|
fun setResult(result: T) {
|
||||||
this.result = result;
|
this.result = result
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getSuccess() {
|
companion object {
|
||||||
return success;
|
private val TAG = ApiResult::class.java.simpleName
|
||||||
|
const val OK = 0
|
||||||
|
private val gson = Gson()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public void setSuccess(Boolean success) {
|
|
||||||
this.success = success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMsgJson() {
|
|
||||||
return msgJson;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +1,15 @@
|
||||||
package com.cmx.hydrology.retrofit;
|
package com.cmx.hydrology.retrofit
|
||||||
|
|
||||||
import com.cmx.hydrology.model.LoginBean;
|
import com.cmx.hydrology.model.LoginBean
|
||||||
import com.cmx.hydrology.model.LoginRes;
|
import com.cmx.hydrology.model.LoginRes
|
||||||
|
import retrofit2.Call
|
||||||
import retrofit2.Call;
|
import retrofit2.http.Body
|
||||||
import retrofit2.http.Body;
|
import retrofit2.http.POST
|
||||||
import retrofit2.http.POST;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by
|
* Created by
|
||||||
*/
|
*/
|
||||||
public interface ApiService {
|
interface ApiService {
|
||||||
/**
|
/**
|
||||||
* 登录
|
* 登录
|
||||||
*
|
*
|
||||||
|
@ -18,5 +17,5 @@ public interface ApiService {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@POST("/login")
|
@POST("/login")
|
||||||
Call<LoginRes> login(@Body LoginBean body);
|
fun login(@Body body: LoginBean?): Call<LoginRes?>?
|
||||||
}
|
}
|
|
@ -1,71 +1,55 @@
|
||||||
package com.cmx.hydrology.retrofit;
|
package com.cmx.hydrology.retrofit
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
import static com.cmx.hydrology.constant.Events.SERVER_URL;
|
import com.cmx.hydrology.activity.MyApplication.Companion.getmInstance
|
||||||
|
import com.cmx.hydrology.constant.Events
|
||||||
import android.util.Log;
|
import com.cmx.hydrology.utils.SpUtils
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
import com.cmx.hydrology.activity.MyApplication;
|
import okhttp3.OkHttpClient
|
||||||
import com.cmx.hydrology.utils.SpUtils;
|
import okhttp3.ResponseBody
|
||||||
import com.google.gson.reflect.TypeToken;
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
|
import retrofit2.Call
|
||||||
import java.io.IOException;
|
import retrofit2.Retrofit
|
||||||
import java.io.UnsupportedEncodingException;
|
import retrofit2.converter.gson.GsonConverterFactory
|
||||||
import java.net.URLDecoder;
|
import java.util.concurrent.TimeUnit
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import okhttp3.Interceptor;
|
|
||||||
import okhttp3.OkHttpClient;
|
|
||||||
import okhttp3.Request;
|
|
||||||
import okhttp3.Response;
|
|
||||||
import okhttp3.ResponseBody;
|
|
||||||
import okhttp3.logging.HttpLoggingInterceptor;
|
|
||||||
import retrofit2.Call;
|
|
||||||
import retrofit2.Retrofit;
|
|
||||||
import retrofit2.converter.gson.GsonConverterFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by TTLock on 2018/9/5.
|
* Created by TTLock on 2018/9/5.
|
||||||
*/
|
*/
|
||||||
|
object RetrofitAPIManager {
|
||||||
|
fun provideClientApi(): ApiService {
|
||||||
public class RetrofitAPIManager {
|
val retrofit = Retrofit.Builder().client(genericClient()).baseUrl(Events.SERVER_URL)
|
||||||
|
.addConverterFactory(GsonConverterFactory.create()).build()
|
||||||
|
return retrofit.create(ApiService::class.java)
|
||||||
public static ApiService provideClientApi() {
|
|
||||||
Retrofit retrofit = new Retrofit.Builder().client(genericClient()).baseUrl(SERVER_URL).addConverterFactory(GsonConverterFactory.create()).build();
|
|
||||||
return retrofit.create(ApiService.class);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static OkHttpClient genericClient() {
|
fun genericClient(): OkHttpClient {
|
||||||
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(new HttpLoggingInterceptor.Logger() {
|
val interceptor = HttpLoggingInterceptor { message ->
|
||||||
@Override
|
// try {
|
||||||
public void log(String message) {
|
// String text = URLDecoder.decode(message, "utf-8");
|
||||||
// try {
|
// Log.e("OKHttp-----", text);
|
||||||
// String text = URLDecoder.decode(message, "utf-8");
|
// } catch (UnsupportedEncodingException e) {
|
||||||
// Log.e("OKHttp-----", text);
|
// e.printStackTrace();
|
||||||
// } catch (UnsupportedEncodingException e) {
|
Log.e("OKHttp-----", message)
|
||||||
// e.printStackTrace();
|
// }
|
||||||
Log.e("OKHttp-----", message);
|
}
|
||||||
// }
|
interceptor.level = HttpLoggingInterceptor.Level.BODY
|
||||||
}
|
return OkHttpClient.Builder().connectTimeout(35, TimeUnit.SECONDS).readTimeout(35, TimeUnit.SECONDS)
|
||||||
});
|
.writeTimeout(35, TimeUnit.SECONDS).addInterceptor(interceptor).addInterceptor { chain ->
|
||||||
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
val original = chain.request()
|
||||||
OkHttpClient httpClient = new OkHttpClient.Builder().connectTimeout(35, TimeUnit.SECONDS).readTimeout(35, TimeUnit.SECONDS).writeTimeout(35, TimeUnit.SECONDS).addInterceptor(interceptor).addInterceptor(new Interceptor() {
|
val requestBuilder =
|
||||||
@Override
|
original.newBuilder().header("token", SpUtils.getString(getmInstance()!!, "token"))
|
||||||
public Response intercept(Chain chain) throws IOException {
|
val request = requestBuilder.build()
|
||||||
Request original = chain.request();
|
chain.proceed(request)
|
||||||
Request.Builder requestBuilder = original.newBuilder().header("token", SpUtils.getString(MyApplication.getmInstance(), "token"));
|
}.build()
|
||||||
Request request = requestBuilder.build();
|
|
||||||
return chain.proceed(request);
|
|
||||||
}
|
|
||||||
}).build();
|
|
||||||
|
|
||||||
return httpClient;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> ApiRequtest enqueue(Call<ResponseBody> call, TypeToken<T> resultType, ApiResponse.Listener<ApiResult<T>> listener, ApiResponse.ErrorListener errorListener) {
|
fun <T> enqueue(
|
||||||
ApiRequtest<T> request = new ApiRequtest<>(call, resultType, listener, errorListener);
|
call: Call<ResponseBody?>?,
|
||||||
return request;
|
resultType: TypeToken<T>?,
|
||||||
|
listener: ApiResponse.Listener<ApiResult<T>?>?,
|
||||||
|
errorListener: ApiResponse.ErrorListener?
|
||||||
|
): ApiRequtest<*> {
|
||||||
|
return ApiRequtest(call!!, resultType!!, listener!!, errorListener!!)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,8 @@
|
||||||
package com.cmx.hydrology.retrofit;
|
package com.cmx.hydrology.retrofit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Administrator on 2018/1/17 0017.
|
* Created by Administrator on 2018/1/17 0017.
|
||||||
*/
|
*/
|
||||||
|
interface onRequestResponse {
|
||||||
public interface onRequestResponse {
|
fun onResult(success: Boolean)
|
||||||
void onResult(boolean success);
|
}
|
||||||
}
|
|
|
@ -1,9 +1,8 @@
|
||||||
package com.cmx.hydrology.retrofit;
|
package com.cmx.hydrology.retrofit
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Administrator on 2018/1/17 0017.
|
* Created by Administrator on 2018/1/17 0017.
|
||||||
*/
|
*/
|
||||||
|
interface onServerRequestCallBack {
|
||||||
public interface onServerRequestCallBack {
|
fun onResult(resultCode: Int)
|
||||||
void onResult(int resultCode);
|
}
|
||||||
}
|
|
|
@ -1,180 +1,48 @@
|
||||||
package com.cmx.hydrology.ui;
|
package com.cmx.hydrology.ui
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
|
import android.content.ClipData
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.os.Environment
|
||||||
|
import android.provider.MediaStore
|
||||||
|
import android.util.Log
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.webkit.ValueCallback
|
||||||
|
import android.webkit.WebChromeClient
|
||||||
|
import android.webkit.WebView
|
||||||
|
import com.cmx.hydrology.constant.Events
|
||||||
|
import com.cmx.hydrology.databinding.FragmentHomeBinding
|
||||||
|
import java.io.File
|
||||||
|
import java.io.IOException
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
import static com.cmx.hydrology.constant.Events.WEB_HOME_URL;
|
class HomeFragment : BaseFragment() {
|
||||||
import static com.cmx.hydrology.constant.Events.WEB_SERVER_URL;
|
private var binding: FragmentHomeBinding? = null
|
||||||
|
private var mWebView: WebView? = null
|
||||||
|
private var mUploadMessage: ValueCallback<Array<Uri>>? = null
|
||||||
|
private var mCameraPhotoPath: String? = null
|
||||||
|
private var size: Long = 0
|
||||||
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
|
binding = FragmentHomeBinding.inflate(inflater, container, false)
|
||||||
|
val root: View = binding!!.root
|
||||||
|
mWebView = binding!!.wvHome
|
||||||
|
setWebView(mWebView!!)
|
||||||
|
mWebView!!.loadUrl(Events.WEB_HOME_URL)
|
||||||
|
return root
|
||||||
|
}
|
||||||
|
|
||||||
import android.app.Activity;
|
override fun onDestroyView() {
|
||||||
import android.content.ClipData;
|
super.onDestroyView()
|
||||||
import android.content.Intent;
|
binding = null
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Environment;
|
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.webkit.ValueCallback;
|
|
||||||
import android.webkit.WebChromeClient;
|
|
||||||
import android.webkit.WebResourceError;
|
|
||||||
import android.webkit.WebResourceRequest;
|
|
||||||
import android.webkit.WebSettings;
|
|
||||||
import android.webkit.WebView;
|
|
||||||
import android.webkit.WebViewClient;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
import com.cmx.hydrology.databinding.FragmentHomeBinding;
|
|
||||||
import com.cmx.hydrology.utils.AndroidtoJs;
|
|
||||||
import com.cmx.hydrology.utils.MyUtils;
|
|
||||||
import com.cmx.hydrology.view.BaseLoadingDialog;
|
|
||||||
import com.lsxiao.apollo.core.Apollo;
|
|
||||||
import com.lsxiao.apollo.core.contract.ApolloBinder;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class HomeFragment extends BaseFragment {
|
|
||||||
|
|
||||||
private FragmentHomeBinding binding;
|
|
||||||
private WebView mWebView;
|
|
||||||
private ValueCallback<Uri[]> mUploadMessage;
|
|
||||||
private String mCameraPhotoPath = null;
|
|
||||||
private long size = 0;
|
|
||||||
private static final int INPUT_FILE_REQUEST_CODE = 1;
|
|
||||||
|
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
binding = FragmentHomeBinding.inflate(inflater, container, false);
|
|
||||||
View root = binding.getRoot();
|
|
||||||
mWebView = binding.wvHome;
|
|
||||||
setWebView(mWebView);
|
|
||||||
mWebView.loadUrl(WEB_HOME_URL);
|
|
||||||
mWebView.setWebChromeClient(new PQChromeClient());
|
|
||||||
return root;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
companion object {
|
||||||
public void onDestroyView() {
|
private const val INPUT_FILE_REQUEST_CODE = 1
|
||||||
super.onDestroyView();
|
|
||||||
binding = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class PQChromeClient extends WebChromeClient {
|
|
||||||
// For Android 5.0+
|
|
||||||
public boolean onShowFileChooser(WebView view, ValueCallback<Uri[]> filePath, WebChromeClient.FileChooserParams fileChooserParams) {
|
|
||||||
// Double check that we don't have any existing callbacks
|
|
||||||
if (mUploadMessage != null) {
|
|
||||||
mUploadMessage.onReceiveValue(null);
|
|
||||||
}
|
|
||||||
mUploadMessage = filePath;
|
|
||||||
Log.e("FileCooserParams => ", filePath.toString());
|
|
||||||
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
|
||||||
if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
|
|
||||||
// Create the File where the photo should go
|
|
||||||
File photoFile = null;
|
|
||||||
try {
|
|
||||||
photoFile = createImageFile();
|
|
||||||
takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
// Error occurred while creating the File
|
|
||||||
Log.e("test", "Unable to create Image File", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Continue only if the File was successfully created
|
|
||||||
if (photoFile != null) {
|
|
||||||
mCameraPhotoPath = "file:" + photoFile.getAbsolutePath();
|
|
||||||
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
|
|
||||||
} else {
|
|
||||||
takePictureIntent = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT);
|
|
||||||
contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE);
|
|
||||||
contentSelectionIntent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
|
||||||
contentSelectionIntent.setType("image/*");
|
|
||||||
Intent[] intentArray;
|
|
||||||
if (takePictureIntent != null) {
|
|
||||||
intentArray = new Intent[]{takePictureIntent};
|
|
||||||
} else {
|
|
||||||
intentArray = new Intent[2];
|
|
||||||
}
|
|
||||||
Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER);
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent);
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_TITLE, "Image Chooser");
|
|
||||||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray);
|
|
||||||
startActivityForResult(Intent.createChooser(chooserIntent, "Select images"), 1);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private File createImageFile() throws IOException {
|
|
||||||
// Create an image file name
|
|
||||||
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
|
||||||
String imageFileName = "JPEG_" + timeStamp + "_";
|
|
||||||
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
|
|
||||||
File imageFile = File.createTempFile(imageFileName, /* prefix */
|
|
||||||
".jpg", /* suffix */
|
|
||||||
storageDir /* directory */);
|
|
||||||
return imageFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
if (requestCode != INPUT_FILE_REQUEST_CODE || mUploadMessage == null) {
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
String file_path = mCameraPhotoPath.replace("file:", "");
|
|
||||||
File file = new File(file_path);
|
|
||||||
size = file.length();
|
|
||||||
if (data != null || mCameraPhotoPath != null) {
|
|
||||||
Integer count = 1;
|
|
||||||
ClipData images = null;
|
|
||||||
try {
|
|
||||||
images = data.getClipData();
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("Error!", e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (images == null && data != null && data.getDataString() != null) {
|
|
||||||
count = data.getDataString().length();
|
|
||||||
} else if (images != null) {
|
|
||||||
count = images.getItemCount();
|
|
||||||
}
|
|
||||||
Uri[] results = new Uri[count];
|
|
||||||
// Check that the response is a good one
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
if (size != 0) {
|
|
||||||
// If there is not data, then we may have taken a photo
|
|
||||||
if (mCameraPhotoPath != null) {
|
|
||||||
results = new Uri[]{Uri.parse(mCameraPhotoPath)};
|
|
||||||
}
|
|
||||||
} else if (data.getClipData() == null) {
|
|
||||||
results = new Uri[]{Uri.parse(data.getDataString())};
|
|
||||||
} else {
|
|
||||||
|
|
||||||
for (int i = 0; i < images.getItemCount(); i++) {
|
|
||||||
results[i] = images.getItemAt(i).getUri();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mUploadMessage.onReceiveValue(results);
|
|
||||||
mUploadMessage = null;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e("Error!", "Error while opening image file" + e.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,48 +1,27 @@
|
||||||
package com.cmx.hydrology.ui;
|
package com.cmx.hydrology.ui
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.webkit.WebView
|
||||||
|
import com.cmx.hydrology.constant.Events
|
||||||
|
import com.cmx.hydrology.databinding.FragmentMapBinding
|
||||||
|
|
||||||
import static com.cmx.hydrology.constant.Events.WEB_MAP_URL;
|
class MapFragment : BaseFragment() {
|
||||||
import static com.cmx.hydrology.constant.Events.WEB_SERVER_URL;
|
private var binding: FragmentMapBinding? = null
|
||||||
|
private var mWebView: WebView? = null
|
||||||
import android.os.Bundle;
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
import android.view.LayoutInflater;
|
binding = FragmentMapBinding.inflate(inflater, container, false)
|
||||||
import android.view.View;
|
val root: View = binding!!.root
|
||||||
import android.view.ViewGroup;
|
mWebView = binding!!.wvMine
|
||||||
import android.webkit.WebResourceError;
|
setWebView(mWebView!!)
|
||||||
import android.webkit.WebResourceRequest;
|
mWebView!!.loadUrl(Events.WEB_MAP_URL)
|
||||||
import android.webkit.WebSettings;
|
return root
|
||||||
import android.webkit.WebView;
|
|
||||||
import android.webkit.WebViewClient;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
import com.cmx.hydrology.databinding.FragmentMapBinding;
|
|
||||||
import com.cmx.hydrology.utils.AndroidtoJs;
|
|
||||||
import com.cmx.hydrology.utils.MyUtils;
|
|
||||||
import com.cmx.hydrology.view.BaseLoadingDialog;
|
|
||||||
import com.lsxiao.apollo.core.Apollo;
|
|
||||||
import com.lsxiao.apollo.core.contract.ApolloBinder;
|
|
||||||
|
|
||||||
public class MapFragment extends BaseFragment {
|
|
||||||
|
|
||||||
private FragmentMapBinding binding;
|
|
||||||
private WebView mWebView;
|
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
binding = FragmentMapBinding.inflate(inflater, container, false);
|
|
||||||
View root = binding.getRoot();
|
|
||||||
mWebView = binding.wvMine;
|
|
||||||
setWebView(mWebView);
|
|
||||||
mWebView.loadUrl(WEB_MAP_URL);
|
|
||||||
return root;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
@Override
|
super.onDestroyView()
|
||||||
public void onDestroyView() {
|
binding = null
|
||||||
super.onDestroyView();
|
|
||||||
binding = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,63 +1,26 @@
|
||||||
package com.cmx.hydrology.ui;
|
package com.cmx.hydrology.ui
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.webkit.WebView
|
||||||
|
import com.cmx.hydrology.databinding.FragmentMsgBinding
|
||||||
|
|
||||||
import static com.cmx.hydrology.constant.Events.SERVER_URL;
|
class MsgFragment : BaseFragment() {
|
||||||
|
private var binding: FragmentMsgBinding? = null
|
||||||
import android.app.Activity;
|
private var mWebView: WebView? = null
|
||||||
import android.content.ClipData;
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
import android.content.Intent;
|
binding = FragmentMsgBinding.inflate(inflater, container, false)
|
||||||
import android.net.Uri;
|
val root: View = binding!!.root
|
||||||
import android.os.Bundle;
|
mWebView = binding!!.wvLoan
|
||||||
import android.os.Environment;
|
setWebView(mWebView!!)
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.webkit.ValueCallback;
|
|
||||||
import android.webkit.WebChromeClient;
|
|
||||||
import android.webkit.WebResourceError;
|
|
||||||
import android.webkit.WebResourceRequest;
|
|
||||||
import android.webkit.WebSettings;
|
|
||||||
import android.webkit.WebView;
|
|
||||||
import android.webkit.WebViewClient;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
import com.cmx.hydrology.databinding.FragmentMsgBinding;
|
|
||||||
import com.cmx.hydrology.utils.AndroidtoJs;
|
|
||||||
import com.cmx.hydrology.utils.MyUtils;
|
|
||||||
import com.cmx.hydrology.view.BaseLoadingDialog;
|
|
||||||
import com.lsxiao.apollo.core.Apollo;
|
|
||||||
import com.lsxiao.apollo.core.contract.ApolloBinder;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
public class MsgFragment extends BaseFragment {
|
|
||||||
|
|
||||||
private FragmentMsgBinding binding;
|
|
||||||
private WebView mWebView;
|
|
||||||
|
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
binding = FragmentMsgBinding.inflate(inflater, container, false);
|
|
||||||
View root = binding.getRoot();
|
|
||||||
mWebView = binding.wvLoan;
|
|
||||||
setWebView(mWebView);
|
|
||||||
// mWebView.loadUrl(SERVER_URL + "/nigeria/?lang=English#/loans");
|
// mWebView.loadUrl(SERVER_URL + "/nigeria/?lang=English#/loans");
|
||||||
return root;
|
return root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
@Override
|
super.onDestroyView()
|
||||||
public void onDestroyView() {
|
binding = null
|
||||||
super.onDestroyView();
|
|
||||||
binding = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,45 +1,26 @@
|
||||||
package com.cmx.hydrology.ui;
|
package com.cmx.hydrology.ui
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import android.view.LayoutInflater
|
||||||
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.webkit.WebView
|
||||||
|
import com.cmx.hydrology.databinding.FragmentMyBinding
|
||||||
|
|
||||||
import android.os.Bundle;
|
class MyFragment : BaseFragment() {
|
||||||
import android.view.LayoutInflater;
|
private var binding: FragmentMyBinding? = null
|
||||||
import android.view.View;
|
private var mWebView: WebView? = null
|
||||||
import android.view.ViewGroup;
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
import android.webkit.WebResourceError;
|
binding = FragmentMyBinding.inflate(inflater, container, false)
|
||||||
import android.webkit.WebResourceRequest;
|
val root: View = binding!!.root
|
||||||
import android.webkit.WebSettings;
|
mWebView = binding!!.wvMine
|
||||||
import android.webkit.WebView;
|
setWebView(mWebView!!)
|
||||||
import android.webkit.WebViewClient;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
import com.cmx.hydrology.databinding.FragmentMyBinding;
|
|
||||||
import com.cmx.hydrology.utils.AndroidtoJs;
|
|
||||||
import com.cmx.hydrology.utils.MyUtils;
|
|
||||||
import com.cmx.hydrology.view.BaseLoadingDialog;
|
|
||||||
import com.lsxiao.apollo.core.Apollo;
|
|
||||||
import com.lsxiao.apollo.core.contract.ApolloBinder;
|
|
||||||
|
|
||||||
public class MyFragment extends BaseFragment {
|
|
||||||
|
|
||||||
private FragmentMyBinding binding;
|
|
||||||
private WebView mWebView;
|
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
binding = FragmentMyBinding.inflate(inflater, container, false);
|
|
||||||
View root = binding.getRoot();
|
|
||||||
mWebView = binding.wvMine;
|
|
||||||
setWebView(mWebView);
|
|
||||||
// mWebView.loadUrl(SERVER_URL + "/nigeria/?lang=English#/my");
|
// mWebView.loadUrl(SERVER_URL + "/nigeria/?lang=English#/my");
|
||||||
return root;
|
return root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onDestroyView() {
|
||||||
@Override
|
super.onDestroyView()
|
||||||
public void onDestroyView() {
|
binding = null
|
||||||
super.onDestroyView();
|
|
||||||
binding = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,78 +1,76 @@
|
||||||
package com.cmx.hydrology.utils;
|
package com.cmx.hydrology.utils
|
||||||
|
|
||||||
import android.content.pm.PackageInfo;
|
import android.content.pm.PackageManager
|
||||||
import android.content.pm.PackageManager;
|
import android.util.Log
|
||||||
import android.util.Log;
|
import android.webkit.JavascriptInterface
|
||||||
import android.webkit.JavascriptInterface;
|
import com.cmx.hydrology.activity.MyApplication.Companion.getmInstance
|
||||||
|
import com.cmx.hydrology.constant.Events
|
||||||
import com.cmx.hydrology.activity.MyApplication;
|
import com.lsxiao.apollo.core.Apollo
|
||||||
import com.cmx.hydrology.constant.Events;
|
|
||||||
import com.lsxiao.apollo.core.Apollo;
|
|
||||||
|
|
||||||
public class AndroidtoJs {
|
|
||||||
private static final String TAG = "cmx_AndroidtoJs";
|
|
||||||
|
|
||||||
|
class AndroidtoJs {
|
||||||
// 定义JS需要调用的方法
|
// 定义JS需要调用的方法
|
||||||
// 被JS调用的方法必须加入@JavascriptInterface注解
|
// 被JS调用的方法必须加入@JavascriptInterface注解
|
||||||
@JavascriptInterface
|
@get:JavascriptInterface
|
||||||
public String getAppToken() {
|
val appToken: String?
|
||||||
L.e("JS--", "getAppToken()");
|
get() {
|
||||||
return SpUtils.getString(MyApplication.getmInstance(), "token");
|
L.e("JS--", "getAppToken()")
|
||||||
}
|
return SpUtils.getString(getmInstance()!!, "token")
|
||||||
|
|
||||||
|
|
||||||
@JavascriptInterface
|
|
||||||
public String getAppVersion() {
|
|
||||||
L.e("JS--", "getAppVersion()");
|
|
||||||
String versionname;//版本号
|
|
||||||
try {
|
|
||||||
PackageManager pm = MyApplication.getmInstance().getApplicationContext().getPackageManager();
|
|
||||||
PackageInfo pi = pm.getPackageInfo(MyApplication.getmInstance().getApplicationContext().getPackageName(), 0);
|
|
||||||
versionname = "V" + pi.versionName;
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
versionname = "未知";
|
|
||||||
}
|
}
|
||||||
Log.e(TAG, "getAppVersion=" + versionname);
|
|
||||||
return versionname;
|
//版本号
|
||||||
|
@get:JavascriptInterface
|
||||||
|
val appVersion: String
|
||||||
|
get() {
|
||||||
|
L.e("JS--", "getAppVersion()")
|
||||||
|
val versionname: String //版本号
|
||||||
|
versionname = try {
|
||||||
|
val pm = getmInstance()!!.applicationContext.packageManager
|
||||||
|
val pi = pm.getPackageInfo(getmInstance()!!.applicationContext.packageName, 0)
|
||||||
|
"V" + pi.versionName
|
||||||
|
} catch (e: PackageManager.NameNotFoundException) {
|
||||||
|
"未知"
|
||||||
|
}
|
||||||
|
Log.e(TAG, "getAppVersion=$versionname")
|
||||||
|
return versionname
|
||||||
|
}
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
fun existApp() {
|
||||||
|
L.e("JS--", "existApp()")
|
||||||
|
Apollo.emit(Events.JS_OPEN_LOGOUT)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void existApp() {
|
fun showTab() { //tabbar显示
|
||||||
L.e("JS--", "existApp()");
|
L.e("JS--", "showTab()")
|
||||||
Apollo.emit(Events.JS_OPEN_LOGOUT);
|
Apollo.emit(Events.JS_OPEN_TABBAR_SHOW)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void showTab() {//tabbar显示
|
fun hideTab() { //tabbar隐藏
|
||||||
L.e("JS--", "showTab()");
|
L.e("JS--", "hideTab()")
|
||||||
Apollo.emit(Events.JS_OPEN_TABBAR_SHOW);
|
Apollo.emit(Events.JS_OPEN_TABBAR_HIDE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void hideTab() {//tabbar隐藏
|
fun openWeb(url: String) { //打开一个新的web界面
|
||||||
L.e("JS--", "hideTab()");
|
L.e("JS--", "openWeb()$url")
|
||||||
Apollo.emit(Events.JS_OPEN_TABBAR_HIDE);
|
Apollo.emit(Events.JS_OPEN_OPEN_WEB, url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void openWeb(String url) {//打开一个新的web界面
|
fun closeWeb() { //关闭那个新的web界面
|
||||||
L.e("JS--", "openWeb()" + url);
|
L.e("JS--", "closeWeb()")
|
||||||
Apollo.emit(Events.JS_OPEN_OPEN_WEB, url);
|
Apollo.emit(Events.JS_OPEN_CLOSE_WEB)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
public void closeWeb() {//关闭那个新的web界面
|
fun checkTab(mode: String?) { //关闭注册/忘记密码
|
||||||
L.e("JS--", "closeWeb()");
|
L.e("JS--", "checkTab()")
|
||||||
Apollo.emit(Events.JS_OPEN_CLOSE_WEB);
|
Apollo.emit(Events.JS_OPEN_TAB, mode!!)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
@JavascriptInterface
|
private const val TAG = "cmx_AndroidtoJs"
|
||||||
public void checkTab(String mode) {//关闭注册/忘记密码
|
|
||||||
L.e("JS--", "checkTab()");
|
|
||||||
Apollo.emit(Events.JS_OPEN_TAB, mode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,92 +1,49 @@
|
||||||
package com.cmx.hydrology.utils;
|
package com.cmx.hydrology.utils
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
import android.util.Log
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.graphics.Bitmap;
|
|
||||||
import android.graphics.BitmapFactory;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.util.Base64;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ListAdapter;
|
|
||||||
import android.widget.ListView;
|
|
||||||
|
|
||||||
import java.io.File;
|
class L private constructor() {
|
||||||
import java.lang.reflect.Method;
|
init {
|
||||||
import java.text.DateFormat;
|
throw UnsupportedOperationException("cannot be instantiated")
|
||||||
import java.text.ParseException;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
|
|
||||||
public class L {
|
|
||||||
private L() {
|
|
||||||
throw new UnsupportedOperationException("cannot be instantiated");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isDebug = true;
|
companion object {
|
||||||
private static String TAG = "LjTestLog";
|
var isDebug = true
|
||||||
|
var tAG = "LjTestLog"
|
||||||
|
fun setDebugMode(debug: Boolean) {
|
||||||
|
isDebug = debug
|
||||||
|
}
|
||||||
|
|
||||||
public static String getTAG() {
|
fun i(msg: String?) {
|
||||||
return TAG;
|
if (isDebug) Log.i(tAG, msg!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun d(msg: String?) {
|
||||||
|
if (isDebug) Log.d(tAG, msg!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun e(msg: String?) {
|
||||||
|
if (isDebug) Log.e(tAG, msg!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun v(msg: String?) {
|
||||||
|
if (isDebug) Log.v(tAG, msg!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun i(tag: String?, msg: String?) {
|
||||||
|
if (isDebug) Log.i(tag, msg!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun d(tag: String?, msg: String?) {
|
||||||
|
if (isDebug) Log.d(tag, msg!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun e(tag: String?, msg: String?) {
|
||||||
|
if (isDebug) Log.e(tag, msg!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun v(tag: String?, msg: String?) {
|
||||||
|
if (isDebug) Log.v(tag, msg!!)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
public static void setTAG(String TAG) {
|
|
||||||
L.TAG = TAG;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setDebugMode(boolean debug) {
|
|
||||||
isDebug = debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void i(String msg) {
|
|
||||||
if (isDebug)
|
|
||||||
Log.i(TAG, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void d(String msg) {
|
|
||||||
if (isDebug)
|
|
||||||
Log.d(TAG, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void e(String msg) {
|
|
||||||
if (isDebug)
|
|
||||||
Log.e(TAG, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void v(String msg) {
|
|
||||||
if (isDebug)
|
|
||||||
Log.v(TAG, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void i(String tag, String msg) {
|
|
||||||
if (isDebug)
|
|
||||||
Log.i(tag, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void d(String tag, String msg) {
|
|
||||||
if (isDebug)
|
|
||||||
Log.d(tag, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void e(String tag, String msg) {
|
|
||||||
if (isDebug)
|
|
||||||
Log.e(tag, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void v(String tag, String msg) {
|
|
||||||
if (isDebug)
|
|
||||||
Log.v(tag, msg);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,180 +1,168 @@
|
||||||
package com.cmx.hydrology.utils;
|
package com.cmx.hydrology.utils
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity
|
||||||
import android.content.ContentResolver;
|
import android.content.Context
|
||||||
import android.content.ContentValues;
|
import android.graphics.Color
|
||||||
import android.content.Context;
|
import android.os.Build
|
||||||
import android.content.pm.PackageInfo;
|
import android.os.Environment
|
||||||
import android.content.pm.PackageManager;
|
import android.os.StatFs
|
||||||
import android.database.Cursor;
|
import android.util.Log
|
||||||
import android.graphics.Color;
|
import android.view.View
|
||||||
import android.net.Uri;
|
import android.view.WindowManager
|
||||||
import android.os.Build;
|
import java.io.BufferedReader
|
||||||
import android.os.Environment;
|
import java.io.File
|
||||||
import android.os.StatFs;
|
import java.io.FileReader
|
||||||
import android.provider.MediaStore;
|
import java.io.IOException
|
||||||
import android.util.Log;
|
import java.nio.charset.StandardCharsets
|
||||||
import android.view.View;
|
import java.security.MessageDigest
|
||||||
import android.view.WindowManager;
|
import java.security.NoSuchAlgorithmException
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
object MyUtils {
|
||||||
import java.io.File;
|
private val TAG = "cmx_" + MyUtils::class.java.simpleName
|
||||||
import java.io.FileReader;
|
fun setNavigationStatusColor(activity: Activity, color: Int) {
|
||||||
import java.io.IOException;
|
activity.window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||||
import java.lang.reflect.Method;
|
activity.window.navigationBarColor = color
|
||||||
import java.nio.charset.StandardCharsets;
|
activity.window.statusBarColor = color
|
||||||
import java.security.MessageDigest;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
|
||||||
import java.util.Locale;
|
|
||||||
|
|
||||||
public class MyUtils {
|
|
||||||
private static final String TAG = "cmx_" + MyUtils.class.getSimpleName();
|
|
||||||
public static void setNavigationStatusColor(Activity activity, int color) {
|
|
||||||
activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
|
|
||||||
activity.getWindow().setNavigationBarColor(color);
|
|
||||||
activity.getWindow().setStatusBarColor(color);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setFullscreen(Activity activity, boolean isShowStatusBar, boolean isShowNavigationBar) {
|
fun setFullscreen(activity: Activity, isShowStatusBar: Boolean, isShowNavigationBar: Boolean) {
|
||||||
int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
|
var uiOptions =
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
|
||||||
if (!isShowStatusBar) {
|
if (!isShowStatusBar) {
|
||||||
uiOptions |= View.SYSTEM_UI_FLAG_FULLSCREEN;
|
uiOptions = uiOptions or View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
}
|
}
|
||||||
if (!isShowNavigationBar) {
|
if (!isShowNavigationBar) {
|
||||||
uiOptions |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
|
uiOptions = uiOptions or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
}
|
}
|
||||||
activity.getWindow().getDecorView().setSystemUiVisibility(uiOptions);
|
activity.window.decorView.systemUiVisibility = uiOptions
|
||||||
setNavigationStatusColor(activity, Color.TRANSPARENT);
|
setNavigationStatusColor(activity, Color.TRANSPARENT)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setAndroidNativeLightStatusBar(Activity activity, boolean dark) {
|
fun setAndroidNativeLightStatusBar(activity: Activity, dark: Boolean) {
|
||||||
View decor = activity.getWindow().getDecorView();
|
val decor = activity.window.decorView
|
||||||
if (dark) {
|
if (dark) {
|
||||||
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
decor.systemUiVisibility =
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||||
} else {
|
} else {
|
||||||
decor.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
|
decor.systemUiVisibility =
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Throws(Exception::class)
|
||||||
private static String getVersionName(Activity activity) throws Exception {
|
private fun getVersionName(activity: Activity): String {
|
||||||
PackageManager packageManager = activity.getPackageManager();
|
val packageManager = activity.packageManager
|
||||||
// getPackageName()是你当前类的包名,0代表是获取版本信息
|
// getPackageName()是你当前类的包名,0代表是获取版本信息
|
||||||
PackageInfo packInfo = packageManager.getPackageInfo(activity.getPackageName(), 0);
|
val packInfo = packageManager.getPackageInfo(activity.packageName, 0)
|
||||||
String version = packInfo.versionName;
|
return packInfo.versionName
|
||||||
return version;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void getDeviceInfo(Activity activity) throws Exception {
|
@Throws(Exception::class)
|
||||||
String model = android.os.Build.MODEL;
|
fun getDeviceInfo(activity: Activity) {
|
||||||
String carrier = android.os.Build.MANUFACTURER;
|
val model = Build.MODEL
|
||||||
String version = getVersionName(activity);
|
val carrier = Build.MANUFACTURER
|
||||||
String lang = getSystemLanguage();
|
val version = getVersionName(activity)
|
||||||
String brand = getPhoneBrand();
|
val lang = systemLanguage
|
||||||
String releaseVersion = getVersionRelease();
|
val brand = phoneBrand
|
||||||
int sdkVersion = getSdkVersion();
|
val releaseVersion = versionRelease
|
||||||
Log.e(TAG, "model=" + model + ", carrier=" + carrier + ", version=" + version + ", lang=" + lang + ", brand=" + brand + ", releaseVersion=" + releaseVersion + ",sdk version=" + sdkVersion);
|
val sdkVersion = sdkVersion
|
||||||
|
Log.e(
|
||||||
|
TAG,
|
||||||
|
"model=$model, carrier=$carrier, version=$version, lang=$lang, brand=$brand, releaseVersion=$releaseVersion,sdk version=$sdkVersion"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getSystemLanguage() {
|
val systemLanguage: String
|
||||||
return Locale.getDefault().getLanguage();
|
get() = Locale.getDefault().language
|
||||||
}
|
val systemLanguageList: Array<Locale>
|
||||||
|
get() = Locale.getAvailableLocales()
|
||||||
|
val phoneBrand: String
|
||||||
|
get() = Build.BRAND
|
||||||
|
val versionRelease: String
|
||||||
|
get() = Build.VERSION.RELEASE
|
||||||
|
val sdkVersion: Int
|
||||||
|
get() = Build.VERSION.SDK_INT//8.0-//8.0+
|
||||||
|
|
||||||
public static Locale[] getSystemLanguageList() {
|
//9.0+
|
||||||
return Locale.getAvailableLocales();
|
val serialNum: String?
|
||||||
}
|
get() {
|
||||||
|
var serial: String? = "unknown"
|
||||||
public static String getPhoneBrand() {
|
try {
|
||||||
return Build.BRAND;
|
serial = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { //9.0+
|
||||||
}
|
Build.getSerial()
|
||||||
|
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) { //8.0+
|
||||||
public static String getVersionRelease() {
|
Build.SERIAL
|
||||||
return Build.VERSION.RELEASE;
|
} else { //8.0-
|
||||||
}
|
val c = Class.forName("android.os.SystemProperties")
|
||||||
|
val get = c.getMethod("get", String::class.java)
|
||||||
public static int getSdkVersion() {
|
get.invoke(c, "ro.serialno") as String
|
||||||
return Build.VERSION.SDK_INT;
|
}
|
||||||
}
|
} catch (e: Exception) {
|
||||||
|
Log.e("序列号》》", e.toString())
|
||||||
|
e.printStackTrace()
|
||||||
public static String getSerialNum() {
|
|
||||||
String serial = "unknown";
|
|
||||||
try {
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {//9.0+
|
|
||||||
serial = Build.getSerial();
|
|
||||||
} else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N) {//8.0+
|
|
||||||
serial = Build.SERIAL;
|
|
||||||
} else {//8.0-
|
|
||||||
Class<?> c = Class.forName("android.os.SystemProperties");
|
|
||||||
Method get = c.getMethod("get", String.class);
|
|
||||||
serial = (String) get.invoke(c, "ro.serialno");
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
Log.e("序列号》》", serial!!)
|
||||||
Log.e("序列号》》", e.toString());
|
return serial
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.e("序列号》》", serial);
|
fun createTempImageFile(context: Context?): File? {
|
||||||
return serial;
|
val destFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
|
||||||
|
destFolder.mkdirs()
|
||||||
|
val dateTimeString = System.currentTimeMillis().toString() + ""
|
||||||
|
var imageFile: File? = null
|
||||||
|
imageFile = try {
|
||||||
|
File.createTempFile("$dateTimeString-", ".jpg", destFolder)
|
||||||
|
} catch (e: IOException) {
|
||||||
|
Log.e("文件失败>>>", e.toString())
|
||||||
|
throw RuntimeException(e)
|
||||||
|
}
|
||||||
|
return imageFile
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File createTempImageFile(Context context) {
|
val totalRam: String
|
||||||
File destFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM);
|
get() {
|
||||||
destFolder.mkdirs();
|
val path = "/proc/meminfo"
|
||||||
String dateTimeString = System.currentTimeMillis() + "";
|
var ramMemorySize: String? = null
|
||||||
File imageFile = null;
|
var totalRam = 0
|
||||||
try {
|
try {
|
||||||
imageFile = File.createTempFile(dateTimeString + "-", ".jpg", destFolder);
|
val fileReader = FileReader(path)
|
||||||
} catch (IOException e) {
|
val br = BufferedReader(fileReader, 4096)
|
||||||
Log.e("文件失败>>>", e.toString());
|
ramMemorySize = br.readLine().split("\\s+".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()[1]
|
||||||
throw new RuntimeException(e);
|
br.close()
|
||||||
}
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
|
||||||
return imageFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static String getTotalRam() {
|
|
||||||
String path = "/proc/meminfo";
|
|
||||||
String ramMemorySize = null;
|
|
||||||
int totalRam = 0;
|
|
||||||
try {
|
|
||||||
FileReader fileReader = new FileReader(path);
|
|
||||||
BufferedReader br = new BufferedReader(fileReader, 4096);
|
|
||||||
ramMemorySize = br.readLine().split("\\s+")[1];
|
|
||||||
br.close();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
if (ramMemorySize != null) {
|
|
||||||
totalRam = (int) Math.ceil((Float.valueOf(Float.parseFloat(ramMemorySize) / (1024 * 1024)).doubleValue()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return totalRam + "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getTotalRom() {
|
|
||||||
File dataDir = Environment.getDataDirectory();
|
|
||||||
StatFs stat = new StatFs(dataDir.getPath());
|
|
||||||
long blockSize = stat.getBlockSizeLong();
|
|
||||||
long totalBlocks = stat.getBlockCountLong();
|
|
||||||
long size = totalBlocks * blockSize;
|
|
||||||
long GB = 1024 * 1024 * 1024;
|
|
||||||
final long[] deviceRomMemoryMap = {2 * GB, 4 * GB, 8 * GB, 16 * GB, 32 * GB, 64 * GB, 128 * GB, 256 * GB, 512 * GB, 1024 * GB, 2048 * GB};
|
|
||||||
String[] displayRomSize = {"2GB", "4GB", "8GB", "16GB", "32GB", "64GB", "128GB", "256GB", "512GB", "1024GB", "2048GB"};
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < deviceRomMemoryMap.length; i++) {
|
|
||||||
if (size <= deviceRomMemoryMap[i]) {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (i == deviceRomMemoryMap.length) {
|
if (ramMemorySize != null) {
|
||||||
i--;
|
totalRam = Math.ceil(java.lang.Float.valueOf(ramMemorySize.toFloat() / (1024 * 1024)).toDouble()).toInt()
|
||||||
}
|
}
|
||||||
|
return totalRam.toString() + ""
|
||||||
|
}
|
||||||
|
val totalRom: String
|
||||||
|
get() {
|
||||||
|
val dataDir = Environment.getDataDirectory()
|
||||||
|
val stat = StatFs(dataDir.path)
|
||||||
|
val blockSize = stat.blockSizeLong
|
||||||
|
val totalBlocks = stat.blockCountLong
|
||||||
|
val size = totalBlocks * blockSize
|
||||||
|
val GB = (1024 * 1024 * 1024).toLong()
|
||||||
|
val deviceRomMemoryMap =
|
||||||
|
longArrayOf(2 * GB, 4 * GB, 8 * GB, 16 * GB, 32 * GB, 64 * GB, 128 * GB, 256 * GB, 512 * GB, 1024 * GB, 2048 * GB)
|
||||||
|
val displayRomSize =
|
||||||
|
arrayOf("2GB", "4GB", "8GB", "16GB", "32GB", "64GB", "128GB", "256GB", "512GB", "1024GB", "2048GB")
|
||||||
|
var i: Int
|
||||||
|
i = 0
|
||||||
|
while (i < deviceRomMemoryMap.size) {
|
||||||
|
if (size <= deviceRomMemoryMap[i]) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (i == deviceRomMemoryMap.size) {
|
||||||
|
i--
|
||||||
|
}
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
return displayRomSize[i].replace("GB", "")
|
||||||
}
|
}
|
||||||
return displayRomSize[i].replace("GB", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sha256加密
|
* sha256加密
|
||||||
|
@ -182,39 +170,36 @@ public class MyUtils {
|
||||||
* @param str 要加密的字符串
|
* @param str 要加密的字符串
|
||||||
* @return 加密后的字符串
|
* @return 加密后的字符串
|
||||||
*/
|
*/
|
||||||
public static String getSha256Str(String str) {
|
fun getSha256Str(str: String): String {
|
||||||
MessageDigest messageDigest;
|
val messageDigest: MessageDigest
|
||||||
String encodeStr = "";
|
var encodeStr = ""
|
||||||
try {
|
try {
|
||||||
messageDigest = MessageDigest.getInstance("SHA-256");
|
messageDigest = MessageDigest.getInstance("SHA-256")
|
||||||
messageDigest.update(str.getBytes(StandardCharsets.UTF_8));
|
messageDigest.update(str.toByteArray(StandardCharsets.UTF_8))
|
||||||
encodeStr = byte2Hex(messageDigest.digest());
|
encodeStr = byte2Hex(messageDigest.digest())
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (e: NoSuchAlgorithmException) {
|
||||||
e.printStackTrace();
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
return encodeStr;
|
return encodeStr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sha256加密 将byte转为16进制
|
* sha256加密 将byte转为16进制
|
||||||
*
|
*
|
||||||
* @param bytes 字节码
|
* @param bytes 字节码
|
||||||
* @return 加密后的字符串
|
* @return 加密后的字符串
|
||||||
*/
|
*/
|
||||||
private static String byte2Hex(byte[] bytes) {
|
private fun byte2Hex(bytes: ByteArray): String {
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
val stringBuilder = StringBuilder()
|
||||||
String temp;
|
var temp: String
|
||||||
for (byte aByte : bytes) {
|
for (aByte in bytes) {
|
||||||
temp = Integer.toHexString(aByte & 0xFF);
|
temp = Integer.toHexString(aByte.toInt() and 0xFF)
|
||||||
if (temp.length() == 1) {
|
if (temp.length == 1) {
|
||||||
//1得到一位的进行补0操作
|
//1得到一位的进行补0操作
|
||||||
stringBuilder.append("0");
|
stringBuilder.append("0")
|
||||||
}
|
}
|
||||||
stringBuilder.append(temp);
|
stringBuilder.append(temp)
|
||||||
}
|
}
|
||||||
return stringBuilder.toString();
|
return stringBuilder.toString()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
|
@ -1,24 +1,18 @@
|
||||||
package com.cmx.hydrology.utils;
|
package com.cmx.hydrology.utils
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.content.Context
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.view.WindowManager;
|
|
||||||
|
|
||||||
public class SpUtils {
|
object SpUtils {
|
||||||
private static final String SP_NAME = "SP_USER_DATA";
|
private const val SP_NAME = "SP_USER_DATA"
|
||||||
|
fun putString(context: Context, key: String?, `val`: String?) {
|
||||||
|
val sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE)
|
||||||
public static void putString(Context context, String key, String val) {
|
val editor = sp.edit()
|
||||||
SharedPreferences sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
|
editor.putString(key, `val`)
|
||||||
SharedPreferences.Editor editor = sp.edit();
|
editor.commit()
|
||||||
editor.putString(key, val);
|
|
||||||
editor.commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getString(Context context, String key) {
|
fun getString(context: Context, key: String?): String? {
|
||||||
SharedPreferences sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
|
val sp = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE)
|
||||||
return sp.getString(key, "");
|
return sp.getString(key, "")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.cmx.hydrology.utils;
|
package com.cmx.hydrology.utils
|
||||||
|
|
||||||
public class StaticFinalData {
|
object StaticFinalData {
|
||||||
public static final String LOGOUT = "LOGOUT";
|
const val LOGOUT = "LOGOUT"
|
||||||
public static final String UPLOAD_FACE = "UPLOAD_FACE";
|
const val UPLOAD_FACE = "UPLOAD_FACE"
|
||||||
public static final String UPLOAD_FACE_OVER = "UPLOAD_FACE_OVER";
|
const val UPLOAD_FACE_OVER = "UPLOAD_FACE_OVER"
|
||||||
public static final String CHANGE_TAB = "CHANGE_TAB";
|
const val CHANGE_TAB = "CHANGE_TAB"
|
||||||
}
|
}
|
Loading…
Reference in New Issue