我的 头像加载增加ssh认证

master
hwf453 9 months ago
parent f2741a07f3
commit 07fbc6202a

@ -439,10 +439,6 @@
<activity <activity
android:name=".ui.activity.AxwaqgcglActivity" android:name=".ui.activity.AxwaqgcglActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity
android:name=".ui.activity.QrCodeActivity"
android:exported="false"
android:screenOrientation="portrait" />
<activity <activity
android:name=".ui.activity.QrCodeNewActivity" android:name=".ui.activity.QrCodeNewActivity"
android:exported="false" android:exported="false"

Before

Width:  |  Height:  |  Size: 479 KiB

After

Width:  |  Height:  |  Size: 479 KiB

@ -203,7 +203,7 @@ public class ActivityMZDH extends BaseActivity {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(ActivityMZDH.this, QrCodeActivity.class); Intent intent = new Intent(ActivityMZDH.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -392,7 +392,7 @@ public class ActivitySHYK extends BaseActivity {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(ActivitySHYK.this, QrCodeActivity.class); Intent intent = new Intent(ActivitySHYK.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -303,7 +303,7 @@ public class AjhGzActivity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(AjhGzActivity.this, QrCodeActivity.class); Intent intent = new Intent(AjhGzActivity.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -363,7 +363,7 @@ public class AxwaqgcglActivity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(AxwaqgcglActivity.this, QrCodeActivity.class); Intent intent = new Intent(AxwaqgcglActivity.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -120,13 +120,13 @@ class HjpdActivity : BaseActivityOaToolbarViewBinding<ActivityHjpdBinding>(),
} }
private fun intentTOQRCode() { private fun intentTOQRCode() {
val intentMHJ = Intent(this, QrCodeActivity::class.java) val intentMHJ = Intent(this, QrCodeNewActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
launcherResultMHJ.launch(intentMHJ) launcherResultMHJ.launch(intentMHJ)
} }
private fun intentTOQRCodeOne() { private fun intentTOQRCodeOne() {
val intentZHJ = Intent(this, QrCodeActivity::class.java) val intentZHJ = Intent(this, QrCodeNewActivity::class.java)
intentZHJ.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) intentZHJ.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
launcherResultZHJ.launch(intentZHJ) launcherResultZHJ.launch(intentZHJ)
} }

@ -190,14 +190,14 @@ public class KccxActivity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(KccxActivity.this, QrCodeActivity.class); Intent intent = new Intent(KccxActivity.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
//startActivity(intent); //startActivity(intent);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }
private void intentTOQRCodeOne(){ private void intentTOQRCodeOne(){
Intent intent = new Intent(KccxActivity.this, QrCodeActivity.class); Intent intent = new Intent(KccxActivity.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
//startActivity(intent); //startActivity(intent);
launcherResultQRCodeOne.launch(intent); launcherResultQRCodeOne.launch(intent);

@ -230,14 +230,14 @@ public class KcpdActivity extends BaseActivity2 implements KcpdAdapter.Callback
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(context, QrCodeActivity.class); Intent intent = new Intent(context, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
//startActivity(intent); //startActivity(intent);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }
private void intentTOQRCodeOne(){ private void intentTOQRCodeOne(){
Intent intent = new Intent(context, QrCodeActivity.class); Intent intent = new Intent(context, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
//startActivity(intent); //startActivity(intent);
launcherResultQRCodeOne.launch(intent); launcherResultQRCodeOne.launch(intent);

@ -174,8 +174,8 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
if (isApkInDebug(context)) { if (isApkInDebug(context)) {
// 管理员 // 管理员
// binding.etUsername.setText("ZHPS_Admin") binding.etUsername.setText("ZHPS_Admin")
// binding.etPassword.setText("Rehome.zhps@996") binding.etPassword.setText("Rehome.zhps@996")
//公司内网215管理员 //公司内网215管理员
// binding.etUsername.setText("ZHPS_Admin") // binding.etUsername.setText("ZHPS_Admin")
@ -359,7 +359,10 @@ class LoginActivity : BaseActivityOaToolbarViewBinding<ActivityLoginBinding>() {
if (bean != null) { if (bean != null) {
val userInfo = bean.rows[0] val userInfo = bean.rows[0]
if (userInfo.statusMsg == "success") { //登录成功 if (userInfo.statusMsg == "success") {
showLog("--------userHeadUrl----------")
showLog(userInfo.userHeadUrl)
//登录成功
val usernameLogin: String = binding.etUsername.text.toString().trim() val usernameLogin: String = binding.etUsername.text.toString().trim()
if (userInfo.manid != null && usernameLogin != null && userInfo.manid.equals( if (userInfo.manid != null && usernameLogin != null && userInfo.manid.equals(
usernameLogin usernameLogin

@ -1,185 +0,0 @@
package com.rehome.zhdcoa.ui.activity
import android.Manifest
import android.annotation.SuppressLint
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.Rect
import android.graphics.RectF
import android.os.Bundle
import android.view.View
import android.widget.Toast
import androidx.camera.core.ImageCapture
import androidx.camera.view.LifecycleCameraController
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import com.rehome.zhdcoa.databinding.ActivityQrCodeBinding
import com.rehome.zhdcoa.Listener.QRCodeAnalyser
import com.rehome.zhdcoa.base.BaseActivityOaToolbarViewBinding
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
/**
* date:2025/02/13 10:05:28
* author:HuangWenfei
* description:二维码扫描
*/
class QrCodeActivity : BaseActivityOaToolbarViewBinding<ActivityQrCodeBinding>() {
private lateinit var lifecycleCameraController: LifecycleCameraController
private lateinit var cameraExecutor: ExecutorService
private val CAMERA_REQUEST_CAMERA_SCAN: Int = 88 //请求码
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// binding = ActivityQrCodeBinding.inflate(layoutInflater)
// setContentView(binding.root)
// initController()
// }
override fun getViewBinding() = ActivityQrCodeBinding.inflate(layoutInflater)
override fun getToolbar()= binding.toolbarView.toolbar
override fun initView() {
initToolbar("二维码/条码扫描")
setLeftOnClickListener { finish() }
checkPermission()
//initController()
}
override fun initData() {
}
private fun checkPermission(){
//检测摄像头权限
if (!context.packageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY)) {
binding.frCamera.visibility=View.GONE
Toast.makeText(
context,
"权限拒绝,请手动设置开启APP访问摄像头权限",
Toast.LENGTH_LONG
).show()
return
}
//动态权限申请
if (ContextCompat.checkSelfPermission(
context,
Manifest.permission.CAMERA
) != PackageManager.PERMISSION_GRANTED
) {
binding.frCamera.visibility=View.GONE
//权限请求
ActivityCompat.requestPermissions(
this,
arrayOf<String>(Manifest.permission.CAMERA),
CAMERA_REQUEST_CAMERA_SCAN
)
} else {
//已授权,打开摄像头扫描
initController()
}
}
override fun onRequestPermissionsResult(
requestCode: Int,
permissions: Array<String>,
grantResults: IntArray
) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
if (CAMERA_REQUEST_CAMERA_SCAN == requestCode) {
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
binding.frCamera.visibility=View.VISIBLE
//已授权,打开摄像头扫描
initController()
} else {
binding.frCamera.visibility=View.GONE
//权限拒绝
Toast.makeText(
this,
"权限拒绝,请手动设置开启APP访问摄像头权限",
Toast.LENGTH_SHORT
).show()
}
}
}
@SuppressLint("ClickableViewAccessibility", "UnsafeOptInUsageError")
private fun initController() {
cameraExecutor = Executors.newSingleThreadExecutor()
lifecycleCameraController = LifecycleCameraController(this)
lifecycleCameraController.bindToLifecycle(this)
lifecycleCameraController.imageCaptureFlashMode = ImageCapture.FLASH_MODE_AUTO
lifecycleCameraController.setImageAnalysisAnalyzer(
cameraExecutor,
QRCodeAnalyser { barcodes, imageWidth, imageHeight ->
if (barcodes.isEmpty()) {
return@QRCodeAnalyser
}
initScale(imageWidth, imageHeight)
val list = ArrayList<RectF>()
val strList = ArrayList<String>()
barcodes.forEach { barcode ->
barcode.boundingBox?.let { rect ->
val translateRect = translateRect(rect)
list.add(translateRect)
// Log.e(
// "ztzt", "left${translateRect.left} +" +
// " top${translateRect.top} + right${translateRect.right}" +
// " + bottom${translateRect.bottom}"
// )
// Log.e("ztzt", "barcode.rawValue${barcode.rawValue}")
strList.add(barcode.rawValue ?: "No Value")
}
}
judgeIntent(strList)
binding.scanView.setRectList(list)
})
binding.previewView.controller = lifecycleCameraController
}
private fun judgeIntent(list: ArrayList<String>) {
val sb = StringBuilder()
list.forEach {
sb.append(it)
//sb.append("\n")
}
intentToResult(sb.toString().trim())
}
private fun intentToResult(result: String) {
val resultIntent = Intent()
val bundle = Bundle()
bundle.putString("code", result)
resultIntent.putExtras(bundle)
setResult(RESULT_OK, resultIntent)
finish();
}
private var scaleX = 0f
private var scaleY = 0f
private fun translateX(x: Float): Float = x * scaleX
private fun translateY(y: Float): Float = y * scaleY
//将扫描的矩形换算为当前屏幕大小
private fun translateRect(rect: Rect) = RectF(
translateX(rect.left.toFloat()),
translateY(rect.top.toFloat()),
translateX(rect.right.toFloat()),
translateY(rect.bottom.toFloat())
)
//初始化缩放比例
private fun initScale(imageWidth: Int, imageHeight: Int) {
//Log.e("ztzt", "imageWidth${imageWidth} + imageHeight${imageHeight}")
scaleY = binding.scanView.height.toFloat() / imageWidth.toFloat()
scaleX = binding.scanView.width.toFloat() / imageHeight.toFloat()
//Log.e("ztzt", "scaleX${scaleX} + scaleY${scaleY}")
}
}

@ -120,13 +120,13 @@ class RealTimeKcpdHistoryActivity : BaseActivityOaToolbarViewBinding<ActivityRea
} }
private fun intentTOQRCode() { private fun intentTOQRCode() {
val intentMHJ = Intent(this, QrCodeActivity::class.java) val intentMHJ = Intent(this, QrCodeNewActivity::class.java)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
launcherResultMHJ.launch(intentMHJ) launcherResultMHJ.launch(intentMHJ)
} }
private fun intentTOQRCodeOne() { private fun intentTOQRCodeOne() {
val intentZHJ = Intent(this, QrCodeActivity::class.java) val intentZHJ = Intent(this, QrCodeNewActivity::class.java)
intentZHJ.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP) intentZHJ.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
launcherResultZHJ.launch(intentZHJ) launcherResultZHJ.launch(intentZHJ)
} }

@ -240,7 +240,7 @@ public class Sajhlv2Fragment extends BaseFragment {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(requireActivity(), QrCodeActivity.class); Intent intent = new Intent(requireActivity(), QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -352,7 +352,7 @@ public class SdjgzActivity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(SdjgzActivity.this, QrCodeActivity.class); Intent intent = new Intent(SdjgzActivity.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -2008,7 +2008,7 @@ public class WztpScActivity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(WztpScActivity.this, QrCodeActivity.class); Intent intent = new Intent(WztpScActivity.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -241,7 +241,7 @@ public class Xbaxg2Activity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(Xbaxg2Activity.this, QrCodeActivity.class); Intent intent = new Intent(Xbaxg2Activity.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -207,7 +207,7 @@ public class XlyxcActivity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(XlyxcActivity.this, QrCodeActivity.class); Intent intent = new Intent(XlyxcActivity.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -200,7 +200,7 @@ public class XscbqyActivity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(context, QrCodeActivity.class); Intent intent = new Intent(context, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -115,7 +115,7 @@ public class XxfxcActivity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(XxfxcActivity.this, QrCodeActivity.class); Intent intent = new Intent(XxfxcActivity.this, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -250,7 +250,7 @@ public class YhpclrActivity extends BaseActivity2 {
} }
private void intentTOQRCode(){ private void intentTOQRCode(){
Intent intent = new Intent(context, QrCodeActivity.class); Intent intent = new Intent(context, QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }

@ -11,6 +11,8 @@ import android.content.pm.PackageManager;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Color; import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
@ -65,13 +67,20 @@ import com.rehome.zhdcoa.ui.activity.LoginActivity;
import com.rehome.zhdcoa.ui.activity.MyAdviceActivity; import com.rehome.zhdcoa.ui.activity.MyAdviceActivity;
import com.rehome.zhdcoa.ui.activity.MyOrderActivity; import com.rehome.zhdcoa.ui.activity.MyOrderActivity;
import com.rehome.zhdcoa.ui.activity.OtherCountMeActivity; import com.rehome.zhdcoa.ui.activity.OtherCountMeActivity;
import com.rehome.zhdcoa.ui.activity.QrCodeActivity; import com.rehome.zhdcoa.ui.activity.QrCodeNewActivity;
import com.rehome.zhdcoa.ui.activity.SqActivity; import com.rehome.zhdcoa.ui.activity.SqActivity;
import com.rehome.zhdcoa.ui.activity.UpdatePwdActivity; import com.rehome.zhdcoa.ui.activity.UpdatePwdActivity;
import com.rehome.zhdcoa.utils.HttpUtils; import com.rehome.zhdcoa.utils.HttpUtils;
import com.rehome.zhdcoa.utils.NohttpUtils;
import com.rehome.zhdcoa.utils.XToastUtils; import com.rehome.zhdcoa.utils.XToastUtils;
import com.rehome.zhdcoa.weiget.AuditDialog; import com.rehome.zhdcoa.weiget.AuditDialog;
import com.rehome.zhdcoa.weiget.ListDialog; import com.rehome.zhdcoa.weiget.ListDialog;
import com.yolanda.nohttp.NoHttp;
import com.yolanda.nohttp.rest.CacheMode;
import com.yolanda.nohttp.rest.OnResponseListener;
import com.yolanda.nohttp.rest.Request;
import com.yolanda.nohttp.rest.RequestQueue;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -79,6 +88,11 @@ import java.io.OutputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocketFactory;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
import de.hdodenhof.circleimageview.CircleImageView; import de.hdodenhof.circleimageview.CircleImageView;
import okhttp3.MediaType; import okhttp3.MediaType;
@ -96,6 +110,7 @@ public class MineFragment extends BaseLazyFragment {
private static final int ALBUM = 1; private static final int ALBUM = 1;
private static final int CROP = 2; private static final int CROP = 2;
public static final int UPDATE_HEAD_PHOTO = 100; public static final int UPDATE_HEAD_PHOTO = 100;
private RequestQueue queue;
private ActivityResultLauncher<Intent> launcherResultEmoji; private ActivityResultLauncher<Intent> launcherResultEmoji;
@ -168,6 +183,7 @@ public class MineFragment extends BaseLazyFragment {
findView(); findView();
queue = NoHttp.newRequestQueue(1);
array.add("\uD83D\uDE00"); array.add("\uD83D\uDE00");
array.add("😃"); array.add("😃");
array.add("😄"); array.add("😄");
@ -395,8 +411,8 @@ public class MineFragment extends BaseLazyFragment {
}); });
} }
private void intentTOQRCode(){ private void intentTOQRCode() {
Intent intent = new Intent(getActivity(), QrCodeActivity.class); Intent intent = new Intent(getActivity(), QrCodeNewActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
launcherResultQRCode.launch(intent); launcherResultQRCode.launch(intent);
} }
@ -408,7 +424,7 @@ public class MineFragment extends BaseLazyFragment {
clearImageDiskCache(getActivity()); clearImageDiskCache(getActivity());
loadImage(); loadImage();
if(App.getInstance().getUserInfo()!=null&&App.getInstance().getUserInfo().getManid()!=null){ if (App.getInstance().getUserInfo() != null && App.getInstance().getUserInfo().getManid() != null) {
if (App.getInstance().getUserInfo().getManid().equals("310569") || App.getInstance().getUserInfo().getManid().equals("ZHPS_Admin") || App.getInstance().getUserInfo().getManid().equals("310674")) { if (App.getInstance().getUserInfo().getManid().equals("310569") || App.getInstance().getUserInfo().getManid().equals("ZHPS_Admin") || App.getInstance().getUserInfo().getManid().equals("310674")) {
tvSq.setVisibility(View.VISIBLE); tvSq.setVisibility(View.VISIBLE);
} else { } else {
@ -472,7 +488,7 @@ public class MineFragment extends BaseLazyFragment {
int resultCode = result.getResultCode(); int resultCode = result.getResultCode();
Intent data = result.getData(); Intent data = result.getData();
if (resultCode == RESULT_OK) { if (resultCode == RESULT_OK) {
if(data!=null){ if (data != null) {
String code = data.getStringExtra("code"); String code = data.getStringExtra("code");
showToast(code); showToast(code);
} }
@ -510,12 +526,74 @@ public class MineFragment extends BaseLazyFragment {
} }
public void loadImage() { public void loadImage() {
showLog("---------App.getInstance().getUserInfo().getUserHeadUrl()---------");
showLog(App.getInstance().getUserInfo().getUserHeadUrl());
if (!TextUtils.isEmpty(App.getInstance().getUserInfo().getUserHeadUrl())) { if (!TextUtils.isEmpty(App.getInstance().getUserInfo().getUserHeadUrl())) {
Glide.with(requireContext()) String fullPath = Contans.BASE_URL + App.getInstance().getUserInfo().getUserHeadUrl();
.load(Contans.BASE_URL + App.getInstance().getUserInfo().getUserHeadUrl()) showLog(fullPath);
.dontAnimate() Request<Bitmap> request = NoHttp.createImageRequest(fullPath);
.placeholder(R.drawable.head_photo) request.setCacheMode(CacheMode.NONE_CACHE_REQUEST_NETWORK);
.into(civHead);
if (Contans.BASE_URL_AI_3D_SERVER.equals(Contans.BASE_URL_AI_3D_SERVER_EXTRANET)) {
SSLSocketFactory socketFactory = NohttpUtils.getSSLSocketFactory(context);
if (socketFactory != null) {
request.setSSLSocketFactory(socketFactory);
request.setHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
});
}
}
if (!TextUtils.isEmpty(request.url())) {
String url = request.url();
if (url.startsWith("https://219.131.195.3:7100") || url.startsWith("https://219.131.195.3:7011") || url.startsWith("https://219.131.195.3:7081") || url.startsWith("https://219.131.195.3:7082")) {
SSLSocketFactory socketFactory = NohttpUtils.getSSLSocketFactory(context);
if (socketFactory != null) {
request.setSSLSocketFactory(socketFactory);
request.setHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String s, SSLSession sslSession) {
return true;
}
});
}
}
}
queue.add(8, request, new OnResponseListener<>() {
@Override
public void onStart(int what) {
}
@Override
public void onSucceed(int what, com.yolanda.nohttp.rest.Response<Bitmap> response) {
Bitmap bitmap = response.get();
Drawable drawable = new BitmapDrawable(context.getResources(), bitmap);
civHead.setImageDrawable(drawable);
}
@Override
public void onFailed(int what, com.yolanda.nohttp.rest.Response<Bitmap> response) {
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.head_photo);
Drawable drawable = new BitmapDrawable(context.getResources(), bitmap);
civHead.setImageDrawable(drawable);
}
@Override
public void onFinish(int what) {
}
});
// Glide.with(requireContext())
// .load(Contans.BASE_URL + App.getInstance().getUserInfo().getUserHeadUrl())
// .dontAnimate()
// .placeholder(R.drawable.head_photo)
// .into(civHead);
} }
} }
@ -540,7 +618,6 @@ public class MineFragment extends BaseLazyFragment {
} }
private void SQApp() { private void SQApp() {
Intent intent = new Intent(getActivity(), SqActivity.class); Intent intent = new Intent(getActivity(), SqActivity.class);
startActivity(intent); startActivity(intent);
@ -569,7 +646,7 @@ public class MineFragment extends BaseLazyFragment {
} }
if (!appVersionName.equals(getVersionName())) { if (!appVersionName.equals(getVersionName())) {
downloadAndInstall(appURL, appVersionName, appDesc, android_versioncode); downloadAndInstall(appURL, appVersionName, appDesc, android_versioncode);
}else{ } else {
showToast("当前已是最新版本!"); showToast("当前已是最新版本!");
} }
} }
@ -713,14 +790,14 @@ public class MineFragment extends BaseLazyFragment {
public void onSuccess(Call<AboutMeBean> call, Response<AboutMeBean> response) { public void onSuccess(Call<AboutMeBean> call, Response<AboutMeBean> response) {
AboutMeBean bean = response.body(); AboutMeBean bean = response.body();
if (bean != null) { if (bean != null) {
if (bean.getTotal()!=null&&(!bean.getTotal().equals("0"))) { if (bean.getTotal() != null && (!bean.getTotal().equals("0"))) {
if(bean.getRows()!=null&&bean.getRows().size()>0){ if (bean.getRows() != null && bean.getRows().size() > 0) {
List<AboutMeBean.RowsBean> rowsBeanList = bean.getRows(); List<AboutMeBean.RowsBean> rowsBeanList = bean.getRows();
for (AboutMeBean.RowsBean rowsBean : rowsBeanList) { for (AboutMeBean.RowsBean rowsBean : rowsBeanList) {
if(rowsBean.getAboutme()!=null){ if (rowsBean.getAboutme() != null) {
if ("3".equals(rowsBean.getAboutme())) { if ("3".equals(rowsBean.getAboutme())) {
if(rowsBean.getCountnum()!=null){ if (rowsBean.getCountnum() != null) {
if(tvAuditNum!=null){ if (tvAuditNum != null) {
if (!rowsBean.getCountnum().equals("0")) { if (!rowsBean.getCountnum().equals("0")) {
tvAuditNum.setVisibility(View.VISIBLE); tvAuditNum.setVisibility(View.VISIBLE);
tvAuditNum.setText(rowsBean.getCountnum()); tvAuditNum.setText(rowsBean.getCountnum());
@ -792,7 +869,7 @@ public class MineFragment extends BaseLazyFragment {
if (sdCardExist) { if (sdCardExist) {
//android 10 以上 //android 10 以上
if (requireActivity().getExternalFilesDir(null) != null) { if (requireActivity().getExternalFilesDir(null) != null) {
String pathSd = Objects.requireNonNull(requireActivity().getExternalFilesDir(null)).getPath() + "/Radio" ; String pathSd = Objects.requireNonNull(requireActivity().getExternalFilesDir(null)).getPath() + "/Radio";
deleteDirectory(pathSd); deleteDirectory(pathSd);
} else { } else {
String pathSd = requireActivity().getFilesDir().getPath() + "/Radio"; String pathSd = requireActivity().getFilesDir().getPath() + "/Radio";
@ -875,6 +952,7 @@ public class MineFragment extends BaseLazyFragment {
/** /**
* *
*
* @throws IOException * @throws IOException
*/ */
private void cropFromTake() throws IOException { private void cropFromTake() throws IOException {
@ -912,7 +990,7 @@ public class MineFragment extends BaseLazyFragment {
.setSandboxFileEngine(new UriToFileTransformEngine() { .setSandboxFileEngine(new UriToFileTransformEngine() {
@Override @Override
public void onUriToFileAsyncTransform(Context context, String srcPath, String mineType, OnKeyValueResultCallbackListener call) { public void onUriToFileAsyncTransform(Context context, String srcPath, String mineType, OnKeyValueResultCallbackListener call) {
Log.i("app",srcPath); Log.i("app", srcPath);
} }
}) })
.forResult(new OnResultCallbackListener<LocalMedia>() { .forResult(new OnResultCallbackListener<LocalMedia>() {
@ -966,7 +1044,7 @@ public class MineFragment extends BaseLazyFragment {
try { try {
//这里调用了截取图片的方法 //这里调用了截取图片的方法
uriTakePic = uriToExternalFile(data.getData(), fileName); uriTakePic = uriToExternalFile(data.getData(), fileName);
startPhotoZoom(uriTakePic, fileName,PICTURE_BOOK_CODE_END); startPhotoZoom(uriTakePic, fileName, PICTURE_BOOK_CODE_END);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -974,7 +1052,7 @@ public class MineFragment extends BaseLazyFragment {
case CAMERA_REQUEST_CODE: case CAMERA_REQUEST_CODE:
try { try {
//这里调用了截取图片的方法 //这里调用了截取图片的方法
startPhotoZoom(uriTakePic, fileName,CAMERA_REQUEST_CODE_END); startPhotoZoom(uriTakePic, fileName, CAMERA_REQUEST_CODE_END);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -1006,10 +1084,10 @@ public class MineFragment extends BaseLazyFragment {
try { try {
String applicationId = App.getApplicationId(context); String applicationId = App.getApplicationId(context);
File fos = this.createFileIfNeed(path, filename); File fos = this.createFileIfNeed(path, filename);
Uri uriOut=FileProvider.getUriForFile(getActivity(), applicationId + ".fileprovider", fos); Uri uriOut = FileProvider.getUriForFile(getActivity(), applicationId + ".fileprovider", fos);
out = getActivity().getContentResolver().openOutputStream(uriOut); out = getActivity().getContentResolver().openOutputStream(uriOut);
fis = getActivity().getContentResolver().openInputStream(uri); fis = getActivity().getContentResolver().openInputStream(uri);
IoUtil.copy(fis,out); IoUtil.copy(fis, out);
return FileProvider.getUriForFile(getActivity(), applicationId + ".fileprovider", fos); return FileProvider.getUriForFile(getActivity(), applicationId + ".fileprovider", fos);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -1031,36 +1109,37 @@ public class MineFragment extends BaseLazyFragment {
} }
return null; return null;
} }
/**
* /**
* *
* @param uri *
* @param fileName * @param uri
* @param flags * @param fileName
* @throws IOException * @param flags
*/ * @throws IOException
private void startPhotoZoom(Uri uri, String fileName, int flags) throws IOException { */
String applicationId = App.getApplicationId(context); private void startPhotoZoom(Uri uri, String fileName, int flags) throws IOException {
File CropPhoto = this.createFileIfNeed(path, fileName); String applicationId = App.getApplicationId(context);
uriTakePicOutput = FileProvider.getUriForFile(requireActivity(), applicationId + ".fileprovider", CropPhoto); File CropPhoto = this.createFileIfNeed(path, fileName);
uriTakePicOutput = FileProvider.getUriForFile(requireActivity(), applicationId + ".fileprovider", CropPhoto);
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*"); Intent intent = new Intent("com.android.camera.action.CROP");
intent.setDataAndType(uri, "image/*");
//添加这一句表示对目标应用临时授权该Uri所代表的文件
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); //添加这一句表示对目标应用临时授权该Uri所代表的文件
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
intent.putExtra("crop", "true");
//intent.putExtra("scale", true); intent.putExtra("crop", "true");
//intent.putExtra("aspectX", 1); //intent.putExtra("scale", true);
//intent.putExtra("aspectY", 1); //intent.putExtra("aspectX", 1);
//输出的宽高 //intent.putExtra("aspectY", 1);
//intent.putExtra("outputX", 300); //输出的宽高
//intent.putExtra("outputY", 300); //intent.putExtra("outputX", 300);
intent.putExtra("return-data", false); //intent.putExtra("outputY", 300);
intent.putExtra(MediaStore.EXTRA_OUTPUT, uriTakePicOutput); intent.putExtra("return-data", false);
intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); intent.putExtra(MediaStore.EXTRA_OUTPUT, uriTakePicOutput);
intent.putExtra("noFaceDetection", true); // no face detection intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
startActivityForResult(intent, flags); intent.putExtra("noFaceDetection", true); // no face detection
} startActivityForResult(intent, flags);
}
} }

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 279 B

After

Width:  |  Height:  |  Size: 279 B

Before

Width:  |  Height:  |  Size: 449 B

After

Width:  |  Height:  |  Size: 449 B

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 709 B

After

Width:  |  Height:  |  Size: 709 B

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Before

Width:  |  Height:  |  Size: 772 B

After

Width:  |  Height:  |  Size: 772 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 872 B

After

Width:  |  Height:  |  Size: 872 B

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Before

Width:  |  Height:  |  Size: 729 KiB

After

Width:  |  Height:  |  Size: 729 KiB

Before

Width:  |  Height:  |  Size: 791 KiB

After

Width:  |  Height:  |  Size: 791 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

Before

Width:  |  Height:  |  Size: 969 B

After

Width:  |  Height:  |  Size: 969 B

Before

Width:  |  Height:  |  Size: 416 B

After

Width:  |  Height:  |  Size: 416 B

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 411 B

Before

Width:  |  Height:  |  Size: 931 B

After

Width:  |  Height:  |  Size: 931 B

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 867 B

Before

Width:  |  Height:  |  Size: 937 B

After

Width:  |  Height:  |  Size: 937 B

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 871 B

Before

Width:  |  Height:  |  Size: 364 B

After

Width:  |  Height:  |  Size: 364 B

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Before

Width:  |  Height:  |  Size: 6.7 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Before

Width:  |  Height:  |  Size: 897 B

After

Width:  |  Height:  |  Size: 897 B

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 7.8 KiB

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Before

Width:  |  Height:  |  Size: 8.5 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

Before

Width:  |  Height:  |  Size: 7.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 27 KiB

Before

Width:  |  Height:  |  Size: 4.8 KiB

After

Width:  |  Height:  |  Size: 4.8 KiB

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save