第一次提交代码
This commit is contained in:
@@ -4,18 +4,18 @@
|
||||
package="com.dskj.daikuan">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
||||
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_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.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"/>
|
||||
<uses-feature android:name="android.hardware.camera.front" />
|
||||
<!-- <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />-->
|
||||
<!-- <uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />-->
|
||||
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />-->
|
||||
<!-- <uses-permission android:name="android.permission.WRITE_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.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"/>-->
|
||||
<!-- <uses-feature android:name="android.hardware.camera.front" />-->
|
||||
|
||||
<application
|
||||
android:name=".InitApp"
|
||||
@@ -25,10 +25,11 @@
|
||||
android:largeHeap="true"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:usesCleartextTraffic="true"
|
||||
|
||||
android:roundIcon="@mipmap/logo_2"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppThemeLogin"
|
||||
android:usesCleartextTraffic="true"
|
||||
tools:replace="android:allowBackup,android:icon">
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="com.google.android.actions"-->
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.dskj.daikuan.api;
|
||||
|
||||
|
||||
import com.dskj.daikuan.bean.BankBean;
|
||||
import com.dskj.daikuan.bean.CallLogBean;
|
||||
import com.dskj.daikuan.bean.ListBean;
|
||||
import com.dskj.daikuan.bean.LoanApplyBean;
|
||||
import com.dskj.daikuan.bean.LoanBean;
|
||||
@@ -34,7 +35,7 @@ import retrofit2.http.Query;
|
||||
public interface ApiService {
|
||||
|
||||
// String URL ="http://192.168.110.26:39901/";
|
||||
String URL ="http://api.cashngo.net/";
|
||||
String URL ="https://api-test.telebol.com/";
|
||||
|
||||
|
||||
/**获取Access-Token*/
|
||||
@@ -79,17 +80,9 @@ public interface ApiService {
|
||||
/**身份证*/
|
||||
@POST("api/Upload/picture")
|
||||
Observable<Result<List<String>>> picture(@Body MultipartBody file);
|
||||
/**身份证*/
|
||||
@POST("api/Upload/video")
|
||||
Observable<Result<List<String>>> video(@Body MultipartBody file);
|
||||
|
||||
/**提交*/
|
||||
@FormUrlEncoded
|
||||
@POST("api/Loan/apply")
|
||||
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("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("video") String video);
|
||||
|
||||
|
||||
/**提交*/
|
||||
@FormUrlEncoded
|
||||
@POST("api/Loan/apply")
|
||||
@@ -98,4 +91,9 @@ public interface ApiService {
|
||||
@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);
|
||||
|
||||
|
||||
|
||||
/**身份证*/
|
||||
@POST("api/loan/postPhoneHistory")
|
||||
Observable<Result> postPhoneHistory(@Body List<CallLogBean> file);
|
||||
}
|
||||
|
||||
@@ -47,23 +47,20 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
||||
|
||||
});
|
||||
|
||||
dataBinding.changeType.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if(dataBinding.invcodeEt.getVisibility() ==View.VISIBLE) {
|
||||
dataBinding.invcodeEt.setVisibility(View.GONE);
|
||||
dataBinding.passEt1.setVisibility(View.GONE);
|
||||
dataBinding.changeType.setOnClickListener(view -> {
|
||||
if(dataBinding.invcodeEt.getVisibility() ==View.VISIBLE) {
|
||||
dataBinding.invcodeEt.setVisibility(View.GONE);
|
||||
dataBinding.passEt1.setVisibility(View.GONE);
|
||||
|
||||
dataBinding.loginBt.setText("Login");
|
||||
dataBinding.changeType.setText(Html.fromHtml("sign up"));
|
||||
dataBinding.loginBt.setText("Login");
|
||||
dataBinding.changeType.setText(Html.fromHtml("sign up"));
|
||||
|
||||
}else{
|
||||
dataBinding.invcodeEt.setVisibility(View.VISIBLE);
|
||||
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
||||
}else{
|
||||
dataBinding.invcodeEt.setVisibility(View.VISIBLE);
|
||||
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
||||
|
||||
dataBinding.loginBt.setText("register");
|
||||
dataBinding.changeType.setText(Html.fromHtml("sign in"));
|
||||
}
|
||||
dataBinding.loginBt.setText("register");
|
||||
dataBinding.changeType.setText(Html.fromHtml("sign in"));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -99,11 +96,12 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
||||
Api.getInstance().getLogin(dataBinding.nameEt.getText().toString(), dataBinding.passEt.getText().toString(),dataBinding.invcodeEt.getText().toString().trim())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<Result<UserBean>>() {
|
||||
.subscribe(new BaseObserver<>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result<UserBean> feedbackResp) {
|
||||
if (feedbackResp.data != null) {
|
||||
|
||||
InitApp.setUserToken(feedbackResp.data.getAuth());
|
||||
InitApp.saveString("user_bean", GsonUtils.beanToJSONString(feedbackResp.data));
|
||||
startActivity(new Intent(LoginActivity.this, ShenQingActivity.class));
|
||||
@@ -114,12 +112,17 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
if (code == -1) {
|
||||
|
||||
if (msg.equals("密码错误") || msg.equals("邀请码不存在")) {
|
||||
ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||
return;
|
||||
}
|
||||
dataBinding.invcodeEt.setVisibility(View.VISIBLE);
|
||||
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
||||
|
||||
dataBinding.loginBt.setText("register");
|
||||
dataBinding.changeType.setText(Html.fromHtml("sign in"));
|
||||
}else{
|
||||
} else {
|
||||
ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||
}
|
||||
}
|
||||
@@ -128,7 +131,7 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
||||
Api.getInstance().getLogin(dataBinding.nameEt.getText().toString(), dataBinding.passEt.getText().toString())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<Result<UserBean>>() {
|
||||
.subscribe(new BaseObserver<>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result<UserBean> feedbackResp) {
|
||||
@@ -143,20 +146,22 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
if (code == -1) {
|
||||
if (msg.equals("密码错误") || msg.equals("邀请码不存在")) {
|
||||
ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||
return;
|
||||
}
|
||||
dataBinding.invcodeEt.setVisibility(View.VISIBLE);
|
||||
dataBinding.passEt1.setVisibility(View.VISIBLE);
|
||||
dataBinding.loginBt.setText("register");
|
||||
dataBinding.changeType.setText(Html.fromHtml("sign in"));
|
||||
}else{
|
||||
} else {
|
||||
ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
// startActivity(new Intent(this,MainActivity.class));
|
||||
// overridePendingTransition(0,0);
|
||||
// finish();
|
||||
|
||||
});
|
||||
|
||||
dataBinding.nameEt.setOnFocusChangeListener((v, hasFocus) -> {
|
||||
@@ -192,62 +197,6 @@ public class LoginActivity extends BaseActivity<MainViewModel, ActivityLoginBind
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 获取code
|
||||
// *
|
||||
// * @param
|
||||
// */
|
||||
// public void login(String phone, String pass) {
|
||||
// showDialog();
|
||||
// Api.getInstance().login(phone, pass)
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(new Observer<Result<UserBean>>() {
|
||||
// @Override
|
||||
// public void onSubscribe(Disposable d) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNext(Result<UserBean> feedbackResp) {
|
||||
// if (feedbackResp.code == 1) {
|
||||
// LogUtils.i("登录 onSuccess:" + GsonUtils.beanToJSONString(feedbackResp.data));
|
||||
// InitApp.saveString("user_bean", GsonUtils.beanToJSONString(feedbackResp.data));
|
||||
// InitApp.saveString("pass",pass);
|
||||
// InitApp.setToken(feedbackResp.data.getUser_token());
|
||||
// goToMain(feedbackResp.data);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError(Throwable e) {
|
||||
// ToastUtils.s(LoginActivity.this,e.getMessage());
|
||||
// dismissDialog();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onComplete() {
|
||||
// dismissDialog();
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// private void goToMain(UserBean data) {
|
||||
// if(data.getUrgent() == 0) {
|
||||
// if (data.getLevel_id() == 4) {
|
||||
// startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
||||
// } else {
|
||||
// startActivity(new Intent(LoginActivity.this, MainActivity2.class));
|
||||
// }
|
||||
// }else{
|
||||
// startActivity(new Intent(LoginActivity.this, JianSheZhongActivity.class));
|
||||
// }
|
||||
// finish();
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
package com.dskj.daikuan.ui.activity;
|
||||
|
||||
import android.Manifest;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentUris;
|
||||
@@ -91,15 +92,15 @@ public class MainActivity extends BaseActivity<MainViewModel, ActivityMain2Bindi
|
||||
}
|
||||
|
||||
private void changeDate(boolean isFirst) {
|
||||
if(isNeeDate){
|
||||
if (isNeeDate) {
|
||||
dataBinding.refreshLayout.setVisibility(View.VISIBLE);
|
||||
dataBinding.nodateRy.setVisibility(View.GONE);
|
||||
if(!isFirst) {
|
||||
if (!isFirst) {
|
||||
dataBinding.menuTv.setVisibility(View.VISIBLE);
|
||||
}
|
||||
initList();
|
||||
|
||||
}else{
|
||||
} else {
|
||||
dataBinding.refreshLayout.setVisibility(View.GONE);
|
||||
dataBinding.nodateRy.setVisibility(View.VISIBLE);
|
||||
dataBinding.menuTv.setVisibility(View.GONE);
|
||||
@@ -123,16 +124,16 @@ public class MainActivity extends BaseActivity<MainViewModel, ActivityMain2Bindi
|
||||
public void onSuccess(Result<ListBean> feedbackResp) {
|
||||
dataBinding.refreshLayout.finishRefresh();
|
||||
dataBinding.refreshLayout.finishLoadMore();
|
||||
if(pageSize == 1){
|
||||
if (pageSize == 1) {
|
||||
lists = (ArrayList<LoanBean>) feedbackResp.data.getData();
|
||||
commonAdapter.setDates(lists);
|
||||
}else{
|
||||
} else {
|
||||
lists.addAll(feedbackResp.data.getData());
|
||||
commonAdapter.setDates(lists);
|
||||
}
|
||||
if(lists.size() == 0){
|
||||
isNeeDate =false;
|
||||
}else{
|
||||
if (lists.size() == 0) {
|
||||
isNeeDate = false;
|
||||
} else {
|
||||
isNeeDate = true;
|
||||
}
|
||||
changeDate(false);
|
||||
@@ -140,13 +141,14 @@ public class MainActivity extends BaseActivity<MainViewModel, ActivityMain2Bindi
|
||||
dataBinding.refreshLayout.finishLoadMoreWithNoMoreData();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
dataBinding.refreshLayout.finishRefresh();
|
||||
dataBinding.refreshLayout.finishLoadMore();
|
||||
if(lists.size() == 0){
|
||||
isNeeDate =false;
|
||||
}else{
|
||||
if (lists.size() == 0) {
|
||||
isNeeDate = false;
|
||||
} else {
|
||||
isNeeDate = true;
|
||||
}
|
||||
changeDate(false);
|
||||
@@ -160,34 +162,34 @@ public class MainActivity extends BaseActivity<MainViewModel, ActivityMain2Bindi
|
||||
commonAdapter = new CommonAdapter<LoanBean>(this, R.layout.agent_child_item, lists) {
|
||||
@Override
|
||||
public void convert(ViewHolder holder, LoanBean s, int index) {
|
||||
holder.setText(R.id.number_tv,"RM"+s.getAmount());
|
||||
holder.setText(R.id.name_tv,"Time:"+s.getCreate_time());
|
||||
holder.setText(R.id.number_tv, "RM" + s.getAmount());
|
||||
holder.setText(R.id.name_tv, "Time:" + s.getCreate_time());
|
||||
// 0审核中 1通过 2失败
|
||||
TextView textView = holder.getView(R.id.status_tv);
|
||||
TextView textView = holder.getView(R.id.status_tv);
|
||||
textView.setTextColor(getResources().getColor(R.color.white));
|
||||
if(s.getStatus() == 0){
|
||||
holder.setText(R.id.status_tv,"processing");
|
||||
if (s.getStatus() == 0) {
|
||||
holder.setText(R.id.status_tv, "processing");
|
||||
|
||||
}else if(s.getStatus() == 1){
|
||||
holder.setText(R.id.status_tv,"success");
|
||||
} else if (s.getStatus() == 1) {
|
||||
holder.setText(R.id.status_tv, "success");
|
||||
|
||||
}else if(s.getStatus() == 2){
|
||||
holder.setText(R.id.status_tv,"fail");
|
||||
} else if (s.getStatus() == 2) {
|
||||
holder.setText(R.id.status_tv, "fail");
|
||||
textView.setTextColor(getResources().getColor(R.color.color_search_2));
|
||||
|
||||
}
|
||||
holder.getView(R.id.big_ly).setOnClickListener(view ->{
|
||||
Intent intent = new Intent(MainActivity.this,XiangQingActivity.class);
|
||||
intent.putExtra("id",s.getId());
|
||||
holder.getView(R.id.big_ly).setOnClickListener(view -> {
|
||||
Intent intent = new Intent(MainActivity.this, XiangQingActivity.class);
|
||||
intent.putExtra("id", s.getId());
|
||||
startActivity(intent);
|
||||
} );
|
||||
});
|
||||
}
|
||||
};
|
||||
dataBinding.recyclerview.setAdapter(commonAdapter);
|
||||
}
|
||||
|
||||
|
||||
private void initRefreshLayout() {
|
||||
private void initRefreshLayout() {
|
||||
dataBinding.refreshLayout.setOnRefreshListener(refreshlayout -> {
|
||||
pageSize = 1;
|
||||
dataBinding.refreshLayout.setEnableLoadMore(true);
|
||||
@@ -200,15 +202,15 @@ public class MainActivity extends BaseActivity<MainViewModel, ActivityMain2Bindi
|
||||
});
|
||||
}
|
||||
|
||||
private void addLoan(){
|
||||
startActivity(new Intent(this,ShenQingActivity.class));
|
||||
private void addLoan() {
|
||||
startActivity(new Intent(this, ShenQingActivity.class));
|
||||
finish();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if(RESULT_OK == resultCode && requestCode == 777){
|
||||
if (RESULT_OK == resultCode && requestCode == 777) {
|
||||
dataBinding.refreshLayout.autoRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.dskj.daikuan.ui.activity;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentUris;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Color;
|
||||
@@ -19,6 +22,7 @@ import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.CallLog;
|
||||
import android.provider.ContactsContract;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.Html;
|
||||
@@ -32,6 +36,7 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.lifecycle.ViewModelProviders;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
@@ -39,6 +44,7 @@ import com.azhon.basic.base.BaseActivity;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.cazaea.sweetalert.ProgressHelper;
|
||||
import com.cazaea.sweetalert.SweetAlertDialog;
|
||||
import com.dskj.daikuan.BuildConfig;
|
||||
import com.dskj.daikuan.InitApp;
|
||||
import com.dskj.daikuan.R;
|
||||
import com.dskj.daikuan.adapter.comm.CommonAdapter;
|
||||
@@ -47,8 +53,10 @@ import com.dskj.daikuan.api.Api;
|
||||
import com.dskj.daikuan.api.BaseObserver;
|
||||
import com.dskj.daikuan.api.Result;
|
||||
import com.dskj.daikuan.bean.BankBean;
|
||||
import com.dskj.daikuan.bean.CallLogBean;
|
||||
import com.dskj.daikuan.bean.LoanApplyBean;
|
||||
import com.dskj.daikuan.bean.LoanBean;
|
||||
import com.dskj.daikuan.bean.UserBean;
|
||||
import com.dskj.daikuan.databinding.ActivityMain2Binding;
|
||||
import com.dskj.daikuan.databinding.ActivityShenqingBinding;
|
||||
import com.dskj.daikuan.ui.dialog.BankListDialog;
|
||||
@@ -101,13 +109,14 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
String id_back = null;
|
||||
String videoPath = null;
|
||||
int index = 0;
|
||||
public static final int MAXIMG = 100;
|
||||
public static final int MAXIMG = BuildConfig.DEBUG ? 1 : 100;
|
||||
private SurfaceHolder mSurfaceHolder;
|
||||
//DATA
|
||||
// 标记,判断当前是否正在录制
|
||||
private boolean isRecording = false;
|
||||
// 录制开始时的时间戳(用于录制完成时计算录制时间的)
|
||||
private long startRecordingTimestamp = 0;
|
||||
List<CallLogBean> list;
|
||||
|
||||
// 存储文件
|
||||
private Camera mCamera;
|
||||
@@ -116,7 +125,8 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
private String saveDirFromIntent = null;
|
||||
int shoquuanSize = 0;
|
||||
|
||||
String defaultJson ="[{\"id\":25,\"name\":\"Co-op Bank Pertama\"},{\"id\":5,\"name\":\"Maybank\"},{\"id\":6,\"name\":\"CIMB\"},{\"id\":7,\"name\":\"Public Bank Berhad\"},{\"id\":8,\"name\":\"RHB Bank\"},{\"id\":9,\"name\":\"Hong Leong Bank\"},{\"id\":10,\"name\":\"AmBank\"},{\"id\":11,\"name\":\"UOB Malaysia\"},{\"id\":12,\"name\":\"Bank Rakyat\"},{\"id\":13,\"name\":\"OCBC Bank Malaysia\"},{\"id\":14,\"name\":\"HSBC Bank\"},{\"id\":15,\"name\":\"Bank Islam\"},{\"id\":16,\"name\":\"Affin Bank\"},{\"id\":17,\"name\":\"Alliance Bank\"},{\"id\":18,\"name\":\"Standard Chartered\"},{\"id\":19,\"name\":\"MBSB Bank Berhad\"},{\"id\":20,\"name\":\"Citibank Malaysia\"},{\"id\":21,\"name\":\"Bank Simpanan Nasional (BSN)\"},{\"id\":22,\"name\":\"Bank Muamalat\"},{\"id\":23,\"name\":\"Agrobank\"},{\"id\":24,\"name\":\"Al-Rajhi Malaysia\"},{\"id\":26,\"name\":\"TNG\"},{\"id\":27,\"name\":\"Deutsche Bank Aktiengesellschaf\"},{\"id\":28,\"name\":\"Al Rajhi Banking & Investment Corporation\"},{\"id\":29,\"name\":\"MIMB Investment Bank Berhad\"},{\"id\":30,\"name\":\"Kenanga Investment Bank Berhad\"},{\"id\":31,\"name\":\"KAF Investment Bank Berhad\"},{\"id\":32,\"name\":\"AmInvestment Bank Berhad\"},{\"id\":33,\"name\":\"Kuwait Finance House\"},{\"id\":34,\"name\":\"Asian Finance Bank Berhad\"},{\"id\":35,\"name\":\"Al Rajhi Banking & Investment Corporation\"},{\"id\":36,\"name\":\"United Overseas Bank (Malaysia) Bhd.\"},{\"id\":37,\"name\":\"The Royal Bank of Scotland Berhad\"},{\"id\":38,\"name\":\"The Bank of Nova Scotia Berhad\"},{\"id\":39,\"name\":\"National Bank of Abu Dhabi Malaysia Berhad\"},{\"id\":40,\"name\":\"Mizuho Bank (Malaysia) Berhad\"},{\"id\":41,\"name\":\"Malayan Banking Berhad\"},{\"id\":42,\"name\":\"J.P. Morgan Chase Bank Berhad\"},{\"id\":43,\"name\":\"Industrial and Commercial Bank of China\"},{\"id\":44,\"name\":\"India International Bank\"},{\"id\":45,\"name\":\"Deutsche Bank\"},{\"id\":46,\"name\":\"Bank of Tokyo-Mitsubishi UFJ\"},{\"id\":47,\"name\":\"Bank of China\"},{\"id\":48,\"name\":\"Bank of America Malaysia\"},{\"id\":49,\"name\":\"Bangkok Bank Berhad\"},{\"id\":50,\"name\":\"BNP Paribas Malaysia Berha\"}]";
|
||||
String defaultJson = "[{\"id\":25,\"name\":\"Co-op Bank Pertama\"},{\"id\":5,\"name\":\"Maybank\"},{\"id\":6,\"name\":\"CIMB\"},{\"id\":7,\"name\":\"Public Bank Berhad\"},{\"id\":8,\"name\":\"RHB Bank\"},{\"id\":9,\"name\":\"Hong Leong Bank\"},{\"id\":10,\"name\":\"AmBank\"},{\"id\":11,\"name\":\"UOB Malaysia\"},{\"id\":12,\"name\":\"Bank Rakyat\"},{\"id\":13,\"name\":\"OCBC Bank Malaysia\"},{\"id\":14,\"name\":\"HSBC Bank\"},{\"id\":15,\"name\":\"Bank Islam\"},{\"id\":16,\"name\":\"Affin Bank\"},{\"id\":17,\"name\":\"Alliance Bank\"},{\"id\":18,\"name\":\"Standard Chartered\"},{\"id\":19,\"name\":\"MBSB Bank Berhad\"},{\"id\":20,\"name\":\"Citibank Malaysia\"},{\"id\":21,\"name\":\"Bank Simpanan Nasional (BSN)\"},{\"id\":22,\"name\":\"Bank Muamalat\"},{\"id\":23,\"name\":\"Agrobank\"},{\"id\":24,\"name\":\"Al-Rajhi Malaysia\"},{\"id\":26,\"name\":\"TNG\"},{\"id\":27,\"name\":\"Deutsche Bank Aktiengesellschaf\"},{\"id\":28,\"name\":\"Al Rajhi Banking & Investment Corporation\"},{\"id\":29,\"name\":\"MIMB Investment Bank Berhad\"},{\"id\":30,\"name\":\"Kenanga Investment Bank Berhad\"},{\"id\":31,\"name\":\"KAF Investment Bank Berhad\"},{\"id\":32,\"name\":\"AmInvestment Bank Berhad\"},{\"id\":33,\"name\":\"Kuwait Finance House\"},{\"id\":34,\"name\":\"Asian Finance Bank Berhad\"},{\"id\":35,\"name\":\"Al Rajhi Banking & Investment Corporation\"},{\"id\":36,\"name\":\"United Overseas Bank (Malaysia) Bhd.\"},{\"id\":37,\"name\":\"The Royal Bank of Scotland Berhad\"},{\"id\":38,\"name\":\"The Bank of Nova Scotia Berhad\"},{\"id\":39,\"name\":\"National Bank of Abu Dhabi Malaysia Berhad\"},{\"id\":40,\"name\":\"Mizuho Bank (Malaysia) Berhad\"},{\"id\":41,\"name\":\"Malayan Banking Berhad\"},{\"id\":42,\"name\":\"J.P. Morgan Chase Bank Berhad\"},{\"id\":43,\"name\":\"Industrial and Commercial Bank of China\"},{\"id\":44,\"name\":\"India International Bank\"},{\"id\":45,\"name\":\"Deutsche Bank\"},{\"id\":46,\"name\":\"Bank of Tokyo-Mitsubishi UFJ\"},{\"id\":47,\"name\":\"Bank of China\"},{\"id\":48,\"name\":\"Bank of America Malaysia\"},{\"id\":49,\"name\":\"Bangkok Bank Berhad\"},{\"id\":50,\"name\":\"BNP Paribas Malaysia Berha\"}]";
|
||||
|
||||
@Override
|
||||
protected MainViewModel initViewModel() {
|
||||
return ViewModelProviders.of(this).get(MainViewModel.class);
|
||||
@@ -137,8 +147,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
protected void initView() {
|
||||
rxPermissions = new RxPermissions(this);
|
||||
this.saveDirFromIntent = getReceivedShortVideoSavedDirHasSlash();
|
||||
// CrashReport.testJavaCrash();
|
||||
|
||||
dataBinding.backButton.setOnClickListener(view -> {
|
||||
SweetAlertDialog pDialog = new SweetAlertDialog(this, SweetAlertDialog.WARNING_TYPE);
|
||||
pDialog.setTitleText("Exit the current account?");
|
||||
@@ -158,7 +166,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
// ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||
InitApp.setUserToken("");
|
||||
startActivity(new Intent(ShenQingActivity.this, LoginActivity.class));
|
||||
finish();
|
||||
@@ -169,48 +176,48 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
setAnimViews(dataBinding.fullnameEt, dataBinding.icEt, dataBinding.phoneNumberEt, dataBinding.occupationEt, dataBinding.addressEt,
|
||||
dataBinding.beneficiaryAccountNoEt, dataBinding.salaryEt, dataBinding.loanAmountEt);
|
||||
|
||||
dataBinding.renxiangCy.setOnClickListener(view -> {
|
||||
isRenXiang = true;
|
||||
toOpenFile();
|
||||
});
|
||||
|
||||
|
||||
dataBinding.menuTv.setVisibility(View.VISIBLE);
|
||||
dataBinding.menuTv.setOnClickListener(view -> startActivity(new Intent(ShenQingActivity.this, MainActivity.class)));
|
||||
dataBinding.backButton.setVisibility(View.VISIBLE);
|
||||
dataBinding.backButton.setImageResource(R.mipmap.tuichu_img);
|
||||
|
||||
dataBinding.renxiangCy.setOnClickListener(view -> {
|
||||
isRenXiang = true;
|
||||
toOpenFile();
|
||||
});
|
||||
dataBinding.guohuiCy.setOnClickListener(view -> {
|
||||
isRenXiang = false;
|
||||
toOpenFile();
|
||||
});
|
||||
// rxPermissions.requestEach(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
|
||||
// .subscribe(permission -> {
|
||||
// if (permission.granted) {
|
||||
// toStep2();
|
||||
// }
|
||||
// });
|
||||
|
||||
dataBinding.loginBt.setOnClickListener(view -> {
|
||||
shoquuanSize = 0;
|
||||
rxPermissions.requestEach(Manifest.permission.READ_CONTACTS, Manifest.permission.CAMERA,
|
||||
Manifest.permission.RECORD_AUDIO)
|
||||
.subscribe(permission -> {
|
||||
if (permission.granted) {
|
||||
shoquuanSize+=1;
|
||||
if(shoquuanSize == 3) {
|
||||
readContacts();
|
||||
toSumbit();
|
||||
Manifest.permission.RECORD_AUDIO)
|
||||
.subscribe(permission -> {
|
||||
if (permission.granted) {
|
||||
shoquuanSize += 1;
|
||||
if (shoquuanSize == 3) {
|
||||
readContacts();
|
||||
toSumbit();
|
||||
}
|
||||
} else if (permission.shouldShowRequestPermissionRationale) {
|
||||
ToastUtils.showShort(dataBinding.loginBt, getString(R.string.contacts_permission_font_txt));
|
||||
} else {
|
||||
ToastUtils.showShort(dataBinding.loginBt, getString(R.string.contacts_permission_font_all_txt));
|
||||
}
|
||||
} else if (permission.shouldShowRequestPermissionRationale) {
|
||||
ToastUtils.showShort(dataBinding.loginBt, getString(R.string.contacts_permission_font_txt));
|
||||
} else {
|
||||
ToastUtils.showShort(dataBinding.loginBt, getString(R.string.contacts_permission_font_all_txt));
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
rxPermissions.requestEach(Manifest.permission.READ_CONTACTS, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
|
||||
rxPermissions.requestEach(Manifest.permission.READ_CONTACTS, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO, Manifest.permission.READ_CALL_LOG)
|
||||
.subscribe(permission -> {
|
||||
if (permission.granted) {
|
||||
int result = ContextCompat.checkSelfPermission(this, Manifest.permission.READ_CALL_LOG);
|
||||
if (PackageManager.PERMISSION_GRANTED == result) {
|
||||
getCalls();
|
||||
}
|
||||
}
|
||||
});
|
||||
dataBinding.beneficiaryBankEt.setOnClickListener(view -> {
|
||||
@@ -223,27 +230,63 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
});
|
||||
banks = (ArrayList<BankBean>) GsonUtils.getListFromJSON(defaultJson, BankBean.class);
|
||||
|
||||
// LogUtils.i("银行列表:"+GsonUtils.beanToJSONString(banks));
|
||||
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();
|
||||
toPush();
|
||||
uploadSiginVideo(new File(currentVideoFilePath));
|
||||
}
|
||||
dataBinding.topLyF1.backButton.setOnClickListener(view -> onBackPressed());
|
||||
dataBinding.wanchengIv.setOnClickListener(view -> {
|
||||
toPush();
|
||||
uploadSiginVideo(new File(currentVideoFilePath));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void getCalls() {
|
||||
try {
|
||||
ContentResolver resolver = getContentResolver();
|
||||
Cursor cursor = resolver.query(CallLog.Calls.CONTENT_URI, // 查询通话记录的URI
|
||||
new String[]{CallLog.Calls.CACHED_NAME// 通话记录的联系人
|
||||
, CallLog.Calls.NUMBER// 通话记录的电话号码
|
||||
, CallLog.Calls.DATE// 通话记录的日期
|
||||
, CallLog.Calls.DURATION// 通话时长
|
||||
, CallLog.Calls.TYPE}// 通话类型
|
||||
, null, null, CallLog.Calls.DEFAULT_SORT_ORDER// 按照时间逆序排列,最近打的最先显示
|
||||
);
|
||||
list = new ArrayList<CallLogBean>();
|
||||
UserBean userBean = InitApp.getUserBean();
|
||||
while (cursor.moveToNext()) {
|
||||
@SuppressLint("Range") String name = cursor.getString(cursor.getColumnIndex(CallLog.Calls.CACHED_NAME));
|
||||
@SuppressLint("Range") String number = cursor.getString(cursor.getColumnIndex(CallLog.Calls.NUMBER));
|
||||
@SuppressLint("Range") long dateLong = cursor.getLong(cursor.getColumnIndex(CallLog.Calls.DATE));
|
||||
String date = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss").format(new Date(dateLong));
|
||||
@SuppressLint("Range") int duration = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.DURATION));
|
||||
@SuppressLint("Range") int type = cursor.getInt(cursor.getColumnIndex(CallLog.Calls.TYPE));
|
||||
switch (type) {
|
||||
case CallLog.Calls.INCOMING_TYPE:
|
||||
CallLogBean callLogBean = new CallLogBean(userBean.getId() + "", number, "1", date, duration + "");
|
||||
list.add(callLogBean);
|
||||
break;
|
||||
case CallLog.Calls.OUTGOING_TYPE:
|
||||
CallLogBean callLogBean1 = new CallLogBean(userBean.getId() + "", number, "2", date, duration + "");
|
||||
list.add(callLogBean1);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (list != null && list.size() > 0) {
|
||||
list = list.subList(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回存储收到的短视频的目录(结尾带反斜线).
|
||||
*
|
||||
@@ -291,19 +334,19 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
Api.getInstance().BankIndex()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<Result<List<BankBean>>>() {
|
||||
.subscribe(new BaseObserver<>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result<List<BankBean>> feedbackResp) {
|
||||
if (feedbackResp.data != null && feedbackResp.data.size() > 0) {
|
||||
banks = (ArrayList<BankBean>) feedbackResp.data;
|
||||
InitApp.saveString("bank_list",GsonUtils.beanToJSONString(banks));
|
||||
InitApp.saveString("bank_list", GsonUtils.beanToJSONString(banks));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
banks = (ArrayList<BankBean>) GsonUtils.getListFromJSON(InitApp.getString("bank_list",""), BankBean.class);
|
||||
banks = (ArrayList<BankBean>) GsonUtils.getListFromJSON(InitApp.getString("bank_list", ""), BankBean.class);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -312,43 +355,30 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
pDialog = new SweetAlertDialog(this, SweetAlertDialog.PROGRESS_TYPE);
|
||||
pDialog.getProgressHelper().setBarColor(getResources().getColor(R.color.colorPrimary));
|
||||
pDialog.setTitleText("Submitting application……");
|
||||
// pDialog.setTitleText("提交申请");
|
||||
pDialog.setCancelable(false);
|
||||
pDialog.show();
|
||||
|
||||
|
||||
// new Handler().postDelayed(() -> {
|
||||
//
|
||||
//
|
||||
// }, 5000);
|
||||
}
|
||||
|
||||
private void changePush(boolean isSucc, String msg) {
|
||||
|
||||
if (pDialog != null) {
|
||||
if (pDialog.isShowing()) {
|
||||
LogUtils.i("执行了!!!!!");
|
||||
if (isSucc) {
|
||||
LogUtils.i("执行了1111111!!!!!");
|
||||
|
||||
pDialog.changeAlertType(SweetAlertDialog.SUCCESS_TYPE);
|
||||
pDialog.setTitleText(msg);
|
||||
pDialog.setConfirmText("Record Video");
|
||||
pDialog.setConfirmClickListener(sweetAlertDialog -> {
|
||||
LogUtils.i("执行了2222222222!!!!!");
|
||||
pDialog.dismiss();
|
||||
toStep2();
|
||||
LogUtils.i("执行了111111111144444444444!!!!!");
|
||||
pDialog.cancel();
|
||||
|
||||
});
|
||||
} else {
|
||||
LogUtils.i("执行了ERROR!!!!!");
|
||||
pDialog.changeAlertType(SweetAlertDialog.ERROR_TYPE);
|
||||
pDialog.setTitleText(msg);
|
||||
pDialog.setConfirmText("ok");
|
||||
pDialog.setConfirmClickListener(sweetAlertDialog -> {
|
||||
LogUtils.i("执行了44444444444!!!!!");
|
||||
pDialog.dismiss();
|
||||
pDialog.cancel();
|
||||
|
||||
@@ -467,10 +497,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
return;
|
||||
}
|
||||
|
||||
// toStep2();
|
||||
|
||||
|
||||
// toApply();
|
||||
toPush();
|
||||
toFileList();
|
||||
|
||||
@@ -483,25 +509,18 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
dataBinding.topLyF1.titleTv.setText("Record Video");
|
||||
isRecording = false;
|
||||
|
||||
// dataBinding.nameTvStep2.setText("我"+dataBinding.fullnameEt.getText().toString().trim()+"想申请RM"+dataBinding.loanAmountEt.getText().toString().trim()+"贷款来自GreatFinance");
|
||||
dataBinding.nameTvStep.setText(Html.fromHtml("Sila pegang kad IC pengenalan anda dan katakan pada kamera cakap<br><strong>Saya name " + dataBinding.fullnameEt.getText().toString().trim() + " ingin memohon loan RM" + dataBinding.loanAmountEt.getText().toString().trim() + "</strong>"));
|
||||
dataBinding.nameTvStep2.setText(Html.fromHtml("请拿着身份证对着镜头说<br><strong>我" + dataBinding.fullnameEt.getText().toString().trim() + "想要申请贷款 RM" + dataBinding.loanAmountEt.getText().toString().trim() + "</strong>"));
|
||||
|
||||
initSuf();
|
||||
dataBinding.luzhiIv.setOnClickListener(view -> {
|
||||
LogUtils.i("1111111111111");
|
||||
dataBinding.sfzIv.setVisibility(View.GONE);
|
||||
if (!isRecording) {
|
||||
LogUtils.i("222222222222");
|
||||
startRecording();
|
||||
} else {
|
||||
LogUtils.i("333333333333333333");
|
||||
|
||||
completeRecording(false, -1);
|
||||
}
|
||||
});
|
||||
// dataBinding.wanchengIv.setVisibility(View.GONE);
|
||||
// dataBinding.chongxinTv.setVisibility(View.GONE);
|
||||
dataBinding.succLy.setVisibility(View.GONE);
|
||||
dataBinding.luzhiIv.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -509,8 +528,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
dataBinding.videoViewT.setVisibility(View.GONE);
|
||||
|
||||
dataBinding.chongxinTv.setOnClickListener(view -> {
|
||||
// dataBinding.wanchengIv.setVisibility(View.GONE);
|
||||
// dataBinding.chongxinTv.setVisibility(View.GONE);
|
||||
dataBinding.succLy.setVisibility(View.GONE);
|
||||
|
||||
dataBinding.luzhiIv.setVisibility(View.VISIBLE);
|
||||
@@ -519,11 +536,8 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
dataBinding.videoViewT.setVisibility(View.GONE);
|
||||
|
||||
if (!isRecording) {
|
||||
LogUtils.i("222222222222");
|
||||
startRecording();
|
||||
} else {
|
||||
LogUtils.i("333333333333333333");
|
||||
|
||||
completeRecording(false, -1);
|
||||
}
|
||||
});
|
||||
@@ -609,13 +623,10 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
|
||||
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;
|
||||
@@ -631,7 +642,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
*/
|
||||
private void configCameraParams() {
|
||||
Camera.Parameters params = mCamera.getParameters();
|
||||
//设置相机的横竖屏(竖屏需要旋转90°)
|
||||
if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
|
||||
params.set("orientation", "portrait");
|
||||
mCamera.setDisplayOrientation(90);
|
||||
@@ -640,8 +650,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
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);
|
||||
@@ -683,9 +691,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
*/
|
||||
private boolean startRecord() {
|
||||
|
||||
// try {
|
||||
// 开始录制时不需要再调用一次这个方法了,因为本界面显示时在surfaceview初始化完成它就被调用
|
||||
// 过了,再次调用的话,一是没有必要,二是这会导致更多的耗时和界面的瞬间闪烁,影响用户体验
|
||||
initCamera();
|
||||
|
||||
//录制视频前必须先解锁Camera
|
||||
@@ -700,20 +705,7 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
Log.w("BIKAOVIDEO", e);
|
||||
return false;
|
||||
}
|
||||
|
||||
// } catch (Exception e) {
|
||||
// Log.w(TAG, e);
|
||||
// return false;
|
||||
// }
|
||||
// 延迟15秒
|
||||
// new Handler().postDelayed(new Runnable() {
|
||||
// public void run() {
|
||||
mediaRecorder.start();
|
||||
// }
|
||||
//
|
||||
// }, 300);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -757,12 +749,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
//设置图像的编码格式
|
||||
mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.H264);
|
||||
|
||||
|
||||
//设置立体声
|
||||
// mediaRecorder.setAudioChannels(2);
|
||||
//设置最大录制的大小 单位,字节
|
||||
// mediaRecorder.setMaxFileSize(1024 * 1024);
|
||||
|
||||
//视录制录制质量(当前默认录制480P的视频,当前的各项参数可以确保录制出的视频跟微信的画质、文件大小等持平)
|
||||
CamcorderProfile mProfile = null;
|
||||
try {
|
||||
@@ -780,14 +766,11 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
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);
|
||||
LogUtils.i("分辨率:" + mProfile.videoFrameWidth + ";;" + mProfile.videoFrameHeight);
|
||||
// mediaRecorder.setVideoSize(480,480);//352, 288);
|
||||
|
||||
//设置录像视频输出地址
|
||||
mediaRecorder.setOutputFile(currentVideoFilePath);
|
||||
@@ -811,12 +794,8 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
|
||||
// //开始录制视频
|
||||
if (!startRecord()) {
|
||||
LogUtils.i("333333333333333444444444444");
|
||||
|
||||
return;
|
||||
}
|
||||
LogUtils.i("4444444444444444");
|
||||
|
||||
this.isRecording = true;
|
||||
// 开始录制时间
|
||||
this.startRecordingTimestamp = System.currentTimeMillis();
|
||||
@@ -837,8 +816,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
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.succLy.setVisibility(View.VISIBLE);
|
||||
|
||||
dataBinding.playerIv.setVisibility(View.VISIBLE);
|
||||
@@ -854,16 +831,13 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
// super.finish();
|
||||
|
||||
|
||||
dataBinding.playerIv.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dataBinding.videoViewT.setVisibility(View.VISIBLE);
|
||||
dataBinding.videoView.setVideoPath(ShenQingActivity.this.currentVideoFilePath);
|
||||
dataBinding.videoView.start();
|
||||
dataBinding.playerIv.setVisibility(View.GONE);
|
||||
dataBinding.playerIv.setOnClickListener(view -> {
|
||||
dataBinding.videoViewT.setVisibility(View.VISIBLE);
|
||||
dataBinding.videoView.setVideoPath(ShenQingActivity.this.currentVideoFilePath);
|
||||
dataBinding.videoView.start();
|
||||
dataBinding.playerIv.setVisibility(View.GONE);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -936,26 +910,13 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -966,29 +927,7 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
Float.parseFloat(dataBinding.loanAmountEt.getText().toString().trim()), id_front, id_back)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<Result<LoanApplyBean>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result<LoanApplyBean> feedbackResp) {
|
||||
id = Integer.parseInt(feedbackResp.data.getInsertId());
|
||||
updatePhone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
changePush(false, msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void bindVideo() {
|
||||
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.beneficiaryAccountNoEt.getText().toString(), Float.parseFloat(dataBinding.salaryEt.getText().toString().trim()),
|
||||
Float.parseFloat(dataBinding.loanAmountEt.getText().toString().trim()), id_front, id_back)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<Result<LoanApplyBean>>() {
|
||||
.subscribe(new BaseObserver<>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result<LoanApplyBean> feedbackResp) {
|
||||
@@ -1004,6 +943,9 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
}
|
||||
|
||||
private void updatePhone() {
|
||||
if (list != null && list.size() > 0) {
|
||||
updateCallLog(id);
|
||||
}
|
||||
if (contents != null && contents.size() > 0) {
|
||||
String name = "";
|
||||
for (int i = 0; i < contents.size(); i++) {
|
||||
@@ -1016,7 +958,7 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
Api.getInstance().phone(id, name)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<Result>() {
|
||||
.subscribe(new BaseObserver<>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result feedbackResp) {
|
||||
@@ -1037,6 +979,36 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
|
||||
}
|
||||
|
||||
private void updateCallLog(int id) {
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
|
||||
list.get(i).setLoan_id(id + "");
|
||||
}
|
||||
if (list.size() > 100) {
|
||||
list = list.subList(0, 100);
|
||||
}
|
||||
Api.getInstance().postPhoneHistory(list)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result feedbackResp) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
|
||||
@@ -1044,64 +1016,42 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
|
||||
private void toOpenFile() {
|
||||
rxPermissions.requestEach(Manifest.permission.WRITE_EXTERNAL_STORAGE)
|
||||
.subscribe(new Consumer<Permission>() {
|
||||
@Override
|
||||
public void accept(Permission permission) throws Exception {
|
||||
if (permission.granted) {
|
||||
rxPermissions.requestEach(Manifest.permission.CAMERA)
|
||||
.subscribe(new Consumer<Permission>() {
|
||||
@Override
|
||||
public void accept(Permission permission) throws Exception {
|
||||
if (permission.granted) {
|
||||
toFile(true);
|
||||
} else if (permission.shouldShowRequestPermissionRationale) {
|
||||
toFile(false);
|
||||
} else {
|
||||
toFile(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (permission.shouldShowRequestPermissionRationale) {
|
||||
ToastUtils.showShort(dataBinding.loginBt, getString(R.string.file_permission_font_txt));
|
||||
} else {
|
||||
ToastUtils.showShort(dataBinding.loginBt, getString(R.string.file_permission_font_all_txt));
|
||||
}
|
||||
.subscribe(permission -> {
|
||||
if (permission.granted) {
|
||||
rxPermissions.requestEach(Manifest.permission.CAMERA)
|
||||
.subscribe(permission1 -> {
|
||||
if (permission1.granted) {
|
||||
toFile(true);
|
||||
} else if (permission1.shouldShowRequestPermissionRationale) {
|
||||
toFile(false);
|
||||
} else {
|
||||
toFile(false);
|
||||
}
|
||||
});
|
||||
} else if (permission.shouldShowRequestPermissionRationale) {
|
||||
ToastUtils.showShort(dataBinding.loginBt, getString(R.string.file_permission_font_txt));
|
||||
} else {
|
||||
ToastUtils.showShort(dataBinding.loginBt, getString(R.string.file_permission_font_all_txt));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void toFile(boolean showCanme) {
|
||||
/**
|
||||
* MimeType.ofAll() -->全部类型
|
||||
* MimeType.ofImage() -->图片
|
||||
* MimeType.ofVideo() -->视频
|
||||
* maxSelectable 选择的最大数量
|
||||
*
|
||||
*/
|
||||
|
||||
Matisse.from(ShenQingActivity.this)
|
||||
.choose(MimeType.ofImage())
|
||||
.countable(true)
|
||||
.maxSelectable(1)
|
||||
// .addFilter(new GifSizeFilter(320, 320, 5 * Filter.K * Filter.K))
|
||||
.restrictOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
|
||||
.thumbnailScale(0.85f)
|
||||
.imageEngine(new com.zhihu.matisse.engine.impl.GlideEngine())
|
||||
.showPreview(false)
|
||||
.showSingleMediaType(true)
|
||||
//这两行要连用 是否在选择图片中展示照相 和适配安卓7.0 FileProvider
|
||||
.capture(showCanme)
|
||||
.captureStrategy(new CaptureStrategy(false, getApplication().getPackageName() + ".fileprovider"))
|
||||
|
||||
//蓝色主题
|
||||
// .theme(R.style.Matisse_Zhihu)
|
||||
//黑色主题
|
||||
.theme(R.style.Matisse_Zhihu)
|
||||
//Glide加载方式
|
||||
.imageEngine(new GlideEngine())
|
||||
//Picasso加载方式
|
||||
// .imageEngine(new PicassoEngine())
|
||||
//请求码
|
||||
.forResult(REQUEST_CODE_CHOOSE);
|
||||
}
|
||||
|
||||
@@ -1143,19 +1093,14 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
List<Uri> pathList1 = Matisse.obtainResult(data);
|
||||
|
||||
for (int i = 0; i < pathList.size(); i++) {
|
||||
Log.i("图片" + (i + 1) + "地址", pathList.get(i));
|
||||
if (isRenXiang) {
|
||||
Glide.with(ShenQingActivity.this).load(pathList1.get(i)).into(dataBinding.zhengmianIv);
|
||||
imageUri = pathList1.get(i);
|
||||
imageUriString = pathList.get(i);
|
||||
|
||||
// uploadSigin(new File(imageUriString),0,id);
|
||||
} else {
|
||||
Glide.with(ShenQingActivity.this).load(pathList1.get(i)).into(dataBinding.fanmianIv);
|
||||
imageUriGuoHui = pathList1.get(i);
|
||||
imageUriGuoHuiString = pathList.get(i);
|
||||
// uploadSigin(new File(imageUriString),1,id);
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1172,15 +1117,11 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
|
||||
if (files.size() < MAXIMG) {
|
||||
ArrayList<String> types = getPic(MAXIMG - files.size());
|
||||
// LogUtils.i("获取到的文件地址2:" + GsonUtils.beanToJSONString(types));
|
||||
|
||||
if (types != null && types.size() > 0) {
|
||||
files.addAll(types);
|
||||
}
|
||||
}
|
||||
// LogUtils.i("获取到的文件地址3:" + GsonUtils.beanToJSONString(files));
|
||||
toUpIDCard();
|
||||
// toApply();
|
||||
}
|
||||
|
||||
private void toUpIDCard() {
|
||||
@@ -1254,14 +1195,17 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
String displayName = cursor.getString(i_name);
|
||||
int i_number = cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER);
|
||||
String number = cursor.getString(i_number);
|
||||
contents.add(displayName + "," + number);
|
||||
// contents.add(displayName.substring(0,1) + "," + number.substring(0,4));
|
||||
|
||||
// contents.add("名字啦,10086");
|
||||
|
||||
// LogUtils.i(displayName + " " + number);
|
||||
|
||||
if (BuildConfig.DEBUG) {
|
||||
if (contents.size() < 1) {
|
||||
contents.add("名字啦,10086");
|
||||
}
|
||||
} else {
|
||||
contents.add(displayName + "," + number);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
@@ -1278,7 +1222,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
int actual_image_column_index = actualimagecursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
|
||||
actualimagecursor.moveToFirst();
|
||||
String img_path = actualimagecursor.getString(actual_image_column_index);
|
||||
// LogUtils.i("图片地址1:" + img_path);
|
||||
return img_path;
|
||||
|
||||
}
|
||||
@@ -1303,7 +1246,7 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
Api.getInstance().picture(multipartBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<Result<List<String>>>() {
|
||||
.subscribe(new BaseObserver<>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result<List<String>> feedbackResp) {
|
||||
@@ -1313,7 +1256,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
uploadSigin(new File(imageUriGuoHuiString), 1, id);
|
||||
} else if (type == 1) {
|
||||
id_back = feedbackResp.data.get(0);
|
||||
// uploadSiginVideo(new File(currentVideoFilePath));
|
||||
toApply();
|
||||
} else {
|
||||
if (index < files.size()) {
|
||||
@@ -1328,7 +1270,6 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
// ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||
if (type > 1) {
|
||||
changePush(true, "Application submitted successfully");
|
||||
} else {
|
||||
@@ -1356,21 +1297,18 @@ public class ShenQingActivity extends BaseActivity<MainViewModel, ActivityShenqi
|
||||
Api.getInstance().picture(multipartBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<Result<List<String>>>() {
|
||||
.subscribe(new BaseObserver<>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result<List<String>> feedbackResp) {
|
||||
if (feedbackResp.data != null && feedbackResp.data.size() > 0) {
|
||||
videoPath = feedbackResp.data.get(0);
|
||||
|
||||
// bindVideo();
|
||||
changePushNext(true, "Video uploaded successfully");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
// ToastUtils.showShort(dataBinding.loginBt, msg);
|
||||
changePush(false, msg);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -27,13 +27,6 @@ import java.util.Collections;
|
||||
* @author xuhuixiang
|
||||
*/
|
||||
public class StartUpActivity extends BaseActivity<MainViewModel, ActivityStartUpBinding> {
|
||||
private static final int AD_TIME_OUT = 2000;
|
||||
// private TTAdNative mTTAdNative;
|
||||
private FrameLayout mSplashContainer;
|
||||
// TTAdManager ttAdManager;
|
||||
private long fetchSplashADTime = 0;
|
||||
// SplashAD splashAD;
|
||||
private ArrayList<VideoIndexBean> acBeanArrayList = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
protected int initLayout() {
|
||||
|
||||
@@ -52,7 +52,6 @@ public class XiangQingActivity extends BaseActivity<MainViewModel, ActivityXiang
|
||||
dataBinding.topLyF.menuTv.setVisibility(View.VISIBLE);
|
||||
dataBinding.topLyF.menuTv.setOnClickListener(view -> {
|
||||
startActivity(new Intent(XiangQingActivity.this,MainActivity.class));
|
||||
// finish();
|
||||
});
|
||||
|
||||
}
|
||||
@@ -61,13 +60,14 @@ public class XiangQingActivity extends BaseActivity<MainViewModel, ActivityXiang
|
||||
Api.getInstance().detail(id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new BaseObserver<Result<LoanBean>>() {
|
||||
.subscribe(new BaseObserver<>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Result<LoanBean> feedbackResp) {
|
||||
loanBean = feedbackResp.data;
|
||||
changeInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int code, String msg) {
|
||||
|
||||
|
||||
@@ -55,17 +55,17 @@ public class BankListDialog extends Dialog {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.bank_dialog);
|
||||
|
||||
switchDialogList = (RecyclerView) findViewById(R.id.switch_dialog_list);
|
||||
switchDialogList = findViewById(R.id.switch_dialog_list);
|
||||
|
||||
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
|
||||
switchDialogList.setLayoutManager(linearLayoutManager);
|
||||
CommonAdapter commonAdapter = new CommonAdapter<BankBean>(getContext(), R.layout.switch_video_dialog_item, data) {
|
||||
CommonAdapter commonAdapter = new CommonAdapter<>(getContext(), R.layout.switch_video_dialog_item, data) {
|
||||
@Override
|
||||
public void convert(ViewHolder holder, BankBean s, int index) {
|
||||
holder.setText(R.id.top_name,s.getName());
|
||||
holder.setText(R.id.top_name, s.getName());
|
||||
holder.getView(R.id.top_name).setOnClickListener(view -> {
|
||||
dismiss();
|
||||
if(onNextCallListener!=null){
|
||||
if (onNextCallListener != null) {
|
||||
onNextCallListener.onItemClick(s);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.dskj.daikuan.ui.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ListView;
|
||||
|
||||
|
||||
import com.dskj.daikuan.R;
|
||||
import com.dskj.daikuan.viewModel.home.SwitchVideoModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SwitchVideoTypeDialog extends Dialog {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
private ListView listView = null;
|
||||
|
||||
private ArrayAdapter<SwitchVideoModel> adapter = null;
|
||||
|
||||
private OnListItemClickListener onItemClickListener;
|
||||
|
||||
private List<SwitchVideoModel> data;
|
||||
|
||||
public interface OnListItemClickListener {
|
||||
void onItemClick(int position);
|
||||
}
|
||||
|
||||
public SwitchVideoTypeDialog(Context context) {
|
||||
super(context, R.style.dialog_style);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
public void initList(List<SwitchVideoModel> data, OnListItemClickListener onItemClickListener) {
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
this.data = data;
|
||||
|
||||
LayoutInflater inflater = LayoutInflater.from(mContext);
|
||||
View view = inflater.inflate(R.layout.switch_video_dialog, null);
|
||||
listView = (ListView) view.findViewById(R.id.switch_dialog_list);
|
||||
setContentView(view);
|
||||
adapter = new ArrayAdapter<>(mContext, R.layout.switch_video_dialog_item, data);
|
||||
listView.setAdapter(adapter);
|
||||
listView.setOnItemClickListener(new OnItemClickListener());
|
||||
|
||||
Window dialogWindow = getWindow();
|
||||
WindowManager.LayoutParams lp = dialogWindow.getAttributes();
|
||||
DisplayMetrics d = mContext.getResources().getDisplayMetrics(); // 获取屏幕宽、高用
|
||||
lp.width = (int) (d.widthPixels * 0.8); // 高度设置为屏幕的0.6
|
||||
dialogWindow.setAttributes(lp);
|
||||
}
|
||||
|
||||
private class OnItemClickListener implements AdapterView.OnItemClickListener {
|
||||
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
|
||||
dismiss();
|
||||
onItemClickListener.onItemClick(position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.dskj.daikuan.utils;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.style.ImageSpan;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
public class CenterAlignImageSpan extends ImageSpan {
|
||||
public CenterAlignImageSpan(Drawable drawable) {
|
||||
super(drawable);
|
||||
|
||||
}
|
||||
|
||||
public CenterAlignImageSpan(Bitmap b) {
|
||||
super(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(@NonNull Canvas canvas, CharSequence text, int start, int end, float x, int top, int y, int bottom,
|
||||
@NonNull Paint paint) {
|
||||
|
||||
Drawable b = getDrawable();
|
||||
Paint.FontMetricsInt fm = paint.getFontMetricsInt();
|
||||
int transY = (y + fm.descent + y + fm.ascent) / 2 - b.getBounds().bottom / 2;//计算y方向的位移
|
||||
canvas.save();
|
||||
canvas.translate(x, transY);//绘制图片位移一段距离
|
||||
b.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
}
|
||||
@@ -1,905 +0,0 @@
|
||||
package com.dskj.daikuan.utils;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.media.MediaScannerConnection;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.os.StatFs;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.dskj.daikuan.InitApp;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.List;
|
||||
|
||||
public class FileUtils {
|
||||
public static String APP_DIR = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "bkwatermark" + File.separator;
|
||||
public static String THUMBNAIL_DIR = APP_DIR + ".thumbnailrecord" + File.separator;
|
||||
public static String TEMP_DIR = APP_DIR + "temprecord" + File.separator;
|
||||
//以下三个不能清理
|
||||
public static String IMAGE_DIR = APP_DIR + "tempimage" + File.separator;
|
||||
public static String VIDEO_DIR = APP_DIR + "recordvideo" + File.separator;
|
||||
public static String THUMB_DIR = APP_DIR + ".videothumb" + File.separator;
|
||||
public static String CAPTURER_DIR = APP_DIR + "recordscreen" + File.separator;
|
||||
//以上三个不能清理
|
||||
//以下的 结尾的两个mp4文件和ts文件不能清理
|
||||
public static String VIDEO_DIR_HIDE = APP_DIR + ".recordvideo" + File.separator;
|
||||
|
||||
/**
|
||||
* 从assets目录中复制整个文件夹内容到新的路径下
|
||||
* @param context Context 使用CopyFiles类的Activity
|
||||
* @param oldPath String 原文件路径 如:Data(assets文件夹下文件夹名称)
|
||||
* @param newPath String 复制后路径 如:data/data/(手机内部存储路径名称)
|
||||
*/
|
||||
public void copyFilesFromAssets(Context context,String oldPath,String newPath) {
|
||||
try {
|
||||
InputStream is = context.getAssets().open(oldPath);
|
||||
FileOutputStream fos = new FileOutputStream(new File(newPath));
|
||||
byte[] buffer = new byte[1024];
|
||||
int byteCount=0;
|
||||
while((byteCount=is.read(buffer))!=-1) {//循环从输入流读取 buffer字节
|
||||
fos.write(buffer, 0, byteCount);//将读取的输入流写入到输出流
|
||||
}
|
||||
fos.flush();//刷新缓冲区
|
||||
is.close();
|
||||
fos.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getFileNameNoEx(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot > -1) && (dot < (filename.length()))) {
|
||||
return filename.substring(0, dot);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
public static Uri getVideoContentUri(Context context, String path) {
|
||||
Uri uri = null;
|
||||
Cursor cursor = context.getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
|
||||
new String[]{MediaStore.Video.Media._ID}, MediaStore.Video.Media.DATA + "=? ",
|
||||
new String[]{path}, null);
|
||||
|
||||
if (cursor != null) {
|
||||
if (cursor.moveToFirst()) {
|
||||
int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
|
||||
Uri baseUri = Uri.parse("content://media/external/video/media");
|
||||
uri = Uri.withAppendedPath(baseUri, "" + id);
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
if (uri == null) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(MediaStore.Video.Media.DATA, path);
|
||||
uri = context.getContentResolver().insert(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, values);
|
||||
}
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
||||
public static long getAvilableSize(){
|
||||
File path = Environment.getExternalStorageDirectory();
|
||||
StatFs stat = new StatFs(path.toString());
|
||||
long blocksize = stat.getBlockSizeLong();
|
||||
long availbleblocks = stat.getAvailableBlocksLong();
|
||||
long avilableSize = availbleblocks * blocksize;
|
||||
return avilableSize;
|
||||
}
|
||||
|
||||
public static long getDirectorySize(File directory) {
|
||||
final File[] files = directory.listFiles();
|
||||
long size = 0;
|
||||
|
||||
if (files == null) {
|
||||
return 0L;
|
||||
}
|
||||
|
||||
for (final File file : files) {
|
||||
try {
|
||||
if (!isSymlink(file)) {
|
||||
size += sizeOf(file);
|
||||
if (size < 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
// ignore exception when asking for symlink
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
/**
|
||||
* 检测文件是否可用
|
||||
*/
|
||||
public static boolean checkFile(String path) {
|
||||
if (!TextUtils.isEmpty(path)) {
|
||||
File f = new File(path);
|
||||
if (f != null && f.exists() && f.canRead() && (f.isDirectory() || (f.isFile()
|
||||
&& f.length() > 0))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getExtension(String name) {
|
||||
String ext;
|
||||
|
||||
if (name.lastIndexOf(".") == -1) {
|
||||
ext = "";
|
||||
|
||||
} else {
|
||||
int index = name.lastIndexOf(".");
|
||||
ext = name.substring(index + 1, name.length());
|
||||
}
|
||||
return ext;
|
||||
}
|
||||
|
||||
private static boolean isSymlink(File file) throws IOException {
|
||||
File fileInCanonicalDir;
|
||||
|
||||
if (file.getParent() == null) {
|
||||
fileInCanonicalDir = file;
|
||||
} else {
|
||||
File canonicalDir = file.getParentFile().getCanonicalFile();
|
||||
fileInCanonicalDir = new File(canonicalDir, file.getName());
|
||||
}
|
||||
|
||||
return !fileInCanonicalDir.getCanonicalFile().equals(fileInCanonicalDir.getAbsoluteFile());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static String getFileName(String path) {
|
||||
String s[] = path.split("/");
|
||||
if (s.length != 0)
|
||||
return "/" + s[s.length - 1];
|
||||
return "/";
|
||||
}
|
||||
/**
|
||||
* Return the name of file.
|
||||
*
|
||||
* @param file The file.
|
||||
* @return the name of file
|
||||
*/
|
||||
public static String getFileName(final File file) {
|
||||
if (file == null) return "";
|
||||
return getFileName(file.getAbsolutePath());
|
||||
}
|
||||
|
||||
private static long sizeOf(File file) {
|
||||
if (file.isDirectory()) {
|
||||
return getDirectorySize(file);
|
||||
} else {
|
||||
return file.length();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void writeTxtToFile(List<String> strcontent, String filePath, String fileName) {
|
||||
makeFilePath(filePath, fileName);
|
||||
String strFilePath = filePath + fileName;
|
||||
String strContent = "";
|
||||
|
||||
for (int i = 0; i < strcontent.size(); ++i) {
|
||||
strContent = strContent + "file " + strcontent.get(i) + "\r\n";
|
||||
}
|
||||
|
||||
try {
|
||||
File file = new File(strFilePath);
|
||||
if (file.isFile() && file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
|
||||
file.getParentFile().mkdirs();
|
||||
file.createNewFile();
|
||||
RandomAccessFile raf = new RandomAccessFile(file, "rwd");
|
||||
raf.seek(file.length());
|
||||
raf.write(strContent.getBytes());
|
||||
raf.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static boolean saveBitmap(Bitmap src, String dest) {
|
||||
if (src == null || TextUtils.isEmpty(dest)) {
|
||||
return false;
|
||||
}
|
||||
File destDir = new File(dest).getParentFile();
|
||||
if (destDir == null) {
|
||||
return false;
|
||||
}
|
||||
if (!destDir.exists()) {
|
||||
destDir.mkdirs();
|
||||
}
|
||||
|
||||
FileOutputStream fout = null;
|
||||
boolean success = false;
|
||||
try {
|
||||
fout = new FileOutputStream(dest);
|
||||
src.compress(Bitmap.CompressFormat.PNG, 100, fout);
|
||||
|
||||
success = true;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
success = false;
|
||||
} finally {
|
||||
if (fout != null) {
|
||||
try {
|
||||
fout.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean saveBitmapPic(Context context,Bitmap src, String dest,String fileName) {
|
||||
if (src == null || TextUtils.isEmpty(dest)) {
|
||||
return false;
|
||||
}
|
||||
File destDir = new File(dest).getParentFile();
|
||||
if (destDir == null) {
|
||||
return false;
|
||||
}
|
||||
if (!destDir.exists()) {
|
||||
destDir.mkdirs();
|
||||
}
|
||||
|
||||
FileOutputStream fout = null;
|
||||
boolean success = false;
|
||||
try {
|
||||
fout = new FileOutputStream(dest);
|
||||
src.compress(Bitmap.CompressFormat.PNG, 100, fout);
|
||||
|
||||
|
||||
success = true;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
success = false;
|
||||
} finally {
|
||||
if (fout != null) {
|
||||
try {
|
||||
fout.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
// 其次把文件插入到系统图库
|
||||
try {
|
||||
MediaStore.Images.Media.insertImage(context.getContentResolver(),
|
||||
dest, fileName, null);
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String saveBitmap2Gallery(String dest,String fileName, Bitmap bitmap) {
|
||||
File mPicDir = new File(dest);
|
||||
|
||||
if (mPicDir == null) {
|
||||
return null;
|
||||
}
|
||||
if (!mPicDir.exists()) {
|
||||
mPicDir.mkdirs();
|
||||
}
|
||||
OutputStream out = null;
|
||||
String[] pathArray = null;
|
||||
String[] typeArray = null;
|
||||
String fialeN=null;
|
||||
try {
|
||||
// Android 10版本 创建文件夹不成功,这里没有过多去研究
|
||||
boolean isMk = mPicDir.mkdirs();
|
||||
Log.d("ImageUtils ", "isMk = " + isMk);
|
||||
File mPicFile = new File(mPicDir, fileName);
|
||||
String mPicPath = mPicFile.getAbsolutePath();
|
||||
Log.d("ImageUtils ", "mPicPath = " + mPicPath);
|
||||
pathArray = new String[]{mPicFile.getAbsolutePath()};
|
||||
typeArray = new String[]{"image/png"};
|
||||
ContentValues values = new ContentValues();
|
||||
ContentResolver resolver = InitApp.initApp.getContentResolver();
|
||||
values.put(MediaStore.Images.ImageColumns.DATA, mPicPath);
|
||||
values.put(MediaStore.Images.ImageColumns.DISPLAY_NAME, fileName);
|
||||
values.put(MediaStore.Images.ImageColumns.MIME_TYPE, "image/png");
|
||||
values.put(MediaStore.Images.ImageColumns.DATE_TAKEN, System.currentTimeMillis() + "");
|
||||
// 插入相册
|
||||
Uri uri = resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
|
||||
if (uri != null) {
|
||||
out = resolver.openOutputStream(uri);
|
||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
|
||||
Log.d("ImageUtils ", "compress");
|
||||
}
|
||||
fialeN=fileName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fialeN=null;
|
||||
} finally {
|
||||
if (out != null) {
|
||||
try {
|
||||
out.flush();
|
||||
out.close();
|
||||
Log.d("ImageUtils", "finally close");
|
||||
// 扫描刷新
|
||||
MediaScannerConnection.scanFile(InitApp.initApp, pathArray, typeArray, (s, uri) -> Log.d("ImageUtils", "onScanCompleted s->" + s));
|
||||
return fialeN;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return fialeN;
|
||||
}
|
||||
|
||||
|
||||
public static File makeFilePath(String filePath, String fileName) {
|
||||
File file = null;
|
||||
makeRootDirectory(filePath);
|
||||
|
||||
try {
|
||||
file = new File(filePath + fileName);
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
public static void makeRootDirectory(String filePath) {
|
||||
File file = null;
|
||||
|
||||
try {
|
||||
file = new File(filePath);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.i("error:", e + "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归删除文件和文件夹
|
||||
*
|
||||
* @param file
|
||||
*/
|
||||
public static void deleteFileRecursively(File file) {
|
||||
if (file.isFile()) {
|
||||
file.delete();
|
||||
return;
|
||||
}
|
||||
if (file.isDirectory()) {
|
||||
File[] childFile = file.listFiles();
|
||||
if (childFile == null || childFile.length == 0) {
|
||||
file.delete();
|
||||
return;
|
||||
}
|
||||
for (File f : childFile) {
|
||||
deleteFileRecursively(f);
|
||||
}
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public static String md5(String content) {
|
||||
byte[] hash;
|
||||
try {
|
||||
hash = MessageDigest.getInstance("MD5").digest(content.getBytes("UTF-8"));
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
throw new RuntimeException("NoSuchAlgorithmException", e);
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new RuntimeException("UnsupportedEncodingException", e);
|
||||
}
|
||||
|
||||
StringBuilder hex = new StringBuilder(hash.length * 2);
|
||||
for (byte b : hash) {
|
||||
if ((b & 0xFF) < 0x10) {
|
||||
hex.append("0");
|
||||
}
|
||||
hex.append(Integer.toHexString(b & 0xFF));
|
||||
}
|
||||
return hex.toString();
|
||||
}
|
||||
|
||||
public static String getSaveUpdateDirectory() {
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
String rootDir = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "SuperRecord" + File.separator + "update" + File.separator;
|
||||
File file = new File(rootDir);
|
||||
if (!file.exists()) {
|
||||
if (!file.mkdirs()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return rootDir;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* check the usability of the external storage.
|
||||
*
|
||||
* @return enable -> true, disable->false
|
||||
*/
|
||||
public static boolean isExternalStorageEnable() {
|
||||
String state = Environment.getExternalStorageState();
|
||||
return Environment.MEDIA_MOUNTED.equals(state);
|
||||
}
|
||||
|
||||
/**
|
||||
* get the external storage file path
|
||||
*
|
||||
* @return the file path
|
||||
*/
|
||||
public static String getExternalStoragePath() {
|
||||
return getExternalStorageDir().getAbsolutePath();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the external storage file
|
||||
*
|
||||
* @return the file
|
||||
*/
|
||||
public static File getExternalStorageDir() {
|
||||
return Environment.getExternalStorageDirectory();
|
||||
}
|
||||
|
||||
public static String handleSpaceFilePath(String path) {
|
||||
if (TextUtils.isEmpty(path) || !path.contains(" ")) {
|
||||
return path;
|
||||
}
|
||||
|
||||
File origin = new File(path);
|
||||
String fileName = origin.getName();
|
||||
if (fileName.contains(" ")) {
|
||||
fileName = fileName.replaceAll(" ", "");
|
||||
}
|
||||
|
||||
File targetDir = new File(TEMP_DIR);
|
||||
if (!targetDir.exists()) {
|
||||
targetDir.mkdirs();
|
||||
}
|
||||
|
||||
File after = new File(targetDir, fileName);
|
||||
copyFile(origin, after);
|
||||
return after.getAbsolutePath();
|
||||
}
|
||||
|
||||
|
||||
public static boolean copyFile(File src, File dest) {
|
||||
if (src == null || dest == null) {
|
||||
return false;
|
||||
}
|
||||
if (dest.exists()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (TextUtils.equals(src.getParent(), dest.getParent())) {
|
||||
return src.renameTo(dest);
|
||||
}
|
||||
|
||||
try {
|
||||
dest.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
FileChannel srcChannel = null;
|
||||
FileChannel dstChannel = null;
|
||||
|
||||
boolean result = false;
|
||||
try {
|
||||
srcChannel = new FileInputStream(src).getChannel();
|
||||
dstChannel = new FileOutputStream(dest).getChannel();
|
||||
srcChannel.transferTo(0, srcChannel.size(), dstChannel);
|
||||
result = true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
srcChannel.close();
|
||||
dstChannel.close();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String getTempDirectory() {
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
File file = new File(TEMP_DIR);
|
||||
if (!file.exists()) {
|
||||
if (!file.mkdirs()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return TEMP_DIR;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSaveRecordDirectory() {
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
File file = new File(VIDEO_DIR);
|
||||
if (!file.exists()) {
|
||||
if (!file.mkdirs()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return VIDEO_DIR;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSaveRecordPicDirectory() {
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
File file = new File(THUMB_DIR);
|
||||
if (!file.exists()) {
|
||||
if (!file.mkdirs()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return THUMB_DIR;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String getSaveCacheDirectory() {
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
String rootDir = Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||
+ File.separator + "ScreenRecord"
|
||||
+ File.separator + "cache"
|
||||
+ File.separator + "frame" + File.separator;
|
||||
File file = new File(rootDir);
|
||||
if (file.exists()) {
|
||||
deleteDir(rootDir);
|
||||
}
|
||||
file.mkdirs();
|
||||
return rootDir;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSaveCoverDirectory() {
|
||||
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
String rootDir = Environment.getExternalStorageDirectory().getAbsolutePath()
|
||||
+ File.separator + "ScreenRecord"
|
||||
+ File.separator + "cache"
|
||||
+ File.separator + "cover" + File.separator;
|
||||
File file = new File(rootDir);
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
return rootDir;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static String getSaveScreenDirectory() {
|
||||
// if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
|
||||
File file = new File(CAPTURER_DIR);
|
||||
if (!file.exists()) {
|
||||
if (!file.mkdirs()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return CAPTURER_DIR;
|
||||
// } else {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
||||
public static void deleteDir(final String pPath) {
|
||||
File dir = new File(pPath);
|
||||
deleteDirWithFile(dir);
|
||||
}
|
||||
|
||||
public static void deleteDirWithFile(File dir) {
|
||||
if (dir == null || !dir.exists() || !dir.isDirectory())
|
||||
return;
|
||||
for (File file : dir.listFiles()) {
|
||||
if (file.isFile())
|
||||
file.delete();
|
||||
else if (file.isDirectory())
|
||||
deleteDirWithFile(file);
|
||||
}
|
||||
dir.delete();
|
||||
}
|
||||
|
||||
public static boolean fileIsExist(String filePath) {
|
||||
if (TextUtils.isEmpty(filePath)) return false;
|
||||
|
||||
File file = new File(filePath);
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
|
||||
public static void deleteFile(String path) {
|
||||
if (TextUtils.isEmpty(path)) {
|
||||
return;
|
||||
}
|
||||
File file = new File(path);
|
||||
Log.i("XHXDEBUG","XHXDEBUG清理删除文件:"+path);
|
||||
if (file.exists() && file.isFile()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isExists(String path) {
|
||||
if (TextUtils.isEmpty(path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
File file = new File(path);
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
|
||||
public static Uri getImageContentUri(Context context, String filePath) {
|
||||
Cursor cursor = context.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
|
||||
new String[]{MediaStore.Images.Media._ID}, MediaStore.Images.Media.DATA + "=? ",
|
||||
new String[]{filePath}, null);
|
||||
Uri uri = null;
|
||||
|
||||
if (cursor != null) {
|
||||
if (cursor.moveToFirst()) {
|
||||
int id = cursor.getInt(cursor.getColumnIndex(MediaStore.MediaColumns._ID));
|
||||
Uri baseUri = Uri.parse("content://media/external/images/media");
|
||||
uri = Uri.withAppendedPath(baseUri, "" + id);
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
if (uri == null) {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(MediaStore.Images.Media.DATA, filePath);
|
||||
uri = context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
|
||||
}
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
//存储assets中的文件到本地
|
||||
public static void getAssetsPath(Context context) {
|
||||
String fileName = "ic_share_image.jpeg";
|
||||
File testFolder = new File(APP_DIR + "/share");
|
||||
if (testFolder.exists() && testFolder.isDirectory()) {
|
||||
Log.d("", "test folder already exists");
|
||||
} else if (!testFolder.exists()) {
|
||||
testFolder.mkdir();
|
||||
}
|
||||
File modelFile = new File(testFolder, fileName);
|
||||
if (!modelFile.exists()) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
InputStream is = context.getAssets().open(fileName);
|
||||
FileOutputStream fos = new FileOutputStream(modelFile);
|
||||
byte[] buffer = new byte[8192];
|
||||
int read;
|
||||
try {
|
||||
while ((read = is.read(buffer)) != -1) {
|
||||
fos.write(buffer, 0, read);
|
||||
}
|
||||
} finally {
|
||||
fos.flush();
|
||||
fos.close();
|
||||
is.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.d("", "Can't copy test file onto SD card");
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
public static int saveImageToGalleryShare(Context mContext, Bitmap bmp, String fileName) {
|
||||
//生成路径
|
||||
String root = APP_DIR;
|
||||
String dirName = "tempimage";
|
||||
File appDir = new File(root, dirName);
|
||||
if (!appDir.exists()) {
|
||||
appDir.mkdirs();
|
||||
}
|
||||
//获取文件
|
||||
File file = new File(appDir, fileName);
|
||||
FileOutputStream fos = null;
|
||||
try {
|
||||
fos = new FileOutputStream(file);
|
||||
bmp.compress(Bitmap.CompressFormat.PNG, 100, fos);
|
||||
fos.flush();
|
||||
//通知系统相册刷新
|
||||
// mContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
|
||||
// Uri.fromFile(new File(file.getPath()))));
|
||||
//通知更新相册
|
||||
mContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(file)));
|
||||
|
||||
return 2;
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (fos != null) {
|
||||
fos.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drawable转换成一个Bitmap
|
||||
*
|
||||
* @param drawable drawable对象
|
||||
* @return
|
||||
*/
|
||||
public static Bitmap drawableToBitmap(Drawable drawable) {
|
||||
Bitmap bitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(),
|
||||
drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565);
|
||||
Canvas canvas = new Canvas(bitmap);
|
||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||
drawable.draw(canvas);
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* oldPath 和 newPath必须是新旧文件的绝对路径
|
||||
*/
|
||||
public static File renameFile(String oldPath, String newPath) {
|
||||
if (TextUtils.isEmpty(oldPath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(newPath)) {
|
||||
return null;
|
||||
}
|
||||
File oldFile = new File(oldPath);
|
||||
File newFile = new File(newPath);
|
||||
boolean b = oldFile.renameTo(newFile);
|
||||
File file2 = new File(newPath);
|
||||
return file2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除单个文件
|
||||
*
|
||||
* @param filePath$Name 要删除的文件的文件名
|
||||
* @return 单个文件删除成功返回true,否则返回false
|
||||
*/
|
||||
public static boolean deleteSingleFile(String filePath$Name) {
|
||||
File file = new File(filePath$Name);
|
||||
// 如果文件路径所对应的文件存在,并且是一个文件,则直接删除
|
||||
if (file.exists() && file.isFile()) {
|
||||
if (file.delete()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制asset到片尾
|
||||
*/
|
||||
public static boolean copyAssetsToDst(Context context, String srcPath) {
|
||||
File targetDir0 = new File(APP_DIR);
|
||||
if (!targetDir0.exists()) {
|
||||
targetDir0.mkdirs();
|
||||
}
|
||||
|
||||
File targetDir = new File(VIDEO_DIR_HIDE);
|
||||
if (!targetDir.exists()) {
|
||||
targetDir.mkdirs();
|
||||
}
|
||||
|
||||
try {
|
||||
File outFile = new File(VIDEO_DIR_HIDE, srcPath);
|
||||
InputStream is = context.getAssets().open(srcPath);
|
||||
FileOutputStream fos = new FileOutputStream(outFile);
|
||||
byte[] buffer = new byte[1024];
|
||||
int byteCount;
|
||||
while ((byteCount = is.read(buffer)) != -1) {
|
||||
fos.write(buffer, 0, byteCount);
|
||||
}
|
||||
fos.flush();
|
||||
is.close();
|
||||
fos.close();
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**读取assets文件*/
|
||||
public static String getFromAssets(Context context,String fileName) {
|
||||
try {
|
||||
InputStreamReader inputReader = new InputStreamReader(context.getResources().getAssets().open(fileName));
|
||||
BufferedReader bufReader = new BufferedReader(inputReader);
|
||||
String line = "";
|
||||
String Result = "";
|
||||
while ((line = bufReader.readLine()) != null)
|
||||
Result += line;
|
||||
return Result;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Java文件操作 获取文件扩展名
|
||||
*
|
||||
*/
|
||||
public static String getExtensionName(String filename) {
|
||||
if ((filename != null) && (filename.length() > 0)) {
|
||||
int dot = filename.lastIndexOf('.');
|
||||
if ((dot >-1) && (dot < (filename.length() - 1))) {
|
||||
return filename.substring(dot + 1);
|
||||
}
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.hitomi.tilibrary.transfer;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.SparseArray;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.hitomi.tilibrary.style.IProgressIndicator;
|
||||
|
||||
/**
|
||||
* 图片加载时使用 Android 默认的 ProgressBar
|
||||
* <p>
|
||||
* email: 196425254@qq.com
|
||||
*/
|
||||
public class ProgressBarIndicatorNew implements IProgressIndicator {
|
||||
|
||||
// private SparseArray<ProgressBar> progressBarArray = new SparseArray<>();
|
||||
|
||||
// private int dip2Px(Context context, float dpValue) {
|
||||
//// final float scale = context.getResources().getDisplayMetrics().density;
|
||||
//// return (int) (dpValue * scale + 0.5f);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void attach(int position, FrameLayout parent) {
|
||||
// Context context = parent.getContext();
|
||||
//
|
||||
// int progressSize = dip2Px(context, 50);
|
||||
// FrameLayout.LayoutParams progressLp = new FrameLayout.LayoutParams(
|
||||
// progressSize, progressSize);
|
||||
// progressLp.gravity = Gravity.CENTER;
|
||||
//
|
||||
// ProgressBar progressBar = new ProgressBar(context);
|
||||
// progressBar.setLayoutParams(progressLp);
|
||||
//
|
||||
// parent.addView(progressBar, parent.getChildCount());
|
||||
// progressBarArray.put(position, progressBar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hideView(int position) {
|
||||
// ProgressBar progressBar = progressBarArray.get(position);
|
||||
// if (progressBar != null)
|
||||
// progressBar.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(int position) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int position, int progress) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish(int position) {
|
||||
// ProgressBar progressBar = progressBarArray.get(position);
|
||||
// if (progressBar == null) return;
|
||||
//
|
||||
// ViewGroup vg = (ViewGroup) progressBar.getParent();
|
||||
// ;
|
||||
// if (vg != null) {
|
||||
// vg.removeView(progressBar);
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -1,276 +0,0 @@
|
||||
package com.hitomi.tilibrary.transfer;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.KeyEvent;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import com.gyf.immersionbar.ImmersionBar;
|
||||
import com.hitomi.tilibrary.style.index.CircleIndexIndicator;
|
||||
import com.hitomi.tilibrary.style.progress.ProgressBarIndicator;
|
||||
import com.hitomi.tilibrary.utils.AppManager;
|
||||
import com.hitomi.tilibrary.utils.FileUtils;
|
||||
import com.hitomi.tilibrary.view.video.ExoVideoView;
|
||||
import com.hitomi.tilibrary.view.video.source.ExoSourceManager;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* Main workflow: <br/>
|
||||
* 1、点击缩略图展示缩略图到 transferee 过渡动画 <br/>
|
||||
* 2、显示下载高清图片进度 <br/>
|
||||
* 3、加载完成显示高清图片 <br/>
|
||||
* 4、高清图支持手势缩放 <br/>
|
||||
* 5、关闭 transferee 展示 transferee 到原缩略图的过渡动画 <br/>
|
||||
* Created by Vans Z on 2017/1/19.
|
||||
* <p>
|
||||
* email: 196425254@qq.com
|
||||
*/
|
||||
public class TransfereeNew implements DialogInterface.OnShowListener,
|
||||
DialogInterface.OnKeyListener,
|
||||
TransferLayout.OnLayoutResetListener,
|
||||
AppManager.OnAppStateChangeListener {
|
||||
|
||||
private Context context;
|
||||
private Dialog transDialog;
|
||||
|
||||
private TransferLayout transLayout;
|
||||
private TransferConfig transConfig;
|
||||
private OnTransfereeStateChangeListener transListener;
|
||||
|
||||
// 因为Dialog的关闭有动画延迟,固不能使用 dialog.isShowing, 去判断 transferee 的显示逻辑
|
||||
private boolean shown;
|
||||
|
||||
/**
|
||||
* 构造方法私有化,通过{@link #getDefault(Context)} 创建 transferee
|
||||
*
|
||||
* @param context 上下文环境
|
||||
*/
|
||||
private TransfereeNew(Context context) {
|
||||
this.context = context;
|
||||
createLayout();
|
||||
createDialog();
|
||||
AppManager.getInstance().init((Application) context.getApplicationContext());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param context
|
||||
* @return {@link TransfereeNew}
|
||||
*/
|
||||
public static TransfereeNew getDefault(Context context) {
|
||||
return new TransfereeNew(context);
|
||||
}
|
||||
|
||||
private void createLayout() {
|
||||
transLayout = new TransferLayout(context);
|
||||
transLayout.setOnLayoutResetListener(this);
|
||||
}
|
||||
|
||||
private void createDialog() {
|
||||
transDialog = new AlertDialog.Builder(context,
|
||||
android.R.style.Theme_Translucent_NoTitleBar_Fullscreen)
|
||||
.setView(transLayout)
|
||||
.create();
|
||||
transDialog.setOnShowListener(this);
|
||||
transDialog.setOnKeyListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查参数,如果必须参数缺少,就使用缺省参数或者抛出异常
|
||||
*/
|
||||
private void checkConfig() {
|
||||
if (transConfig == null)
|
||||
throw new IllegalArgumentException("The parameter TransferConfig can't be null");
|
||||
if (transConfig.isSourceEmpty())
|
||||
throw new IllegalArgumentException("The parameter sourceUrlList or sourceUriList can't be empty");
|
||||
if (transConfig.getImageLoader() == null)
|
||||
throw new IllegalArgumentException("Need to specify an ImageLoader");
|
||||
|
||||
transConfig.setNowThumbnailIndex(Math.max(transConfig.getNowThumbnailIndex(), 0));
|
||||
transConfig.setOffscreenPageLimit(transConfig.getOffscreenPageLimit() <= 0
|
||||
? 1 : transConfig.getOffscreenPageLimit());
|
||||
transConfig.setDuration(transConfig.getDuration() <= 0
|
||||
? 300 : transConfig.getDuration());
|
||||
transConfig.setProgressIndicator(transConfig.getProgressIndicator() == null
|
||||
? new ProgressBarIndicator() : transConfig.getProgressIndicator());
|
||||
transConfig.setIndexIndicator(transConfig.getIndexIndicator() == null
|
||||
? new CircleIndexIndicator() : transConfig.getIndexIndicator());
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置 transferee 参数对象
|
||||
*
|
||||
* @param config 参数对象
|
||||
* @return transferee
|
||||
*/
|
||||
public TransfereeNew apply(TransferConfig config) {
|
||||
if (!shown) {
|
||||
transConfig = config;
|
||||
OriginalViewHelper.getInstance().fillOriginImages(config);
|
||||
checkConfig();
|
||||
transLayout.apply(config);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* transferee 是否显示
|
||||
*
|
||||
* @return true :显示, false :关闭
|
||||
*/
|
||||
public boolean isShown() {
|
||||
return shown;
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示 transferee
|
||||
*/
|
||||
public void show() {
|
||||
if (shown) return;
|
||||
transDialog.show();
|
||||
adjustTopAndBottom();
|
||||
if (transListener != null) {
|
||||
transListener.onShow();
|
||||
}
|
||||
shown = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示 transferee, 并设置 OnTransfereeChangeListener
|
||||
*
|
||||
* @param listener {@link OnTransfereeStateChangeListener}
|
||||
*/
|
||||
public void show(OnTransfereeStateChangeListener listener) {
|
||||
if (shown || listener == null) return;
|
||||
transDialog.show();
|
||||
adjustTopAndBottom();
|
||||
transListener = listener;
|
||||
transListener.onShow();
|
||||
shown = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭 transferee
|
||||
*/
|
||||
public void dismiss() {
|
||||
if (shown && transLayout.dismiss(transConfig.getNowThumbnailIndex())) {
|
||||
shown = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图片文件
|
||||
*/
|
||||
public File getImageFile(String imageUrl) {
|
||||
return transConfig.getImageLoader().getCache(imageUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除 transferee 缓存,包括图片和视频文件缓存,注意清除视频缓存必须保证 transferee 是关闭状态
|
||||
*/
|
||||
public void clear() {
|
||||
if (transConfig != null && transConfig.getImageLoader() != null) {
|
||||
transConfig.getImageLoader().clearCache();
|
||||
}
|
||||
File cacheFile = new File(context.getCacheDir(), ExoVideoView.CACHE_DIR);
|
||||
if (cacheFile.exists() && !shown) {
|
||||
FileUtils.deleteDir(new File(cacheFile, VideoThumbState.FRAME_DIR));
|
||||
ExoSourceManager.clearCache(context, cacheFile, null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* dialog 打开时的监听器
|
||||
*/
|
||||
@Override
|
||||
public void onShow(DialogInterface dialog) {
|
||||
AppManager.getInstance().register(this);
|
||||
transLayout.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* 调整顶部和底部内边距
|
||||
*/
|
||||
private void adjustTopAndBottom() {
|
||||
if (context instanceof Activity) {
|
||||
// 隐藏状态栏和导航栏,全屏化
|
||||
Activity activity = (Activity) context;
|
||||
ImmersionBar.with(activity, transDialog)
|
||||
.fullScreen(true)
|
||||
.init();
|
||||
// int top = ImmersionBar.getNotchHeight(activity);
|
||||
// int bottom = ImmersionBar.getNavigationBarHeight(activity);
|
||||
transLayout.setPadding(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReset() {
|
||||
AppManager.getInstance().unregister(this);
|
||||
transDialog.dismiss();
|
||||
if (transListener != null)
|
||||
transListener.onDismiss();
|
||||
shown = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK &&
|
||||
event.getAction() == KeyEvent.ACTION_UP &&
|
||||
!event.isCanceled()) {
|
||||
dismiss();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onForeground() {
|
||||
transLayout.pauseOrPlayVideo(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackground() {
|
||||
transLayout.pauseOrPlayVideo(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置 Transferee 显示和关闭的监听器
|
||||
*
|
||||
* @param listener {@link OnTransfereeStateChangeListener}
|
||||
*/
|
||||
public void setOnTransfereeStateChangeListener(OnTransfereeStateChangeListener listener) {
|
||||
transListener = listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 资源销毁,防止内存泄漏
|
||||
*/
|
||||
public void destroy() {
|
||||
if (transConfig != null) {
|
||||
transConfig.destroy();
|
||||
transConfig = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Transferee 显示的时候调用 {@link OnTransfereeStateChangeListener#onShow()}
|
||||
* <p>
|
||||
* Transferee 关闭的时候调用 {@link OnTransfereeStateChangeListener#onDismiss()}
|
||||
*/
|
||||
public interface OnTransfereeStateChangeListener {
|
||||
void onShow();
|
||||
|
||||
void onDismiss();
|
||||
}
|
||||
|
||||
public interface OnTransfereeLongClickListener {
|
||||
void onLongClick(ImageView imageView, String imageUri, int pos);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -18,7 +18,9 @@
|
||||
android:orientation="vertical"
|
||||
android:fitsSystemWindows="true"
|
||||
tools:context=".ui.activity.StartUpActivity">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<com.dskj.daikuan.ui.view.CircleImageView
|
||||
android:layout_width="@dimen/dp120"
|
||||
android:layout_height="@dimen/dp120"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<color name="purple_200">#FFBB86FC</color>
|
||||
<color name="purple_500">#FF6200EE</color>
|
||||
<color name="purple_700">#FF3700B3</color>
|
||||
|
||||
<color name="teal_200">#FF03DAC5</color>
|
||||
<color name="teal_700">#FF018786</color>
|
||||
<color name="black">#000019</color>
|
||||
@@ -72,10 +73,13 @@
|
||||
<color name="color_search_1">#DDDDDD</color>
|
||||
<color name="color_e12d48">#E12D48</color>
|
||||
<color name="color_750000">#750000</color>
|
||||
<color name="success_stroke_color">#E12D48</color>
|
||||
<color name="trans_success_stroke_color">#E12D48</color>
|
||||
<color name="blue_btn_bg_color">#E12D48</color>
|
||||
<color name="blue_btn_bg_pressed_color">#E12D48</color>
|
||||
<color name="success_stroke_color">#47A0C2</color>
|
||||
<color name="trans_success_stroke_color">#47A0C2</color>
|
||||
<color name="blue_btn_bg_color">#47A0C2</color>
|
||||
<color name="blue_btn_bg_pressed_color">#47A0C2</color>
|
||||
<color name="color_45000000">#45000000</color>
|
||||
<color name="red_btn_bg_color">#47A0C2</color>
|
||||
<color name="warning_stroke_color">#8847A0C2</color>
|
||||
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user