初始化
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.parts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.DriverAuthDataBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/9/9 15:39
|
||||
* @description:
|
||||
*/
|
||||
public class AuthParts {
|
||||
|
||||
private static Gson gson=new Gson();
|
||||
|
||||
public static DriverAuthDataBean getAuth(Context con){
|
||||
String authData=SPUtil.getSP(con,"data","authdata");
|
||||
Log.e("--data--",authData);
|
||||
if("".equals(authData)){
|
||||
return null;
|
||||
}else {
|
||||
return gson.fromJson(authData, DriverAuthDataBean.class);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setAuth(Context con,DriverAuthDataBean auth){
|
||||
if(auth!=null){
|
||||
//组件修改
|
||||
|
||||
//数据修改
|
||||
SPUtil.insSP(con,"data","authdata",gson.toJson(auth));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.parts;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.ConfigBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/9/11 11:53
|
||||
* @description:配置
|
||||
*/
|
||||
public class ConfigParts {
|
||||
private static Gson gson=new Gson();
|
||||
|
||||
public static ConfigBean getConfigParts(Context con){
|
||||
String configBean= SPUtil.getSP(con,"data","configdata");
|
||||
if("".equals(configBean)){
|
||||
return null;
|
||||
}else {
|
||||
return gson.fromJson(configBean, ConfigBean.class);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setParts(Context con,ConfigBean cb){
|
||||
if(cb!=null){
|
||||
//数据修改
|
||||
SPUtil.insSP(con,"data","configdata",gson.toJson(cb));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.parts;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.StartOrderBean;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/9/6 9:05
|
||||
* @description:
|
||||
*/
|
||||
public class OrderParts {
|
||||
|
||||
private static Gson gson=new Gson();
|
||||
|
||||
public static StartOrderBean getOrder(String sob){
|
||||
return gson.fromJson(sob,StartOrderBean.class);
|
||||
}
|
||||
|
||||
public static void setOrder(Context con){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.parts;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.StartOrderBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/10/15 10:05
|
||||
* @description:执行中运单
|
||||
*/
|
||||
public class StartOrderParts {
|
||||
|
||||
private static Gson gson=new Gson();
|
||||
|
||||
public static StartOrderBean getStartOrder(Context con){
|
||||
String sob= SPUtil.getSP(con,"data","startOrder");
|
||||
if("".equals(sob)){
|
||||
return null;
|
||||
}else {
|
||||
return gson.fromJson(sob,StartOrderBean.class);
|
||||
}
|
||||
}
|
||||
public static void setStartOrder(Context con, StartOrderBean sob){
|
||||
if(sob!=null){
|
||||
SPUtil.insSP(con,"data","startOrder",gson.toJson(sob));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.arpa.hndahesudintocctmsdriver.parts;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.UserBean;
|
||||
import com.arpa.hndahesudintocctmsdriver.ui.wallet.WalletFragment;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.sp.SPUtil;
|
||||
|
||||
/**
|
||||
* @author hlh
|
||||
* @version 1.0.0
|
||||
* @date 2021/9/6 8:32
|
||||
* @description:账户
|
||||
*/
|
||||
public class UserParts {
|
||||
|
||||
private static Gson gson=new Gson();
|
||||
//获取部件实例
|
||||
public static UserBean getUser(Context con){
|
||||
String userdata=SPUtil.getSP(con,"data","userdata");
|
||||
if("".equals(userdata)){
|
||||
return null;
|
||||
}else {
|
||||
return gson.fromJson(userdata,UserBean.class);
|
||||
}
|
||||
}
|
||||
public static void setUser(Context con,UserBean user){
|
||||
if(user!=null){
|
||||
//组件修改
|
||||
WalletFragment.account.setText(user.getData().getAccount());
|
||||
WalletFragment.userBean=user;
|
||||
//数据修改
|
||||
SPUtil.insSP(con,"data","userdata",gson.toJson(user));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user