bug修改,同步
parent
9ee5468010
commit
9c7fd037ad
|
@ -5,16 +5,19 @@ import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.TextUtils
|
import android.text.TextUtils
|
||||||
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.core.app.ActivityCompat
|
import androidx.core.app.ActivityCompat
|
||||||
import com.cmx.wanhui.R
|
import com.cmx.wanhui.R
|
||||||
|
import com.cmx.wanhui.constant.Events
|
||||||
import com.cmx.wanhui.model.LoginBean
|
import com.cmx.wanhui.model.LoginBean
|
||||||
import com.cmx.wanhui.model.LoginRes
|
import com.cmx.wanhui.model.LoginRes
|
||||||
import com.cmx.wanhui.retrofit.RetrofitAPIManager
|
import com.cmx.wanhui.retrofit.RetrofitAPIManager
|
||||||
import com.cmx.wanhui.utils.MyUtils.setAndroidNativeLightStatusBar
|
import com.cmx.wanhui.utils.MyUtils.setAndroidNativeLightStatusBar
|
||||||
import com.cmx.wanhui.utils.MyUtils.setFullscreen
|
import com.cmx.wanhui.utils.MyUtils.setFullscreen
|
||||||
import com.cmx.wanhui.utils.SpUtils.putString
|
import com.cmx.wanhui.utils.SpUtils.putString
|
||||||
|
import com.cmx.wanhui.view.ConfirmDialog
|
||||||
|
import com.lsxiao.apollo.core.Apollo
|
||||||
import es.dmoral.toasty.Toasty
|
import es.dmoral.toasty.Toasty
|
||||||
import kotlinx.android.synthetic.main.activity_login.btn_login
|
import kotlinx.android.synthetic.main.activity_login.btn_login
|
||||||
import kotlinx.android.synthetic.main.activity_login.edt_password
|
import kotlinx.android.synthetic.main.activity_login.edt_password
|
||||||
|
@ -24,9 +27,8 @@ import retrofit2.Callback
|
||||||
import retrofit2.Response
|
import retrofit2.Response
|
||||||
|
|
||||||
class LoginActivity : BaseActivity() {
|
class LoginActivity : BaseActivity() {
|
||||||
private val REQUIRED_PERMISSION_LIST = arrayOf(
|
|
||||||
Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA
|
private val REQUIRED_PERMISSION_LIST = arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA)
|
||||||
)
|
|
||||||
private val REQUEST_PERMISSION_CODE = 99
|
private val REQUEST_PERMISSION_CODE = 99
|
||||||
private var allPermission = true
|
private var allPermission = true
|
||||||
|
|
||||||
|
@ -42,7 +44,6 @@ class LoginActivity : BaseActivity() {
|
||||||
Toasty.info(this, "请输入用户名").show()
|
Toasty.info(this, "请输入用户名").show()
|
||||||
return@OnClickListener
|
return@OnClickListener
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TextUtils.isEmpty(edt_password.text.toString().trim { it <= ' ' })) {
|
if (TextUtils.isEmpty(edt_password.text.toString().trim { it <= ' ' })) {
|
||||||
Toasty.info(this@LoginActivity, "请输入密码").show()
|
Toasty.info(this@LoginActivity, "请输入密码").show()
|
||||||
return@OnClickListener
|
return@OnClickListener
|
||||||
|
@ -94,18 +95,31 @@ class LoginActivity : BaseActivity() {
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
finish()
|
finish()
|
||||||
} else {
|
} else {
|
||||||
Toasty.error(this@LoginActivity, response.body()!!.message!!).show()
|
if (null != response.body() && null != response.body()!!.message) {
|
||||||
|
Toasty.error(this@LoginActivity, response.body()!!.message!!).show()
|
||||||
|
} else {
|
||||||
|
Toasty.error(this@LoginActivity, "登录失败").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()
|
||||||
val intent = Intent(this@LoginActivity, MainActivity::class.java)
|
|
||||||
startActivity(intent)
|
|
||||||
finish()
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
ConfirmDialog(this, object : ConfirmDialog.IBack {
|
||||||
|
override fun confirmBack() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun cancelBack() {
|
||||||
|
}
|
||||||
|
}).show()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,14 +3,16 @@ package com.cmx.wanhui.activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Toast
|
|
||||||
import androidx.annotation.RequiresApi
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import androidx.navigation.Navigation
|
import androidx.navigation.Navigation
|
||||||
import androidx.navigation.ui.NavigationUI
|
import androidx.navigation.ui.NavigationUI
|
||||||
import com.cmx.wanhui.R
|
import com.cmx.wanhui.R
|
||||||
import com.cmx.wanhui.constant.Events
|
import com.cmx.wanhui.constant.Events
|
||||||
|
import com.cmx.wanhui.view.ConfirmDialog
|
||||||
|
import com.cmx.wanhui.view.ConfirmDialog.*
|
||||||
import com.google.zxing.integration.android.IntentIntegrator
|
import com.google.zxing.integration.android.IntentIntegrator
|
||||||
import com.lsxiao.apollo.core.Apollo
|
import com.lsxiao.apollo.core.Apollo
|
||||||
import com.lsxiao.apollo.core.annotations.Receive
|
import com.lsxiao.apollo.core.annotations.Receive
|
||||||
|
@ -25,8 +27,10 @@ class MainActivity : BaseActivity() {
|
||||||
setContentView(R.layout.activity_main)
|
setContentView(R.layout.activity_main)
|
||||||
navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main)
|
navController = Navigation.findNavController(this, R.id.nav_host_fragment_activity_main)
|
||||||
NavigationUI.setupWithNavController(nav_view, navController!!)
|
NavigationUI.setupWithNavController(nav_view, navController!!)
|
||||||
|
nav_view.itemIconTintList = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示tabbar
|
* 显示tabbar
|
||||||
*/
|
*/
|
||||||
|
@ -35,6 +39,7 @@ class MainActivity : BaseActivity() {
|
||||||
nav_view.visibility = View.VISIBLE
|
nav_view.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 隐藏tabbar
|
* 隐藏tabbar
|
||||||
*/
|
*/
|
||||||
|
@ -83,6 +88,7 @@ class MainActivity : BaseActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出登录
|
* 退出登录
|
||||||
*/
|
*/
|
||||||
|
@ -94,6 +100,7 @@ class MainActivity : BaseActivity() {
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 二维码扫描
|
* 二维码扫描
|
||||||
*/
|
*/
|
||||||
|
@ -106,6 +113,7 @@ class MainActivity : BaseActivity() {
|
||||||
integrator.initiateScan()
|
integrator.initiateScan()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 处理扫描结果
|
// 处理扫描结果
|
||||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||||
val result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data)
|
val result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data)
|
||||||
|
@ -114,10 +122,27 @@ class MainActivity : BaseActivity() {
|
||||||
} else { // 扫描成功,处理结果
|
} else { // 扫描成功,处理结果
|
||||||
val scannedData = result.contents
|
val scannedData = result.contents
|
||||||
Apollo.emit(Events.JS_OPEN_SCANQR_BACK, scannedData)
|
Apollo.emit(Events.JS_OPEN_SCANQR_BACK, scannedData)
|
||||||
Toast.makeText(this, "扫描结果: $scannedData", Toast.LENGTH_LONG).show()
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
super.onActivityResult(requestCode, resultCode, data)
|
super.onActivityResult(requestCode, resultCode, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun onBackPressed() {
|
||||||
|
Apollo.emit(Events.JS_OPEN_WEB_BACK)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Receive(Events.JS_OPEN_WEB_BACK_EXIT)
|
||||||
|
fun exitApp() {
|
||||||
|
ConfirmDialog(this, object : IBack {
|
||||||
|
override fun confirmBack() {
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun cancelBack() {
|
||||||
|
}
|
||||||
|
}).show()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -19,6 +19,7 @@ class MyApplication : Application() {
|
||||||
companion object {
|
companion object {
|
||||||
private var mInstance: Context? = null
|
private var mInstance: Context? = null
|
||||||
private var mToken: String? = null
|
private var mToken: String? = null
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun getmInstance(): Context? {
|
fun getmInstance(): Context? {
|
||||||
return mInstance
|
return mInstance
|
||||||
|
|
|
@ -6,8 +6,17 @@ package com.cmx.wanhui.constant
|
||||||
*/
|
*/
|
||||||
interface Events {
|
interface Events {
|
||||||
companion object {
|
companion object {
|
||||||
const val WEB_SERVER_URL = "http://8.222.137.126:80"
|
|
||||||
const val SERVER_URL = "http://192.168.110.174:8000"
|
//const val SERVER_URL = "http://192.168.110.174:8000"
|
||||||
|
//const val WBE_URL = "http://192.168.110.253:5173"
|
||||||
|
|
||||||
|
const val SERVER_URL = "http://120.46.182.114:7777"
|
||||||
|
const val WBE_URL = "http://120.46.182.114:7788"
|
||||||
|
|
||||||
|
|
||||||
|
const val WEB_HOME_URL = WBE_URL
|
||||||
|
const val WEB_MODE_URL = "$WBE_URL/function"
|
||||||
|
const val WEB_MY_URL = "$WBE_URL/my"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tabbar显示
|
* tabbar显示
|
||||||
|
@ -49,7 +58,14 @@ interface Events {
|
||||||
*/
|
*/
|
||||||
const val JS_OPEN_SCANQR_BACK = "js_open_scan_qr_back"
|
const val JS_OPEN_SCANQR_BACK = "js_open_scan_qr_back"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原生返回_发送给web返回
|
||||||
|
*/
|
||||||
|
const val JS_OPEN_WEB_BACK = "js_open_web_back"
|
||||||
|
/**
|
||||||
|
* web无法在返回——退出APP
|
||||||
|
*/
|
||||||
|
const val JS_OPEN_WEB_BACK_EXIT = "js_open_web_back_exit"
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.cmx.wanhui.model
|
||||||
|
|
||||||
|
class QRBean {
|
||||||
|
var msg: String? = null
|
||||||
|
}
|
|
@ -42,7 +42,7 @@ open class BaseFragment : Fragment() {
|
||||||
fun setWebView(webView: WebView) {
|
fun setWebView(webView: WebView) {
|
||||||
val webSettings = webView!!.settings
|
val webSettings = webView!!.settings
|
||||||
webSettings.javaScriptEnabled = true
|
webSettings.javaScriptEnabled = true
|
||||||
webSettings.cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK
|
webSettings.cacheMode = WebSettings.LOAD_NO_CACHE
|
||||||
webSettings.domStorageEnabled = true
|
webSettings.domStorageEnabled = true
|
||||||
webSettings.allowFileAccess = true //文件访问
|
webSettings.allowFileAccess = true //文件访问
|
||||||
webSettings.allowFileAccessFromFileURLs = true
|
webSettings.allowFileAccessFromFileURLs = true
|
||||||
|
|
|
@ -29,10 +29,13 @@ import androidx.lifecycle.ViewModelProvider;
|
||||||
import com.cmx.wanhui.activity.LoginActivity;
|
import com.cmx.wanhui.activity.LoginActivity;
|
||||||
import com.cmx.wanhui.constant.Events;
|
import com.cmx.wanhui.constant.Events;
|
||||||
import com.cmx.wanhui.databinding.FragmentHomeBinding;
|
import com.cmx.wanhui.databinding.FragmentHomeBinding;
|
||||||
|
import com.cmx.wanhui.model.QRBean;
|
||||||
import com.cmx.wanhui.utils.AndroidtoJs;
|
import com.cmx.wanhui.utils.AndroidtoJs;
|
||||||
import com.cmx.wanhui.utils.L;
|
import com.cmx.wanhui.utils.L;
|
||||||
import com.cmx.wanhui.utils.MyUtils;
|
import com.cmx.wanhui.utils.MyUtils;
|
||||||
import com.cmx.wanhui.view.BaseLoadingDialog;
|
import com.cmx.wanhui.view.BaseLoadingDialog;
|
||||||
|
import com.cmx.wanhui.view.ConfirmDialog;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.lsxiao.apollo.core.Apollo;
|
import com.lsxiao.apollo.core.Apollo;
|
||||||
import com.lsxiao.apollo.core.annotations.Receive;
|
import com.lsxiao.apollo.core.annotations.Receive;
|
||||||
import com.lsxiao.apollo.core.contract.ApolloBinder;
|
import com.lsxiao.apollo.core.contract.ApolloBinder;
|
||||||
|
@ -57,18 +60,11 @@ public class HomeFragment extends BaseFragment {
|
||||||
View root = binding.getRoot();
|
View root = binding.getRoot();
|
||||||
mWebView = binding.wvHome;
|
mWebView = binding.wvHome;
|
||||||
setWebView(mWebView);
|
setWebView(mWebView);
|
||||||
mWebView.loadUrl("https://www.baidu.com/");
|
mWebView.loadUrl(Events.WEB_HOME_URL);
|
||||||
mWebView.setWebChromeClient(new PQChromeClient());
|
mWebView.setWebChromeClient(new PQChromeClient());
|
||||||
binding.tvTe.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
Apollo.emit(Events.JS_OPEN_SCANQR);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
@ -187,17 +183,35 @@ public class HomeFragment extends BaseFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 二维码扫描返回
|
* 二维码扫描返回
|
||||||
*/
|
*/
|
||||||
@Receive(Events.JS_OPEN_SCANQR_BACK)
|
@Receive(Events.JS_OPEN_SCANQR_BACK)
|
||||||
public void onQRBack(String msg) {
|
public void onQRBack(String msg) {
|
||||||
String jsString = "javascript:onQRBack(" + msg + ")";
|
QRBean mQRBean = new QRBean();
|
||||||
L.e("JS二维码扫描返回>>>>", jsString);
|
mQRBean.setMsg(msg);
|
||||||
|
String ms = new Gson().toJson(mQRBean);
|
||||||
|
String jsString = "javascript:window.onQRBack(" + ms + ")";
|
||||||
|
L.e("JS二维码扫描返回>>>>", ms + "<<>>" + jsString);
|
||||||
mWebView.evaluateJavascript(jsString, new ValueCallback<String>() {
|
mWebView.evaluateJavascript(jsString, new ValueCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceiveValue(String s) {
|
public void onReceiveValue(String s) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web返回
|
||||||
|
*/
|
||||||
|
@Receive(Events.JS_OPEN_WEB_BACK)
|
||||||
|
public void webBack() {
|
||||||
|
if (mWebView.canGoBack()) {
|
||||||
|
mWebView.goBack();
|
||||||
|
} else {
|
||||||
|
Apollo.emit(Events.JS_OPEN_WEB_BACK_EXIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -26,10 +26,12 @@ import androidx.fragment.app.Fragment;
|
||||||
|
|
||||||
import com.cmx.wanhui.constant.Events;
|
import com.cmx.wanhui.constant.Events;
|
||||||
import com.cmx.wanhui.databinding.FragmentDashboardBinding;
|
import com.cmx.wanhui.databinding.FragmentDashboardBinding;
|
||||||
|
import com.cmx.wanhui.model.QRBean;
|
||||||
import com.cmx.wanhui.utils.AndroidtoJs;
|
import com.cmx.wanhui.utils.AndroidtoJs;
|
||||||
import com.cmx.wanhui.utils.L;
|
import com.cmx.wanhui.utils.L;
|
||||||
import com.cmx.wanhui.utils.MyUtils;
|
import com.cmx.wanhui.utils.MyUtils;
|
||||||
import com.cmx.wanhui.view.BaseLoadingDialog;
|
import com.cmx.wanhui.view.BaseLoadingDialog;
|
||||||
|
import com.google.gson.Gson;
|
||||||
import com.lsxiao.apollo.core.Apollo;
|
import com.lsxiao.apollo.core.Apollo;
|
||||||
import com.lsxiao.apollo.core.annotations.Receive;
|
import com.lsxiao.apollo.core.annotations.Receive;
|
||||||
import com.lsxiao.apollo.core.contract.ApolloBinder;
|
import com.lsxiao.apollo.core.contract.ApolloBinder;
|
||||||
|
@ -47,12 +49,13 @@ public class ModeFragment extends BaseFragment {
|
||||||
private long size = 0;
|
private long size = 0;
|
||||||
private static final int INPUT_FILE_REQUEST_CODE = 1;
|
private static final int INPUT_FILE_REQUEST_CODE = 1;
|
||||||
|
|
||||||
|
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
binding = FragmentDashboardBinding.inflate(inflater, container, false);
|
binding = FragmentDashboardBinding.inflate(inflater, container, false);
|
||||||
View root = binding.getRoot();
|
View root = binding.getRoot();
|
||||||
mWebView = binding.wvLoan;
|
mWebView = binding.wvLoan;
|
||||||
setWebView(mWebView);
|
setWebView(mWebView);
|
||||||
mWebView.loadUrl("https://www.baidu.com/");
|
mWebView.loadUrl(Events.WEB_MODE_URL);
|
||||||
mWebView.setWebChromeClient(new PQChromeClient());
|
mWebView.setWebChromeClient(new PQChromeClient());
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
@ -176,12 +179,27 @@ public class ModeFragment extends BaseFragment {
|
||||||
*/
|
*/
|
||||||
@Receive(Events.JS_OPEN_SCANQR_BACK)
|
@Receive(Events.JS_OPEN_SCANQR_BACK)
|
||||||
public void onQRBack(String msg) {
|
public void onQRBack(String msg) {
|
||||||
String jsString = "javascript:onQRBack(" + msg + ")";
|
QRBean mQRBean = new QRBean();
|
||||||
L.e("JS二维码扫描返回>>>>", jsString);
|
mQRBean.setMsg(msg);
|
||||||
|
String ms = new Gson().toJson(mQRBean);
|
||||||
|
String jsString = "javascript:window.onQRBack(" + ms + ")";
|
||||||
|
L.e("JS二维码扫描返回>>>>", ms + "<<>>" + jsString);
|
||||||
mWebView.evaluateJavascript(jsString, new ValueCallback<String>() {
|
mWebView.evaluateJavascript(jsString, new ValueCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onReceiveValue(String s) {
|
public void onReceiveValue(String s) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web返回
|
||||||
|
*/
|
||||||
|
@Receive(Events.JS_OPEN_WEB_BACK)
|
||||||
|
public void webBack() {
|
||||||
|
if (mWebView.canGoBack()) {
|
||||||
|
mWebView.goBack();
|
||||||
|
} else {
|
||||||
|
Apollo.emit(Events.JS_OPEN_WEB_BACK_EXIT);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,20 +1,22 @@
|
||||||
package com.cmx.wanhui.ui
|
package com.cmx.wanhui.ui
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.webkit.ValueCallback
|
||||||
import com.cmx.wanhui.R
|
import com.cmx.wanhui.R
|
||||||
import com.cmx.wanhui.constant.Events
|
import com.cmx.wanhui.constant.Events
|
||||||
import com.cmx.wanhui.utils.L
|
import com.cmx.wanhui.model.QRBean
|
||||||
|
import com.cmx.wanhui.utils.L.Companion.e
|
||||||
|
import com.google.gson.Gson
|
||||||
import com.lsxiao.apollo.core.Apollo
|
import com.lsxiao.apollo.core.Apollo
|
||||||
import com.lsxiao.apollo.core.annotations.Receive
|
import com.lsxiao.apollo.core.annotations.Receive
|
||||||
import kotlinx.android.synthetic.main.fragment_home.tv_te
|
|
||||||
import kotlinx.android.synthetic.main.fragment_notifications.wv_mine
|
import kotlinx.android.synthetic.main.fragment_notifications.wv_mine
|
||||||
|
|
||||||
class PersonalFragment : BaseFragment() {
|
class PersonalFragment : BaseFragment() {
|
||||||
|
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
return inflater.inflate(R.layout.fragment_notifications, container, false)
|
return inflater.inflate(R.layout.fragment_notifications, container, false)
|
||||||
}
|
}
|
||||||
|
@ -22,7 +24,7 @@ class PersonalFragment : BaseFragment() {
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
setWebView(wv_mine!!)
|
setWebView(wv_mine!!)
|
||||||
wv_mine!!.loadUrl("https://www.baidu.com/")//SERVER_URL
|
wv_mine!!.loadUrl(Events.WEB_MY_URL)
|
||||||
//wv_mine!!.webChromeClient = PQChromeClient()
|
//wv_mine!!.webChromeClient = PQChromeClient()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,8 +34,23 @@ class PersonalFragment : BaseFragment() {
|
||||||
*/
|
*/
|
||||||
@Receive(Events.JS_OPEN_SCANQR_BACK)
|
@Receive(Events.JS_OPEN_SCANQR_BACK)
|
||||||
fun onQRBack(msg: String) {
|
fun onQRBack(msg: String) {
|
||||||
val jsString = "javascript:onQRBack($msg)"
|
val mQRBean = QRBean()
|
||||||
L.e("JS二维码扫描返回>>>>", jsString)
|
mQRBean.msg = msg
|
||||||
wv_mine!!.evaluateJavascript(jsString) { }
|
val ms = Gson().toJson(mQRBean)
|
||||||
|
val jsString = "javascript:window.onQRBack($ms)"
|
||||||
|
e("JS二维码扫描返回>>>>", "$ms<<>>$jsString")
|
||||||
|
wv_mine!!.evaluateJavascript(jsString, ValueCallback<String?> { })
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web返回
|
||||||
|
*/
|
||||||
|
@Receive(Events.JS_OPEN_WEB_BACK)
|
||||||
|
fun webBack() {
|
||||||
|
if (wv_mine!!.canGoBack()) {
|
||||||
|
wv_mine!!.goBack()
|
||||||
|
} else {
|
||||||
|
Apollo.emit(Events.JS_OPEN_WEB_BACK_EXIT)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.cmx.wanhui.view;
|
||||||
|
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.cmx.wanhui.R;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认弹窗
|
||||||
|
*/
|
||||||
|
public class ConfirmDialog extends Dialog {
|
||||||
|
|
||||||
|
private TextView mConfirm;
|
||||||
|
private TextView mCancel;
|
||||||
|
private IBack mIBack;
|
||||||
|
|
||||||
|
|
||||||
|
public ConfirmDialog(Context context, IBack mIBack) {
|
||||||
|
super(context, R.style.CustomDialog);
|
||||||
|
this.mIBack = mIBack;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.dialog_confirm_all);
|
||||||
|
setCancelable(false);
|
||||||
|
setCanceledOnTouchOutside(false);
|
||||||
|
mConfirm = findViewById(R.id.con_con);
|
||||||
|
mCancel = findViewById(R.id.con_cancel);
|
||||||
|
mConfirm.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
mIBack.confirmBack();
|
||||||
|
dismiss();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
mCancel.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
mIBack.cancelBack();
|
||||||
|
dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IBack {
|
||||||
|
void confirmBack();
|
||||||
|
|
||||||
|
void cancelBack();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,9 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M3,13h8L11,3L3,3v10zM3,21h8v-6L3,15v6zM13,21h8L21,11h-8v10zM13,3v6h8L21,3h-8z" />
|
|
||||||
</vector>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z" />
|
|
||||||
</vector>
|
|
|
@ -1,9 +0,0 @@
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.89,2 2,2zM18,16v-5c0,-3.07 -1.64,-5.64 -4.5,-6.32L13.5,4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.63,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z" />
|
|
||||||
</vector>
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@mipmap/icon_home_on" android:state_checked="true" />
|
||||||
|
<item android:drawable="@mipmap/icon_home_off" android:state_checked="false" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@mipmap/icon_mode_on" android:state_checked="true" />
|
||||||
|
<item android:drawable="@mipmap/icon_mode_off" android:state_checked="false" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:drawable="@mipmap/icon_my_on" android:state_checked="true" />
|
||||||
|
<item android:drawable="@mipmap/icon_my_off" android:state_checked="false" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:color="@color/black" android:state_checked="false" />
|
||||||
|
<item android:color="#284891" android:state_checked="true" />
|
||||||
|
</selector>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!--边框颜色-->
|
||||||
|
<corners android:radius="5dp" />
|
||||||
|
|
||||||
|
<stroke
|
||||||
|
android:width="1dp"
|
||||||
|
android:color="@color/white" />
|
||||||
|
|
||||||
|
<solid android:color="@color/white" />
|
||||||
|
</shape>
|
|
@ -33,10 +33,11 @@
|
||||||
android:hint="请输入用户名"
|
android:hint="请输入用户名"
|
||||||
android:paddingStart="10dip"
|
android:paddingStart="10dip"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:text="15102353035"
|
android:text="wanhui"
|
||||||
android:textColorHint="#919191"
|
android:textColorHint="#919191"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
<!-- wanhui-->
|
||||||
|
<!-- 15102353035-->
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/edt_password"
|
android:id="@+id/edt_password"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -55,7 +56,6 @@
|
||||||
android:textColorHint="#919191"
|
android:textColorHint="#919191"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
android:layout_marginStart="0dp"
|
android:layout_marginStart="0dp"
|
||||||
android:layout_marginEnd="0dp"
|
android:layout_marginEnd="0dp"
|
||||||
android:background="?android:attr/windowBackground"
|
android:background="?android:attr/windowBackground"
|
||||||
|
app:itemTextColor="@drawable/sel_tab_col"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/shape_eh_line"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:paddingLeft="40dp"
|
||||||
|
android:paddingRight="40dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:padding="20dp"
|
||||||
|
android:text="提示"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="22sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_msg"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="确认退出软件?"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="38dp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="20dp"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/con_con"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@drawable/shape_eh_line"
|
||||||
|
android:backgroundTint="@color/base_col"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:text="确 认"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/con_cancel"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginLeft="50dp"
|
||||||
|
android:background="@drawable/shape_eh_line"
|
||||||
|
android:backgroundTint="#999999"
|
||||||
|
android:gravity="center"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:text="取 消"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
|
@ -4,14 +4,6 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_te"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
|
||||||
android:text="首页"
|
|
||||||
android:textSize="30sp" />
|
|
||||||
|
|
||||||
<WebView
|
<WebView
|
||||||
android:id="@+id/wv_home"
|
android:id="@+id/wv_home"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -3,17 +3,17 @@
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/navigation_home"
|
android:id="@+id/navigation_home"
|
||||||
android:icon="@drawable/ic_home_black_24dp"
|
android:icon="@drawable/sel_home"
|
||||||
android:title="首页" />
|
android:title="首页" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/navigation_dashboard"
|
android:id="@+id/navigation_dashboard"
|
||||||
android:icon="@drawable/ic_dashboard_black_24dp"
|
android:icon="@drawable/sel_mode"
|
||||||
android:title="功能" />
|
android:title="功能" />
|
||||||
|
|
||||||
<item
|
<item
|
||||||
android:id="@+id/navigation_notifications"
|
android:id="@+id/navigation_notifications"
|
||||||
android:icon="@drawable/ic_notifications_black_24dp"
|
android:icon="@drawable/sel_my"
|
||||||
android:title="我的" />
|
android:title="我的" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
|
@ -1,8 +1,8 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">万汇</string>
|
<string name="app_name">万汇</string>
|
||||||
<string name="title_home">Home</string>
|
<string name="title_home">首页</string>
|
||||||
<string name="title_dashboard">Loan</string>
|
<string name="title_dashboard">功能</string>
|
||||||
<string name="title_notifications">Mine</string>
|
<string name="title_notifications">我的</string>
|
||||||
<string name="title_activity_login">Login</string>
|
<string name="title_activity_login">Login</string>
|
||||||
<string name="prompt_email">Email</string>
|
<string name="prompt_email">Email</string>
|
||||||
<string name="prompt_password">Password</string>
|
<string name="prompt_password">Password</string>
|
||||||
|
|
Loading…
Reference in New Issue