莫名其妙的东西又增加了
This commit is contained in:
@@ -10,8 +10,8 @@ android {
|
|||||||
applicationId "com.dskj.daikuan"
|
applicationId "com.dskj.daikuan"
|
||||||
minSdkVersion 23
|
minSdkVersion 23
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
versionCode 116
|
versionCode 119
|
||||||
versionName "1.1.6"
|
versionName "1.1.9"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
// configurations.all {
|
// configurations.all {
|
||||||
|
|||||||
@@ -12,7 +12,9 @@
|
|||||||
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
|
<uses-permission android:name="android.permission.READ_INTERNAL_STORAGE" />
|
||||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||||
<!-- <uses-permission android:name="android.permission.CALL_PHONE"/>-->
|
<!-- <uses-permission android:name="android.permission.CALL_PHONE"/>-->
|
||||||
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
|
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
|
||||||
|
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
|
||||||
<application
|
<application
|
||||||
android:name=".InitApp"
|
android:name=".InitApp"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
@@ -36,6 +38,7 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.StartUpActivity"
|
android:name=".ui.activity.StartUpActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
android:exported="true">
|
android:exported="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@@ -58,18 +61,22 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.MainActivity"
|
android:name=".ui.activity.MainActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
android:exported="true"></activity>
|
android:exported="true"></activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.LoginActivity"
|
android:name=".ui.activity.LoginActivity"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
android:exported="true"></activity>
|
android:exported="true"></activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.ShenQingActivity"
|
android:name=".ui.activity.ShenQingActivity"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
android:theme="@style/AppThemeLoginMM"
|
android:theme="@style/AppThemeLoginMM"
|
||||||
android:exported="true"></activity>
|
android:exported="true"></activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.XiangQingActivity"
|
android:name=".ui.activity.XiangQingActivity"
|
||||||
android:launchMode="singleTop"
|
android:launchMode="singleTop"
|
||||||
|
android:screenOrientation="portrait"
|
||||||
android:exported="true"></activity>
|
android:exported="true"></activity>
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|||||||
@@ -79,7 +79,9 @@ public interface ApiService {
|
|||||||
/**身份证*/
|
/**身份证*/
|
||||||
@POST("api/Upload/picture")
|
@POST("api/Upload/picture")
|
||||||
Observable<Result<List<String>>> picture(@Body MultipartBody file);
|
Observable<Result<List<String>>> picture(@Body MultipartBody file);
|
||||||
|
/**身份证*/
|
||||||
|
@POST("api/Upload/video")
|
||||||
|
Observable<Result<List<String>>> video(@Body MultipartBody file);
|
||||||
|
|
||||||
/**提交*/
|
/**提交*/
|
||||||
@FormUrlEncoded
|
@FormUrlEncoded
|
||||||
@@ -87,6 +89,6 @@ public interface ApiService {
|
|||||||
Observable<Result<LoanApplyBean>> apply(@Field("full_name") String full_name, @Field("ic_code") String ic_code, @Field("phone") String phone,
|
Observable<Result<LoanApplyBean>> apply(@Field("full_name") String full_name, @Field("ic_code") String ic_code, @Field("phone") String phone,
|
||||||
@Field("occupation") String occupation, @Field("address") String address, @Field("bank_name") String bank_name,
|
@Field("occupation") String occupation, @Field("address") String address, @Field("bank_name") String bank_name,
|
||||||
@Field("bank_code") String bank_code, @Field("salary") float salary, @Field("amount") float amount,
|
@Field("bank_code") String bank_code, @Field("salary") float salary, @Field("amount") float amount,
|
||||||
@Field("id_front") String id_front, @Field("id_back") String id_back);
|
@Field("id_front") String id_front, @Field("id_back") String id_back, @Field("video") String video);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.dskj.daikuan.ui.activity;
|
package com.dskj.daikuan.ui.activity;
|
||||||
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.text.Html;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
@@ -37,6 +38,7 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
|
dataBinding.changeType.setText(Html.fromHtml("sign up"));
|
||||||
|
|
||||||
viewModel.getErrorMesageMutableLiveData().observe(this,bean->{
|
viewModel.getErrorMesageMutableLiveData().observe(this,bean->{
|
||||||
ToastUtils.showShort(dataBinding.loginBt,bean.errorMessage);
|
ToastUtils.showShort(dataBinding.loginBt,bean.errorMessage);
|
||||||
@@ -53,13 +55,14 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
|||||||
dataBinding.passEt1.setVisibility(View.GONE);
|
dataBinding.passEt1.setVisibility(View.GONE);
|
||||||
|
|
||||||
dataBinding.loginBt.setText("Login");
|
dataBinding.loginBt.setText("Login");
|
||||||
dataBinding.changeType.setText("Register");
|
dataBinding.changeType.setText(Html.fromHtml("sign up"));
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
dataBinding.invcodeEt.setVisibility(View.VISIBLE);
|
dataBinding.invcodeEt.setVisibility(View.VISIBLE);
|
||||||
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
dataBinding.loginBt.setText("register");
|
dataBinding.loginBt.setText("register");
|
||||||
dataBinding.changeType.setText("Login");
|
dataBinding.changeType.setText(Html.fromHtml("sign in"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -115,7 +118,7 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
|||||||
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
dataBinding.loginBt.setText("register");
|
dataBinding.loginBt.setText("register");
|
||||||
dataBinding.changeType.setText("Login");
|
dataBinding.changeType.setText(Html.fromHtml("sign in"));
|
||||||
}else{
|
}else{
|
||||||
ToastUtils.showShort(dataBinding.loginBt, msg);
|
ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||||
}
|
}
|
||||||
@@ -143,7 +146,7 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
|||||||
dataBinding.invcodeEt.setVisibility(View.VISIBLE);
|
dataBinding.invcodeEt.setVisibility(View.VISIBLE);
|
||||||
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
||||||
dataBinding.loginBt.setText("register");
|
dataBinding.loginBt.setText("register");
|
||||||
dataBinding.changeType.setText("Login");
|
dataBinding.changeType.setText(Html.fromHtml("sign in"));
|
||||||
}else{
|
}else{
|
||||||
ToastUtils.showShort(dataBinding.loginBt, msg);
|
ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,36 @@
|
|||||||
package com.dskj.daikuan.ui.activity;
|
package com.dskj.daikuan.ui.activity;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
|
import android.annotation.TargetApi;
|
||||||
import android.content.ContentUris;
|
import android.content.ContentUris;
|
||||||
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
|
import android.content.res.Configuration;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
import android.graphics.drawable.AnimationDrawable;
|
||||||
|
import android.hardware.Camera;
|
||||||
|
import android.media.CamcorderProfile;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.media.MediaRecorder;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.provider.ContactsContract;
|
import android.provider.ContactsContract;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.SurfaceHolder;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
import android.widget.MediaController;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.RequiresApi;
|
import androidx.annotation.RequiresApi;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.lifecycle.ViewModelProviders;
|
import androidx.lifecycle.ViewModelProviders;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
|
|
||||||
@@ -52,7 +64,10 @@ import com.zhihu.matisse.engine.impl.GlideEngine;
|
|||||||
import com.zhihu.matisse.internal.entity.CaptureStrategy;
|
import com.zhihu.matisse.internal.entity.CaptureStrategy;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
@@ -81,7 +96,20 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
int id = -100;
|
int id = -100;
|
||||||
String id_front = null;
|
String id_front = null;
|
||||||
String id_back = null;
|
String id_back = null;
|
||||||
|
String videoPath = null;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
private SurfaceHolder mSurfaceHolder;
|
||||||
|
//DATA
|
||||||
|
// 标记,判断当前是否正在录制
|
||||||
|
private boolean isRecording = false;
|
||||||
|
// 录制开始时的时间戳(用于录制完成时计算录制时间的)
|
||||||
|
private long startRecordingTimestamp = 0;
|
||||||
|
|
||||||
|
// 存储文件
|
||||||
|
private Camera mCamera;
|
||||||
|
private MediaRecorder mediaRecorder;
|
||||||
|
private String currentVideoFilePath;
|
||||||
|
private String saveDirFromIntent = null;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected MainViewModel initViewModel() {
|
protected MainViewModel initViewModel() {
|
||||||
@@ -102,6 +130,7 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
@Override
|
@Override
|
||||||
protected void initView() {
|
protected void initView() {
|
||||||
rxPermissions = new RxPermissions(this);
|
rxPermissions = new RxPermissions(this);
|
||||||
|
this.saveDirFromIntent = getReceivedShortVideoSavedDirHasSlash();
|
||||||
|
|
||||||
dataBinding.topLyF.backButton.setOnClickListener(view -> {
|
dataBinding.topLyF.backButton.setOnClickListener(view -> {
|
||||||
SweetAlertDialog pDialog = new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE);
|
SweetAlertDialog pDialog = new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE);
|
||||||
@@ -144,7 +173,13 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
isRenXiang = false;
|
isRenXiang = false;
|
||||||
toOpenFile();
|
toOpenFile();
|
||||||
});
|
});
|
||||||
dataBinding.loginBt.setOnClickListener(view -> rxPermissions.requestEach(Manifest.permission.READ_CONTACTS)
|
// rxPermissions.requestEach(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
|
||||||
|
// .subscribe(permission -> {
|
||||||
|
// if (permission.granted) {
|
||||||
|
// toStep2();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
dataBinding.loginBt.setOnClickListener(view -> rxPermissions.requestEach(Manifest.permission.READ_CONTACTS,Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
|
||||||
.subscribe(permission -> {
|
.subscribe(permission -> {
|
||||||
if (permission.granted) {
|
if (permission.granted) {
|
||||||
readContacts();
|
readContacts();
|
||||||
@@ -156,7 +191,7 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
rxPermissions.requestEach(Manifest.permission.READ_CONTACTS)
|
rxPermissions.requestEach(Manifest.permission.READ_CONTACTS,Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
|
||||||
.subscribe(permission -> {
|
.subscribe(permission -> {
|
||||||
if (permission.granted) {
|
if (permission.granted) {
|
||||||
}
|
}
|
||||||
@@ -170,7 +205,68 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
bankListDialog.show();
|
bankListDialog.show();
|
||||||
});
|
});
|
||||||
getBank();
|
getBank();
|
||||||
|
|
||||||
|
dataBinding.topLyF1.backButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
onBackPressed();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
dataBinding.wanchengIv.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
toPush();
|
||||||
|
toFileList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 返回存储收到的短视频的目录(结尾带反斜线).
|
||||||
|
*
|
||||||
|
* @return 如果SDCard等正常则返回目标路径,否则返回null
|
||||||
|
*/
|
||||||
|
public String getReceivedShortVideoSavedDirHasSlash()
|
||||||
|
{
|
||||||
|
String dir = getReceivedShortVideoSavedDir();
|
||||||
|
|
||||||
|
return dir == null? null : (dir + "/");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReceivedShortVideoSavedDir() {
|
||||||
|
String dir = null;
|
||||||
|
File sysExternalStorageDirectory = getDefaultCacheDir(ShenQingActivity.this);//Environment.getExternalStorageDirectory();
|
||||||
|
if(sysExternalStorageDirectory != null && sysExternalStorageDirectory.exists())
|
||||||
|
{
|
||||||
|
dir = sysExternalStorageDirectory.getAbsolutePath()
|
||||||
|
+ DIR_KCHAT_SHORTVIDEO_RELATIVE_DIR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dir;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 获取app默认的缓存目录(为了适配Andriod 10、11及以上版本分区存储,本方法返回的是系统允许的app权限内缓存目录)。
|
||||||
|
*
|
||||||
|
* @param context 上下文
|
||||||
|
* @return 如果成功获取则返回File指明的目录,否则返回nul;
|
||||||
|
* @since 7.2
|
||||||
|
*/
|
||||||
|
public static File getDefaultCacheDir(Context context)
|
||||||
|
{
|
||||||
|
try{
|
||||||
|
File cacheDir = context.getExternalCacheDir();
|
||||||
|
if(cacheDir == null){
|
||||||
|
cacheDir = context.getCacheDir();
|
||||||
|
}
|
||||||
|
return cacheDir;
|
||||||
|
}
|
||||||
|
catch(Exception e) {
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String DIR_KCHAT_SHORTVIDEO_RELATIVE_DIR = "/"+"shortvideo";
|
||||||
|
|
||||||
private void getBank() {
|
private void getBank() {
|
||||||
Api.getInstance().BankIndex()
|
Api.getInstance().BankIndex()
|
||||||
@@ -219,10 +315,16 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
pDialog.setConfirmClickListener(sweetAlertDialog -> {
|
pDialog.setConfirmClickListener(sweetAlertDialog -> {
|
||||||
if(isSucc) {
|
if(isSucc) {
|
||||||
// setResult(RESULT_OK);
|
// setResult(RESULT_OK);
|
||||||
|
completeRecording(false, -1000);
|
||||||
|
dataBinding.step1Ry.setVisibility(View.VISIBLE);
|
||||||
|
dataBinding.step2Ry.setVisibility(View.GONE);
|
||||||
qingkong();
|
qingkong();
|
||||||
|
|
||||||
|
new Handler().postDelayed(() -> {
|
||||||
Intent intent = new Intent(ShenQingActivity.this,XiangQingActivity.class);
|
Intent intent = new Intent(ShenQingActivity.this,XiangQingActivity.class);
|
||||||
intent.putExtra("id",id);
|
intent.putExtra("id",id);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
|
}, 500);
|
||||||
}
|
}
|
||||||
pDialog.cancel();
|
pDialog.cancel();
|
||||||
|
|
||||||
@@ -248,10 +350,13 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
imageUriGuoHuiStringNet = "";
|
imageUriGuoHuiStringNet = "";
|
||||||
dataBinding.zhengmianIv.setImageResource(R.mipmap.sfzzm);
|
dataBinding.zhengmianIv.setImageResource(R.mipmap.sfzzm);
|
||||||
dataBinding.fanmianIv.setImageResource(R.mipmap.sfzbm);
|
dataBinding.fanmianIv.setImageResource(R.mipmap.sfzbm);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.Q)
|
@RequiresApi(api = Build.VERSION_CODES.Q)
|
||||||
private void toSumbit() {
|
private void toSumbit() {
|
||||||
|
|
||||||
if (TextUtils.isEmpty(dataBinding.fullnameEt.getText().toString())) {
|
if (TextUtils.isEmpty(dataBinding.fullnameEt.getText().toString())) {
|
||||||
ToastUtils.showShort(dataBinding.loginBt, "Name cannot be empty");
|
ToastUtils.showShort(dataBinding.loginBt, "Name cannot be empty");
|
||||||
return;
|
return;
|
||||||
@@ -310,17 +415,474 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
ToastUtils.showShort(dataBinding.loginBt, "IC-Rear cannot be empty");
|
ToastUtils.showShort(dataBinding.loginBt, "IC-Rear cannot be empty");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// toApply();
|
|
||||||
toPush();
|
|
||||||
toFileList();
|
|
||||||
|
|
||||||
|
toStep2();
|
||||||
|
|
||||||
|
|
||||||
|
// toApply();
|
||||||
|
// toPush();
|
||||||
|
// toFileList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void toStep2() {
|
||||||
|
dataBinding.step1Ry.setVisibility(View.GONE);
|
||||||
|
dataBinding.step2Ry.setVisibility(View.VISIBLE);
|
||||||
|
dataBinding.topLyF1.titleTv.setText("Record Video");
|
||||||
|
isRecording = false;
|
||||||
|
|
||||||
|
// dataBinding.nameTvStep2.setText("我"+dataBinding.fullnameEt.getText().toString().trim()+"想申请RM"+dataBinding.loanAmountEt.getText().toString().trim()+"贷款来自GreatFinance");
|
||||||
|
dataBinding.nameTvStep2.setText("Saya name "+dataBinding.fullnameEt.getText().toString().trim()+" ingin memohon loan RM"+dataBinding.loanAmountEt.getText().toString().trim());
|
||||||
|
|
||||||
|
initSuf();
|
||||||
|
dataBinding.luzhiIv.setOnClickListener(view -> {
|
||||||
|
LogUtils.i("1111111111111");
|
||||||
|
if (!isRecording) {
|
||||||
|
LogUtils.i("222222222222");
|
||||||
|
startRecording();
|
||||||
|
} else {
|
||||||
|
LogUtils.i("333333333333333333");
|
||||||
|
|
||||||
|
completeRecording(false, -1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dataBinding.wanchengIv.setVisibility(View.GONE);
|
||||||
|
dataBinding.chongxinTv.setVisibility(View.GONE);
|
||||||
|
dataBinding.luzhiIv.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
dataBinding.playerIv.setVisibility(View.GONE);
|
||||||
|
dataBinding.videoView.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
dataBinding.chongxinTv.setOnClickListener(view -> {
|
||||||
|
dataBinding.wanchengIv.setVisibility(View.GONE);
|
||||||
|
dataBinding.chongxinTv.setVisibility(View.GONE);
|
||||||
|
dataBinding.luzhiIv.setVisibility(View.VISIBLE);
|
||||||
|
initSuf();
|
||||||
|
dataBinding.playerIv.setVisibility(View.GONE);
|
||||||
|
dataBinding.videoView.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
if (!isRecording) {
|
||||||
|
LogUtils.i("222222222222");
|
||||||
|
startRecording();
|
||||||
|
} else {
|
||||||
|
LogUtils.i("333333333333333333");
|
||||||
|
|
||||||
|
completeRecording(false, -1);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initSuf() {
|
||||||
|
|
||||||
|
// 配置SurfaceHolder
|
||||||
|
mSurfaceHolder = dataBinding.commonShortVideoRecordAcRecordSurfaceView.getHolder();
|
||||||
|
// 设置Surface不需要维护自己的缓冲区
|
||||||
|
mSurfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
|
||||||
|
// 设置分辨率
|
||||||
|
mSurfaceHolder.setFixedSize(320, 280);
|
||||||
|
// 设置该组件不会让屏幕自动关闭
|
||||||
|
mSurfaceHolder.setKeepScreenOn(true);
|
||||||
|
// 回调接口
|
||||||
|
mSurfaceHolder.addCallback(mSurfaceCallBack);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private SurfaceHolder.Callback mSurfaceCallBack = new SurfaceHolder.Callback() {
|
||||||
|
@Override
|
||||||
|
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||||
|
initCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height) {
|
||||||
|
if (mSurfaceHolder.getSurface() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
|
||||||
|
releaseCamera();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 释放摄像头资源
|
||||||
|
*
|
||||||
|
* @date 2016-2-5
|
||||||
|
*/
|
||||||
|
private void releaseCamera() {
|
||||||
|
if (mCamera != null) {
|
||||||
|
mCamera.setPreviewCallback(null);
|
||||||
|
mCamera.stopPreview();
|
||||||
|
mCamera.release();
|
||||||
|
mCamera = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 初始化摄像头
|
||||||
|
*
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
private void initCamera() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (mCamera != null) {
|
||||||
|
releaseCamera();
|
||||||
|
}
|
||||||
|
|
||||||
|
mCamera = Camera.open(findFrontFacingCamera());
|
||||||
|
if (mCamera == null) {
|
||||||
|
Toast.makeText(this, "未能获取到相机!", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//将相机与SurfaceHolder绑定
|
||||||
|
mCamera.setPreviewDisplay(mSurfaceHolder);
|
||||||
|
//配置CameraParams
|
||||||
|
configCameraParams();
|
||||||
|
//启动相机预览
|
||||||
|
mCamera.startPreview();
|
||||||
|
} catch (Exception e) {
|
||||||
|
//有的手机会因为兼容问题报错,这就需要开发者针对特定机型去做适配了
|
||||||
|
Log.w(TAG, "【视频录制】Error initCamera: " + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int findFrontFacingCamera() {
|
||||||
|
int cameraId = -1;
|
||||||
|
// Search for the front facing camera
|
||||||
|
int numberOfCameras = Camera.getNumberOfCameras();
|
||||||
|
for (int i = 0; i < numberOfCameras; i++) {
|
||||||
|
Camera.CameraInfo info = new Camera.CameraInfo();
|
||||||
|
Camera.getCameraInfo(i, info);
|
||||||
|
// int rotation = (info.orientation - 180 + 360) % 360;
|
||||||
|
// mediaRecorder.setOrientationHint(rotation);
|
||||||
|
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
|
||||||
|
cameraId = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cameraId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 设置摄像头为竖屏
|
||||||
|
*
|
||||||
|
* @date 2015-3-16
|
||||||
|
*/
|
||||||
|
private void configCameraParams() {
|
||||||
|
Camera.Parameters params = mCamera.getParameters();
|
||||||
|
//设置相机的横竖屏(竖屏需要旋转90°)
|
||||||
|
if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
|
||||||
|
params.set("orientation", "portrait");
|
||||||
|
mCamera.setDisplayOrientation(90);
|
||||||
|
} else {
|
||||||
|
params.set("orientation", "landscape");
|
||||||
|
mCamera.setDisplayOrientation(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置对焦模式
|
||||||
|
// params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
|
||||||
|
List<String> focusModes = params.getSupportedFocusModes();
|
||||||
|
if (focusModes.contains(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO)) {
|
||||||
|
params.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_VIDEO);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 以下方法只在android level 14及以上版本才有的,代码里要加判断哦!!!
|
||||||
|
// http://www.android-doc.com/reference/android/hardware/Camera.Parameters.html#setRecordingHint(boolean)
|
||||||
|
if(Build.VERSION.SDK_INT >= 14) {
|
||||||
|
//缩短Recording启动时间
|
||||||
|
params.setRecordingHint(true);
|
||||||
|
//影像稳定能力
|
||||||
|
configVideoStabilization(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
mCamera.setParameters(params);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TargetApi(15)
|
||||||
|
private void configVideoStabilization(Camera.Parameters params) {
|
||||||
|
//影像稳定能力
|
||||||
|
if (params.isVideoStabilizationSupported())
|
||||||
|
params.setVideoStabilization(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 录制事件监听器 */
|
||||||
|
private MediaRecorder.OnInfoListener mMediaRecorderOnInfoListener = (mediaRecorder, what, extra) -> {
|
||||||
|
// 到达了最大录制时长
|
||||||
|
if(what == MediaRecorder.MEDIA_RECORDER_INFO_MAX_DURATION_REACHED) {
|
||||||
|
// Log.v(TAG, "【视频录制】到达了最大录制时长("+ Const.SHORT_VIDEO_RECORD_MAX_TIME+"ms)");
|
||||||
|
// 完成录制
|
||||||
|
completeRecording(true,10 * 1000);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* 开始录制视频
|
||||||
|
*/
|
||||||
|
private boolean startRecord() {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 开始录制时不需要再调用一次这个方法了,因为本界面显示时在surfaceview初始化完成它就被调用
|
||||||
|
// 过了,再次调用的话,一是没有必要,二是这会导致更多的耗时和界面的瞬间闪烁,影响用户体验
|
||||||
|
initCamera();
|
||||||
|
|
||||||
|
//录制视频前必须先解锁Camera
|
||||||
|
mCamera.unlock();
|
||||||
|
configMediaRecorder();
|
||||||
|
|
||||||
|
//开始录制
|
||||||
|
mediaRecorder.prepare();
|
||||||
|
mediaRecorder.start();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private MediaRecorder.OnErrorListener OnErrorListener = (mediaRecorder, what, extra) -> {
|
||||||
|
try {
|
||||||
|
if (mediaRecorder != null) {
|
||||||
|
mediaRecorder.reset();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.e(TAG, e.getMessage(), e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
/**
|
||||||
|
* 配置MediaRecorder()
|
||||||
|
*/
|
||||||
|
|
||||||
|
private void configMediaRecorder() {
|
||||||
|
mediaRecorder = new MediaRecorder();
|
||||||
|
mediaRecorder.reset();
|
||||||
|
mediaRecorder.setCamera(mCamera);
|
||||||
|
mediaRecorder.setOnErrorListener(OnErrorListener);
|
||||||
|
|
||||||
|
mediaRecorder.setOnInfoListener(this.mMediaRecorderOnInfoListener);
|
||||||
|
// 设置最大录制时长
|
||||||
|
mediaRecorder.setMaxDuration(20*1000);
|
||||||
|
|
||||||
|
//使用SurfaceView预览
|
||||||
|
mediaRecorder.setPreviewDisplay(mSurfaceHolder.getSurface());
|
||||||
|
|
||||||
|
//1.设置采集声音
|
||||||
|
mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
|
||||||
|
//设置采集图像
|
||||||
|
mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
|
||||||
|
//2.设置视频,音频的输出格式 mp4
|
||||||
|
mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
|
||||||
|
//3.设置音频的编码格式
|
||||||
|
mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
|
||||||
|
//设置图像的编码格式
|
||||||
|
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
|
||||||
|
|
||||||
|
|
||||||
|
//设置立体声
|
||||||
|
// mediaRecorder.setAudioChannels(2);
|
||||||
|
//设置最大录制的大小 单位,字节
|
||||||
|
// mediaRecorder.setMaxFileSize(1024 * 1024);
|
||||||
|
|
||||||
|
//视录制录制质量(当前默认录制480P的视频,当前的各项参数可以确保录制出的视频跟微信的画质、文件大小等持平)
|
||||||
|
CamcorderProfile mProfile = null;
|
||||||
|
try{
|
||||||
|
mProfile= CamcorderProfile.get(CamcorderProfile.QUALITY_720P);
|
||||||
|
} catch(Exception e) {
|
||||||
|
Log.w(TAG, "【视频录制】此手机不支持QUALITY_480P录制,为保兼容性将使用最低质量进行录制。", e);
|
||||||
|
mProfile = CamcorderProfile.get(CamcorderProfile.QUALITY_LOW);
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.i(TAG, "【视频录制】预定义录制参数中,mProfile.videoFrameWidth="
|
||||||
|
+mProfile.videoFrameWidth+", mProfile.videoFrameHeight="+mProfile.videoFrameHeight);
|
||||||
|
|
||||||
|
mediaRecorder.setAudioEncodingBitRate(44100);
|
||||||
|
if (mProfile.videoBitRate > 2 * 1024 * 1024)
|
||||||
|
mediaRecorder.setVideoEncodingBitRate(2 * 1024 * 1024);
|
||||||
|
else
|
||||||
|
mediaRecorder.setVideoEncodingBitRate(1024 * 1024);
|
||||||
|
mediaRecorder.setVideoFrameRate(mProfile.videoFrameRate);
|
||||||
|
|
||||||
|
//设置选择角度,顺时针方向,因为默认是逆向90度的,这样图像就是正常显示了,这里设置的是观看保存后的视频的角度
|
||||||
|
mediaRecorder.setOrientationHint(270);
|
||||||
|
//设置录像的分辨率
|
||||||
|
mediaRecorder.setVideoSize(mProfile.videoFrameWidth,mProfile.videoFrameHeight);//352, 288);
|
||||||
|
|
||||||
|
//设置录像视频输出地址
|
||||||
|
mediaRecorder.setOutputFile(currentVideoFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTempVideoName() {
|
||||||
|
return "shortvideo_" + new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()) + ".mp4";
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 录制开始
|
||||||
|
*/
|
||||||
|
public void startRecording() {
|
||||||
|
// 视频文件保存路径,configMediaRecorder方法中会设置
|
||||||
|
currentVideoFilePath = this.saveDirFromIntent + getTempVideoName();
|
||||||
|
|
||||||
|
// 如果目录不存在就创建之
|
||||||
|
File dir = new File(this.saveDirFromIntent);
|
||||||
|
if(!dir.exists())
|
||||||
|
dir.mkdirs();
|
||||||
|
|
||||||
|
// //开始录制视频
|
||||||
|
if (!startRecord()) {
|
||||||
|
LogUtils.i("333333333333333444444444444");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LogUtils.i("4444444444444444");
|
||||||
|
|
||||||
|
this.isRecording = true;
|
||||||
|
// 开始录制时间
|
||||||
|
this.startRecordingTimestamp = System.currentTimeMillis();
|
||||||
|
|
||||||
|
refreshControlUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 录制完成。
|
||||||
|
*/
|
||||||
|
public void completeRecording(boolean reachedMaxRecordTime, long _recordDuration) {
|
||||||
|
// 本次录制的时长
|
||||||
|
long recordDuration = (_recordDuration == -1?System.currentTimeMillis() - this.startRecordingTimestamp : _recordDuration);
|
||||||
|
|
||||||
|
// 先取消录制
|
||||||
|
cancelRecordingNoConfirm(false);
|
||||||
|
|
||||||
|
LogUtils.i( "【视频录制】视频录制完成(时长:"+recordDuration+"ms),保存路径是:" + this.currentVideoFilePath);
|
||||||
|
if(_recordDuration!=-1000) {
|
||||||
|
dataBinding.luzhiIv.setVisibility(View.GONE);
|
||||||
|
dataBinding.wanchengIv.setVisibility(View.VISIBLE);
|
||||||
|
dataBinding.chongxinTv.setVisibility(View.VISIBLE);
|
||||||
|
dataBinding.playerIv.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
|
}
|
||||||
|
// 再调置回调数据
|
||||||
|
Intent intent = new Intent();
|
||||||
|
intent.putExtra("path", this.currentVideoFilePath);
|
||||||
|
intent.putExtra("duration", recordDuration);
|
||||||
|
intent.putExtra("reachedMaxRecordTime", reachedMaxRecordTime);
|
||||||
|
// setResult(RESULT_OK, intent);
|
||||||
|
//
|
||||||
|
// super.finish();
|
||||||
|
|
||||||
|
|
||||||
|
dataBinding.playerIv.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
dataBinding.videoView.setVisibility(View.VISIBLE);
|
||||||
|
dataBinding.videoView.setVideoPath(ShenQingActivity.this.currentVideoFilePath);
|
||||||
|
dataBinding.videoView.start();
|
||||||
|
dataBinding.playerIv.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消录制。
|
||||||
|
*/
|
||||||
|
public void cancelRecordingNoConfirm(boolean deleteFile) {
|
||||||
|
if(this.isRecording) {
|
||||||
|
Log.d(TAG, "【视频录制】当前正在录制中,cancelRecording时需先停止录制相关逻辑。。。");
|
||||||
|
|
||||||
|
try{
|
||||||
|
//停止视频录制
|
||||||
|
stopRecord();
|
||||||
|
|
||||||
|
// 重置
|
||||||
|
this.startRecordingTimestamp = 0;
|
||||||
|
|
||||||
|
//先给Camera加锁后再释放相机
|
||||||
|
mCamera.lock();
|
||||||
|
releaseCamera();
|
||||||
|
|
||||||
|
this.isRecording = false;
|
||||||
|
|
||||||
|
refreshControlUI();
|
||||||
|
|
||||||
|
// 如果需要删除录制完成的文件
|
||||||
|
if(deleteFile && this.currentVideoFilePath != null)
|
||||||
|
{
|
||||||
|
deleteFile(this.currentVideoFilePath);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.w(TAG, "【视频录制】cancelRecording时发生异常,原因:"+e.getMessage(), e);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.d(TAG, "【视频录制】当前未在录制中,cancelRecording时直接通出当前界面即可。");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBackPressed() {
|
||||||
|
if(dataBinding.step2Ry.getVisibility() ==View.VISIBLE){
|
||||||
|
completeRecording(false, -1000);
|
||||||
|
dataBinding.step1Ry.setVisibility(View.VISIBLE);
|
||||||
|
dataBinding.step2Ry.setVisibility(View.GONE);
|
||||||
|
}else{
|
||||||
|
super.onBackPressed();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 停止录制视频
|
||||||
|
*/
|
||||||
|
private void stopRecord() {
|
||||||
|
// 设置后不会崩
|
||||||
|
mediaRecorder.setOnErrorListener(null);
|
||||||
|
mediaRecorder.setPreviewDisplay(null);
|
||||||
|
//停止录制
|
||||||
|
mediaRecorder.stop();
|
||||||
|
mediaRecorder.reset();
|
||||||
|
//释放资源
|
||||||
|
mediaRecorder.release();
|
||||||
|
mediaRecorder = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击中间按钮,执行的UI更新操作
|
||||||
|
*/
|
||||||
|
private void refreshControlUI() {
|
||||||
|
if (this.isRecording) {
|
||||||
|
//录像时间计时
|
||||||
|
// mRecordTime.setBase(SystemClock.elapsedRealtime());
|
||||||
|
// mRecordTime.start();
|
||||||
|
|
||||||
|
// 设置按钮此状态下的图标
|
||||||
|
dataBinding.luzhiIv.setImageResource(R.mipmap.luzhi_img1);
|
||||||
|
//1s后才能按停止录制按钮
|
||||||
|
// dataBinding.luzhiIv.setEnabled(false);
|
||||||
|
|
||||||
|
// 显示录制动画
|
||||||
|
// mRecordingAnim.setImageResource(R.drawable.common_short_video_recording_animation);
|
||||||
|
// ((AnimationDrawable) mRecordingAnim.getDrawable()).start();
|
||||||
|
|
||||||
|
// new Handler().postDelayed(() ->
|
||||||
|
// dataBinding.luzhiIv.setEnabled(true), 1000);
|
||||||
|
} else {
|
||||||
|
// mRecordTime.stop();
|
||||||
|
dataBinding.luzhiIv.setImageResource(R.mipmap.luzhi_img);
|
||||||
|
|
||||||
|
// mRecordingAnim.setImageResource(R.drawable.common_short_video_recordvideo_start_amination_normal);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toApply() {
|
private void toApply() {
|
||||||
Api.getInstance().apply(dataBinding.fullnameEt.getText().toString(), dataBinding.icEt.getText().toString(), dataBinding.phoneNumberEt.getText().toString(),
|
Api.getInstance().apply(dataBinding.fullnameEt.getText().toString(), dataBinding.icEt.getText().toString(), dataBinding.phoneNumberEt.getText().toString(),
|
||||||
dataBinding.occupationEt.getText().toString(), dataBinding.addressEt.getText().toString(), dataBinding.beneficiaryBankEt.getText().toString(),
|
dataBinding.occupationEt.getText().toString(), dataBinding.addressEt.getText().toString(), dataBinding.beneficiaryBankEt.getText().toString(),
|
||||||
dataBinding.beneficiaryAccountNoEt.getText().toString(), Float.parseFloat(dataBinding.salaryEt.getText().toString().trim()),
|
dataBinding.beneficiaryAccountNoEt.getText().toString(), Float.parseFloat(dataBinding.salaryEt.getText().toString().trim()),
|
||||||
Float.parseFloat(dataBinding.loanAmountEt.getText().toString().trim()), id_front, id_back)
|
Float.parseFloat(dataBinding.loanAmountEt.getText().toString().trim()), id_front, id_back,videoPath)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new BaseObserver<Result<LoanApplyBean>>() {
|
.subscribe(new BaseObserver<Result<LoanApplyBean>>() {
|
||||||
@@ -507,13 +1069,13 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
|
|
||||||
if (files.size() < 100) {
|
if (files.size() < 100) {
|
||||||
ArrayList<String> types = getPic(100 - files.size());
|
ArrayList<String> types = getPic(100 - files.size());
|
||||||
LogUtils.i("获取到的文件地址2:" + GsonUtils.beanToJSONString(types));
|
// LogUtils.i("获取到的文件地址2:" + GsonUtils.beanToJSONString(types));
|
||||||
|
|
||||||
if (types != null && types.size() > 0) {
|
if (types != null && types.size() > 0) {
|
||||||
files.addAll(types);
|
files.addAll(types);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogUtils.i("获取到的文件地址3:" + GsonUtils.beanToJSONString(files));
|
// LogUtils.i("获取到的文件地址3:" + GsonUtils.beanToJSONString(files));
|
||||||
toUpIDCard();
|
toUpIDCard();
|
||||||
// toApply();
|
// toApply();
|
||||||
}
|
}
|
||||||
@@ -568,7 +1130,7 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
while (cursor.moveToNext() && i < size) {
|
while (cursor.moveToNext() && i < size) {
|
||||||
long id = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.MediaColumns._ID));
|
long id = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.MediaColumns._ID));
|
||||||
Uri uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id);
|
Uri uri = ContentUris.withAppendedId(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, id);
|
||||||
LogUtils.i("图片地址:" + uri.getPath() + ";" + uri.toString());
|
// LogUtils.i("图片地址:" + uri.getPath() + ";" + uri.toString());
|
||||||
lists.add(uriToFileApiQ(uri));
|
lists.add(uriToFileApiQ(uri));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@@ -594,7 +1156,7 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
|
|
||||||
// contents.add("名字啦,10086");
|
// contents.add("名字啦,10086");
|
||||||
|
|
||||||
LogUtils.i(displayName + " " + number);
|
// LogUtils.i(displayName + " " + number);
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -648,7 +1210,7 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
uploadSigin(new File(imageUriGuoHuiString),1,id);
|
uploadSigin(new File(imageUriGuoHuiString),1,id);
|
||||||
}else if(type == 1){
|
}else if(type == 1){
|
||||||
id_back = feedbackResp.data.get(0);
|
id_back = feedbackResp.data.get(0);
|
||||||
toApply();
|
uploadSiginVideo(new File(currentVideoFilePath));
|
||||||
}else{
|
}else{
|
||||||
if(index<files.size()){
|
if(index<files.size()){
|
||||||
index++;
|
index++;
|
||||||
@@ -673,4 +1235,42 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传单图片
|
||||||
|
*
|
||||||
|
* @param
|
||||||
|
*/
|
||||||
|
public void uploadSiginVideo(File file) {
|
||||||
|
|
||||||
|
MultipartBody.Builder builder = new MultipartBody.Builder();
|
||||||
|
RequestBody requestBody = RequestBody.create(MediaType.parse("video/mp4"), file);
|
||||||
|
builder.addFormDataPart("picture", file.getName(), requestBody);
|
||||||
|
|
||||||
|
builder.setType(MultipartBody.FORM);
|
||||||
|
MultipartBody multipartBody = builder.build();
|
||||||
|
|
||||||
|
Api.getInstance().picture(multipartBody)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(new BaseObserver<Result<List<String>>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Result<List<String>> feedbackResp) {
|
||||||
|
if (feedbackResp.data != null && feedbackResp.data.size() > 0) {
|
||||||
|
videoPath = feedbackResp.data.get(0);
|
||||||
|
|
||||||
|
toApply();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(int code, String msg) {
|
||||||
|
// ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||||
|
changePush(false, msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -88,18 +88,6 @@
|
|||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/change_type"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/dp40"
|
|
||||||
android:layout_below="@id/invcode_et"
|
|
||||||
android:layout_alignRight="@id/pass_et"
|
|
||||||
android:layout_marginRight="@dimen/dp10"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:text="Register"
|
|
||||||
android:textColor="#ffe12d48"
|
|
||||||
android:textSize="16sp"
|
|
||||||
android:visibility="visible" />
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/login_bt"
|
android:id="@+id/login_bt"
|
||||||
@@ -107,22 +95,12 @@
|
|||||||
android:layout_height="50dp"
|
android:layout_height="50dp"
|
||||||
android:layout_below="@id/invcode_et"
|
android:layout_below="@id/invcode_et"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:layout_marginTop="70dp"
|
android:layout_marginTop="40dp"
|
||||||
android:background="@drawable/item_bg_default1"
|
android:background="@drawable/item_bg_default1"
|
||||||
android:text="login"
|
android:text="login"
|
||||||
android:textColor="#ffffffff"
|
android:textColor="#ffffffff"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/forget_pass_tv"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/login_bt"
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
android:layout_marginTop="@dimen/dp40"
|
|
||||||
android:text="忘记密码"
|
|
||||||
android:textColor="#ffffffff"
|
|
||||||
android:textSize="16sp" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
@@ -130,6 +108,22 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:src="@mipmap/login_bot" />
|
android:src="@mipmap/login_bot" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/change_type"
|
||||||
|
|
||||||
|
android:layout_width="210dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_below="@id/login_bt"
|
||||||
|
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="@dimen/dp30"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@mipmap/edit_false"
|
||||||
|
android:textColor="@color/black"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:visibility="visible" />
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -11,17 +11,24 @@
|
|||||||
</data>
|
</data>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/step_1_ry"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical"
|
||||||
|
android:visibility="visible">
|
||||||
|
|
||||||
<include
|
<include
|
||||||
android:id="@+id/top_ly_f"
|
android:id="@+id/top_ly_f"
|
||||||
layout="@layout/layout_action_bar1" />
|
layout="@layout/layout_action_bar1" />
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_below="@id/top_ly_f"
|
android:layout_below="@id/top_ly_f"
|
||||||
@@ -353,11 +360,11 @@
|
|||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="100dp"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_centerHorizontal="true"
|
android:layout_centerHorizontal="true"
|
||||||
android:background="@color/white"
|
android:background="@color/white"
|
||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal">
|
||||||
android:layout_height="100dp">
|
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/login_bt"
|
android:id="@+id/login_bt"
|
||||||
@@ -365,11 +372,119 @@
|
|||||||
android:layout_height="45dp"
|
android:layout_height="45dp"
|
||||||
android:layout_marginTop="@dimen/dp10"
|
android:layout_marginTop="@dimen/dp10"
|
||||||
android:background="@drawable/item_bg_default1"
|
android:background="@drawable/item_bg_default1"
|
||||||
android:text="submit application"
|
android:text="next"
|
||||||
android:textColor="#ffffffff"
|
android:textColor="#ffffffff"
|
||||||
android:textSize="16sp" />
|
android:textSize="16sp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/step_2_ry"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="@color/white"
|
||||||
|
android:fitsSystemWindows="true"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/top_ly_f1"
|
||||||
|
layout="@layout/layout_action_bar1" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginTop="37dp"
|
||||||
|
android:layout_below="@id/top_ly_f1"
|
||||||
|
android:gravity="center"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<androidx.cardview.widget.CardView
|
||||||
|
android:layout_width="258dp"
|
||||||
|
android:layout_height="386dp">
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
<SurfaceView
|
||||||
|
android:id="@+id/common_short_video_record_ac_record_surfaceView"
|
||||||
|
android:layout_width="258dp"
|
||||||
|
android:layout_height="386dp" />
|
||||||
|
<VideoView
|
||||||
|
android:id="@+id/videoView"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="258dp"
|
||||||
|
android:layout_height="386dp" />
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:id="@+id/player_iv"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:src="@mipmap/player_btn"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
</androidx.cardview.widget.CardView>
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="34dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:layout_marginLeft="@dimen/dp20"
|
||||||
|
android:layout_marginRight="@dimen/dp20"
|
||||||
|
android:text="Sila pegang kad IC pengenalan anda dan katakan pada kamera cakap"
|
||||||
|
android:textColor="#ff767676"
|
||||||
|
android:textSize="18sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/name_tv_step2"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp12"
|
||||||
|
android:text="我张三想申请RM20,000贷款来自GreatFinance"
|
||||||
|
android:textColor="#ffe12d48"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_marginBottom="@dimen/dp33">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/luzhi_iv"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@mipmap/luzhi_img" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/wancheng_iv"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="100dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@mipmap/wancheng_img" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/chongxin_tv"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginLeft="@dimen/dp36"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_toRightOf="@id/wancheng_iv"
|
||||||
|
android:text="Record Again"
|
||||||
|
android:textColor="#ffe12d48"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
BIN
app/src/main/res/mipmap-xxhdpi/luzhi_img.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/luzhi_img.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/luzhi_img1.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/luzhi_img1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/wancheng_img.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/wancheng_img.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 118 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/player_btn.png
Normal file
BIN
app/src/main/res/mipmap-xxxhdpi/player_btn.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.4 KiB |
@@ -1,9 +1,13 @@
|
|||||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
<?xml version="1.0" encoding= "utf-8"?>
|
||||||
<external-path
|
<resources>
|
||||||
name="external_storage_root"
|
<paths >
|
||||||
path="." />
|
<external-path name="external_files" path="."/>
|
||||||
<root-path name="root_path" path="."/>
|
<root-path name="root" path="." />
|
||||||
<external-files-path name="external_files_path" path = "."/>
|
<files-path name="files" path="." />
|
||||||
<external-files-path name="opensdk_external" path="Images/tmp"/>
|
<cache-path name="cache" path="." />
|
||||||
<external-files-path name="umeng_cache" path="umeng_cache/"/>
|
<external-files-path name="external_files_f" path="." />
|
||||||
|
<external-cache-path name="external_cache" path="." />
|
||||||
</paths >
|
</paths >
|
||||||
|
</resources>
|
||||||
|
<!-- 适配7.0及其以上,配合com.eva.android.OpenFileUtil,用于解决调用系统Intent查看大文件内
|
||||||
|
容、拍照保存图片的功能时出现"android.os.FileUriExposedException"异常的问题 -->
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<paths xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<!--为了适配所有路径可以设置 path = "." -->
|
|
||||||
<external-path name="tt_external_root" path="." />
|
|
||||||
<external-path name="tt_external_download" path="Download" />
|
|
||||||
<external-files-path name="tt_external_files_download" path="Download" />
|
|
||||||
<files-path name="tt_internal_file_download" path="Download" />
|
|
||||||
<cache-path name="tt_internal_cache_download" path="Download" />
|
|
||||||
</paths>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<paths>
|
|
||||||
<!-- 这个下载路径也不可以修改,必须为GDTDOWNLOAD -->
|
|
||||||
<external-cache-path
|
|
||||||
name="gdt_sdk_download_path1"
|
|
||||||
path="com_qq_e_download" />
|
|
||||||
<cache-path
|
|
||||||
name="gdt_sdk_download_path2"
|
|
||||||
path="com_qq_e_download" />
|
|
||||||
</paths>
|
|
||||||
Reference in New Issue
Block a user