d
This commit is contained in:
@@ -3,6 +3,7 @@ package com.example.administrator.seven;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
|
||||
import com.example.administrator.seven.db.dao.DataBaseHelper;
|
||||
import com.example.administrator.seven.utils.checkVersionsUtils.ProfileSpUtils;
|
||||
import com.lzy.okgo.OkGo;
|
||||
import com.lzy.okgo.cache.CacheEntity;
|
||||
@@ -54,6 +55,7 @@ public class BaseApplication extends Application {
|
||||
mContext = this;
|
||||
//用户资料存储工具
|
||||
ProfileSpUtils.init(this);
|
||||
DataBaseHelper.initOrmLite(this);
|
||||
initOkGo();
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.administrator.seven.R;
|
||||
import com.example.administrator.seven.dialog.PersonnelDialogHelptwo;
|
||||
import com.example.administrator.seven.utils.StatusBarUtils;
|
||||
|
||||
|
||||
@@ -192,5 +193,13 @@ public class BaseActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
}
|
||||
public void messageDialog(String str) {
|
||||
new PersonnelDialogHelptwo().showDownloadDialog(BaseActivity.this, str,"确定", new PersonnelDialogHelptwo.ClickListener() {
|
||||
@Override
|
||||
public void confirm() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.example.administrator.seven.base;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.core.app.ActivityCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import android.text.TextPaint;
|
||||
@@ -22,6 +26,8 @@ public class BaseFragment extends Fragment {
|
||||
|
||||
protected Activity mContext;
|
||||
|
||||
public static final int REQUEST_CALL_PERMISSION = 10111; //拨号请求码
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -73,4 +79,36 @@ public class BaseFragment extends Fragment {
|
||||
startActivity(new Intent(mContext, clz));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 拨打电话(直接拨打)
|
||||
*
|
||||
* @param telPhone 电话
|
||||
*/
|
||||
public void call(String telPhone) {
|
||||
if (checkReadPermission(Manifest.permission.CALL_PHONE, REQUEST_CALL_PERMISSION)) {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_CALL);
|
||||
Uri phoneNum = Uri.parse("tel:" + telPhone);
|
||||
intent.setData(phoneNum);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 判断是否有某项权限
|
||||
*
|
||||
* @param string_permission 权限
|
||||
* @param request_code 请求码
|
||||
* @return
|
||||
*/
|
||||
public boolean checkReadPermission(String string_permission, int request_code) {
|
||||
boolean flag = false;
|
||||
if (ContextCompat.checkSelfPermission(getActivity(), string_permission) == PackageManager.PERMISSION_GRANTED) {//已有权限
|
||||
flag = true;
|
||||
} else {//申请权限
|
||||
ActivityCompat.requestPermissions(getActivity(), new String[]{string_permission}, request_code);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.example.administrator.seven.db;
|
||||
|
||||
public class DbBean {
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.example.administrator.seven.db;
|
||||
|
||||
import com.j256.ormlite.field.DatabaseField;
|
||||
import com.j256.ormlite.table.DatabaseTable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Caiyn on 2018/7/5.
|
||||
* 名单管理实体类
|
||||
*/
|
||||
@DatabaseTable(tableName = "tab_record")
|
||||
public class DbRecordBeanData extends DbBean implements Serializable{
|
||||
|
||||
@DatabaseField(columnName = "headimg")
|
||||
private String headimg;
|
||||
|
||||
|
||||
@DatabaseField(columnName = "fp_num")
|
||||
private String fp_num;
|
||||
|
||||
public String getHeadimg() {
|
||||
return headimg;
|
||||
}
|
||||
|
||||
public void setHeadimg(String headimg) {
|
||||
this.headimg = headimg;
|
||||
}
|
||||
|
||||
public String getFp_num() {
|
||||
return fp_num;
|
||||
}
|
||||
|
||||
public void setFp_num(String fp_num) {
|
||||
this.fp_num = fp_num;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getWechat() {
|
||||
return wechat;
|
||||
}
|
||||
|
||||
public void setWechat(String wechat) {
|
||||
this.wechat = wechat;
|
||||
}
|
||||
|
||||
public String getCustomer_id() {
|
||||
return customer_id;
|
||||
}
|
||||
|
||||
public void setCustomer_id(String customer_id) {
|
||||
this.customer_id = customer_id;
|
||||
}
|
||||
|
||||
@DatabaseField(columnName = "phone")
|
||||
private String phone;
|
||||
@DatabaseField(columnName = "name")
|
||||
private String name;
|
||||
@DatabaseField(columnName = "wechat")
|
||||
private String wechat;
|
||||
@DatabaseField(columnName = "customer_id")
|
||||
private String customer_id;
|
||||
|
||||
@DatabaseField(columnName = "selectstuta")
|
||||
private String selectstuta = "0"; //0未选 1选中
|
||||
@DatabaseField(id = true,columnName = "Id")
|
||||
private String id;
|
||||
|
||||
|
||||
public String getSelectstuta() {
|
||||
return selectstuta;
|
||||
}
|
||||
|
||||
public void setSelectstuta(String selectstuta) {
|
||||
this.selectstuta = selectstuta;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.example.administrator.seven.db.dao;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.SQLException;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
|
||||
import com.example.administrator.seven.db.DbRecordBeanData;
|
||||
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
import com.j256.ormlite.support.ConnectionSource;
|
||||
import com.j256.ormlite.table.TableUtils;
|
||||
|
||||
public class DataBaseHelper extends OrmLiteSqliteOpenHelper {
|
||||
|
||||
/**
|
||||
* 数据库名称
|
||||
*/
|
||||
private static final String TABLE_NAME = "sqlite-test.db";
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
private static final int DBVERSION = 1;
|
||||
|
||||
private static Context mContext;
|
||||
/**
|
||||
* 单例
|
||||
*/
|
||||
private static DataBaseHelper mInstance;
|
||||
private static DataBaseHelper dataBaseHelper;
|
||||
|
||||
|
||||
private DataBaseHelper(Context context) {
|
||||
super(context, TABLE_NAME, null, DBVERSION);
|
||||
}
|
||||
|
||||
public synchronized static DataBaseHelper getInstance(Context mContext) {
|
||||
if (dataBaseHelper == null) {
|
||||
dataBaseHelper = new DataBaseHelper(mContext);
|
||||
}
|
||||
return dataBaseHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void initOrmLite(Context context) {
|
||||
mContext = context;
|
||||
getIntence();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建数据库表
|
||||
*
|
||||
* @param database
|
||||
* @param connectionSource
|
||||
*/
|
||||
@Override
|
||||
public void onCreate(SQLiteDatabase database,
|
||||
ConnectionSource connectionSource) {
|
||||
try {
|
||||
|
||||
TableUtils.createTable(connectionSource, DbRecordBeanData.class);
|
||||
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
} catch (java.sql.SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 升级数据库
|
||||
*
|
||||
* @param database
|
||||
* @param connectionSource
|
||||
* @param oldVersion
|
||||
* @param newVersion
|
||||
*/
|
||||
@Override
|
||||
public void onUpgrade(SQLiteDatabase database,
|
||||
ConnectionSource connectionSource, int oldVersion, int newVersion) {
|
||||
try {
|
||||
|
||||
|
||||
onCreate(database, connectionSource);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 单例获取该Helper
|
||||
*
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static synchronized DataBaseHelper getIntence() {
|
||||
|
||||
if (null == mInstance) {
|
||||
synchronized (DataBaseHelper.class) {
|
||||
if (null == mInstance) {
|
||||
mInstance = new DataBaseHelper(mContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取数据对象
|
||||
*
|
||||
* @param classz 对应的表实体的字节码对象
|
||||
* @return Dao<T, ID> :T:表实体对象类型.ID:对应的表实体中被指定为id字段的属性类型
|
||||
* @throws SQLException
|
||||
*/
|
||||
@Override
|
||||
public Dao getDao(Class classz) throws SQLException, java.sql.SQLException {
|
||||
return super.getDao(classz);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.example.administrator.seven.db.dao;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.SQLException;
|
||||
|
||||
import com.example.administrator.seven.db.DbRecordBeanData;
|
||||
import com.j256.ormlite.dao.Dao;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class DbRecordDao {
|
||||
private static Dao<DbRecordBeanData, Integer> userAccountDao;
|
||||
|
||||
public DbRecordDao(Context mContext) {
|
||||
DataBaseHelper dataBaseHelper = DataBaseHelper.getInstance(mContext);
|
||||
try {
|
||||
try {
|
||||
userAccountDao = dataBaseHelper.getDao(DbRecordBeanData.class);
|
||||
} catch (java.sql.SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public long addInsert(DbRecordBeanData userData) {
|
||||
int id = 0;
|
||||
try {
|
||||
try {
|
||||
id = userAccountDao.create(userData);
|
||||
} catch (java.sql.SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public List<DbRecordBeanData> queryByCustom(String columnName, String columnValue) {
|
||||
List<DbRecordBeanData> ormTables = new ArrayList<>();
|
||||
try {
|
||||
ormTables = userAccountDao.queryBuilder().where().eq(columnName, columnValue).query();
|
||||
} catch (java.sql.SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return ormTables;
|
||||
}
|
||||
|
||||
public List<DbRecordBeanData> queryByCustomtwo(String columnName, String columnValue) {
|
||||
List<DbRecordBeanData> ormTables = new ArrayList<>();
|
||||
try {
|
||||
// ormTables = userAccountDao.queryBuilder().where().eq(columnName, columnValue).query();
|
||||
ormTables= userAccountDao.queryBuilder().where().like("phone", "%"+columnValue+"%").or().like("name","%"+columnValue+"%").query();
|
||||
|
||||
} catch (java.sql.SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return ormTables;
|
||||
}
|
||||
|
||||
public boolean updateData(DbRecordBeanData userData) {
|
||||
|
||||
try {
|
||||
int result = userAccountDao.update(userData);
|
||||
if (result != -1) {
|
||||
return true;
|
||||
|
||||
}
|
||||
} catch (java.sql.SQLException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<DbRecordBeanData> queryInByCustom(String columnName,String columnValues){
|
||||
List<DbRecordBeanData> ormTables = new ArrayList<>();
|
||||
try {
|
||||
List<String> strings = Arrays.asList(columnValues.split(","));
|
||||
|
||||
ormTables = userAccountDao.queryBuilder().where().in(columnName,strings ).query();
|
||||
}catch (java.sql.SQLException e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ormTables;
|
||||
}
|
||||
|
||||
public ArrayList<DbRecordBeanData> queryAll() {
|
||||
ArrayList<DbRecordBeanData> userAccountList = new ArrayList<>();
|
||||
try {
|
||||
userAccountList = (ArrayList<DbRecordBeanData>) userAccountDao.queryForAll();
|
||||
} catch (java.sql.SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return userAccountList;
|
||||
}
|
||||
|
||||
public long delete(List<DbRecordBeanData> DATA){
|
||||
int id = 0;
|
||||
try {
|
||||
try {
|
||||
id = userAccountDao.delete(DATA);
|
||||
} catch (java.sql.SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.example.administrator.seven.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.text.Html;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.administrator.seven.R;
|
||||
|
||||
/**
|
||||
* Time: 2020/5/12
|
||||
* Author: jianbo
|
||||
* Description: 封装的自定义对话框
|
||||
*/
|
||||
public class PersonnelDialogHelptwo {
|
||||
|
||||
Context mcontext;
|
||||
ClickListener clickListener;
|
||||
|
||||
public void showDownloadDialog(Context mcontext,final String s1,final String s2, final ClickListener clickListener) {
|
||||
this.clickListener=clickListener;
|
||||
this.mcontext=mcontext;
|
||||
final Dialog dialog = new Dialog(mcontext, R.style.DialogStyle);
|
||||
dialog.setCancelable(false);
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
View view = LayoutInflater.from(mcontext).inflate(R.layout.item_personnel_dialog_two, null);
|
||||
dialog.setContentView(view);
|
||||
TextView tvPhone = (TextView) view.findViewById(R.id.tvPhone);
|
||||
TextView tvSexSend = (TextView) view.findViewById(R.id.tvSexSend);
|
||||
tvPhone.setText(Html.fromHtml(s1));
|
||||
tvSexSend.setText(s2);
|
||||
tvPhone.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
tvSexSend.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
clickListener.confirm();
|
||||
dialog.dismiss();
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
Window mWindow = dialog.getWindow();
|
||||
WindowManager.LayoutParams lp = mWindow.getAttributes();
|
||||
lp.width = MyDialog.getScreenWidth(mcontext);
|
||||
mWindow.setGravity(Gravity.CENTER);
|
||||
// mWindow.setWindowAnimations(R.style.dialogAnim);
|
||||
mWindow.setAttributes(lp);
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
public interface ClickListener{
|
||||
|
||||
void confirm();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -26,9 +26,7 @@ public class MyModelImpl implements MyContract.Model {
|
||||
|
||||
@Override
|
||||
public boolean isBindWeChat() {
|
||||
return "2".equals(ProfileSpUtils.getInstance()
|
||||
.getUserProfie()
|
||||
.getIs_bind_wechat());
|
||||
return "2".equals("");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,9 +45,7 @@ public class MyModelImpl implements MyContract.Model {
|
||||
}
|
||||
//绑定成功后刷新资料
|
||||
return ApiUtils.getApi()
|
||||
.userIdentity(ProfileSpUtils.getInstance()
|
||||
.getUserProfie()
|
||||
.getIm_identifier());
|
||||
.userIdentity("");
|
||||
}
|
||||
})
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -70,9 +66,7 @@ public class MyModelImpl implements MyContract.Model {
|
||||
@Override
|
||||
public void refresh(final ApiCallBack<TreeUserEntity> callBack) {
|
||||
ApiUtils.getApi()
|
||||
.userIdentity(ProfileSpUtils.getInstance()
|
||||
.getUserProfie()
|
||||
.getIm_identifier())
|
||||
.userIdentity("")
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<ResponseBean<TreeUserEntity>>() {
|
||||
@@ -90,6 +84,6 @@ public class MyModelImpl implements MyContract.Model {
|
||||
|
||||
@Override
|
||||
public void save(TreeUserEntity entity) {
|
||||
ProfileSpUtils.getInstance().saveProfile(entity);
|
||||
ProfileSpUtils.getInstance().saveProfile(null );
|
||||
}
|
||||
}
|
||||
@@ -33,7 +33,7 @@ public class LoginPasswordModelImpl implements LoginPasswordContract.Model {
|
||||
|
||||
@Override
|
||||
public void saveUserInfo(LoginBean data) {
|
||||
|
||||
ProfileSpUtils.getInstance().saveProfile(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
package com.example.administrator.seven.main.kehu.Bean;
|
||||
|
||||
import com.example.administrator.seven.test.BaseModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Time: 2020/8/17
|
||||
* Author: jianbo
|
||||
* Description:
|
||||
*/
|
||||
public class CustomerListBean extends BaseModel {
|
||||
|
||||
/**
|
||||
* result : {"msg":"获取成功","total":0,"data":[{"headimg":"","phone":"15862656263","name":"text","wechat":"weixin","source":"1","customer_id":"3aaa642ed2f57470f62c51ee60d8a852","type":"old","source_name":"添加客户"}],"success":0}
|
||||
* status : 0
|
||||
*/
|
||||
|
||||
private ResultBean result;
|
||||
private int status;
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ResultBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
/**
|
||||
* msg : 获取成功
|
||||
* total : 0
|
||||
* data : [{"headimg":"","phone":"15862656263","name":"text","wechat":"weixin","source":"1","customer_id":"3aaa642ed2f57470f62c51ee60d8a852","type":"old","source_name":"添加客户"}]
|
||||
* success : 0
|
||||
*/
|
||||
|
||||
private String msg;
|
||||
private int total;
|
||||
private int success;
|
||||
private List<DataBean> data;
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public int getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(int success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
/**
|
||||
* headimg :
|
||||
* phone : 15862656263
|
||||
* name : text
|
||||
* wechat : weixin
|
||||
* source : 1
|
||||
* customer_id : 3aaa642ed2f57470f62c51ee60d8a852
|
||||
* type : old
|
||||
* source_name : 添加客户
|
||||
*/
|
||||
|
||||
private String headimg;
|
||||
private String phone;
|
||||
private String name;
|
||||
private String wechat;
|
||||
private String source;
|
||||
private String customer_id;
|
||||
private String type;
|
||||
private String source_name;
|
||||
|
||||
public String getHeadimg() {
|
||||
return headimg;
|
||||
}
|
||||
|
||||
public void setHeadimg(String headimg) {
|
||||
this.headimg = headimg;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getWechat() {
|
||||
return wechat;
|
||||
}
|
||||
|
||||
public void setWechat(String wechat) {
|
||||
this.wechat = wechat;
|
||||
}
|
||||
|
||||
public String getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(String source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public String getCustomer_id() {
|
||||
return customer_id;
|
||||
}
|
||||
|
||||
public void setCustomer_id(String customer_id) {
|
||||
this.customer_id = customer_id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getSource_name() {
|
||||
return source_name;
|
||||
}
|
||||
|
||||
public void setSource_name(String source_name) {
|
||||
this.source_name = source_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package com.example.administrator.seven.main.kehu.Bean;
|
||||
|
||||
import com.example.administrator.seven.test.BaseModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Time: 2020/8/17
|
||||
* Author: jianbo
|
||||
* Description:
|
||||
*/
|
||||
public class FpListBean extends BaseModel {
|
||||
|
||||
/**
|
||||
* result : {"msg":"获取成功","data":[{"headimg":"localhost/upload/2020081115530962805.jpg","fp_num":"2","phone":"18831913290","name":"demo","wechat":"wangyuxin283425757","industry":[{"industry":"家具","type":"0","customer_id":"ae0c5199fdf564f90796aec09482b85d"}],"customer_id":"ae0c5199fdf564f90796aec09482b85d"}],"success":0}
|
||||
* status : 0
|
||||
*/
|
||||
|
||||
private ResultBean result;
|
||||
private int status;
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ResultBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
/**
|
||||
* msg : 获取成功
|
||||
* data : [{"headimg":"localhost/upload/2020081115530962805.jpg","fp_num":"2","phone":"18831913290","name":"demo","wechat":"wangyuxin283425757","industry":[{"industry":"家具","type":"0","customer_id":"ae0c5199fdf564f90796aec09482b85d"}],"customer_id":"ae0c5199fdf564f90796aec09482b85d"}]
|
||||
* success : 0
|
||||
*/
|
||||
|
||||
private String msg;
|
||||
private int success;
|
||||
private List<DataBean> data;
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(int success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
/**
|
||||
* headimg : localhost/upload/2020081115530962805.jpg
|
||||
* fp_num : 2
|
||||
* phone : 18831913290
|
||||
* name : demo
|
||||
* wechat : wangyuxin283425757
|
||||
* industry : [{"industry":"家具","type":"0","customer_id":"ae0c5199fdf564f90796aec09482b85d"}]
|
||||
* customer_id : ae0c5199fdf564f90796aec09482b85d
|
||||
*/
|
||||
|
||||
private String headimg;
|
||||
private String fp_num;
|
||||
private String phone;
|
||||
private String name;
|
||||
private String wechat;
|
||||
private String customer_id;
|
||||
private List<IndustryBean> industry;
|
||||
|
||||
public String getHeadimg() {
|
||||
return headimg;
|
||||
}
|
||||
|
||||
public void setHeadimg(String headimg) {
|
||||
this.headimg = headimg;
|
||||
}
|
||||
|
||||
public String getFp_num() {
|
||||
return fp_num;
|
||||
}
|
||||
|
||||
public void setFp_num(String fp_num) {
|
||||
this.fp_num = fp_num;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getWechat() {
|
||||
return wechat;
|
||||
}
|
||||
|
||||
public void setWechat(String wechat) {
|
||||
this.wechat = wechat;
|
||||
}
|
||||
|
||||
public String getCustomer_id() {
|
||||
return customer_id;
|
||||
}
|
||||
|
||||
public void setCustomer_id(String customer_id) {
|
||||
this.customer_id = customer_id;
|
||||
}
|
||||
|
||||
public List<IndustryBean> getIndustry() {
|
||||
return industry;
|
||||
}
|
||||
|
||||
public void setIndustry(List<IndustryBean> industry) {
|
||||
this.industry = industry;
|
||||
}
|
||||
|
||||
public static class IndustryBean {
|
||||
/**
|
||||
* industry : 家具
|
||||
* type : 0
|
||||
* customer_id : ae0c5199fdf564f90796aec09482b85d
|
||||
*/
|
||||
|
||||
private String industry;
|
||||
private String type;
|
||||
private String customer_id;
|
||||
|
||||
public String getIndustry() {
|
||||
return industry;
|
||||
}
|
||||
|
||||
public void setIndustry(String industry) {
|
||||
this.industry = industry;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getCustomer_id() {
|
||||
return customer_id;
|
||||
}
|
||||
|
||||
public void setCustomer_id(String customer_id) {
|
||||
this.customer_id = customer_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.example.administrator.seven.main.kehu.Bean;
|
||||
|
||||
/**
|
||||
* Created by chenss on 2018/7/7.
|
||||
*/
|
||||
|
||||
public class WxuSerinfo {
|
||||
|
||||
public String getHongbao() {
|
||||
return hongbao;
|
||||
}
|
||||
|
||||
public void setHongbao(String hongbao) {
|
||||
this.hongbao = hongbao;
|
||||
}
|
||||
|
||||
String hongbao=null;
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
String message="";
|
||||
|
||||
public String getMessageSource() {
|
||||
return messageSource;
|
||||
}
|
||||
|
||||
public void setMessageSource(String messageSource) {
|
||||
this.messageSource = messageSource;
|
||||
}
|
||||
|
||||
String messageSource="";//消息来源 2.调拨客户
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
package com.example.administrator.seven.main.kehu.Bean;
|
||||
|
||||
import com.example.administrator.seven.test.BaseModel;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Time: 2020/8/17
|
||||
* Author: jianbo
|
||||
* Description:
|
||||
*/
|
||||
public class customerFPListBean extends BaseModel {
|
||||
|
||||
/**
|
||||
* result : {"msg":"获取成功","data":[{"headimg":"localhost/upload/2020081115530962805.jpg","fp_num":"0","phone":"18831913290","name":"demo","wechat":"wangyuxin283425757","customer_id":"ae0c5199fdf564f90796aec09482b85d"}],"success":0}
|
||||
* status : 0
|
||||
*/
|
||||
|
||||
private ResultBean result;
|
||||
private int status;
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ResultBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
/**
|
||||
* msg : 获取成功
|
||||
* data : [{"headimg":"localhost/upload/2020081115530962805.jpg","fp_num":"0","phone":"18831913290","name":"demo","wechat":"wangyuxin283425757","customer_id":"ae0c5199fdf564f90796aec09482b85d"}]
|
||||
* success : 0
|
||||
*/
|
||||
|
||||
private String msg;
|
||||
private int success;
|
||||
private List<DataBean> data;
|
||||
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
public int getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setSuccess(int success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public List<DataBean> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(List<DataBean> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static class DataBean {
|
||||
/**
|
||||
* headimg : localhost/upload/2020081115530962805.jpg
|
||||
* fp_num : 0
|
||||
* phone : 18831913290
|
||||
* name : demo
|
||||
* wechat : wangyuxin283425757
|
||||
* customer_id : ae0c5199fdf564f90796aec09482b85d
|
||||
*/
|
||||
|
||||
private String headimg;
|
||||
private String fp_num;
|
||||
private String phone;
|
||||
private String name;
|
||||
private String wechat;
|
||||
private String customer_id;
|
||||
|
||||
public String getHeadimg() {
|
||||
return headimg;
|
||||
}
|
||||
|
||||
public void setHeadimg(String headimg) {
|
||||
this.headimg = headimg;
|
||||
}
|
||||
|
||||
public String getFp_num() {
|
||||
return fp_num;
|
||||
}
|
||||
|
||||
public void setFp_num(String fp_num) {
|
||||
this.fp_num = fp_num;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getWechat() {
|
||||
return wechat;
|
||||
}
|
||||
|
||||
public void setWechat(String wechat) {
|
||||
this.wechat = wechat;
|
||||
}
|
||||
|
||||
public String getCustomer_id() {
|
||||
return customer_id;
|
||||
}
|
||||
|
||||
public void setCustomer_id(String customer_id) {
|
||||
this.customer_id = customer_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.example.administrator.seven.main.kehu.Bean;
|
||||
|
||||
public class fenpeisuccess {
|
||||
public String getMsg() {
|
||||
return msg;
|
||||
}
|
||||
|
||||
public void setMsg(String msg) {
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
String msg="";
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
String message="";
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.example.administrator.seven.main.kehu.entity;
|
||||
package com.example.administrator.seven.main.kehu.Bean;
|
||||
|
||||
import com.example.administrator.seven.test.BaseModel;
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
package com.example.administrator.seven.main.kehu;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.example.administrator.seven.JsonUtils;
|
||||
import com.example.administrator.seven.main.adapter.mine.XikeInfoAdapter;
|
||||
import com.example.administrator.seven.main.entity.XikeInfoBean;
|
||||
import com.example.administrator.seven.R;
|
||||
import com.example.administrator.seven.dialog.BaseTipsDialog;
|
||||
import com.example.administrator.seven.main.activity.LoginPasswordActivity;
|
||||
import com.example.administrator.seven.main.kehu.Bean.CustomerListBean;
|
||||
import com.example.administrator.seven.main.kehu.Dialog.CusOperationDialog;
|
||||
import com.example.administrator.seven.main.kehu.adapter.CusListAdapter;
|
||||
import com.example.administrator.seven.okgonet.NetApi;
|
||||
import com.example.administrator.seven.okgonet.Observer;
|
||||
import com.example.administrator.seven.utils.checkVersionsUtils.ProfileSpUtils;
|
||||
import com.lzy.okgo.model.Response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -33,33 +40,70 @@ public class CustomerFragment extends MobanFragment {
|
||||
CusListAdapter markingtwoAdapter = new CusListAdapter(mContext, null);
|
||||
getAdpter(markingtwoAdapter);
|
||||
mMarkingFragmentRecyclerView.setAdapter(markingtwoAdapter);
|
||||
markingtwoAdapter.operationListenner(new CusListAdapter.OnViewClickListener() {
|
||||
@Override
|
||||
public void operation(final CustomerListBean.ResultBean.DataBean item) {
|
||||
new CusOperationDialog(getActivity(), R.style.dialog, new CusOperationDialog.OnCloseListener() {
|
||||
@Override
|
||||
public void phoneClick() {//拨打电话
|
||||
if (item.getPhone() != null) {
|
||||
call(item.getPhone());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void kaidanonClick() {//信息完善
|
||||
|
||||
}
|
||||
|
||||
//删除客户
|
||||
@Override
|
||||
public void uploadAvatar() {
|
||||
new BaseTipsDialog().showDownloadDialog(getActivity(), "确认删除该客户吗?", "确定", new BaseTipsDialog.ClickListener() {
|
||||
@Override
|
||||
public void confirm() {
|
||||
Toast.makeText(getActivity(), "还没调接口", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancle() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestData() {
|
||||
new NetApi().xikeInfo("b886798bdce09746a787651013f2c6e6").subscribe(new Observer<Response>() {
|
||||
@Override
|
||||
public void onNext(Response response) {
|
||||
String body = (String) response.body();
|
||||
XikeInfoBean.ResultBean esdv = JsonUtils.fromJson(body, XikeInfoBean.class).getResult();
|
||||
mSwl.setRefreshing(false);
|
||||
if (esdv != null && String.valueOf(esdv.getSuccess()).equals("0")) {
|
||||
// new NetApi().customerList(ProfileSpUtils.getInstance().getUserProfie().getData().getUuid(),"").subscribe(new Observer<Response>() {
|
||||
// @Override
|
||||
// public void onNext(Response response) {
|
||||
// String body = (String) response.body();
|
||||
// CustomerListBean.ResultBean result = JsonUtils.fromJson(body, CustomerListBean.class).getResult();
|
||||
// mSwl.setRefreshing(false);
|
||||
// if (result != null && String.valueOf(result.getSuccess()).equals("0")) {
|
||||
|
||||
// List<XikeInfoBean.ResultBean.DataBean> data = esdv.getData();
|
||||
|
||||
|
||||
List<XikeInfoBean.ResultBean.DataBean> data = new ArrayList<XikeInfoBean.ResultBean.DataBean>();
|
||||
// List<CustomerListBean.ResultBean.DataBean> data = result.getData();
|
||||
List<CustomerListBean.ResultBean.DataBean> data = new ArrayList<CustomerListBean.ResultBean.DataBean>();
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
XikeInfoBean.ResultBean.DataBean dataBean = new XikeInfoBean.ResultBean.DataBean();
|
||||
dataBean.setTime("2020-07-01 12:00:00");
|
||||
dataBean.setXike_num("+89.00");
|
||||
dataBean.setXike_remark("收益账户转入");
|
||||
CustomerListBean.ResultBean.DataBean dataBean = new CustomerListBean.ResultBean.DataBean();
|
||||
dataBean.setName("小斐");
|
||||
dataBean.setPhone("15862656263");
|
||||
dataBean.setSource_name("添加客户");
|
||||
dataBean.setWechat("weixin");
|
||||
dataBean.setHeadimg("");
|
||||
dataBean.setSource("1");
|
||||
dataBean.setType("old");
|
||||
data.add(dataBean);
|
||||
}
|
||||
|
||||
if (data.size() == 0) {
|
||||
//markingtwoAdapter.setEmptyView(notDataView);
|
||||
markingtwoAdapter.setEmptyView(notDataView);
|
||||
return;
|
||||
}
|
||||
if (mNextRequestPage == 1) {
|
||||
@@ -67,19 +111,19 @@ public class CustomerFragment extends MobanFragment {
|
||||
} else {
|
||||
setData(false, data);
|
||||
}
|
||||
} else {
|
||||
setData(true, null);
|
||||
markingtwoAdapter.setEmptyView(notDataView);
|
||||
mSwl.setRefreshing(false);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void onError(Exception e) {
|
||||
e.printStackTrace();
|
||||
markingtwoAdapter.setEmptyView(errorView);
|
||||
mSwl.setRefreshing(false);
|
||||
}
|
||||
});
|
||||
// } else {
|
||||
// setData(true, null);
|
||||
// markingtwoAdapter.setEmptyView(notDataView);
|
||||
// mSwl.setRefreshing(false);
|
||||
// }
|
||||
// }
|
||||
// @Override
|
||||
// public void onError(Exception e) {
|
||||
// e.printStackTrace();
|
||||
// markingtwoAdapter.setEmptyView(errorView);
|
||||
// mSwl.setRefreshing(false);
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.example.administrator.seven.main.kehu.Dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.administrator.seven.R;
|
||||
|
||||
public class CusOperationDialog extends Dialog implements View.OnClickListener {
|
||||
|
||||
private Context mContext;
|
||||
private OnCloseListener listener;
|
||||
private TextView bt_draining_kehu;
|
||||
private RelativeLayout rl_tv_kaidan,rl_tv_uploadAvatar;
|
||||
private TextView tv_cancel;
|
||||
private ImageView img_hongdian_bg;
|
||||
private ImageView img_hongdian_kai;
|
||||
private LinearLayout ly_kaidan;
|
||||
|
||||
public CusOperationDialog(Context context) {
|
||||
super(context);
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
public CusOperationDialog(Context context, int themeResId, OnCloseListener listener) {
|
||||
super(context, themeResId);
|
||||
this.mContext = context;
|
||||
this.listener = listener;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.qiangdan_dialog);
|
||||
setCanceledOnTouchOutside(false);
|
||||
Window window = getWindow();
|
||||
window.getDecorView().setPadding(0, 0, 0, 0);
|
||||
WindowManager.LayoutParams layoutParams = window.getAttributes();
|
||||
layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
layoutParams.horizontalMargin = 0;
|
||||
window.setAttributes(layoutParams);
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
bt_draining_kehu = (TextView) findViewById(R.id.bt_draining_kehu);
|
||||
bt_draining_kehu.setOnClickListener(this);
|
||||
rl_tv_kaidan = (RelativeLayout) findViewById(R.id.rl_tv_kaidan);
|
||||
rl_tv_kaidan.setOnClickListener(this);
|
||||
rl_tv_uploadAvatar = (RelativeLayout) findViewById(R.id.rl_tv_uploadAvatar);
|
||||
rl_tv_uploadAvatar.setOnClickListener(this);
|
||||
tv_cancel = (TextView) findViewById(R.id.tv_cancel);
|
||||
tv_cancel.setOnClickListener(this);
|
||||
ly_kaidan = (LinearLayout) findViewById(R.id.ly_kaidan);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.bt_draining_kehu://拨打电话
|
||||
if (listener != null) {
|
||||
listener.phoneClick();
|
||||
}
|
||||
dismiss();
|
||||
break;
|
||||
case R.id.rl_tv_kaidan://开单
|
||||
if (listener != null) {
|
||||
listener.kaidanonClick();
|
||||
}
|
||||
dismiss();
|
||||
break;
|
||||
case R.id.rl_tv_uploadAvatar://上传头像
|
||||
if (listener != null) {
|
||||
listener.uploadAvatar();
|
||||
}
|
||||
dismiss();
|
||||
break;
|
||||
case R.id.tv_cancel://取消
|
||||
this.dismiss();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnCloseListener {
|
||||
|
||||
void phoneClick();
|
||||
void kaidanonClick();
|
||||
void uploadAvatar();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,12 @@
|
||||
package com.example.administrator.seven.main.kehu;
|
||||
|
||||
import com.example.administrator.seven.JsonUtils;
|
||||
import com.example.administrator.seven.main.adapter.mine.XikeInfoAdapter;
|
||||
import com.example.administrator.seven.main.entity.XikeInfoBean;
|
||||
import com.example.administrator.seven.main.kehu.Bean.FpListBean;
|
||||
import com.example.administrator.seven.main.kehu.adapter.DisListAdapter;
|
||||
import com.example.administrator.seven.okgonet.NetApi;
|
||||
import com.example.administrator.seven.okgonet.Observer;
|
||||
import com.lzy.okgo.model.Response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@@ -37,29 +35,16 @@ public class DistriFragment extends MobanFragment {
|
||||
|
||||
@Override
|
||||
public void requestData() {
|
||||
new NetApi().xikeInfo("b886798bdce09746a787651013f2c6e6").subscribe(new Observer<Response>() {
|
||||
new NetApi().fpList("b886798bdce09746a787651013f2c6e6","").subscribe(new Observer<Response>() {
|
||||
@Override
|
||||
public void onNext(Response response) {
|
||||
String body = (String) response.body();
|
||||
XikeInfoBean.ResultBean esdv = JsonUtils.fromJson(body, XikeInfoBean.class).getResult();
|
||||
FpListBean.ResultBean result = JsonUtils.fromJson(body, FpListBean.class).getResult();
|
||||
mSwl.setRefreshing(false);
|
||||
if (esdv != null && String.valueOf(esdv.getSuccess()).equals("0")) {
|
||||
|
||||
// List<XikeInfoBean.ResultBean.DataBean> data = esdv.getData();
|
||||
|
||||
|
||||
List<XikeInfoBean.ResultBean.DataBean> data = new ArrayList<XikeInfoBean.ResultBean.DataBean>();
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
XikeInfoBean.ResultBean.DataBean dataBean = new XikeInfoBean.ResultBean.DataBean();
|
||||
dataBean.setTime("2020-07-01 12:00:00");
|
||||
dataBean.setXike_num("+89.00");
|
||||
dataBean.setXike_remark("收益账户转入");
|
||||
data.add(dataBean);
|
||||
}
|
||||
|
||||
if (result != null && String.valueOf(result.getSuccess()).equals("0")) {
|
||||
List<FpListBean.ResultBean.DataBean> data = result.getData();
|
||||
if (data.size() == 0) {
|
||||
//markingtwoAdapter.setEmptyView(notDataView);
|
||||
markingtwoAdapter.setEmptyView(notDataView);
|
||||
return;
|
||||
}
|
||||
if (mNextRequestPage == 1) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.widget.TextView;
|
||||
|
||||
import com.example.administrator.seven.R;
|
||||
import com.example.administrator.seven.main.entity.Savaselect;
|
||||
import com.example.administrator.seven.main.kehu.activity.ShowAty;
|
||||
import com.example.administrator.seven.test.BaseFragment;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
|
||||
@@ -140,7 +141,8 @@ public class TraceFragment extends BaseFragment implements View.OnClickListener
|
||||
mEnterShopTitle = (TextView) view.findViewById(R.id.enter_shop_title);
|
||||
mEnterShopTitle.setOnClickListener(this);
|
||||
enter_shop_shaixuan = (TextView) view.findViewById(R.id.enter_shop_shaixuan);
|
||||
|
||||
RelativeLayout bt_fenpei = (RelativeLayout)view.findViewById(R.id.bt_fenpei);
|
||||
bt_fenpei.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -152,6 +154,10 @@ public class TraceFragment extends BaseFragment implements View.OnClickListener
|
||||
break;
|
||||
case R.id.enter_shop_shai:
|
||||
break;
|
||||
case R.id.bt_fenpei:
|
||||
ShowAty.AllocationActivity(getActivity());
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
package com.example.administrator.seven.main.kehu.activity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.AutoCompleteTextView;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.administrator.seven.JsonUtils;
|
||||
import com.example.administrator.seven.R;
|
||||
import com.example.administrator.seven.base.BaseActivity;
|
||||
import com.example.administrator.seven.db.DbRecordBeanData;
|
||||
import com.example.administrator.seven.db.dao.DbRecordDao;
|
||||
import com.example.administrator.seven.main.kehu.Bean.CustomerListBean;
|
||||
import com.example.administrator.seven.main.kehu.Bean.WxuSerinfo;
|
||||
import com.example.administrator.seven.main.kehu.Bean.customerFPListBean;
|
||||
import com.example.administrator.seven.main.kehu.Bean.fenpeisuccess;
|
||||
import com.example.administrator.seven.main.kehu.adapter.AllocationAdapter;
|
||||
import com.example.administrator.seven.okgonet.NetApi;
|
||||
import com.example.administrator.seven.okgonet.Observer;
|
||||
import com.example.administrator.seven.utils.AbStrUtil;
|
||||
import com.lzy.okgo.model.Response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import de.greenrobot.event.EventBus;
|
||||
|
||||
/**
|
||||
* 客户分配
|
||||
*/
|
||||
public class AllocationActivity extends BaseActivity implements View.OnClickListener{
|
||||
private RelativeLayout mRlLeft;
|
||||
private ImageView mIvLeft;
|
||||
private TextView mTvCenter;
|
||||
private TextView RightTv;
|
||||
private RecyclerView mRvList;
|
||||
private List<DbRecordBeanData> mShowList = new ArrayList<>();
|
||||
private List<DbRecordBeanData> mShowListtwo = new ArrayList<>();
|
||||
private AllocationAdapter mAdapter;
|
||||
|
||||
protected final String TAG = this.getClass().getSimpleName();
|
||||
private List<DbRecordBeanData> dbRecordBeanData;
|
||||
private String search;
|
||||
private DbRecordDao dbRecordDao;
|
||||
private String times;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_allocation);
|
||||
times = getIntent().getStringExtra("times");
|
||||
initView();
|
||||
setEvent();
|
||||
EventBus.getDefault().register(this);
|
||||
dbRecordDao = new DbRecordDao(this);
|
||||
initData();
|
||||
getData(times);
|
||||
|
||||
}
|
||||
public void onEvent(fenpeisuccess event) {
|
||||
if (null != event && event.getMsg().equals("2")) {
|
||||
// dbRecordDao.delete(mShowList);
|
||||
// getData(times);
|
||||
WxuSerinfo wxuSerinfo = new WxuSerinfo();
|
||||
wxuSerinfo.setHongbao("1");
|
||||
wxuSerinfo.setMessage(event.getMessage());
|
||||
EventBus.getDefault().post(wxuSerinfo);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
private void initView() {
|
||||
mRlLeft = (RelativeLayout) findViewById(R.id.rl_left);
|
||||
mIvLeft = (ImageView) findViewById(R.id.leftIv);
|
||||
mTvCenter = (TextView) findViewById(R.id.centerTv);
|
||||
mRvList = (RecyclerView) findViewById(R.id.rv_list);
|
||||
RightTv = findViewById(R.id.RightTv);
|
||||
mIvLeft.setVisibility(View.VISIBLE);
|
||||
mTvCenter.setVisibility(View.VISIBLE);
|
||||
RightTv.setVisibility(View.VISIBLE);
|
||||
mTvCenter.setText("客户调拨");
|
||||
RightTv.setText("调拨");
|
||||
|
||||
}
|
||||
|
||||
private void initData() {
|
||||
LinearLayoutManager layoutManager = new LinearLayoutManager(this );
|
||||
mRvList.setLayoutManager(layoutManager);
|
||||
mAdapter = new AllocationAdapter(mShowList, AllocationActivity.this,RightTv);
|
||||
mRvList.setAdapter(mAdapter);
|
||||
mAdapter.setNumListener(new AllocationAdapter.NumListener() {
|
||||
@Override
|
||||
public void sennum(List<DbRecordBeanData> mDatas) {
|
||||
//刷新数据
|
||||
ArrayList<DbRecordBeanData> dbRecordBeanData = dbRecordDao.queryAll();
|
||||
int numtwo=0;
|
||||
for (int i = 0; i < dbRecordBeanData.size(); i++) {
|
||||
if (dbRecordBeanData.get(i).getSelectstuta().equals("1")) {
|
||||
numtwo+=1;
|
||||
}
|
||||
}
|
||||
RightTv.setText("调拨("+numtwo+")");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
//从数据库里取
|
||||
//这里做一个判断
|
||||
dbRecordBeanData = dbRecordDao.queryAll();
|
||||
Log.e("数据的个数==", dbRecordBeanData.size()+"");
|
||||
setData(dbRecordBeanData);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void getData(String times) {
|
||||
// new NetApi().customerFPList("b886798bdce09746a787651013f2c6e6").subscribe(new Observer<Response>() {
|
||||
// @Override
|
||||
// public void onNext(Response response) {
|
||||
// String body = (String) response.body();
|
||||
// customerFPListBean.ResultBean result = JsonUtils.fromJson(body, customerFPListBean.class).getResult();
|
||||
// if (result != null && String.valueOf(result.getSuccess()).equals("0")) {
|
||||
// List<customerFPListBean.ResultBean.DataBean> data = result.getData();
|
||||
|
||||
|
||||
List<customerFPListBean.ResultBean.DataBean> data = new ArrayList<customerFPListBean.ResultBean.DataBean>();
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
customerFPListBean.ResultBean.DataBean dataBean = new customerFPListBean.ResultBean.DataBean();
|
||||
dataBean.setName("小斐");
|
||||
dataBean.setPhone("15862656263");
|
||||
dataBean.setWechat("weixin");
|
||||
dataBean.setHeadimg("");
|
||||
data.add(dataBean);
|
||||
}
|
||||
|
||||
//存入数据库
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
customerFPListBean.ResultBean.DataBean dataBean = data.get(i);
|
||||
DbRecordBeanData userData = new DbRecordBeanData();
|
||||
userData.setId(i+"");
|
||||
userData.setSelectstuta("0");
|
||||
userData.setCustomer_id(dataBean.getCustomer_id());
|
||||
userData.setFp_num(dataBean.getFp_num());
|
||||
userData.setHeadimg(dataBean.getHeadimg());
|
||||
userData.setName(dataBean.getName());
|
||||
userData.setPhone(dataBean.getPhone());
|
||||
userData.setWechat(dataBean.getWechat());
|
||||
if (null != dbRecordDao.queryByCustom("Id", userData.getId()) && dbRecordDao.queryByCustom("Id", userData.getId()).size() > 0) {
|
||||
dbRecordDao.updateData(userData);
|
||||
} else {
|
||||
dbRecordDao.addInsert(userData);
|
||||
}
|
||||
}
|
||||
//从数据库里取
|
||||
dbRecordBeanData = dbRecordDao.queryAll();
|
||||
Log.e("数据的个数==", dbRecordBeanData.size()+"");
|
||||
setData(dbRecordBeanData);
|
||||
// }
|
||||
// }
|
||||
// @Override
|
||||
// public void onError(Exception e) {
|
||||
// e.printStackTrace();
|
||||
//
|
||||
// }
|
||||
// });
|
||||
}
|
||||
|
||||
private void setEvent() {
|
||||
mRlLeft.setOnClickListener(this);
|
||||
RightTv.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()){
|
||||
case R.id.rl_left:
|
||||
finish();
|
||||
break;
|
||||
case R.id.RightTv:
|
||||
mShowListtwo.clear();
|
||||
dbRecordBeanData = dbRecordDao.queryAll();
|
||||
for (int i = 0; i < dbRecordBeanData.size(); i++) {
|
||||
if (dbRecordBeanData.get(i).getSelectstuta().equals("1")) {
|
||||
mShowListtwo.add(mShowList.get(i));
|
||||
}
|
||||
}
|
||||
if(mShowListtwo.size()>0){
|
||||
|
||||
//进入分配页面
|
||||
ShowAty.AllocationSelectActivity(this,mShowListtwo);}else {
|
||||
messageDialog("请选择调拨客户");
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
EventBus.getDefault().unregister(this);
|
||||
dbRecordDao.delete(mShowList);
|
||||
}
|
||||
|
||||
private void setData(List<DbRecordBeanData> dbRecordBeanData) {
|
||||
//给适配器设置数据
|
||||
if(mShowList!=null){
|
||||
mShowList.clear();
|
||||
}
|
||||
mShowList.addAll(dbRecordBeanData);
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.example.administrator.seven.main.kehu.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.example.administrator.seven.db.DbRecordBeanData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ShowAty {
|
||||
|
||||
/**
|
||||
* 选择调拨店铺
|
||||
*/
|
||||
public static void AllocationSelectActivity(Context ctx, List<DbRecordBeanData> mShowListtwo) {
|
||||
// Intent i = new Intent(ctx, AllocationSelectActivity.class);
|
||||
// Bundle bundle = new Bundle();
|
||||
// bundle.putSerializable("dataBean", (Serializable) mShowListtwo);
|
||||
// i.putExtras(bundle);
|
||||
// ctx.startActivity(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户调拨
|
||||
*/
|
||||
public static void AllocationActivity(Context ctx) {
|
||||
Intent i = new Intent(ctx, AllocationActivity.class);
|
||||
ctx.startActivity(i);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.example.administrator.seven.main.kehu.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.example.administrator.seven.R;
|
||||
import com.example.administrator.seven.db.DbRecordBeanData;
|
||||
import com.example.administrator.seven.db.dao.DbRecordDao;
|
||||
import com.example.administrator.seven.utils.GlideTools;
|
||||
import com.example.administrator.seven.utils.WidgetTools;
|
||||
import com.example.administrator.seven.widget.CircleImageView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
|
||||
public class AllocationAdapter extends RecyclerView.Adapter<AllocationAdapter.FromViewHolder>{
|
||||
private List<DbRecordBeanData> mDatas;
|
||||
private Context mContext;
|
||||
private String selectType="2";
|
||||
TextView RightTv;
|
||||
NumListener numListener;
|
||||
private DbRecordDao dbRecordDao;
|
||||
|
||||
public AllocationAdapter(List<DbRecordBeanData> mDatas, Context mContext, TextView RightTv) {
|
||||
this.mDatas = mDatas;
|
||||
this.mContext = mContext;
|
||||
this.RightTv = RightTv;
|
||||
dbRecordDao = new DbRecordDao(mContext);
|
||||
}
|
||||
|
||||
public void setNumListener(NumListener numListener){
|
||||
this.numListener = numListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FromViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.allocation_item,parent,false);
|
||||
FromViewHolder holder = new FromViewHolder(view);
|
||||
return holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(FromViewHolder holder, final int position) {
|
||||
GlideTools.init(mContext).displaypic(holder.mCivDefine, mDatas.get(position).getHeadimg(), R.mipmap.icon_default_head);
|
||||
WidgetTools.setTextfive(holder.mTvIntoTime, mDatas.get(position).getName()+" • ", mDatas.get(position).getPhone());
|
||||
String selectstuta = mDatas.get(position).getSelectstuta();
|
||||
if (selectstuta.equals("1")) {
|
||||
holder.select_iv.setImageResource(R.mipmap.icon_cheched_true);
|
||||
} else {
|
||||
holder.select_iv.setImageResource(R.mipmap.icon_cheched_false);
|
||||
}
|
||||
//发送消息改变分数数量
|
||||
numListener.sennum(mDatas);
|
||||
|
||||
//做单选条件限制
|
||||
holder.mRlRemove.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
//本次选择
|
||||
if (IsSelecet(position)) {
|
||||
cancalchoose(position);
|
||||
} else {
|
||||
//selectType 1为单选 2为多选
|
||||
selecttrue(position);
|
||||
}
|
||||
numListener.refresh();
|
||||
//发送消息改变分数数量
|
||||
numListener.sennum(mDatas);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDatas!=null?mDatas.size():0;
|
||||
}
|
||||
|
||||
class FromViewHolder extends RecyclerView.ViewHolder {
|
||||
CircleImageView mCivDefine;
|
||||
ImageView select_iv;
|
||||
TextView mTvIntoTime;
|
||||
RelativeLayout mRlRemove;
|
||||
|
||||
public FromViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
mCivDefine = itemView.findViewById(R.id.iv_default_image);
|
||||
|
||||
mTvIntoTime = itemView.findViewById(R.id.tv_into_time_value);
|
||||
select_iv = itemView.findViewById(R.id.select_iv);
|
||||
|
||||
mRlRemove = itemView.findViewById(R.id.rl_remove);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 选中(单选)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private void selecttrue(int position) {
|
||||
mDatas.get(position).setSelectstuta("1");
|
||||
DbRecordBeanData fromManagerBeanData = mDatas.get(position);
|
||||
dbRecordDao.updateData(fromManagerBeanData);
|
||||
ArrayList<DbRecordBeanData> fromManagerBeanData1 = dbRecordDao.queryAll();
|
||||
Log.e("数据的个数==", fromManagerBeanData1.size()+"");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private void cancalchoose(int position) {
|
||||
mDatas.get(position).setSelectstuta("0");
|
||||
DbRecordBeanData fromManagerBeanData = mDatas.get(position);
|
||||
dbRecordDao.updateData(fromManagerBeanData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前条目是否选中
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean IsSelecet(int position) {
|
||||
if (mDatas.get(position).getSelectstuta().equals("1")) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public interface NumListener{
|
||||
|
||||
/**
|
||||
* @description 数字监听
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
void sennum(List<DbRecordBeanData> mDatas);
|
||||
|
||||
void refresh();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,28 +1,49 @@
|
||||
package com.example.administrator.seven.main.kehu.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.administrator.seven.R;
|
||||
import com.example.administrator.seven.main.entity.XikeInfoBean;
|
||||
import com.example.administrator.seven.main.kehu.Bean.CustomerListBean;
|
||||
import com.example.administrator.seven.utils.WidgetTools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class CusListAdapter extends BaseQuickAdapter<XikeInfoBean.ResultBean.DataBean, BaseViewHolder> {
|
||||
public class CusListAdapter extends BaseQuickAdapter<CustomerListBean.ResultBean.DataBean, BaseViewHolder> {
|
||||
Context mcontext;
|
||||
OnViewClickListener onViewClickListener;
|
||||
|
||||
public CusListAdapter(Context context, List list) {
|
||||
super(R.layout.cuslist_item, list);
|
||||
this.mcontext = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void convert(final BaseViewHolder helper, final XikeInfoBean.ResultBean.DataBean item) {
|
||||
// WidgetTools.setTextfive((TextView) helper.getView(R.id.xike_tv_01), "", item.getXike_remark());
|
||||
// WidgetTools.setTextfive((TextView) helper.getView(R.id.xike_tv_02), "", item.getTime());
|
||||
// WidgetTools.setTextfive((TextView) helper.getView(R.id.xike_tv_03), "", item.getXike_num());
|
||||
protected void convert(final BaseViewHolder helper, final CustomerListBean.ResultBean.DataBean item) {
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.tv_dea_name), "", item.getName());
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.tv_dea_phone), "", item.getPhone());
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.tv_dea_watch), "", item.getWechat());
|
||||
TextView tv_cuslist_caozuo = (TextView)helper.getView(R.id.tv_cuslist_caozuo);
|
||||
tv_cuslist_caozuo.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
onViewClickListener.operation(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void operationListenner(OnViewClickListener onViewClickListener){
|
||||
this.onViewClickListener = onViewClickListener;
|
||||
}
|
||||
|
||||
public interface OnViewClickListener{
|
||||
|
||||
void operation(CustomerListBean.ResultBean.DataBean item);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,29 +1,66 @@
|
||||
package com.example.administrator.seven.main.kehu.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.administrator.seven.R;
|
||||
import com.example.administrator.seven.main.entity.XikeInfoBean;
|
||||
import com.example.administrator.seven.main.kehu.Bean.FpListBean;
|
||||
import com.example.administrator.seven.utils.GlideTools;
|
||||
import com.example.administrator.seven.utils.WidgetTools;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class DisListAdapter extends BaseQuickAdapter<XikeInfoBean.ResultBean.DataBean, BaseViewHolder> {
|
||||
|
||||
public class DisListAdapter extends BaseQuickAdapter<FpListBean.ResultBean.DataBean, BaseViewHolder> {
|
||||
Context mcontext;
|
||||
public DisListAdapter(Context context, List list) {
|
||||
super(R.layout.disliat_item, list);
|
||||
this.mcontext = context;
|
||||
}
|
||||
@Override
|
||||
protected void convert(final BaseViewHolder helper, final XikeInfoBean.ResultBean.DataBean item) {
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.xike_tv_01), "", item.getXike_remark());
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.xike_tv_02), "", item.getTime());
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.xike_tv_03), "", item.getXike_num());
|
||||
protected void convert(final BaseViewHolder helper, final FpListBean.ResultBean.DataBean item) {
|
||||
ImageView image = (ImageView)helper.getView(R.id.iv_dea_avatar);
|
||||
GlideTools.init(mContext).displaypic(image, item.getHeadimg(), R.mipmap.icon_default_head);
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.tv_dea_name), "", item.getName());
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.tv_dea_phone), "", item.getPhone());
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.tv_dea_watch), "", item.getWechat());
|
||||
RecyclerView recy_dis = (RecyclerView)helper.getView(R.id.recy_dis);
|
||||
|
||||
LinearLayoutManager manager = new LinearLayoutManager(mcontext);
|
||||
manager.setOrientation(LinearLayoutManager.HORIZONTAL);
|
||||
recy_dis.setLayoutManager(manager);
|
||||
recy_dis.setAdapter(new BaseQuickAdapter<FpListBean.ResultBean.DataBean.IndustryBean, BaseViewHolder>(R.layout.item_recy_dislist, item.getIndustry()) {
|
||||
@Override
|
||||
protected void convert(final BaseViewHolder helper, final FpListBean.ResultBean.DataBean.IndustryBean item) {
|
||||
|
||||
WidgetTools.setTextfive((TextView) helper.getView(R.id.tv_hangye), "", item.getIndustry());
|
||||
TextView tv_fenpei_status = (TextView)helper.getView(R.id.tv_fenpei_status);
|
||||
//0:已分配,1:已被抢,2:已进店,3:已成交
|
||||
String type = item.getType();
|
||||
switch (type){
|
||||
case "0":
|
||||
tv_fenpei_status.setText("已分配");
|
||||
break;
|
||||
case "1":
|
||||
tv_fenpei_status.setText("已被抢");
|
||||
break;
|
||||
case "2":
|
||||
tv_fenpei_status.setText("已进店");
|
||||
break;
|
||||
case "3":
|
||||
tv_fenpei_status.setText("已成交");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import android.widget.ImageView;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
import com.chad.library.adapter.base.BaseViewHolder;
|
||||
import com.example.administrator.seven.R;
|
||||
import com.example.administrator.seven.main.kehu.entity.markingYiliushi;
|
||||
import com.example.administrator.seven.main.kehu.Bean.markingYiliushi;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.example.administrator.seven.network.http;
|
||||
|
||||
/**
|
||||
* 项目名:NewJiaJieSong
|
||||
* 包名:com.example.administrator.newjiajiesong
|
||||
* 创建者:任剑波
|
||||
* 创建时间:2018/8/28 11:14
|
||||
* 描述:TODO
|
||||
*/
|
||||
public class Constants {
|
||||
|
||||
public static final String BASE_URL="http://192.168.0.158:81";
|
||||
|
||||
/**
|
||||
* 接口请求地址
|
||||
*/
|
||||
public static class UrlOrigin {
|
||||
/**
|
||||
*登录
|
||||
*//*
|
||||
public static final String login = "/device/DevLogin/accountPwd";*/
|
||||
/**
|
||||
* 获取验证码
|
||||
*/
|
||||
public static final String SEND_SMS = "/device/SendSMS/send";
|
||||
|
||||
/**
|
||||
* 验证码登录
|
||||
*/
|
||||
public static final String CODE_LOGIN = "/device/SendSMS/checkCode";
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,9 @@ package com.example.administrator.seven.okgonet;
|
||||
public class HttpConstants {
|
||||
|
||||
|
||||
public static String URiBase = "http://www.fenghoo.com.cn";// 蜂狐商户版线上
|
||||
// public static String URiBase = "http://www.fenghoo.com.cn";// 蜂狐商户版线上
|
||||
|
||||
// public static String URiBase = "http://www.fenghoo.com.cn:88";// 蜂狐商户版(测试库)
|
||||
public static String URiBase = "http://192.168.1.4";// 7月7
|
||||
|
||||
|
||||
/**
|
||||
@@ -393,614 +393,20 @@ public class HttpConstants {
|
||||
public static String URi_device_DevPerManager_xikeInfo = URiBase + "/device/DevPerManager/xikeInfo";
|
||||
|
||||
/**
|
||||
* 抢单客户信息详情
|
||||
* 分配列表
|
||||
*/
|
||||
public static String URi_device_DevPerManager_robCustomerInfo = URiBase + "/device/DevPerManager/robCustomerInfo";
|
||||
/**
|
||||
* 已成交--修改金额
|
||||
*/
|
||||
public static String URi_device_DevMark_ChangePrice = URiBase + "/device/DevMark/ChangePrice";
|
||||
|
||||
/**
|
||||
* 已成交---新增成交
|
||||
*/
|
||||
public static String URi_device_DevMark_AddPrice = URiBase + "/device/DevMark/AddPrice";
|
||||
/**
|
||||
* 设计师异业推荐信息
|
||||
*/
|
||||
public static String URi_device_DevMark_RECOMMENDINFO = URiBase + "/device/DevMark/RecommentInfo";
|
||||
|
||||
/**
|
||||
* 设计师异业推荐信息
|
||||
*/
|
||||
public static String URi_device_DevMark_RecommentInfomation = URiBase + "/device/DevMark/RecommentInfomation";
|
||||
|
||||
|
||||
/**
|
||||
* 获取报备奖励---已成交
|
||||
*/
|
||||
public static String URi_device_DevClient_GETBAOBEIINFO = URiBase + "/device/DevClient/getBaibeiInfo";
|
||||
/**
|
||||
* 获取报备奖励---未成交
|
||||
*/
|
||||
public static String URi_device_DevClient_GETBAOBEINOTINFO = URiBase + "/device/DevClient/getBaibeiNotInfo";
|
||||
/**
|
||||
* 获取已成交报备详情
|
||||
*/
|
||||
public static String URi_device_DevClient_GETBAOBEIDETAIL = URiBase + "/device/DevClient/getBaibeiDetail";
|
||||
/**
|
||||
* 转介---获取品牌列表
|
||||
*/
|
||||
public static String URi_device_DevClient_getBrands = URiBase + "/device/DevRefer/getBrands";
|
||||
/**
|
||||
* 转介---获取品牌列表(转介)
|
||||
*/
|
||||
public static String URi_device_DevRefer_myReferBrand = URiBase + "/device/DevRefer/myReferBrand";
|
||||
/**
|
||||
* 转介---提交转介信息
|
||||
*/
|
||||
public static String URi_device_DevRefer_setReferMsg = URiBase + "/device/DevRefer/setReferMsg";
|
||||
/**
|
||||
* H5 弹窗广告
|
||||
*/
|
||||
public static String URi_device_DevJoinGood_getAppAlert = URiBase + "/device/DevJoinGood/getAppAlert";
|
||||
/**
|
||||
* 转介---转介进店已成交
|
||||
*/
|
||||
public static String URi_device_DevClient_GETREFERINVISITOR = URiBase + "/device/DevRefer/get_riv_list";
|
||||
/**
|
||||
* 转介---转介进店已成交
|
||||
*/
|
||||
public static String URi_device_DevClient_GETREFERIVNLIST = URiBase + "/device/DevRefer/get_rivn_list";
|
||||
/**
|
||||
* 转介--- 审核详情统一接口
|
||||
*/
|
||||
public static String URi_device_DevClient_GETRVODESC = URiBase + "/device/DevRefer/get_rvo_desc";
|
||||
/**
|
||||
* 我的转介 -- 已成交列表
|
||||
*/
|
||||
public static String URi_device_DevRefer_GETROVLIST = URiBase + "/device/DevRefer/get_rov_list";
|
||||
/**
|
||||
* 我我的转介 -- 未成交列表
|
||||
*/
|
||||
public static String URi_device_DevRefer_GETROVNLIST = URiBase + "/device/DevRefer/get_rovn_list";
|
||||
/**
|
||||
* 转介---转介详情统一接口
|
||||
*/
|
||||
public static String URi_device_DevRefer_GETREFERDESC = URiBase + "/device/DevRefer/get_refer_desc";
|
||||
|
||||
/**
|
||||
* 神工具-神罗盘-方位信息
|
||||
*/
|
||||
public static String Uri_device_Config_getGeomancy = URiBase + "/device/DevFission/getGeomancy";
|
||||
|
||||
/**
|
||||
* 云裂变中 App活动列表
|
||||
*/
|
||||
public static String URi_device_DevFission_GETACTIVITYLISTS = URiBase + "/device/DevFission/getActivityLists";
|
||||
|
||||
/**
|
||||
* 云抖音 -- 列表
|
||||
*/
|
||||
public static String URi_device_DevTool_dyList = URiBase + "/device/DevTool/dyList";
|
||||
|
||||
|
||||
/**
|
||||
* 获取云裂变链接
|
||||
*/
|
||||
public static String URi_device_DevFission_GETLINK = URiBase + "/device/DevFission/getIink";
|
||||
|
||||
/**
|
||||
* 获取云推荐链接
|
||||
*/
|
||||
public static String URi_device_DevFission_GETWXPTLINK = URiBase + "/device/DevFission/getWxptLink";
|
||||
/**
|
||||
* 获取酷家乐的户型
|
||||
*/
|
||||
public static String URi_device_DevFission_GETAKUHOUSE = URiBase + "/device/DevFission/getKuHouse";
|
||||
/**
|
||||
* 获取酷家乐的户型
|
||||
*/
|
||||
public static String URi_device_DevMark_visitorOrder = URiBase + "/device/DevMark/visitorOrder";
|
||||
/**
|
||||
* 云裂变 -- 报名客户
|
||||
*/
|
||||
public static String URi_device_DevFission_enrollUser = URiBase + "/device/DevFission/enrollUser";
|
||||
/**
|
||||
* 云拼团 -- 报名客户
|
||||
*/
|
||||
public static String URi_device_DevGroup_enrollUser = URiBase + "/device/DevAssemble/assembleEnrollUser";
|
||||
/**
|
||||
* 云砍价 -- 报名客户
|
||||
*/
|
||||
public static String URi_device_DevTool_BargaiEnrollUser = URiBase + "/device/DevTool/BargaiEnrollUser";
|
||||
/**
|
||||
* 云吸粉 -- 报名客户
|
||||
*/
|
||||
public static String URi_device_DevTool_fansEnrollUser = URiBase + "/device/DevTool/fansEnrollUser";
|
||||
/**
|
||||
* 云裂变 -- 数据统计 -- 店铺
|
||||
*/
|
||||
public static String URi_device_DevFission_fissionStore = URiBase + "/device/DevFission/fissionStore";
|
||||
/**
|
||||
* 云拼团 -- 数据统计 -- 店铺
|
||||
*/
|
||||
public static String URi_device_DevGroup_groupStore = URiBase + "/device/DevAssemble/assembleStore";
|
||||
/**
|
||||
* 云砍价 -- 数据统计 -- 店铺筛选
|
||||
*/
|
||||
public static String URi_device_DevTool_BargaiStore = URiBase + "/device/DevTool/BargaiStore";
|
||||
/**
|
||||
* 云吸粉 -- 数据统计 -- 店铺
|
||||
*/
|
||||
public static String URi_device_DevTool_fansStore = URiBase + "/device/DevTool/fansStore";
|
||||
/**
|
||||
* 云裂变 -- 数据统计列表
|
||||
*/
|
||||
public static String URi_device_DevFission_fissionStatistical = URiBase + "/device/DevFission/fissionStatistical";
|
||||
/**
|
||||
* 云拼团 -- 数据统计列表
|
||||
*/
|
||||
public static String URi_device_DevGroup_groupStatistical = URiBase + "/device/DevAssemble/assembleStatistical";
|
||||
/**
|
||||
* 云砍价 -- 数据统计列表
|
||||
*/
|
||||
public static String URi_device_DevTool_BargaiStatistical = URiBase + "/device/DevTool/BargaiStatistical";
|
||||
/**
|
||||
* 云吸粉 -- 数据统计列表
|
||||
*/
|
||||
public static String URi_device_DevTool_fansStatistical = URiBase + "/device/DevTool/fansStatistical";
|
||||
/**
|
||||
* 引流客户 -- 云推荐客户信息
|
||||
*/
|
||||
public static String URi_device_DevFission_fissionWxClient = URiBase + "/device/DevFission/fissionWxClient";
|
||||
/**
|
||||
* 设计师推荐 -- 客户详情
|
||||
*/
|
||||
public static String URi_device_DevTool_designerDetail = URiBase + "/device/DevTool/designerDetail";
|
||||
/**
|
||||
* 转介 -- 推荐客户 -- 转介信息
|
||||
*/
|
||||
public static String URi_device_DevRefer_roundReferInfo = URiBase + "/device/DevRefer/roundReferInfo";
|
||||
/**
|
||||
* 云裂变 -- 资金明细
|
||||
*/
|
||||
public static String URi_device_DevFission_fissionMoneyInfo = URiBase + "/device/DevFission/fissionMoneyInfo";
|
||||
/**
|
||||
* 云裂变 -- 活动下线
|
||||
*/
|
||||
public static String URi_device_DevFission_fissionOffline = URiBase + "/device/DevFission/fissionOffline";
|
||||
/**
|
||||
* 进店列表 -- 今日引流和跟踪数量
|
||||
*/
|
||||
public static String URi_device_DevMark_redDotNum = URiBase + "/device/DevMark/redDotNum";
|
||||
|
||||
/**
|
||||
* 云拼团 -- 资金明细
|
||||
*/
|
||||
public static String URi_device_DevAssemble_assembleMoneyInfo = URiBase + "/device/DevAssemble/assembleMoneyInfo";
|
||||
|
||||
/**
|
||||
* 云吸粉 -- 资金明细
|
||||
*/
|
||||
public static String URi_device_DevTool_fansMoneyInfo = URiBase + "/device/DevTool/fansMoneyInfo";
|
||||
|
||||
/**
|
||||
* 云拼团中 App活动列表
|
||||
*/
|
||||
public static String URi_device_DevFission_GETASSEMBLELISTS = URiBase + "/device/DevAssemble/getAssembleLists";
|
||||
|
||||
/**
|
||||
* 云砍价 -- 列表
|
||||
*/
|
||||
public static String URi_device_DevTool_getBargainLists = URiBase + "/device/DevTool/getBargainLists";
|
||||
|
||||
/**
|
||||
* 云吸粉
|
||||
*/
|
||||
public static String URi_device_DevTool_getFansLists = URiBase + "/device/DevTool/getFansLists";
|
||||
|
||||
/**
|
||||
* 云拼团 -- 链接
|
||||
*/
|
||||
public static String URi_device_DevGroup_getAssembleLink = URiBase + "/device/DevAssemble/getAssembleIink";
|
||||
|
||||
/**
|
||||
* 云商城 -- 分享链接
|
||||
*/
|
||||
public static String URi_device_DevTool_shoppingLink = URiBase + "/device/DevTool/shoppingLink";
|
||||
|
||||
|
||||
/**
|
||||
* 云砍价 -- 链接
|
||||
*/
|
||||
public static String URi_device_DevTool_getBargaiIink = URiBase + "/device/DevTool/getBargaiIink";
|
||||
|
||||
|
||||
/**
|
||||
* 云吸粉 -- 链接
|
||||
*/
|
||||
public static String URi_device_DevTool_getFansIink = URiBase + "/device/DevTool/getFansIink";
|
||||
|
||||
/**
|
||||
* 订单 -- 详情页获取老带新扫码信息
|
||||
*/
|
||||
|
||||
public static String URi_device_DevOrder_getLdx = URiBase + "/device/DevOrder/getLdx";
|
||||
|
||||
/**
|
||||
* 云裂变 -- 新建活动
|
||||
*/
|
||||
public static String URi_device_DevFission_newActivity = URiBase + "/device/DevFission/newActivity";
|
||||
public static String URi_device_AppCustomer_fpList = URiBase + "/device/AppCustomer/fpList";
|
||||
|
||||
/**
|
||||
* 云裂变--活动编辑
|
||||
*/
|
||||
public static String URi_device_DevFission_updateActivity = URiBase + "/device/DevFission/updateActivity";
|
||||
|
||||
/**
|
||||
* 云裂变--活动编辑详情获取
|
||||
*/
|
||||
public static String URi_device_DevFission_activityUpdateDetail = URiBase + "/device/DevFission/activityUpdateDetail";
|
||||
/**
|
||||
* vr-- 风格
|
||||
*/
|
||||
public static String URi_device_DevVR_Style = URiBase + "/device/DevVR/style";
|
||||
/**
|
||||
* 云VR -- 发布需求
|
||||
*/
|
||||
public static String URi_device_DevVR_ReleaseNeed = URiBase + "/device/DevVR/releaseNeed";
|
||||
/**
|
||||
* 云VR -- 任务需求页面
|
||||
*/
|
||||
public static String URi_device_DevVR_TaskNeed = URiBase + "/device/DevVR/taskNeed";
|
||||
/**
|
||||
* 云VR -- 作品审核页面
|
||||
*/
|
||||
public static String URi_device_DevVR_TaskCheck = URiBase + "/device/DevVR/taskCheck";
|
||||
/**
|
||||
* 云VR -- 我的作品页面
|
||||
*/
|
||||
public static String URi_device_DevVR_MyWorks = URiBase + "/device/DevVR/myWorks";
|
||||
/**
|
||||
* 云VR -- 详情页面
|
||||
*/
|
||||
public static String URi_device_DevVR_WorksDetail = URiBase + "/device/DevVR/worksDetail";
|
||||
/**
|
||||
* 云VR -- 获取H5链接
|
||||
*/
|
||||
public static String URi_device_DevVR_GetHLink = URiBase + "/device/DevVR/getHLink";
|
||||
/**
|
||||
* 云VR -- 店长审核作品
|
||||
*/
|
||||
public static String URi_device_DevVR_WorkAudit = URiBase + "/device/DevVR/worksAudit";
|
||||
|
||||
/**
|
||||
* 云VR -- 抢单
|
||||
*/
|
||||
public static String URi_device_DevVR_RoboneWork = URiBase + "/device/DevVR/roboneWork";
|
||||
/**
|
||||
* 云VR -- 富文本上传图片
|
||||
*/
|
||||
public static String URi_device_DevVR_uploadImg = URiBase + "/device/DevVR/uploadImg";
|
||||
|
||||
/**
|
||||
* 上传图片临时存储图片链接
|
||||
*/
|
||||
public static String URi_device_DevMark_uploadPic = URiBase + "/device/DevMark/uploadPic";
|
||||
|
||||
|
||||
/**
|
||||
* 客户分配---客户分配
|
||||
*/
|
||||
public static String URi_device_DevClient_assignment= URiBase + "/device/DevClient/assignment";
|
||||
/**
|
||||
* 云VR -- 开始提交方案设计页
|
||||
*/
|
||||
public static String URi_device_DevVR_worksDesign= URiBase + "/device/DevVR/worksDesign";
|
||||
/**
|
||||
* 云VR -- 重新编辑页
|
||||
*/
|
||||
public static String URi_device_DevVR_worksReedit= URiBase + "/device/DevVR/worksReedit";
|
||||
|
||||
/**
|
||||
* 云VR -- 上传补打头像
|
||||
*/
|
||||
public static String URi_device_DevVR_WorkUploadHead = URiBase + "/device/DevVR/worksUplodehead";
|
||||
|
||||
/**
|
||||
* 云VR -- 任务需求和审核和我的作品数量
|
||||
*/
|
||||
public static String URi_device_DevVR_Amount = URiBase + "/device/DevVR/amount";
|
||||
|
||||
/**
|
||||
* 红点数量 == 营销工具和里面分别数量
|
||||
* 分配列表
|
||||
*/
|
||||
public static String URi_device_DevVR_MarketTool = URiBase + "/device/DevVR/marketTool";
|
||||
public static String URi_device_AppCustomer_customerList = URiBase + "/device/AppCustomer/customerList";
|
||||
|
||||
/**
|
||||
* 红点数量 == 营销工具和里面分别数量
|
||||
* 客户分配
|
||||
*/
|
||||
public static String URi_device_DevTool_getShareImg = URiBase + "/device/DevTool/getShareImg";
|
||||
|
||||
/**
|
||||
* 设计师推荐 -- 设计师邀请链接
|
||||
*/
|
||||
public static String URi_device_DevTool_designerLink = URiBase + "/device/DevTool/designerLink";
|
||||
|
||||
/**
|
||||
* 异业推荐 -- 异业邀请链接
|
||||
*/
|
||||
public static String URi_device_DevTool_yiyeLink = URiBase + "/device/DevTool/yiyeLink";
|
||||
|
||||
|
||||
/**
|
||||
* 云抖音 -- 新增视频
|
||||
*/
|
||||
public static String URi_device_DevTool_addVideo = URiBase + "/device/DevTool/addVideo";
|
||||
|
||||
/**
|
||||
* 云抖音 -- 保存选择
|
||||
*/
|
||||
public static String URi_device_DevTool_saveChoose = URiBase + "/device/DevTool/saveChoose";
|
||||
|
||||
/**
|
||||
* 云抖音 -- 应用工具设置
|
||||
*/
|
||||
public static String URi_device_DevTool_toolSet = URiBase + "/device/DevTool/toolSet";
|
||||
|
||||
|
||||
/**
|
||||
* 云抖音 -- 应用工具设置 -- 修改状态
|
||||
*/
|
||||
public static String URi_device_DevTool_toolUpdate = URiBase + "/device/DevTool/toolUpdate";
|
||||
|
||||
/**
|
||||
* 云抖音 -- 删除
|
||||
*/
|
||||
public static String URi_device_DevTool_deleteVideo = URiBase + "/device/DevTool/deleteVideo";
|
||||
|
||||
/**
|
||||
* 报备奖励-- 已成交 -- 待审核通过或驳回
|
||||
*/
|
||||
public static String URi_device_DevClient_checkBaobei = URiBase + "/device/DevClient/checkBaobei";
|
||||
|
||||
/**
|
||||
* 转介 -- 转介进店 -- 已成交 -- 待审核通过和驳回
|
||||
*/
|
||||
public static String URi_device_DevRefer_checkRefer = URiBase + "/device/DevRefer/checkRefer";
|
||||
/**
|
||||
* 转介 -- 批量转介 -- 提交转介信息
|
||||
*/
|
||||
public static String URi_device_DevRefer_myBatchReferMsg = URiBase + "/device/DevRefer/myBatchReferMsg";
|
||||
|
||||
/**
|
||||
* 店铺位置
|
||||
*/
|
||||
public static String URi_wxpt_app_index = URiBase + "/wxpt/app/dw/index";
|
||||
|
||||
/**
|
||||
* 异业推荐 -- 列表 H5链接
|
||||
*/
|
||||
public static String URi_device_DevTool_yiyeList = URiBase + "/device/DevTool/yiyeList";
|
||||
|
||||
/**
|
||||
* 云商城 -- 列表
|
||||
*/
|
||||
public static String URi_device_DevTool_shoppingList = URiBase + "/device/DevTool/shoppingList";
|
||||
|
||||
/**
|
||||
* 云裂变、云拼团 -- 保证金支付
|
||||
*/
|
||||
public static String URi_device_DevFission_bondPay= URiBase + "/device/DevFission/bondPay";
|
||||
/**
|
||||
* 云微信 -- 列表
|
||||
*/
|
||||
public static String Uri_device_DevTool_pcwechatList = URiBase + "/device/DevTool/pcwechatList";
|
||||
/**
|
||||
* 云微信 -- 二维码
|
||||
*/
|
||||
public static String Uri_device_DevTool_pcwechatGetQrcode = URiBase + "/device/DevTool/pcwechatGetQrcode";
|
||||
|
||||
/**
|
||||
* 云微信 -- 占用并调取方法
|
||||
*/
|
||||
public static String Uri_device_DevTool_pcwechatQrcode = URiBase + "/device/DevTool/pcwechatQrcode";
|
||||
|
||||
/**
|
||||
* 云裂变、云拼团 -- 任务详情
|
||||
*/
|
||||
public static String Uri_device_DevFission_taskDetail= URiBase + "/device/DevFission/taskDetail";
|
||||
|
||||
/**
|
||||
* 云微信——活动宣传
|
||||
*/
|
||||
public static String Uri_device_wxpt_ywx= URiBase + "/wxpt/ywx/ywx/activityList/id=";
|
||||
|
||||
/**
|
||||
* 群邀请
|
||||
*/
|
||||
public static String Uri_device_wxpt_groupInvitation= URiBase + "/wxpt/ywx/ywx/groupInvitation/id=";
|
||||
|
||||
|
||||
/**
|
||||
* 云微信 -- 删除pc数据
|
||||
*/
|
||||
public static String Uri_device_DevTool_deletePc= URiBase + "/device/DevTool/deletePc";
|
||||
|
||||
/**
|
||||
* 订单 -- 修改订单金额
|
||||
*/
|
||||
public static String Uri_device_DevOrder_changeOrderSales= URiBase + "/device/DevOrder/changeOrderSales";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 订单 -- 修改订单金额 -- 详情
|
||||
*/
|
||||
public static String URi_device_DevOrder_changeOrderInfo = URiBase + "/device/DevOrder/changeOrderInfo";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 人事——获取全部店铺
|
||||
*/
|
||||
public static String URi_device_DevPerManager_storeInfo = URiBase + "/device/DevPerManager/storeInfo";
|
||||
|
||||
/**
|
||||
* 组 -- 组员列表
|
||||
*/
|
||||
public static String URi_device_DevPerManager_teamList = URiBase + "/device/DevPerManager/teamList";
|
||||
|
||||
/**
|
||||
* 人事——当前店铺 -- 店员
|
||||
*/
|
||||
public static String URi_device_DevPerManager_storeClerk = URiBase + "/device/DevPerManager/storeClerk";
|
||||
/**
|
||||
* 新增组 -- 请选择组员
|
||||
*/
|
||||
public static String URi_device_DevPerManager_zyGroupList = URiBase + "/device/DevPerManager/zyGroupList";
|
||||
/**
|
||||
* 新增组 -- 请选择组长
|
||||
*/
|
||||
public static String URi_device_DevPerManager_zzGroupList = URiBase + "/device/DevPerManager/zzGroupList";
|
||||
|
||||
/**
|
||||
* 当前店铺 -- 所有组
|
||||
*/
|
||||
public static String URi_device_DevPerManager_groupAll = URiBase + "/device/DevPerManager/groupAll";
|
||||
|
||||
|
||||
/**
|
||||
* 当前店铺 -- 新增店员店长
|
||||
*/
|
||||
public static String URi_device_DevPerManager_saveClerk = URiBase + "/device/DevPerManager/saveClerk";
|
||||
|
||||
/**
|
||||
* 组 -- 修改组信息列表
|
||||
*/
|
||||
public static String URi_device_DevPerManager_upTeamInfo = URiBase + "/device/DevPerManager/upTeamInfo";
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 当前店铺-- 新增组/修改组
|
||||
*/
|
||||
public static String URi_device_DevPerManager_saveGroup = URiBase + "/device/DevPerManager/saveGroup";
|
||||
|
||||
|
||||
/**
|
||||
* 当前店铺 -- 新增店员店长
|
||||
*/
|
||||
public static String URi_device_DevPerManager_updClerk = URiBase + "/device/DevPerManager/updClerk";
|
||||
|
||||
/**
|
||||
* 调职 -- 调至店铺
|
||||
*/
|
||||
public static String URi_device_DevPerManager_transfer = URiBase + "/device/DevPerManager/transfer";
|
||||
|
||||
/**
|
||||
* 调职、离职 -- 交接人
|
||||
*/
|
||||
public static String URi_device_DevPerManager_Handover = URiBase + "/device/DevPerManager/Handover";
|
||||
|
||||
/**
|
||||
* 确认调职
|
||||
*/
|
||||
public static String URi_device_DevPerManager_updClerkStore = URiBase + "/device/DevPerManager/updClerkStore";
|
||||
|
||||
/**
|
||||
* 确认离职
|
||||
*/
|
||||
public static String URi_device_DevPerManager_updLeaveTime = URiBase + "/device/DevPerManager/updLeaveTime";
|
||||
|
||||
/**
|
||||
* 培训视频 -- 分类
|
||||
*/
|
||||
public static String URi_device_DevVideo_videoStyle = URiBase + "/device/DevVideo/videoStyle";
|
||||
|
||||
/**
|
||||
* 培训视频 -- 列表
|
||||
*/
|
||||
public static String URi_device_DevVideo_videoList = URiBase + "/device/DevVideo/videoList";
|
||||
|
||||
/**
|
||||
* 培训视频 -- 视频详情
|
||||
*/
|
||||
public static String URi_device_DevVideo_videoInfo = URiBase + "/device/DevVideo/videoInfo";
|
||||
|
||||
/**
|
||||
* 培训视频 -- 视频观看完返回
|
||||
*/
|
||||
public static String URi_device_DevVideo_videoRecord = URiBase + "/device/DevVideo/videoRecord";
|
||||
|
||||
/**
|
||||
* 培训视频 -- 留言评论
|
||||
*/
|
||||
public static String URi_device_DevVideo_videoComment = URiBase + "/device/DevVideo/videoComment";
|
||||
|
||||
/**
|
||||
* 培训视频 -- 点赞点踩
|
||||
*/
|
||||
public static String URi_device_DevVideo_videoDzDc = URiBase + "/device/DevVideo/videoDzDc";
|
||||
|
||||
/**
|
||||
* 调拨 - -确认调拨
|
||||
*/
|
||||
public static String URi_device_DevMark_dbConfirm= URiBase + "/device/DevMark/dbConfirm";
|
||||
|
||||
/**
|
||||
* 调拨 -- 客户调拨列表
|
||||
*/
|
||||
public static String URi_device_DevMark_dbRecord= URiBase + "/device/DevMark/dbRecord";
|
||||
|
||||
/**
|
||||
* 调拨-- 店铺列表
|
||||
*/
|
||||
public static String URi_device_DevMark_dbStore= URiBase + "/device/DevMark/dbStore";
|
||||
|
||||
/**
|
||||
* 客户信息页 -- 推荐客户进店信息
|
||||
*/
|
||||
public static String URi_device_DevMark_allYlCustomer= URiBase + "/device/DevMark/allYlCustomer";
|
||||
|
||||
/**
|
||||
* 蜂狐推荐-抢单客户:
|
||||
*/
|
||||
public static String URi_device_DevMark_robCustomer= URiBase + "/device/DevMark/robCustomer";
|
||||
|
||||
|
||||
/**
|
||||
* 没有分享活动
|
||||
*/
|
||||
public static String URi_device_DevMark_shareActivity= URiBase + "/device/DevMark/shareActivity";
|
||||
|
||||
/**
|
||||
* 组 -- 删除组
|
||||
*/
|
||||
public static String URi_device_DevPerManager_deleteGroup= URiBase + "/device/DevPerManager/deleteGroup";
|
||||
|
||||
/**
|
||||
* 进店列表 -- 抢单客户
|
||||
*/
|
||||
public static String URi_device_DevPerManager_robCustomer= URiBase + "/device/DevPerManager/robCustomer";
|
||||
|
||||
/**
|
||||
* 抢单客户列表
|
||||
*/
|
||||
public static String URi_device_DevPerManager_robCustomerList= URiBase + "/device/DevPerManager/robCustomerList";
|
||||
|
||||
/**
|
||||
* 开始抢单
|
||||
*/
|
||||
public static String URi_device_DevPerManager_startRob= URiBase + "/device/DevPerManager/startRob";
|
||||
|
||||
/**
|
||||
* 打标 -- 获取用户类型
|
||||
*/
|
||||
public static String URi_device_DevMark_customerType= URiBase + "/device/DevMark/customerType";
|
||||
|
||||
public static String URi_device_AppCustomer_customerFPList = URiBase + "/device/AppCustomer/customerFPList";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -59,4 +59,141 @@ public class NetApi {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分配列表
|
||||
*/
|
||||
public Observable<Response> fpList(final String uid,final String search) {
|
||||
|
||||
return new Observable<Response>() {
|
||||
@Override
|
||||
public void subscribe(final Observer<Response> observer) {
|
||||
|
||||
OkGo.<String>post(HttpConstants.URi_device_AppCustomer_fpList)//
|
||||
.params("uid", uid)
|
||||
.params("search", search)
|
||||
.converter(new StringConvert())//
|
||||
.cacheMode(CacheMode.NO_CACHE) //无缓存模式 CacheMode.NO_CACHE
|
||||
.adapt(new ObservableResponse<String>())//
|
||||
.subscribeOn(Schedulers.io())//
|
||||
.observeOn(AndroidSchedulers.mainThread())//
|
||||
.subscribe(new io.reactivex.Observer<Response<String>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
// addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull Response<String> response) {
|
||||
observer.onNext(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 客户列表
|
||||
*/
|
||||
public Observable<Response> customerList(final String uid,final String search) {
|
||||
|
||||
return new Observable<Response>() {
|
||||
@Override
|
||||
public void subscribe(final Observer<Response> observer) {
|
||||
|
||||
OkGo.<String>post(HttpConstants.URi_device_AppCustomer_customerList)//
|
||||
.params("uid", uid)
|
||||
.params("search", search)
|
||||
.converter(new StringConvert())//
|
||||
.cacheMode(CacheMode.NO_CACHE) //无缓存模式 CacheMode.NO_CACHE
|
||||
.adapt(new ObservableResponse<String>())//
|
||||
.subscribeOn(Schedulers.io())//
|
||||
.observeOn(AndroidSchedulers.mainThread())//
|
||||
.subscribe(new io.reactivex.Observer<Response<String>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
// addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull Response<String> response) {
|
||||
observer.onNext(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 客户分配
|
||||
*/
|
||||
public Observable<Response> customerFPList(final String uid) {
|
||||
|
||||
return new Observable<Response>() {
|
||||
@Override
|
||||
public void subscribe(final Observer<Response> observer) {
|
||||
|
||||
OkGo.<String>post(HttpConstants.URi_device_AppCustomer_customerFPList)//
|
||||
.params("uid", uid)
|
||||
.converter(new StringConvert())//
|
||||
.cacheMode(CacheMode.NO_CACHE) //无缓存模式 CacheMode.NO_CACHE
|
||||
.adapt(new ObservableResponse<String>())//
|
||||
.subscribeOn(Schedulers.io())//
|
||||
.observeOn(AndroidSchedulers.mainThread())//
|
||||
.subscribe(new io.reactivex.Observer<Response<String>>() {
|
||||
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
// addDisposable(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull Response<String> response) {
|
||||
observer.onNext(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,671 @@
|
||||
/*
|
||||
*
|
||||
*/
|
||||
package com.example.administrator.seven.utils;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
|
||||
/**
|
||||
* 描述:字符串处理类.
|
||||
*/
|
||||
public final class AbStrUtil {
|
||||
|
||||
/**
|
||||
* 描述:将null转化为“”.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return 字符串的String类型
|
||||
*/
|
||||
public static String parseEmpty(String str) {
|
||||
if (str == null || "null".equals(str.trim())) {
|
||||
str = "";
|
||||
}
|
||||
return str.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:判断一个字符串是否为null或空值.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return true or false
|
||||
*/
|
||||
public static boolean isEmpty(String str) {
|
||||
return str == null || str.trim().length() == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字符串中文字符的长度(每个中文算2个字符).
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return 中文字符的长度
|
||||
*/
|
||||
public static int chineseLength(String str) {
|
||||
int valueLength = 0;
|
||||
String chinese = "[\u0391-\uFFE5]";
|
||||
/* 获取字段值的长度,如果含中文字符,则每个中文字符长度为2,否则为1 */
|
||||
if (!isEmpty(str)) {
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
/* 获取一个字符 */
|
||||
String temp = str.substring(i, i + 1);
|
||||
/* 判断是否为中文字符 */
|
||||
if (temp.matches(chinese)) {
|
||||
valueLength += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return valueLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:获取字符串的长度.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return 字符串的长度(中文字符计2个)
|
||||
*/
|
||||
public static int strLength(String str) {
|
||||
int valueLength = 0;
|
||||
String chinese = "[\u0391-\uFFE5]";
|
||||
if (!isEmpty(str)) {
|
||||
// 获取字段值的长度,如果含中文字符,则每个中文字符长度为2,否则为1
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
// 获取一个字符
|
||||
String temp = str.substring(i, i + 1);
|
||||
// 判断是否为中文字符
|
||||
if (temp.matches(chinese)) {
|
||||
// 中文字符长度为2
|
||||
valueLength += 2;
|
||||
} else {
|
||||
// 其他字符长度为1
|
||||
valueLength += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return valueLength;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:获取指定长度的字符所在位置.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @param maxL 要取到的长度(字符长度,中文字符计2个)
|
||||
* @return 字符的所在位置
|
||||
*/
|
||||
public static int subStringLength(String str, int maxL) {
|
||||
int currentIndex = 0;
|
||||
int valueLength = 0;
|
||||
String chinese = "[\u0391-\uFFE5]";
|
||||
// 获取字段值的长度,如果含中文字符,则每个中文字符长度为2,否则为1
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
// 获取一个字符
|
||||
String temp = str.substring(i, i + 1);
|
||||
// 判断是否为中文字符
|
||||
if (temp.matches(chinese)) {
|
||||
// 中文字符长度为2
|
||||
valueLength += 2;
|
||||
} else {
|
||||
// 其他字符长度为1
|
||||
valueLength += 1;
|
||||
}
|
||||
if (valueLength >= maxL) {
|
||||
currentIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return currentIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:手机号格式验证.
|
||||
*
|
||||
* @param str 指定的手机号码字符串
|
||||
* @return 是否为手机号码格式:是为true,否则false
|
||||
*/
|
||||
public static Boolean isMobileNo(String str) {
|
||||
Boolean isMobileNo = false;
|
||||
try {
|
||||
Pattern p = Pattern.compile("^((13[0-9])|(15[^4,\\D])|(17[0-9])|(18[0-9]))\\d{8}$");
|
||||
Matcher m = p.matcher(str);
|
||||
isMobileNo = m.matches();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return isMobileNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:是否只是字母和数字.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return 是否只是字母和数字:是为true,否则false
|
||||
*/
|
||||
public static Boolean isNumberLetter(String str) {
|
||||
Boolean isNoLetter = false;
|
||||
String expr = "^[A-Za-z0-9]+$";
|
||||
if (str.matches(expr)) {
|
||||
isNoLetter = true;
|
||||
}
|
||||
return isNoLetter;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查价格和面积是不是符合格式
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return
|
||||
* @author 常斌
|
||||
* 2015-7-7 上午11:49:00 create
|
||||
*/
|
||||
public static Boolean isPriceOrArea(String str) {
|
||||
Boolean isPrice = false;
|
||||
String expr = "\\d{1,10}(\\.\\d{1,2})?$";
|
||||
if (str.matches(expr)) {
|
||||
isPrice = true;
|
||||
}
|
||||
return isPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是不是身份证号码
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return
|
||||
* @author 常斌
|
||||
* 2015-7-7 上午10:51:44 create 是否是身份证号码:是为true,不是为false
|
||||
*/
|
||||
public static Boolean isIDCardNo(String str) {
|
||||
Boolean isIDCardNo = false;
|
||||
String expr1 = "^[1-9]\\d{7}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}$";//15位的
|
||||
String expr2 = "^[1-9]\\d{5}[1-9]\\d{3}((0\\d)|(1[0-2]))(([0|1|2]\\d)|3[0-1])\\d{3}([0-9]|X)$";//18位的
|
||||
if (str.matches(expr1)) {
|
||||
isIDCardNo = true;
|
||||
} else isIDCardNo = str.matches(expr2);
|
||||
return isIDCardNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:是否只是数字.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return 是否只是数字:是为true,否则false
|
||||
*/
|
||||
public static Boolean isNumber(String str) {
|
||||
Boolean isNumber = false;
|
||||
String expr = "^[0-9]+$";
|
||||
if (str.matches(expr)) {
|
||||
isNumber = true;
|
||||
}
|
||||
return isNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:是否是邮箱.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return 是否是邮箱:是为true,否则false
|
||||
*/
|
||||
public static Boolean isEmail(String str) {
|
||||
Boolean isEmail = false;
|
||||
String expr = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";
|
||||
if (str.matches(expr)) {
|
||||
isEmail = true;
|
||||
}
|
||||
return isEmail;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:是否是中文.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return 是否是中文:是为true,否则false
|
||||
*/
|
||||
public static Boolean isChinese(String str) {
|
||||
Boolean isChinese = true;
|
||||
String chinese = "[\u0391-\uFFE5]";
|
||||
if (!isEmpty(str)) {
|
||||
// 获取字段值的长度,如果含中文字符,则每个中文字符长度为2,否则为1
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
// 获取一个字符
|
||||
String temp = str.substring(i, i + 1);
|
||||
// 判断是否为中文字符
|
||||
if (temp.matches(chinese)) {
|
||||
} else {
|
||||
isChinese = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isChinese;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:是否包含中文.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return 是否包含中文:是为true,否则false
|
||||
*/
|
||||
public static Boolean isContainChinese(String str) {
|
||||
Boolean isChinese = false;
|
||||
String chinese = "[\u0391-\uFFE5]";
|
||||
if (!isEmpty(str)) {
|
||||
// 获取字段值的长度,如果含中文字符,则每个中文字符长度为2,否则为1
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
// 获取一个字符
|
||||
String temp = str.substring(i, i + 1);
|
||||
// 判断是否为中文字符
|
||||
if (temp.matches(chinese)) {
|
||||
isChinese = true;
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return isChinese;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:从输入流中获得String.
|
||||
*
|
||||
* @param is 输入流
|
||||
* @return 获得的String
|
||||
*/
|
||||
public static String convertStreamToString(InputStream is) {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String line = null;
|
||||
try {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
sb.append(line + "\n");
|
||||
}
|
||||
|
||||
// 最后一个\n删除
|
||||
if (sb.indexOf("\n") != -1 && sb.lastIndexOf("\n") == sb.length() - 1) {
|
||||
sb.delete(sb.lastIndexOf("\n"), sb.lastIndexOf("\n") + 1);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:标准化日期时间类型的数据,不足两位的补0.
|
||||
*
|
||||
* @param dateTime 预格式的时间字符串,如:2012-3-2 12:2:20
|
||||
* @return String 格式化好的时间字符串,如:2012-03-20 12:02:20
|
||||
*/
|
||||
public static String dateTimeFormat(String dateTime) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try {
|
||||
if (isEmpty(dateTime)) {
|
||||
return null;
|
||||
}
|
||||
String[] dateAndTime = dateTime.split(" ");
|
||||
if (dateAndTime.length > 0) {
|
||||
for (String str : dateAndTime) {
|
||||
if (str.indexOf("-") != -1) {
|
||||
String[] date = str.split("-");
|
||||
for (int i = 0; i < date.length; i++) {
|
||||
String str1 = date[i];
|
||||
sb.append(strFormat2(str1));
|
||||
if (i < date.length - 1) {
|
||||
sb.append("-");
|
||||
}
|
||||
}
|
||||
} else if (str.indexOf(":") != -1) {
|
||||
String[] date = str.split(":");
|
||||
for (int i = 0; i < date.length; i++) {
|
||||
String str1 = date[i];
|
||||
sb.append(strFormat2(str1));
|
||||
if (i < date.length - 1) {
|
||||
sb.append(":");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:不足2个字符的在前面补“0”.
|
||||
*
|
||||
* @param str 指定的字符串
|
||||
* @return 至少2个字符的字符串
|
||||
*/
|
||||
public static String strFormat2(String str) {
|
||||
try {
|
||||
if (str.length() <= 1) {
|
||||
str = "0" + str;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:截取字符串到指定字节长度.
|
||||
*
|
||||
* @param str the str
|
||||
* @param length 指定字节长度
|
||||
* @return 截取后的字符串
|
||||
*/
|
||||
public static String cutString(String str, int length) {
|
||||
return cutString(str, length, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:截取字符串到指定字节长度.
|
||||
*
|
||||
* @param str 文本
|
||||
* @param length 字节长度
|
||||
* @param dot 省略符号
|
||||
* @return 截取后的字符串
|
||||
*/
|
||||
public static String cutString(String str, int length, String dot) {
|
||||
int strBLen = strlen(str, "GBK");
|
||||
if (strBLen <= length) {
|
||||
return str;
|
||||
}
|
||||
int temp = 0;
|
||||
StringBuffer sb = new StringBuffer(length);
|
||||
char[] ch = str.toCharArray();
|
||||
for (char c : ch) {
|
||||
sb.append(c);
|
||||
if (c > 256) {
|
||||
temp += 2;
|
||||
} else {
|
||||
temp += 1;
|
||||
}
|
||||
if (temp >= length) {
|
||||
if (dot != null) {
|
||||
sb.append(dot);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:截取字符串从第一个指定字符.
|
||||
*
|
||||
* @param str1 原文本
|
||||
* @param str2 指定字符
|
||||
* @param offset 偏移的索引
|
||||
* @return 截取后的字符串
|
||||
*/
|
||||
public static String cutStringFromChar(String str1, String str2, int offset) {
|
||||
if (isEmpty(str1)) {
|
||||
return "";
|
||||
}
|
||||
int start = str1.indexOf(str2);
|
||||
if (start != -1) {
|
||||
if (str1.length() > start + offset) {
|
||||
return str1.substring(start + offset);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:获取字节长度.
|
||||
*
|
||||
* @param str 文本
|
||||
* @param charset 字符集(GBK)
|
||||
* @return the int
|
||||
*/
|
||||
public static int strlen(String str, String charset) {
|
||||
if (str == null || str.length() == 0) {
|
||||
return 0;
|
||||
}
|
||||
int length = 0;
|
||||
try {
|
||||
length = str.getBytes(charset).length;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return length;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取大小的描述.
|
||||
*
|
||||
* @param size 字节个数
|
||||
* @return 大小的描述
|
||||
*/
|
||||
public static String getSizeDesc(long size) {
|
||||
String suffix = "B";
|
||||
if (size >= 1024) {
|
||||
suffix = "K";
|
||||
size = size >> 10;
|
||||
if (size >= 1024) {
|
||||
suffix = "M";
|
||||
// size /= 1024;
|
||||
size = size >> 10;
|
||||
if (size >= 1024) {
|
||||
suffix = "G";
|
||||
size = size >> 10;
|
||||
// size /= 1024;
|
||||
}
|
||||
}
|
||||
}
|
||||
return size + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 描述:ip地址转换为10进制数.
|
||||
*
|
||||
* @param ip the ip
|
||||
* @return the long
|
||||
*/
|
||||
public static long ip2int(String ip) {
|
||||
ip = ip.replace(".", ",");
|
||||
String[] items = ip.split(",");
|
||||
return Long.valueOf(items[0]) << 24 | Long.valueOf(items[1]) << 16 | Long.valueOf(items[2]) << 8 | Long.valueOf(items[3]);
|
||||
}
|
||||
|
||||
/**
|
||||
* The main method.
|
||||
*
|
||||
* @param args the arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
System.out.println(dateTimeFormat("2012-3-2 12:2:20"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串数组转换为list
|
||||
*
|
||||
* @param arr 字符串数组
|
||||
* @return 2015-5-4 上午11:15:57 create
|
||||
*/
|
||||
public static List<String> arrayToList(String[] arr) {
|
||||
return Arrays.asList(arr);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Unicode编码字符串 装汉字
|
||||
// *
|
||||
// * @param utfString
|
||||
// * @return
|
||||
// * @author wop
|
||||
// * 2015-5-11 下午6:15:28 create
|
||||
// */
|
||||
// public static String convert(String utfString) {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// int i = -1;
|
||||
// int pos = 0;
|
||||
//
|
||||
// while ((i = utfString.indexOf("\\u", pos)) != -1) {
|
||||
// sb.append(utfString.substring(pos, i));
|
||||
// if (i + 5 < utfString.length()) {
|
||||
// pos = i + 6;
|
||||
// sb.append((char) Integer.parseInt(utfString.substring(i + 2, i + 6), 16));
|
||||
// }
|
||||
// }
|
||||
// return sb.toString();
|
||||
// }
|
||||
|
||||
/**
|
||||
* 将Unicode编码解析成汉字
|
||||
*
|
||||
* @param pStr 包含(汉字的Unicode)编码的字符串
|
||||
* @return
|
||||
*/
|
||||
public static String decodeUnicode(String pStr) {
|
||||
char aChar;
|
||||
int len = pStr.length();
|
||||
StringBuffer outBuffer = new StringBuffer(len);
|
||||
for (int x = 0; x < len; ) {
|
||||
aChar = pStr.charAt(x++);
|
||||
if (aChar == '\\') {
|
||||
aChar = pStr.charAt(x++);
|
||||
if (aChar == 'u') {
|
||||
int value = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
aChar = pStr.charAt(x++);
|
||||
switch (aChar) {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
value = (value << 4) + aChar - '0';
|
||||
break;
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'c':
|
||||
case 'd':
|
||||
case 'e':
|
||||
case 'f':
|
||||
value = (value << 4) + 10 + aChar - 'a';
|
||||
break;
|
||||
case 'A':
|
||||
case 'B':
|
||||
case 'C':
|
||||
case 'D':
|
||||
case 'E':
|
||||
case 'F':
|
||||
value = (value << 4) + 10 + aChar - 'A';
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(
|
||||
"Malformed encoding.");
|
||||
}
|
||||
}
|
||||
outBuffer.append((char) value);
|
||||
} else {
|
||||
if (aChar == 't') {
|
||||
aChar = '\t';
|
||||
} else if (aChar == 'r') {
|
||||
aChar = '\r';
|
||||
} else if (aChar == 'n') {
|
||||
aChar = '\n';
|
||||
} else if (aChar == 'f') {
|
||||
aChar = '\f';
|
||||
}
|
||||
outBuffer.append(aChar);
|
||||
}
|
||||
} else {
|
||||
outBuffer.append(aChar);
|
||||
}
|
||||
}
|
||||
return outBuffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串按指定的分隔符转换成String[]
|
||||
*
|
||||
* @param str 原字符串
|
||||
* @param tmp 指定的分隔符
|
||||
* @return
|
||||
* @author wop
|
||||
* 2015-5-21 上午9:59:47 create
|
||||
*/
|
||||
public static String[] getStrings(String str, String tmp) {
|
||||
String[] result = str.split(tmp);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除集合里面重复的数据
|
||||
*
|
||||
* @param li 原集合
|
||||
* @return 处理以后的集合
|
||||
*/
|
||||
public static ArrayList<String> getNewList(ArrayList<String> li) {
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
for (int i = 0; i < li.size(); i++) {
|
||||
String str = li.get(i); //获取传入集合对象的每一个元素
|
||||
if (!list.contains(str)) { //查看新集合中是否有指定的元素,如果没有则加入
|
||||
list.add(str);
|
||||
}
|
||||
}
|
||||
return list; //返回集合
|
||||
}
|
||||
|
||||
/**
|
||||
* 过滤网页标签
|
||||
*/
|
||||
public static String getHtml2Text(String inputString) {
|
||||
String htmlStr = inputString; //含html标签的字符串
|
||||
String textStr = "";
|
||||
Pattern p_script;
|
||||
Matcher m_script;
|
||||
Pattern p_style;
|
||||
Matcher m_style;
|
||||
Pattern p_html;
|
||||
Matcher m_html;
|
||||
try {
|
||||
String regEx_script = "<[\\s]*?script[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?script[\\s]*?>"; //定义script的正则表达式{或<script[^>]*?>[\\s\\S]*?<\\/script> }
|
||||
String regEx_style = "<[\\s]*?style[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?style[\\s]*?>"; //定义style的正则表达式{或<style[^>]*?>[\\s\\S]*?<\\/style> }
|
||||
String regEx_html = "<[^>]+>"; //定义HTML标签的正则表达式
|
||||
|
||||
p_script = Pattern.compile(regEx_script, Pattern.CASE_INSENSITIVE);
|
||||
m_script = p_script.matcher(htmlStr);
|
||||
htmlStr = m_script.replaceAll(""); //过滤script标签
|
||||
|
||||
p_style = Pattern.compile(regEx_style, Pattern.CASE_INSENSITIVE);
|
||||
m_style = p_style.matcher(htmlStr);
|
||||
htmlStr = m_style.replaceAll(""); //过滤style标签
|
||||
|
||||
p_html = Pattern.compile(regEx_html, Pattern.CASE_INSENSITIVE);
|
||||
m_html = p_html.matcher(htmlStr);
|
||||
htmlStr = m_html.replaceAll(""); //过滤html标签
|
||||
|
||||
textStr = htmlStr;
|
||||
|
||||
} catch (Exception e) {
|
||||
System.err.println("Html2Text: " + e.getMessage());
|
||||
}
|
||||
|
||||
return textStr;//返回文本字符串
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,666 @@
|
||||
package com.example.administrator.seven.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.RectF;
|
||||
import android.net.Uri;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.RequestManager;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
|
||||
import java.io.File;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
/**
|
||||
* @ ClassName: XGlide .class
|
||||
* @ function:图片加载类
|
||||
* @ author linzl 2017/1/23 10:24
|
||||
* @ version 1.0
|
||||
*/
|
||||
|
||||
public class GlideTools {
|
||||
|
||||
private static GlideTools singleton;
|
||||
private static Context mCtx;
|
||||
private static RequestManager glideRequest;
|
||||
private boolean isDiskCache = true;
|
||||
|
||||
public static GlideTools init(Context ctx) {
|
||||
mCtx=ctx;
|
||||
glideRequest = Glide.with(ctx);
|
||||
// TODO 双重校验锁
|
||||
if (null == singleton)
|
||||
synchronized (GlideTools.class) {
|
||||
if (null == singleton) {
|
||||
singleton = new GlideTools();
|
||||
}
|
||||
}
|
||||
return singleton;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setDiskCache(boolean isCache) {
|
||||
this.isDiskCache = isCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* url
|
||||
*
|
||||
* @param iv
|
||||
* @param url
|
||||
*/
|
||||
// public void display(ImageView iv, String url) {
|
||||
// display(iv, url, -1);
|
||||
// }
|
||||
public void display(ImageView iv, String url) {
|
||||
glideRequest.load(url).into(iv);
|
||||
}
|
||||
/**
|
||||
* url
|
||||
*
|
||||
* @param iv
|
||||
* @param url
|
||||
* @param defaultResId
|
||||
*/
|
||||
// public void display(ImageView iv, String url, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<String> builder = glideRequest.load(url);
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
/**
|
||||
* Uri
|
||||
*
|
||||
* @ param iv
|
||||
* @ param uri
|
||||
*/
|
||||
public void display(ImageView iv, Uri uri) {
|
||||
display(iv, uri, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Uri
|
||||
*
|
||||
* @ param iv
|
||||
* @ param uri
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void display(ImageView iv, Uri uri, int defaultResId) {
|
||||
if (iv == null)
|
||||
return;
|
||||
// DrawableRequestBuilder<Uri> builder = glideRequest.load(uri);
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId);
|
||||
glideRequest.load(uri).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* drawableId
|
||||
*
|
||||
* @ param iv
|
||||
* @ param drawableId
|
||||
*/
|
||||
public void display(ImageView iv, int drawableId) {
|
||||
display(iv, drawableId, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* drawableId
|
||||
*
|
||||
* @ param iv
|
||||
* @ param drawableId
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void display(ImageView iv, int drawableId, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<Integer> builder = glideRequest.load(drawableId);
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId);
|
||||
glideRequest.load(drawableId).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* File
|
||||
*
|
||||
* @ param iv
|
||||
* @ param imgFile
|
||||
*/
|
||||
public void display(ImageView iv, File imgFile) {
|
||||
display(iv, imgFile, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* File
|
||||
*
|
||||
* @ param iv
|
||||
* @ param imgFile
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void display(ImageView iv, File imgFile, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<File> builder = glideRequest.load(imgFile);
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId);
|
||||
glideRequest.load(imgFile).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* byte[]
|
||||
*
|
||||
* @ param iv
|
||||
* @ param modle
|
||||
*/
|
||||
public void display(ImageView iv, byte[] modle) {
|
||||
display(iv, modle, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* byte[]
|
||||
*
|
||||
* @ param iv
|
||||
* @ param modle
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void display(ImageView iv, byte[] modle, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<byte[]> builder = glideRequest.load(modle);
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId);
|
||||
glideRequest.load(modle).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// ///圆角图片--------------------------------------------------------------------
|
||||
/**
|
||||
* 圆角-Url
|
||||
*
|
||||
* @ param iv
|
||||
* @ param url
|
||||
* @ param roundDip
|
||||
*/
|
||||
public void displayRound(ImageView iv, String url, int roundDip) {
|
||||
displayRound(iv, url, roundDip, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆角-Url
|
||||
*
|
||||
* @ param iv
|
||||
* @ param url
|
||||
* @ param roundDip
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void displayRound(ImageView iv, String url, int roundDip, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<String> builder = glideRequest.load(url).transform(new GlideRoundTransform(mCtx, roundDip));
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId).transform(new GlideRoundTransform(mCtx, roundDip));
|
||||
glideRequest.load(url).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆角-drawableId
|
||||
*
|
||||
* @ param iv
|
||||
* @ param drawableId
|
||||
* @ param roundDip
|
||||
*/
|
||||
public void displayRound(ImageView iv, int drawableId, int roundDip) {
|
||||
displayRound(iv, drawableId, roundDip, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆角-drawableId
|
||||
*
|
||||
* @ param iv
|
||||
* @ param drawableId
|
||||
* @ param roundDip
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void displayRound(ImageView iv, int drawableId, int roundDip, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<Integer> builder = glideRequest.load(drawableId).transform(new GlideRoundTransform(mCtx, roundDip));
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId).transform(new GlideRoundTransform(mCtx, roundDip));
|
||||
glideRequest.load(drawableId).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆角-Uri
|
||||
*
|
||||
* @ param iv
|
||||
* @ param uri
|
||||
* @ param roundDip
|
||||
*/
|
||||
public void displayRound(ImageView iv, Uri uri, int roundDip) {
|
||||
displayRound(iv, uri, roundDip, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆角-Uri
|
||||
*
|
||||
* @ param iv
|
||||
* @ param uri
|
||||
* @ param roundDip
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void displayRound(ImageView iv, Uri uri, int roundDip, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<Uri> builder = glideRequest.load(uri).transform(new GlideRoundTransform(mCtx, roundDip));
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId).transform(new GlideRoundTransform(mCtx, roundDip));
|
||||
glideRequest.load(uri).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆角-File
|
||||
*
|
||||
* @ param iv
|
||||
* @ param imgFile
|
||||
* @ param roundDip
|
||||
*/
|
||||
public void displayRound(ImageView iv, File imgFile, int roundDip) {
|
||||
displayRound(iv, imgFile, roundDip, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆角-File
|
||||
*
|
||||
* @ param iv
|
||||
* @ param imgFile
|
||||
* @ param roundDip
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void displayRound(ImageView iv, File imgFile, int roundDip, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<File> builder = glideRequest.load(imgFile).transform(new GlideRoundTransform(mCtx, roundDip));
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
|
||||
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId).transform(new GlideRoundTransform(mCtx, roundDip));
|
||||
glideRequest.load(imgFile).apply(options).into(iv);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 圆图片
|
||||
/**
|
||||
* 圆图片-drawableId
|
||||
*
|
||||
* @ param iv
|
||||
* @ param drawableId
|
||||
*/
|
||||
public void displayCircle(ImageView iv, int drawableId) {
|
||||
displayCircle(iv, drawableId, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆图片-drawableId
|
||||
*
|
||||
* @ param iv
|
||||
* @ param drawableId
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void displayCircle(ImageView iv, int drawableId, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<Integer> builder = glideRequest.load(drawableId).transform(new GlideCircleTransform(mCtx));
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId).transform(new GlideRoundTransform(mCtx));
|
||||
glideRequest.load(drawableId).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
public void displaypic(ImageView iv, String url, int defaultResId) {
|
||||
RequestOptions options = new RequestOptions()
|
||||
.centerCrop()
|
||||
.placeholder(defaultResId)
|
||||
.error(defaultResId)
|
||||
.priority(Priority.HIGH);
|
||||
Glide.with(mCtx).load(url).apply(options).into(iv);
|
||||
}
|
||||
/**
|
||||
* 圆图片-url
|
||||
*
|
||||
* @ param iv
|
||||
* @ param url
|
||||
*/
|
||||
public void displayCircle(ImageView iv, String url) {
|
||||
displayCircle(iv, url, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆图片-url
|
||||
*
|
||||
* @ param iv
|
||||
* @ param url
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void displayCircle(ImageView iv, String url, int defaultResId) {
|
||||
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId).transform(new GlideRoundTransform(mCtx));
|
||||
glideRequest.load(url).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆图片-Uri
|
||||
*
|
||||
* @ param iv
|
||||
* @ param uri
|
||||
*/
|
||||
public void displayCircle(ImageView iv, Uri uri) {
|
||||
displayCircle(iv, uri, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆图片-Uri
|
||||
*
|
||||
* @ param iv
|
||||
* @ param uri
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void displayCircle(ImageView iv, Uri uri, int defaultResId) {
|
||||
// if (iv == null)
|
||||
// return;
|
||||
// DrawableRequestBuilder<Uri> builder = glideRequest.load(uri).transform(new GlideCircleTransform(mCtx));
|
||||
// if (defaultResId != -1)
|
||||
// builder.placeholder(defaultResId);
|
||||
// if (isDiskCache)
|
||||
// builder.diskCacheStrategy(DiskCacheStrategy.ALL);
|
||||
// builder.into(iv);
|
||||
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId).transform(new GlideRoundTransform(mCtx));
|
||||
glideRequest.load(uri).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆图片-File
|
||||
*
|
||||
* @ param iv
|
||||
* @ param imgFile
|
||||
*/
|
||||
public void displayCircle(ImageView iv, File imgFile) {
|
||||
displayCircle(iv, imgFile, -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆图片-File
|
||||
*
|
||||
* @ param iv
|
||||
* @ param imgFile
|
||||
* @ param defaultResId
|
||||
*/
|
||||
public void displayCircle(ImageView iv, File imgFile, int defaultResId) {
|
||||
|
||||
if (iv == null)
|
||||
return;
|
||||
if (defaultResId != -1){
|
||||
RequestOptions options = new RequestOptions().placeholder(defaultResId).transform(new GlideRoundTransform(mCtx));
|
||||
glideRequest.load(imgFile).apply(options).into(iv);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** 下载图片获取地址 */
|
||||
public String downloadPath(String url) {
|
||||
try {
|
||||
File file = glideRequest.load(url).downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).get();
|
||||
return file.getPath();
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
return "";
|
||||
} catch (ExecutionException e) {
|
||||
// TODO Auto-generated catch block
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/** 下载图片 */
|
||||
public File downloadFile(String url) {
|
||||
try {
|
||||
File file = glideRequest.load(url).downloadOnly(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL).get();
|
||||
return file;
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
return null;
|
||||
} catch (ExecutionException e) {
|
||||
// TODO Auto-generated catch block
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除图片缓存
|
||||
*/
|
||||
public void Clear() {
|
||||
Glide.get(mCtx).clearDiskCache();
|
||||
Glide.get(mCtx).clearMemory();
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆图片
|
||||
*/
|
||||
public class GlideCircleTransform extends BitmapTransformation {
|
||||
public GlideCircleTransform(Context context) {
|
||||
// super(context);
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
|
||||
return circleCrop(pool, toTransform);
|
||||
}
|
||||
|
||||
private Bitmap circleCrop(BitmapPool pool, Bitmap source) {
|
||||
if (source == null)
|
||||
return null;
|
||||
|
||||
int size = Math.min(source.getWidth(), source.getHeight());
|
||||
int x = (source.getWidth() - size) / 2;
|
||||
int y = (source.getHeight() - size) / 2;
|
||||
|
||||
// TODO this could be acquired from the pool too
|
||||
Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);
|
||||
|
||||
Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);
|
||||
if (result == null) {
|
||||
result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(result);
|
||||
Paint paint = new Paint();
|
||||
paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
|
||||
paint.setAntiAlias(true);
|
||||
float r = size / 2f;
|
||||
canvas.drawCircle(r, r, r, paint);
|
||||
return result;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getId() {
|
||||
// return getClass().getName();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 圆角头像
|
||||
*/
|
||||
public class GlideRoundTransform extends BitmapTransformation {
|
||||
|
||||
private float radius = 0f;
|
||||
|
||||
public GlideRoundTransform(Context context) {
|
||||
this(context, 4);
|
||||
}
|
||||
|
||||
public GlideRoundTransform(Context context, int dp) {
|
||||
// super(context);
|
||||
super();
|
||||
this.radius = Resources.getSystem().getDisplayMetrics().density * dp;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
|
||||
return roundCrop(pool, toTransform);
|
||||
}
|
||||
|
||||
private Bitmap roundCrop(BitmapPool pool, Bitmap source) {
|
||||
if (source == null)
|
||||
return null;
|
||||
|
||||
Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
if (result == null) {
|
||||
result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
|
||||
Canvas canvas = new Canvas(result);
|
||||
Paint paint = new Paint();
|
||||
paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
|
||||
paint.setAntiAlias(true);
|
||||
RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
|
||||
canvas.drawRoundRect(rectF, radius, radius, paint);
|
||||
return result;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public String getId() {
|
||||
// return getClass().getName() + Math.round(radius);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.example.administrator.seven.main.entity.LoginBean;
|
||||
import com.example.administrator.seven.main.entity.mine.TreeUserEntity;
|
||||
import com.example.administrator.seven.main.entity.mine.UserHeadEntity;
|
||||
import com.google.gson.Gson;
|
||||
@@ -161,12 +162,12 @@ public class ProfileSpUtils {
|
||||
*
|
||||
* @return SP存储的用户资料
|
||||
*/
|
||||
public TreeUserEntity getUserProfie() {
|
||||
public LoginBean getUserProfie() {
|
||||
String userStr = sharedPreferences.getString(KEY_USER, "");
|
||||
if (TextUtils.isEmpty(userStr)) {
|
||||
return new TreeUserEntity();
|
||||
return new LoginBean();
|
||||
}
|
||||
return new Gson().fromJson(userStr, TreeUserEntity.class);
|
||||
return new Gson().fromJson(userStr, LoginBean.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -174,17 +175,9 @@ public class ProfileSpUtils {
|
||||
*
|
||||
* @param treeUserEntity 用户资料实体类
|
||||
*/
|
||||
public void saveProfile(TreeUserEntity treeUserEntity) {
|
||||
//头像数据转存
|
||||
UserHeadEntity userHeadEntity = new UserHeadEntity();
|
||||
userHeadEntity.setHome_Page_Size(treeUserEntity.getHome_Page_Size());
|
||||
userHeadEntity.setOrigin(treeUserEntity.getOrigin_img());
|
||||
userHeadEntity.setInfo_page_size(treeUserEntity.getInfo_page_size());
|
||||
userHeadEntity.setUser_list_size(treeUserEntity.getUser_list_size());
|
||||
|
||||
public void saveProfile(LoginBean treeUserEntity) {
|
||||
sharedPreferences.edit()
|
||||
.putString(KEY_USER, new Gson().toJson(treeUserEntity))
|
||||
.putString(KEY_HEAD, new Gson().toJson(userHeadEntity))
|
||||
.apply();
|
||||
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class WXEntryActivity extends WechatHandlerActivity implements IWXAPIEven
|
||||
return ApiUtils.getApi()
|
||||
.bindWx(ProfileSpUtils.getInstance()
|
||||
.getUserProfie()
|
||||
.getUser_token()
|
||||
.getData().getUuid()
|
||||
, mEntity.getOpen_id()
|
||||
, entity.getNickname()
|
||||
, entity.getHeadimg()
|
||||
|
||||
Reference in New Issue
Block a user