kotlin转化完结
This commit is contained in:
@@ -2,6 +2,14 @@ package com.arpa.hndahesudintocctmsdriver.request.net;
|
||||
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.BuildConfig;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.UserBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.bean.LoginRegInputBean;
|
||||
import com.dahe.mylibrary.net.CommonResponseBean;
|
||||
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* Created by Administrator on 2018/8/8 0008.
|
||||
@@ -9,13 +17,14 @@ import com.arpa.hndahesudintocctmsdriver.BuildConfig;
|
||||
|
||||
public interface Api {
|
||||
|
||||
String BASE_URL = "BuildConfig.BASE_URL";
|
||||
String BASE_URL = BuildConfig.BASE_URL;
|
||||
|
||||
|
||||
//获取版本
|
||||
String VERSION = BASE_URL + "app/version";
|
||||
|
||||
|
||||
@POST(BASE_URL+"/common/register")
|
||||
Observable<CommonResponseBean> log(@Body LoginRegInputBean bean);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import android.content.Context;
|
||||
|
||||
import com.dahe.mylibrary.net.CommonResponseBean;
|
||||
|
||||
import io.reactivex.Observer;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.rxjava3.annotations.NonNull;
|
||||
import io.reactivex.rxjava3.core.Observer;
|
||||
import io.reactivex.rxjava3.disposables.Disposable;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,7 @@ public class DataManager {
|
||||
return api();
|
||||
}
|
||||
|
||||
public static Api api() {
|
||||
private static Api api() {
|
||||
return CommonBaseLibrary.getRetrofit().newBuilder()
|
||||
.client(new OkHttpClient.Builder()
|
||||
.connectTimeout(30, TimeUnit.SECONDS)
|
||||
|
||||
@@ -8,6 +8,8 @@ import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Window;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.MainActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.UiAuxiliary;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.login.LoginActivity;
|
||||
import com.dahe.mylibrary.net.CommonResponseBean;
|
||||
import com.dahe.mylibrary.net.ResultException;
|
||||
@@ -85,9 +87,9 @@ public abstract class RxHttpCallBack<T> {
|
||||
|
||||
}
|
||||
if (t.getCode() == 401) {
|
||||
// UserUtils.Companion.getInstance().loginOut(mContext);
|
||||
Intent intent = new Intent(mContext, LoginActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
UiAuxiliary.delLogin(mContext);
|
||||
Intent intent = new Intent(mContext, MainActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
|
||||
mContext.startActivity(intent);
|
||||
ToastUtils.showToast(mContext,"您的账号再异地登录,请重新登录");
|
||||
}else{
|
||||
|
||||
@@ -20,62 +20,66 @@ import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BottomTabUtil
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.PanDuanUtil
|
||||
import com.google.gson.Gson
|
||||
import com.luck.picture.lib.permissions.RxPermissions
|
||||
import io.reactivex.functions.Consumer
|
||||
import com.permissionx.guolindev.PermissionX
|
||||
|
||||
class MainActivity : BaseAppCompatActivity() {
|
||||
|
||||
private var ibs = arrayOf<ImageView>()
|
||||
private var title_view=arrayOf<TextView>()
|
||||
private var imgs0= intArrayOf(R.mipmap.tab1,R.mipmap.tab2,R.mipmap.xiaoxi0,R.mipmap.tab3)
|
||||
private var imgs1= intArrayOf(R.mipmap.tab1_s,R.mipmap.tab2_s,R.mipmap.xiaoxi1,R.mipmap.tab3_s)
|
||||
private var title_view = arrayOf<TextView>()
|
||||
private var imgs0 = intArrayOf(R.mipmap.tab1, R.mipmap.tab2, R.mipmap.xiaoxi0, R.mipmap.tab3)
|
||||
private var imgs1 =
|
||||
intArrayOf(R.mipmap.tab1_s, R.mipmap.tab2_s, R.mipmap.xiaoxi1, R.mipmap.tab3_s)
|
||||
private val gson = Gson()
|
||||
|
||||
override fun msgMethod(m: Message?) {
|
||||
super.msgMethod(m)
|
||||
when(m!!.what){
|
||||
1->{
|
||||
when (m!!.what) {
|
||||
1 -> {
|
||||
isExit = false;
|
||||
}
|
||||
RequsetCodeConstants.SUCCESS->{ }
|
||||
RequsetCodeConstants.SUCCESS -> {}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
StateStyleUtil.stateTextColor(this)
|
||||
setContentView(R.layout.activity_main)
|
||||
con=this
|
||||
act=this
|
||||
con = this
|
||||
act = this
|
||||
//隐藏标题栏
|
||||
val actionBar = supportActionBar
|
||||
actionBar?.hide()
|
||||
var r1=findViewById<LinearLayout>(R.id.r1)
|
||||
var r2=findViewById<LinearLayout>(R.id.r2)
|
||||
var r3=findViewById<LinearLayout>(R.id.r3)
|
||||
var r4=findViewById<LinearLayout>(R.id.r4)
|
||||
var r1 = findViewById<LinearLayout>(R.id.r1)
|
||||
var r2 = findViewById<LinearLayout>(R.id.r2)
|
||||
var r3 = findViewById<LinearLayout>(R.id.r3)
|
||||
var r4 = findViewById<LinearLayout>(R.id.r4)
|
||||
var fs = arrayOfNulls<Fragment>(4)
|
||||
fs[0] = HomeFragment()
|
||||
fs[1] = WalletFragment()
|
||||
fs[2] = NewsFragment()
|
||||
fs[3] = MyFragment()
|
||||
ibs=arrayOf(
|
||||
ibs = arrayOf(
|
||||
findViewById(R.id.huoyuan),
|
||||
findViewById(R.id.qianbao),
|
||||
findViewById(R.id.xiaoxi),
|
||||
findViewById(R.id.wode))
|
||||
title_view=arrayOf(findViewById(R.id.title1),findViewById(R.id.title2),findViewById(R.id.title3),findViewById(R.id.title4))
|
||||
title_view = arrayOf(findViewById(R.id.title1),
|
||||
findViewById(R.id.title2),
|
||||
findViewById(R.id.title3),
|
||||
findViewById(R.id.title4))
|
||||
var bt = BottomTabUtil(this, R.id.body, fs)
|
||||
bt.selectItem(fs[0])
|
||||
r1.setOnClickListener { v ->
|
||||
selectImage(bt.index,0)
|
||||
selectImage(bt.index, 0)
|
||||
bt.setDefaultFragment(fs[0])
|
||||
bt.index=0
|
||||
bt.index = 0
|
||||
}
|
||||
r2.setOnClickListener { v ->
|
||||
if (!PanDuanUtil.isLogin(con)){
|
||||
if (!PanDuanUtil.isLogin(con)) {
|
||||
jumpLogin()
|
||||
}else{
|
||||
selectImage(bt.index,1)
|
||||
} else {
|
||||
selectImage(bt.index, 1)
|
||||
if (!fs[1]!!.isAdded) {
|
||||
bt.hide(fs[bt.index])
|
||||
bt.selectItem(fs[1])
|
||||
@@ -86,10 +90,10 @@ class MainActivity : BaseAppCompatActivity() {
|
||||
}
|
||||
}
|
||||
r3.setOnClickListener { v ->
|
||||
if (!PanDuanUtil.isLogin(con)){
|
||||
if (!PanDuanUtil.isLogin(con)) {
|
||||
jumpLogin()
|
||||
}else{
|
||||
selectImage(bt.index,2)
|
||||
} else {
|
||||
selectImage(bt.index, 2)
|
||||
if (!fs[2]!!.isAdded) {
|
||||
bt.hide(fs[bt.index])
|
||||
bt.selectItem(fs[2])
|
||||
@@ -100,10 +104,10 @@ class MainActivity : BaseAppCompatActivity() {
|
||||
}
|
||||
}
|
||||
r4.setOnClickListener { v ->
|
||||
if (!PanDuanUtil.isLogin(con)){
|
||||
if (!PanDuanUtil.isLogin(con)) {
|
||||
jumpLogin()
|
||||
}else{
|
||||
selectImage(bt.index,3)
|
||||
} else {
|
||||
selectImage(bt.index, 3)
|
||||
if (!fs[3]!!.isAdded) {
|
||||
bt.hide(fs[bt.index])
|
||||
bt.selectItem(fs[3])
|
||||
@@ -113,41 +117,35 @@ class MainActivity : BaseAppCompatActivity() {
|
||||
bt.index = 3
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q){
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
||||
getPression()
|
||||
}
|
||||
}
|
||||
|
||||
fun getPression(){
|
||||
var gpsPermissions = RxPermissions(this)
|
||||
gpsPermissions.request(
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
Manifest.permission.ACCESS_BACKGROUND_LOCATION
|
||||
).subscribe(
|
||||
Consumer { b: Boolean ->
|
||||
if (b) {
|
||||
//判断GPS模块是否开启
|
||||
fun getPression() {
|
||||
PermissionX.init(this)
|
||||
.permissions(Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION,
|
||||
Manifest.permission.ACCESS_BACKGROUND_LOCATION)
|
||||
.request { allGranted, grantedList, deniedList ->
|
||||
if (allGranted) {
|
||||
|
||||
} else {
|
||||
Toast.makeText(con,"开启权限失败,请在应用设置-权限-定位-始终允许",Toast.LENGTH_SHORT).show()
|
||||
//.show("开启权限失败,请在应用设置-权限-定位-始终允许")
|
||||
Toast.makeText(con, "开启权限失败,请在应用设置-权限-定位-始终允许", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun selectImage(old:Int, new:Int){
|
||||
fun selectImage(old: Int, new: Int) {
|
||||
ibs[old].setImageResource(imgs0[old])
|
||||
ibs[new].setImageResource(imgs1[new])
|
||||
title_view[old].setTextColor(resources.getColor(R.color.tab_select_no,null))
|
||||
title_view[new].setTextColor(resources.getColor(R.color.tab_select,null))
|
||||
title_view[old].setTextColor(resources.getColor(R.color.tab_select_no, null))
|
||||
title_view[new].setTextColor(resources.getColor(R.color.tab_select, null))
|
||||
}
|
||||
|
||||
fun jumpLogin(){
|
||||
var inl=Intent(con,LoginActivity::class.java)
|
||||
fun jumpLogin() {
|
||||
var inl = Intent(con, LoginActivity::class.java)
|
||||
startActivity(inl)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.cardview.widget.CardView;
|
||||
|
||||
|
||||
import com.lxj.xpopup.core.CenterPopupView;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.CarListBean;
|
||||
|
||||
@@ -11,10 +11,7 @@ import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import rx.Observable;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* @ClassName AddCarSuccActivity
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -36,6 +37,7 @@ import com.luck.picture.lib.PictureSelector;
|
||||
import com.luck.picture.lib.config.PictureConfig;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.ImageViewerPopupView;
|
||||
import com.lxj.xpopup.interfaces.XPopupImageLoader;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.BaseBean;
|
||||
@@ -65,6 +67,7 @@ import com.arpa.hndahesudintocctmsdriver.util.http.RequsetCodeConstants;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.statusbar.StateStyleUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseRecyclerView;
|
||||
import com.lxj.xpopup.photoview.PhotoView;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,7 +30,6 @@ import com.arpa.hndahesudintocctmsdriver.util.view.BaseAppCompatActivity;
|
||||
import com.esign.esignsdk.EsignSdk;
|
||||
import com.esign.esignsdk.data.AuthEvent;
|
||||
import com.google.gson.Gson;
|
||||
import com.luck.picture.lib.permissions.RxPermissions;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.lxj.xpopup.core.BasePopupView;
|
||||
import com.lxj.xpopup.interfaces.OnConfirmListener;
|
||||
|
||||
@@ -19,6 +19,10 @@ import androidx.annotation.Nullable;
|
||||
import androidx.cardview.widget.CardView;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.BaseObserver;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.DataManager;
|
||||
import com.arpa.hndahesudintocctmsdriver.request.net.RxHttpCallBack;
|
||||
import com.dahe.mylibrary.net.CommonResponseBean;
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.ConfigBean;
|
||||
@@ -45,21 +49,21 @@ import cn.jpush.android.api.JPushInterface;
|
||||
|
||||
public class LoginActivity extends BaseActivity {
|
||||
|
||||
public static final String CODE_RESULT="code_result";
|
||||
public static final String LOGIN_RESULT="login_result";
|
||||
public static final String USER="user";
|
||||
public static final String USER_TOKEN="token";
|
||||
public static final String USER_UNAME="uname";
|
||||
public static final String USER_RNAME="rname";
|
||||
public static final String USER_ID="id";
|
||||
public static final String CODE_RESULT = "code_result";
|
||||
public static final String LOGIN_RESULT = "login_result";
|
||||
public static final String USER = "user";
|
||||
public static final String USER_TOKEN = "token";
|
||||
public static final String USER_UNAME = "uname";
|
||||
public static final String USER_RNAME = "rname";
|
||||
public static final String USER_ID = "id";
|
||||
|
||||
private Button btn_login;
|
||||
private Button auto_login;
|
||||
private EditText input_phone,input_code;
|
||||
private EditText input_phone, input_code;
|
||||
private Button getCode;
|
||||
private LoginBean loginBean;
|
||||
private TimerTask tt;
|
||||
private int timer_sum=60;
|
||||
private int timer_sum = 60;
|
||||
private ImageButton agree_btn;
|
||||
private CardView no_btn;
|
||||
private UserRequset ur;
|
||||
@@ -67,38 +71,39 @@ public class LoginActivity extends BaseActivity {
|
||||
@Override
|
||||
public void msgMethod(Message m) {
|
||||
super.msgMethod(m);
|
||||
switch (m.what){
|
||||
switch (m.what) {
|
||||
case 12:
|
||||
getCode.setText(timer_sum+"s");
|
||||
if(timer_sum<=0){
|
||||
getCode.setText(timer_sum + "s");
|
||||
if (timer_sum <= 0) {
|
||||
getCode.setText("获取验证码");
|
||||
timer_sum=60;
|
||||
code_key=true;
|
||||
timer_sum = 60;
|
||||
code_key = true;
|
||||
}
|
||||
break;
|
||||
case RequsetCodeConstants.SUCCESS:
|
||||
if(CacheGroup.cacheList.get(CODE_RESULT)!=null){
|
||||
Log.e("--短信发送res--","短信发送成功");
|
||||
if (CacheGroup.cacheList.get(CODE_RESULT) != null) {
|
||||
Log.e("--短信发送res--", "短信发送成功");
|
||||
}
|
||||
if(CacheGroup.cacheList.get(LOGIN_RESULT)!=null){
|
||||
if (CacheGroup.cacheList.get(LOGIN_RESULT) != null) {
|
||||
//存储登录记录
|
||||
loginBean=new Gson().fromJson(CacheGroup.cacheList.get(LOGIN_RESULT),LoginBean.class);
|
||||
Log.e("--登录信息--",new Gson().toJson(loginBean));
|
||||
if(loginBean.getCode()==200){
|
||||
SPUtil.insSP(con,USER,USER_TOKEN,loginBean.getData().getToken());
|
||||
SPUtil.insSP(con,USER,USER_UNAME,loginBean.getData().getUname());
|
||||
SPUtil.insSP(con,USER,USER_RNAME,loginBean.getData().getRname());
|
||||
SPUtil.insSP(con,USER,USER_ID,loginBean.getData().getId()+"");
|
||||
JPushInterface.setAlias(con,0,loginBean.getData().getUname());
|
||||
UiAuxiliary.homeRequest("登录成功");
|
||||
finish();
|
||||
}else{
|
||||
Toast.makeText(con,loginBean.getMsg(),Toast.LENGTH_SHORT).show();
|
||||
loginBean = new Gson().fromJson(CacheGroup.cacheList.get(LOGIN_RESULT), LoginBean.class);
|
||||
Log.e("--登录信息--", new Gson().toJson(loginBean));
|
||||
if (loginBean.getCode() == 200) {
|
||||
SPUtil.insSP(con, USER, USER_TOKEN, loginBean.getData().getToken());
|
||||
SPUtil.insSP(con, USER, USER_UNAME, loginBean.getData().getUname());
|
||||
SPUtil.insSP(con, USER, USER_RNAME, loginBean.getData().getRname());
|
||||
SPUtil.insSP(con, USER, USER_ID, loginBean.getData().getId() + "");
|
||||
JPushInterface.setAlias(con, 0, loginBean.getData().getUname());
|
||||
UiAuxiliary.homeRequest("登录成功");
|
||||
finish();
|
||||
} else {
|
||||
Toast.makeText(con, loginBean.getMsg(), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
CacheGroup.cacheList.remove(LOGIN_RESULT);
|
||||
}
|
||||
break;
|
||||
default:break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,42 +112,43 @@ public class LoginActivity extends BaseActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
StatusBarUtil.touming(getWindow());
|
||||
setContentView(R.layout.activity_login);
|
||||
con=this;
|
||||
btn_login=findViewById(R.id.btn_login);
|
||||
auto_login=findViewById(R.id.auto_login);
|
||||
input_phone=findViewById(R.id.input_phone);
|
||||
input_code=findViewById(R.id.input_code);
|
||||
getCode=findViewById(R.id.getCode);
|
||||
agree_btn=findViewById(R.id.agree_btn);
|
||||
no_btn=findViewById(R.id.no_btn);
|
||||
ur=new UserRequset(con,hd);
|
||||
con = this;
|
||||
btn_login = findViewById(R.id.btn_login);
|
||||
auto_login = findViewById(R.id.auto_login);
|
||||
input_phone = findViewById(R.id.input_phone);
|
||||
input_code = findViewById(R.id.input_code);
|
||||
getCode = findViewById(R.id.getCode);
|
||||
agree_btn = findViewById(R.id.agree_btn);
|
||||
no_btn = findViewById(R.id.no_btn);
|
||||
ur = new UserRequset(con, hd);
|
||||
initView(null);
|
||||
}
|
||||
|
||||
boolean key=false;
|
||||
boolean code_key=true;
|
||||
private String url1="";
|
||||
private String url2="";
|
||||
boolean key = false;
|
||||
boolean code_key = true;
|
||||
private String url1 = "";
|
||||
private String url2 = "";
|
||||
|
||||
@Override
|
||||
public void initView(Object obj) {
|
||||
super.initView(obj);
|
||||
agree_btn.setOnClickListener(v -> {
|
||||
agree_btn.setVisibility(View.GONE);
|
||||
no_btn.setVisibility(View.VISIBLE);
|
||||
key=false;
|
||||
key = false;
|
||||
});
|
||||
no_btn.setOnClickListener(v -> {
|
||||
agree_btn.setVisibility(View.VISIBLE);
|
||||
no_btn.setVisibility(View.GONE);
|
||||
key=true;
|
||||
key = true;
|
||||
|
||||
});
|
||||
ConfigBean cb= ConfigParts.getConfigParts(con);
|
||||
if(cb!=null){
|
||||
url1=cb.getData().getUserUrl();
|
||||
url2="https://agreement.dahehuoyun.com/huawei/#/private";
|
||||
ConfigBean cb = ConfigParts.getConfigParts(con);
|
||||
if (cb != null) {
|
||||
url1 = cb.getData().getUserUrl();
|
||||
url2 = "https://agreement.dahehuoyun.com/huawei/#/private";
|
||||
}
|
||||
TextView tv_content=findViewById(R.id.tv_content);
|
||||
TextView tv_content = findViewById(R.id.tv_content);
|
||||
String str = "我已阅读并同意相关服务条款和隐私政策《用户服务协议》和《隐私政策》";
|
||||
SpannableStringBuilder ssb = new SpannableStringBuilder();
|
||||
ssb.append(str);
|
||||
@@ -151,18 +157,19 @@ public class LoginActivity extends BaseActivity {
|
||||
ssb.setSpan(new ClickableSpan() {
|
||||
@Override
|
||||
public void onClick(View widget) {
|
||||
Log.e("-用户服务协议-",url1);
|
||||
Log.e("-用户服务协议-", url1);
|
||||
//用户服务协议点击事件
|
||||
Intent in=new Intent(con, WebActivity.class);
|
||||
in.putExtra("title","用户服务协议");
|
||||
Intent in = new Intent(con, WebActivity.class);
|
||||
in.putExtra("title", "用户服务协议");
|
||||
in.putExtra("url", url1);
|
||||
startActivity(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
//设置文件颜色
|
||||
ds.setColor(getResources().getColor(R.color.theme_color,null));
|
||||
ds.setColor(getResources().getColor(R.color.theme_color, null));
|
||||
// 去掉下划线
|
||||
ds.setUnderlineText(false);
|
||||
}
|
||||
@@ -172,16 +179,17 @@ public class LoginActivity extends BaseActivity {
|
||||
@Override
|
||||
public void onClick(View widget) {
|
||||
//隐私协议点击事件
|
||||
Intent in=new Intent(con, WebActivity.class);
|
||||
in.putExtra("title","隐私政策");
|
||||
in.putExtra("url",url2);
|
||||
Intent in = new Intent(con, WebActivity.class);
|
||||
in.putExtra("title", "隐私政策");
|
||||
in.putExtra("url", url2);
|
||||
startActivity(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrawState(TextPaint ds) {
|
||||
super.updateDrawState(ds);
|
||||
//设置文件颜色
|
||||
ds.setColor(getResources().getColor(R.color.theme_color,null));
|
||||
ds.setColor(getResources().getColor(R.color.theme_color, null));
|
||||
// 去掉下划线
|
||||
ds.setUnderlineText(false);
|
||||
}
|
||||
@@ -190,36 +198,37 @@ public class LoginActivity extends BaseActivity {
|
||||
tv_content.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
tv_content.setText(ssb, TextView.BufferType.SPANNABLE);
|
||||
getCode.setOnClickListener(v -> {
|
||||
String phone=String.valueOf(input_phone.getText());
|
||||
if ("".equals(phone) || phone==null){
|
||||
Log.e("点击事件","请先输入手机号");
|
||||
Toast.makeText(con,"请先输入手机号",Toast.LENGTH_SHORT).show();
|
||||
}else{
|
||||
if(11==phone.length() && phone.indexOf("1")==0){
|
||||
if(code_key){
|
||||
getCd();
|
||||
ur.getPhoneCode(phone);
|
||||
code_key=false;
|
||||
}
|
||||
}else{
|
||||
Toast.makeText(con,"手机号格式不正确",Toast.LENGTH_SHORT).show();
|
||||
String phone = String.valueOf(input_phone.getText());
|
||||
if ("".equals(phone) || phone == null) {
|
||||
Log.e("点击事件", "请先输入手机号");
|
||||
Toast.makeText(con, "请先输入手机号", Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
if (11 == phone.length() && phone.indexOf("1") == 0) {
|
||||
if (code_key) {
|
||||
getCd();
|
||||
ur.getPhoneCode(phone);
|
||||
code_key = false;
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(con, "手机号格式不正确", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
btn_login.setOnClickListener(v -> {
|
||||
String phone=String.valueOf(input_phone.getText());
|
||||
String code=String.valueOf(input_code.getText());
|
||||
Log.e("--code--",code);
|
||||
if (judgeFormat(phone,code)){
|
||||
if(key){
|
||||
LoginRegInputBean lb=new LoginRegInputBean();
|
||||
String phone = String.valueOf(input_phone.getText());
|
||||
String code = String.valueOf(input_code.getText());
|
||||
Log.e("--code--", code);
|
||||
if (judgeFormat(phone, code)) {
|
||||
if (key) {
|
||||
LoginRegInputBean lb = new LoginRegInputBean();
|
||||
lb.setRoleId(4);
|
||||
lb.setUname(phone);
|
||||
lb.setSmscode(code);
|
||||
lb.setRegisterType(1);
|
||||
|
||||
ur.UserLogin(lb);
|
||||
}else{
|
||||
Toast.makeText(con,"请先同意用户协议和隐私政策",Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(con, "请先同意用户协议和隐私政策", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -238,8 +247,8 @@ public class LoginActivity extends BaseActivity {
|
||||
.setLogBtnText(LoginConstant.LOG_BTN_TEXT.getValue())
|
||||
.setLogBtnTextColor(0xffffffff)
|
||||
.setLogBtnImgPath(LoginConstant.BTN_IMG_PATH.getValue())
|
||||
.setAppPrivacyOne(LoginConstant.TIAOKUAN_ONE.getValue(),LoginConstant.TIAOKUAN_ONE_URL.getValue())
|
||||
.setAppPrivacyTwo(LoginConstant.TIAOKUAN_TWO.getValue(),LoginConstant.TIAOKUAN_TWO_URL.getValue())
|
||||
.setAppPrivacyOne(LoginConstant.TIAOKUAN_ONE.getValue(), LoginConstant.TIAOKUAN_ONE_URL.getValue())
|
||||
.setAppPrivacyTwo(LoginConstant.TIAOKUAN_TWO.getValue(), LoginConstant.TIAOKUAN_TWO_URL.getValue())
|
||||
.setUncheckedImgPath(LoginConstant.BTN_IMG_PATH.getValue())
|
||||
.setCheckedImgPath(LoginConstant.BTN_IMG_PATH.getValue())
|
||||
.setSloganTextColor(0xff999999)
|
||||
@@ -263,9 +272,9 @@ public class LoginActivity extends BaseActivity {
|
||||
}
|
||||
});//设置授权页事件监听
|
||||
JVerificationInterface.loginAuth(con, settings, (code, content, operator) -> {
|
||||
if (code == 6000){
|
||||
Log.d("授权页", "code=" + code + ", token=" + content+" ,operator="+operator);
|
||||
}else{
|
||||
if (code == 6000) {
|
||||
Log.d("授权页", "code=" + code + ", token=" + content + " ,operator=" + operator);
|
||||
} else {
|
||||
Log.d("授权页", "code=" + code + ", message=" + content);
|
||||
}
|
||||
});
|
||||
@@ -273,36 +282,38 @@ public class LoginActivity extends BaseActivity {
|
||||
|
||||
});
|
||||
}
|
||||
public void getCd(){
|
||||
new Thread(){
|
||||
|
||||
public void getCd() {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
while (timer_sum>0) {
|
||||
while (timer_sum > 0) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
timer_sum--;
|
||||
Message msg=new Message();
|
||||
msg.what=12;
|
||||
Message msg = new Message();
|
||||
msg.what = 12;
|
||||
hd.sendMessage(msg);
|
||||
}
|
||||
interrupt();
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
//验证用户输入的是否符合格式
|
||||
public boolean judgeFormat(String phone,String code){
|
||||
public boolean judgeFormat(String phone, String code) {
|
||||
//1[0-9]{10}
|
||||
if("".equals(phone) || "".equals(code)){
|
||||
Toast.makeText(con,"手机号和验证码不得为空",Toast.LENGTH_SHORT).show();
|
||||
if ("".equals(phone) || "".equals(code)) {
|
||||
Toast.makeText(con, "手机号和验证码不得为空", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}else{
|
||||
if(11==phone.length() && phone.indexOf("1")==0){
|
||||
} else {
|
||||
if (11 == phone.length() && phone.indexOf("1") == 0) {
|
||||
return true;
|
||||
}else{
|
||||
Toast.makeText(con,"手机号格式不正确",Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
Toast.makeText(con, "手机号格式不正确", Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ import com.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.esign.esignsdk.EsignSdk;
|
||||
import com.google.gson.Gson;
|
||||
import com.luck.picture.lib.permissions.RxPermissions;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.ConfigBean;
|
||||
|
||||
@@ -23,9 +23,9 @@ import com.arpa.hndahesudintocctmsdriver.parts.ConfigParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.StartOrderParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.parts.UserParts;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.business.BusinessActivity;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.google.gson.Gson;
|
||||
import com.luck.picture.lib.permissions.RxPermissions;
|
||||
import com.lxj.xpopup.XPopup;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
@@ -43,6 +43,7 @@ import com.arpa.hndahesudintocctmsdriver.util.cache.CacheGroup;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.string.StringUtil;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseFragment;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.view.BaseRecyclerView;
|
||||
import com.permissionx.guolindev.PermissionX;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@@ -217,19 +218,17 @@ public class MyFragment extends BaseFragment {
|
||||
onAuth.setOnClickListener(v -> startActivity(new Intent(con, PersonalAuthActivity.class)));
|
||||
//司机之家
|
||||
onDriverHome.setOnClickListener(v -> {
|
||||
RxPermissions rp=new RxPermissions(getActivity());
|
||||
rp.request(
|
||||
Manifest.permission.ACCESS_BACKGROUND_LOCATION
|
||||
).subscribe(b -> {
|
||||
if (b) {
|
||||
PermissionX.init(getActivity())
|
||||
.permissions(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
Intent in=new Intent(con, BusinessActivity.class);
|
||||
in.putExtra("type","餐饮");
|
||||
startActivity(in);
|
||||
} else {
|
||||
Toast.makeText(getContext(),"请先开启定位权限",Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
//联系我们
|
||||
onContact.setOnClickListener(v -> {
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.app.Activity;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.dahe.mylibrary.weight.GlideEngine;
|
||||
import com.luck.picture.lib.PictureSelector;
|
||||
import com.luck.picture.lib.config.PictureConfig;
|
||||
import com.luck.picture.lib.entity.LocalMedia;
|
||||
@@ -16,15 +17,16 @@ public class PicturlUtil {
|
||||
//(Activity) ctx 图片选择器
|
||||
PictureSelector.create(activity)
|
||||
.openGallery(PictureConfig.TYPE_IMAGE)
|
||||
.imageEngine(GlideEngine.createGlideEngine())
|
||||
.maxSelectNum(maxNum)
|
||||
.minSelectNum(1)
|
||||
.imageSpanCount(4)// 每行显示个数
|
||||
.selectionMode(PictureConfig.MULTIPLE)//多选
|
||||
.previewImage(true)//预览图片
|
||||
.compress(true)//压缩
|
||||
.isPreviewImage(true)//预览图片
|
||||
.isCompress(true)//压缩
|
||||
.isCamera(true)// 是否显示拍照按钮 true or false
|
||||
.minimumCompressSize(100)// 小于100kb的图片不压缩
|
||||
.selectionMedia(imgs)
|
||||
.selectionData(imgs)
|
||||
.forResult(PictureConfig.CHOOSE_REQUEST);//回调请求码
|
||||
}
|
||||
|
||||
|
||||
+13
-18
@@ -14,7 +14,7 @@ import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil;
|
||||
import com.luck.picture.lib.permissions.RxPermissions;
|
||||
import com.permissionx.guolindev.PermissionX;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
@@ -55,32 +55,27 @@ public class GetCarImageAlert {
|
||||
//请按照如图所示拍摄回单照片,回单照片必须保持清晰完整,能看清具体吨数,便于结算运费时核查,感谢配合。
|
||||
}
|
||||
btn_xiangce.setOnClickListener(v -> {
|
||||
RxPermissions rp=new RxPermissions(act);
|
||||
rp.request(
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
).subscribe(b -> {
|
||||
if (b) {
|
||||
//ImageGetUtil.AlbumGetImage(act);
|
||||
PermissionX.init(act)
|
||||
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
PicturlUtil.selectPicter(act, new ArrayList<>(), 1);
|
||||
} else {
|
||||
Toast.makeText(act.getBaseContext(),"开启权限失败,请手动开启权限",Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(act.getBaseContext(), "开启权限失败,请手动开启权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
btn_paizhao.setOnClickListener(v -> {
|
||||
RxPermissions rp=new RxPermissions(act);
|
||||
rp.request(
|
||||
Manifest.permission.CAMERA
|
||||
).subscribe(b -> {
|
||||
if (b) {
|
||||
PermissionX.init(act)
|
||||
.permissions(Manifest.permission.CAMERA)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
file=ImageGetUtil.createImageFile(act);
|
||||
ImageGetUtil.cameraAlbumGetImage(act,file);
|
||||
} else {
|
||||
Toast.makeText(act.getBaseContext(),"开启权限失败,请手动开启权限",Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(act.getBaseContext(), "开启权限失败,请手动开启权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
btn_quxiao.setOnClickListener(v -> popupWindow.dismiss());
|
||||
//popupWindow消失屏幕变为不透明
|
||||
|
||||
@@ -11,11 +11,12 @@ import android.widget.Toast;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.arpa.hndahesudintocctmsdriver.util.PicturlUtil;
|
||||
import com.luck.picture.lib.permissions.RxPermissions;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.permissionx.guolindev.PermissionX;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
@@ -27,46 +28,44 @@ public class GetImageAlert {
|
||||
|
||||
File file;
|
||||
PopupWindow popupWindow;
|
||||
public void showPopueWindow(AppCompatActivity act){
|
||||
View popView = View.inflate(act, R.layout.choice_img,null);
|
||||
Button btn_xiangce =popView.findViewById(R.id.btn_xiangce);
|
||||
|
||||
public void showPopueWindow(AppCompatActivity act) {
|
||||
View popView = View.inflate(act, R.layout.choice_img, null);
|
||||
Button btn_xiangce = popView.findViewById(R.id.btn_xiangce);
|
||||
Button btn_paizhao = popView.findViewById(R.id.btn_paizhao);
|
||||
Button btn_quxiao = popView.findViewById(R.id.btn_quxiao);
|
||||
Button btn_quxiao = popView.findViewById(R.id.btn_quxiao);
|
||||
//获取屏幕宽高
|
||||
int weight =act.getResources().getDisplayMetrics().widthPixels;
|
||||
int height = act.getResources().getDisplayMetrics().heightPixels*1/3;
|
||||
popupWindow = new PopupWindow(popView,weight,height);
|
||||
int weight = act.getResources().getDisplayMetrics().widthPixels;
|
||||
int height = act.getResources().getDisplayMetrics().heightPixels * 1 / 3;
|
||||
popupWindow = new PopupWindow(popView, weight, height);
|
||||
//popupWindow.setAnimationStyle(R.style.anim_popup_dir);
|
||||
popupWindow.setFocusable(true);
|
||||
//点击外部popueWindow消失
|
||||
popupWindow.setOutsideTouchable(true);
|
||||
|
||||
btn_xiangce.setOnClickListener(v -> {
|
||||
RxPermissions rp=new RxPermissions(act);
|
||||
rp.request(
|
||||
Manifest.permission.READ_EXTERNAL_STORAGE
|
||||
).subscribe(b -> {
|
||||
if (b) {
|
||||
PermissionX.init(act)
|
||||
.permissions(Manifest.permission.READ_EXTERNAL_STORAGE)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
PicturlUtil.selectPicter(act, new ArrayList<>(), 1);
|
||||
} else {
|
||||
Toast.makeText(act.getBaseContext(),"开启权限失败,请手动开启权限",Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(act.getBaseContext(), "开启权限失败,请手动开启权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
btn_paizhao.setOnClickListener(v -> {
|
||||
RxPermissions rp=new RxPermissions(act);
|
||||
rp.request(
|
||||
Manifest.permission.CAMERA
|
||||
).subscribe(b -> {
|
||||
if (b) {
|
||||
file=ImageGetUtil.createImageFile(act);
|
||||
ImageGetUtil.cameraAlbumGetImage(act,file);
|
||||
|
||||
PermissionX.init(act)
|
||||
.permissions(Manifest.permission.CAMERA)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
file = ImageGetUtil.createImageFile(act);
|
||||
ImageGetUtil.cameraAlbumGetImage(act, file);
|
||||
} else {
|
||||
Toast.makeText(act.getBaseContext(),"开启权限失败,请手动开启权限",Toast.LENGTH_LONG).show();
|
||||
Toast.makeText(act.getBaseContext(), "开启权限失败,请手动开启权限", Toast.LENGTH_LONG).show();
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
btn_quxiao.setOnClickListener(v -> popupWindow.dismiss());
|
||||
//popupWindow消失屏幕变为不透明
|
||||
@@ -79,14 +78,14 @@ public class GetImageAlert {
|
||||
WindowManager.LayoutParams lp = act.getWindow().getAttributes();
|
||||
lp.alpha = 0.5f;
|
||||
act.getWindow().setAttributes(lp);
|
||||
popupWindow.showAtLocation(popView, Gravity.BOTTOM,0,50);
|
||||
popupWindow.showAtLocation(popView, Gravity.BOTTOM, 0, 50);
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void dis(){
|
||||
public void dis() {
|
||||
popupWindow.dismiss();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user