@@ -23,6 +23,9 @@ | |||
android:fullBackupContent="@xml/backup_rules" | |||
android:label="@string/app_name" | |||
android:supportsRtl="true" | |||
android:hardwareAccelerated="false" | |||
android:networkSecurityConfig="@xml/network_security_config" | |||
android:largeHeap="true" | |||
android:theme="@style/Theme.Design.NoActionBar" | |||
tools:targetApi="31"> | |||
@@ -33,7 +36,7 @@ | |||
<!-- android:label="@string/title_activity_pagination_bar"--> | |||
<!-- android:theme="@style/NoActionBar" />--> | |||
<activity | |||
android:name=".WelcomeActivity" | |||
android:name=".UI.activity.WelcomeActivity" | |||
android:exported="true" | |||
android:screenOrientation="landscape" | |||
> | |||
@@ -44,6 +47,12 @@ | |||
</intent-filter> | |||
</activity> | |||
<activity | |||
android:name=".UI.activity.LoginActivity" | |||
android:screenOrientation="landscape" | |||
android:launchMode="singleTask" | |||
android:exported="true"> | |||
</activity> | |||
<activity | |||
android:name=".MainActivity" | |||
@@ -2,15 +2,12 @@ package com.jdzh.jdzhandroid.Business; | |||
import com.google.gson.Gson; | |||
import com.google.gson.reflect.TypeToken; | |||
import com.jdzh.jdzhandroid.Enum.Status; | |||
import com.jdzh.jdzhandroid.Interface.IFunc; | |||
import com.jdzh.jdzhandroid.Interface.IRun; | |||
import com.jdzh.jdzhandroid.Interface.IRunT; | |||
import com.jdzh.jdzhandroid.Interface.IRunT2; | |||
import com.jdzh.jdzhandroid.Log.MessageLog; | |||
import com.jdzh.jdzhandroid.Task.Task; | |||
import com.jdzh.jdzhandroid.Task.TaskManager; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import com.jdzh.jdzhandroid.util.Util; | |||
import com.jdzh.jdzhandroid.Communication.Modbus.ModbusHelper; | |||
@@ -18,7 +15,6 @@ import com.jdzh.jdzhandroid.Communication.Modbus.ModbusHelper; | |||
import java.util.Collections; | |||
import java.util.LinkedHashMap; | |||
import java.util.Map; | |||
import java.util.Random; | |||
public class PlcControl extends ModbusHelper { | |||
private volatile static PlcControl _instance; | |||
@@ -38,6 +34,7 @@ public class PlcControl extends ModbusHelper { | |||
} | |||
private boolean[] chDischargeComplete=new boolean[16]; | |||
private boolean multipleComplete = false;//单次批量配料完成 | |||
public void start(){ | |||
RtuConnect("/dev/ttyS7",9600).OnSource(()->{ | |||
@@ -47,6 +44,9 @@ public class PlcControl extends ModbusHelper { | |||
ReadBool("20",16).OnSource((res)->{ | |||
for(int i=0;i<chDischargeComplete.length;i++)chDischargeComplete[i]=res.Content[i];//单通道配料完成 | |||
}); | |||
ReadBool("16",1).OnSource((res)->{ | |||
multipleComplete = res.Content[0];//单次批量配料完成 | |||
}); | |||
} | |||
Task.Delay(100); | |||
@@ -5,7 +5,7 @@ import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Recipeattribute; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeattributeValue; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
@@ -12,7 +12,7 @@ import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.Task.TaskManager; | |||
import com.jdzh.jdzhandroid.UI.dialog.RecipeExecuteDialog; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import com.jdzh.jdzhandroid.util.Util; | |||
@@ -39,7 +39,7 @@ public class TaskControl { | |||
} | |||
/** | |||
* 启动单通道配料 | |||
* 启动多通道配料 | |||
* @param callBack 任务执行反馈 | |||
*/ | |||
public static void startBatchList(String recipeId,String configId, RecipeExecuteDialog.ExecuteCallBack callBack){ | |||
@@ -7,7 +7,7 @@ import com.jdzh.jdzhandroid.Log.MessageLog; | |||
import com.jdzh.jdzhandroid.Result.OperateResult; | |||
import com.jdzh.jdzhandroid.Result.OperateResultT; | |||
import com.jdzh.jdzhandroid.Task.Task; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.util.Util; | |||
import com.licheedev.modbus4android.ModbusCallback; | |||
import com.licheedev.modbus4android.ModbusParam; | |||
@@ -1,4 +1,4 @@ | |||
package com.jdzh.jdzhandroid.config; | |||
package com.jdzh.jdzhandroid.Config; | |||
import android.app.Application; | |||
@@ -16,16 +16,6 @@ public class Config { | |||
* 是否是称重模式 | |||
*/ | |||
public boolean isWeight = false; | |||
/** | |||
* 门店 | |||
*/ | |||
public String storeName = ""; | |||
public String storeId = ""; | |||
/** | |||
* 设备 | |||
*/ | |||
public String deviceName = ""; | |||
public String deviceId = ""; | |||
/** | |||
* 设备唯一码 | |||
*/ | |||
@@ -45,6 +35,8 @@ public class Config { | |||
public static final String SHARE_KEY_storePhone = "SHARE_KEY_storePhone";//门店联系电话 | |||
public static final String SHARE_KEY_wePhone = "SHARE_KEY_wePhone";//联系我们 | |||
public static final String SHARE_KEY_isWeight = "SHARE_KEY_isWeight";//是否是称重模式 | |||
public static final String SHARE_KEY_account = "SHARE_KEY_account";//登录账号 | |||
public static final String SHARE_KEY_password = "SHARE_KEY_password";//登录密码 | |||
public static void Test(){ | |||
PreferenceUtils.setString(Config.SHARE_KEY_autoKey,"1"); |
@@ -15,6 +15,8 @@ import android.widget.Toast; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.Log.RecordManager; | |||
import com.jdzh.jdzhandroid.api.IHttpCallBack; | |||
import com.jdzh.jdzhandroid.api.ServerManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.io.File; | |||
@@ -34,7 +36,6 @@ import java.util.Map; | |||
@SuppressLint("SimpleDateFormat") | |||
public class CrashHandler implements UncaughtExceptionHandler { | |||
public static String TAG = "MyCrash"; | |||
private UncaughtExceptionHandler mDefaultHandler; | |||
private static CrashHandler instance = new CrashHandler(); | |||
@@ -111,6 +112,18 @@ public class CrashHandler implements UncaughtExceptionHandler { | |||
LogUtils.d("saveCrashLogToFile ///////////// 准备重启"+mContext.getPackageName()); | |||
SystemClock.sleep(3000); | |||
ServerManager.uploadCrashLog(new File(Environment.getExternalStorageDirectory(),"/jdzhandroid/crash.log"), new IHttpCallBack<Object>() { | |||
@Override | |||
public void onSuccess(Object o) { | |||
} | |||
@Override | |||
public void onError(int failCode, String msg) { | |||
} | |||
@Override | |||
public void onFailed(int failCode, Throwable throwable, String message) { | |||
} | |||
}); | |||
Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(mContext.getPackageName()); | |||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
@@ -43,8 +43,6 @@ public class MainActivity extends AppCompatActivity { | |||
super.onCreate(savedInstanceState); | |||
EdgeToEdge.enable((ComponentActivity) this); | |||
binding=ActivityMainBinding.inflate(getLayoutInflater()); | |||
DisplayManager.setReferenceMaxWidthHeight(1280, 800); | |||
DisplayManager.updateDisplayInfo(this); | |||
setContentView(binding.getRoot()); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> { | |||
@@ -5,27 +5,23 @@ import android.app.Activity; | |||
import android.app.Application; | |||
import android.content.Context; | |||
import android.content.Intent; | |||
import android.content.SharedPreferences; | |||
import android.content.pm.PackageManager; | |||
import android.os.Bundle; | |||
import android.os.Environment; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import android.os.SystemClock; | |||
import android.util.Log; | |||
import android.widget.Toast; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.Business.RecipeMgr; | |||
import com.jdzh.jdzhandroid.Log.MessageLog; | |||
import com.jdzh.jdzhandroid.Sqlite.DaoManager; | |||
import com.jdzh.jdzhandroid.Task.TaskManager; | |||
import com.jdzh.jdzhandroid.api.ServerManager; | |||
import com.jdzh.jdzhandroid.api.net.HttpUtil; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.util.GlobalContext; | |||
import com.jdzh.jdzhandroid.util.PreferenceUtils; | |||
@@ -28,7 +28,7 @@ public class BPA_Batching { | |||
/** | |||
* 料仓通道编号 | |||
*/ | |||
private String siloChannelNum; | |||
private String siloChannelNum="未设置"; | |||
public String getSiloChannelNum() { | |||
return siloChannelNum; | |||
@@ -0,0 +1,98 @@ | |||
package com.jdzh.jdzhandroid.Sqlite.Model; | |||
import org.greenrobot.greendao.annotation.Entity; | |||
import org.greenrobot.greendao.annotation.Generated; | |||
import org.greenrobot.greendao.annotation.Id; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/10/23 10:06. | |||
*/ | |||
@Entity | |||
public class BPA_UserInfo { | |||
@Id | |||
private String id; | |||
private String name; | |||
private String account; | |||
private String password; | |||
private String phone; | |||
private int adminType; | |||
private String sysOrgId; | |||
private String companyName; | |||
private String createAt; | |||
@Generated(hash = 115114648) | |||
public BPA_UserInfo(String id, String name, String account, String password, | |||
String phone, int adminType, String sysOrgId, String companyName, | |||
String createAt) { | |||
this.id = id; | |||
this.name = name; | |||
this.account = account; | |||
this.password = password; | |||
this.phone = phone; | |||
this.adminType = adminType; | |||
this.sysOrgId = sysOrgId; | |||
this.companyName = companyName; | |||
this.createAt = createAt; | |||
} | |||
@Generated(hash = 1785663034) | |||
public BPA_UserInfo() { | |||
} | |||
public String getId() { | |||
return this.id; | |||
} | |||
public void setId(String id) { | |||
this.id = id; | |||
} | |||
public String getName() { | |||
return this.name; | |||
} | |||
public void setName(String name) { | |||
this.name = name; | |||
} | |||
public String getAccount() { | |||
return this.account; | |||
} | |||
public void setAccount(String account) { | |||
this.account = account; | |||
} | |||
public String getPassword() { | |||
return this.password; | |||
} | |||
public void setPassword(String password) { | |||
this.password = password; | |||
} | |||
public String getPhone() { | |||
return this.phone; | |||
} | |||
public void setPhone(String phone) { | |||
this.phone = phone; | |||
} | |||
public int getAdminType() { | |||
return this.adminType; | |||
} | |||
public void setAdminType(int adminType) { | |||
this.adminType = adminType; | |||
} | |||
public String getSysOrgId() { | |||
return this.sysOrgId; | |||
} | |||
public void setSysOrgId(String sysOrgId) { | |||
this.sysOrgId = sysOrgId; | |||
} | |||
public String getCompanyName() { | |||
return this.companyName; | |||
} | |||
public void setCompanyName(String companyName) { | |||
this.companyName = companyName; | |||
} | |||
public String getCreateAt() { | |||
return this.createAt; | |||
} | |||
public void setCreateAt(String createAt) { | |||
this.createAt = createAt; | |||
} | |||
} |
@@ -8,32 +8,19 @@ import android.view.ViewGroup; | |||
import android.widget.TextView; | |||
import androidx.annotation.Nullable; | |||
import androidx.core.graphics.Insets; | |||
import androidx.core.view.ViewCompat; | |||
import androidx.core.view.WindowInsetsCompat; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bigkoo.pickerview.TimePickerView; | |||
import com.jdzh.jdzhandroid.R; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeBathingUseDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeInfoDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeUseDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeBathingUseDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeUseDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.record.NameColorListAdapter; | |||
import com.jdzh.jdzhandroid.UI.dialog.BatchingNameListRecordDialog; | |||
import com.jdzh.jdzhandroid.UI.dialog.RecipeNameListRecordDialog; | |||
import com.jdzh.jdzhandroid.UI.fragment.RecipeUseLineChartFragment; | |||
import com.jdzh.jdzhandroid.UI.fragment.RecipeUseRankFragment; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.databinding.ActivityRecipeRecordBinding; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.FragmentRoundLineChartBinding; | |||
import com.jdzh.jdzhandroid.model.BatchingUseNum; | |||
import com.jdzh.jdzhandroid.model.NameColorBean; | |||
import com.jdzh.jdzhandroid.model.RecipeUseNum; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
@@ -42,8 +29,6 @@ import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.Calendar; | |||
import java.util.Collections; | |||
import java.util.Comparator; | |||
import java.util.Date; | |||
import java.util.HashSet; | |||
import java.util.List; | |||
@@ -0,0 +1,304 @@ | |||
package com.jdzh.jdzhandroid.UI.activity; | |||
import android.annotation.SuppressLint; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.text.Editable; | |||
import android.text.InputType; | |||
import android.text.TextUtils; | |||
import android.text.TextWatcher; | |||
import android.view.KeyEvent; | |||
import android.view.View; | |||
import android.view.WindowManager; | |||
import android.widget.EditText; | |||
import android.widget.ImageView; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.core.graphics.Insets; | |||
import androidx.core.view.ViewCompat; | |||
import androidx.core.view.WindowInsetsCompat; | |||
import androidx.lifecycle.LifecycleObserver; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.Enum.DialogButton; | |||
import com.jdzh.jdzhandroid.MainActivity; | |||
import com.jdzh.jdzhandroid.R; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_UserInfoDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_UserInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.view.WaitProcessUtil; | |||
import com.jdzh.jdzhandroid.api.IHttpCallBack; | |||
import com.jdzh.jdzhandroid.api.ServerManager; | |||
import com.jdzh.jdzhandroid.databinding.ActivityLoginBinding; | |||
import com.jdzh.jdzhandroid.databinding.ActivityWelcomeBinding; | |||
import com.jdzh.jdzhandroid.model.get.UsersDataBean; | |||
import com.jdzh.jdzhandroid.util.Dialog.DialogManager; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.GlobalContext; | |||
import com.jdzh.jdzhandroid.util.KeyboardToolUtils; | |||
import com.jdzh.jdzhandroid.util.MD5Encoder; | |||
import com.jdzh.jdzhandroid.util.PreferenceUtils; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
public class LoginActivity extends AppCompatActivity { | |||
private ActivityLoginBinding binding; | |||
private boolean isGetUser = false; | |||
@SuppressLint("ResourceAsColor") | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
binding = ActivityLoginBinding.inflate(getLayoutInflater()); | |||
setContentView(binding.getRoot()); | |||
//设置当前 activity 为全屏模式 | |||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN); | |||
//隐藏状态栏 | |||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_FULLSCREEN); | |||
DisplayManager.scaleViewGroup(binding.getRoot()); | |||
ViewCompat.setOnApplyWindowInsetsListener(binding.root, (v, insets) -> { | |||
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars()); | |||
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom); | |||
return insets; | |||
}); | |||
initUser(); | |||
initView(); | |||
initEvent(); | |||
binding.etAccount.requestFocus(); | |||
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); | |||
} | |||
@Override | |||
protected void onResume() { | |||
super.onResume(); | |||
GlobalContext.setContext(this); | |||
} | |||
@Override | |||
protected void onPause() { | |||
super.onPause(); | |||
GlobalContext.setContext(null); | |||
} | |||
/** | |||
* 初始化登录历史记录 | |||
* */ | |||
private void initUser() { | |||
//从sharePreference拿出保存的账号密码 | |||
String username = PreferenceUtils.getString(Config.SHARE_KEY_account,""); | |||
String password = PreferenceUtils.getString(Config.SHARE_KEY_password,""); | |||
binding.etAccount.getText().clear(); | |||
binding.etPassword.getText().clear(); | |||
if (!TextUtils.isEmpty(username)) { | |||
binding.etAccount.setText(username); | |||
binding.etAccount.setSelection(binding.etAccount.getText().length()); | |||
binding.ivCleanAccount.setVisibility(View.VISIBLE); | |||
} | |||
if (!TextUtils.isEmpty(password)) { | |||
//password = Des3Utils.decode(password); | |||
binding.etPassword.setText(password); | |||
binding.etPassword.setSelection(binding.etPassword.getText().length()); | |||
binding.cleanPassword.setVisibility(View.VISIBLE); | |||
} | |||
} | |||
private void initView(){ | |||
binding.ivCleanAccount.setOnClickListener(v->{ | |||
binding.etAccount.getText().clear(); | |||
}); | |||
binding.cleanPassword.setOnClickListener(v->{ | |||
binding.etPassword.getText().clear(); | |||
}); | |||
binding.ivShowPwd.setOnClickListener(v->{ | |||
changePasswordEye(); | |||
}); | |||
binding.btnLogin.setOnClickListener(v->{ | |||
if(binding.etAccount.getText().toString().isEmpty() || binding.etPassword.getText().toString().isEmpty()){ | |||
ToastUtil.showWarn("账号或密码不能为空"); | |||
return; | |||
} | |||
startLogin(); | |||
}); | |||
} | |||
private void startLogin(){ | |||
if(binding.etAccount.getText().toString().equals("admin")&&binding.etPassword.getText().toString().equals("hbl123456")){ | |||
KeyboardToolUtils.hideSoftInput(this); | |||
Intent intent = new Intent(this, MainActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
ToastUtil.showInfo("管理员登录成功!"); | |||
PreferenceUtils.setString(Config.SHARE_KEY_account,binding.etAccount.getText().toString()); | |||
PreferenceUtils.setString(Config.SHARE_KEY_password,binding.etPassword.getText().toString()); | |||
finish(); | |||
return; | |||
} | |||
LogUtils.d(" etPassword="+MD5Encoder.encode(binding.etPassword.getText().toString())); | |||
BPA_UserInfo userInfo = SqliteHelper.get().queryByQueryBuilderEntity(BPA_UserInfo.class, | |||
BPA_UserInfoDao.Properties.Account.eq(binding.etAccount.getText().toString()), | |||
BPA_UserInfoDao.Properties.Password.eq(MD5Encoder.encode(binding.etPassword.getText().toString())) | |||
); | |||
if(userInfo!=null){ | |||
// 隐藏软键盘 | |||
KeyboardToolUtils.hideSoftInput(this); | |||
Intent intent = new Intent(this, MainActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP|Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
ToastUtil.showInfo("登录成功!"); | |||
PreferenceUtils.setString(Config.SHARE_KEY_account,binding.etAccount.getText().toString()); | |||
PreferenceUtils.setString(Config.SHARE_KEY_password,binding.etPassword.getText().toString()); | |||
finish(); | |||
}else { | |||
if(!isGetUser){ | |||
getUserInfo(); | |||
}else { | |||
ToastUtil.showWarn("账号或密码错误!"); | |||
} | |||
} | |||
} | |||
/** | |||
* 获取账号信息 | |||
*/ | |||
private void getUserInfo(){ | |||
WaitProcessUtil.getInstance().show(this,"请稍等","正在请求登录接口,请耐心等待...",false); | |||
ServerManager.getUsers(new IHttpCallBack<ArrayList<UsersDataBean>>() { | |||
@Override | |||
public void onSuccess(ArrayList<UsersDataBean> usersDataBeans) { | |||
isGetUser = true; | |||
if(usersDataBeans!=null){ | |||
SqliteHelper.get().deleteMulti(SqliteHelper.get().queryAll(BPA_UserInfo.class)); | |||
List<BPA_UserInfo> userInfos = new ArrayList<>(); | |||
for(UsersDataBean bean : usersDataBeans){ | |||
BPA_UserInfo userInfo = new BPA_UserInfo(); | |||
userInfo.setId(bean.getId()); | |||
userInfo.setAccount(bean.getAccount()); | |||
userInfo.setPassword(bean.getPassword()); | |||
userInfo.setPhone(bean.getPhone()); | |||
userInfo.setAdminType(bean.getAdminType()); | |||
userInfo.setSysOrgId(bean.getSysOrgId()); | |||
userInfo.setCompanyName(bean.getCompanyName()); | |||
userInfo.setCreateAt(bean.getCreateAt()); | |||
userInfos.add(userInfo); | |||
} | |||
SqliteHelper.get().insertMulti(userInfos); | |||
} | |||
WaitProcessUtil.getInstance().dismiss(); | |||
startLogin(); | |||
} | |||
@Override | |||
public void onError(int failCode, String msg) { | |||
DialogManager.showWarn("登录接口请求报错:failCode="+failCode+"description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
public void onFailed(int failCode, Throwable throwable, String message) { | |||
DialogManager.showWarn("登录接口请求失败:failCode="+failCode+" description="+message, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
}); | |||
} | |||
/** | |||
* 点击眼睛图片显示或隐藏密码 | |||
* */ | |||
private void changePasswordEye() { | |||
if (binding.etPassword.getInputType() != InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) { | |||
binding.etPassword.setInputType(InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD); | |||
binding.ivShowPwd.setImageResource(R.drawable.icon_pass_visuable); | |||
} else { | |||
binding.etPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); | |||
binding.ivShowPwd.setImageResource(R.drawable.icon_pass_gone); | |||
} | |||
// 将光标移至文字末尾 | |||
String pwd = binding.etPassword.getText().toString(); | |||
if (!TextUtils.isEmpty(pwd)) | |||
binding.etPassword.setSelection(pwd.length()); | |||
} | |||
private long exitTime = 0; | |||
private int screenHeight = 0;//屏幕高度 | |||
private int keyHeight = 0; //软件盘弹起后所占高度 | |||
private final float scale = 0.9f; //logo缩放比例 | |||
private int height = 0; | |||
@SuppressLint("ClickableViewAccessibility") | |||
private void initEvent() { | |||
// 获取屏幕高度 | |||
screenHeight = this.getResources().getDisplayMetrics().heightPixels; | |||
// 弹起高度为屏幕高度的1/3 | |||
keyHeight = screenHeight / 3; | |||
// 输入账号状态监听,在右边显示或隐藏clean | |||
addIconClearListener(binding.etAccount,binding.ivCleanAccount); | |||
// 监听EtPassword输入状态,在右边显示或隐藏clean | |||
addIconClearListener(binding.etPassword,binding.cleanPassword); | |||
} | |||
/** | |||
* 设置文本框与右侧删除图标监听器 | |||
*/ | |||
private void addIconClearListener(final EditText et, final ImageView iv) { | |||
et.addTextChangedListener(new TextWatcher() { | |||
@Override | |||
public void beforeTextChanged(CharSequence s, int start, int count, int after) { | |||
} | |||
@Override | |||
public void onTextChanged(CharSequence s, int start, int before, int count) { | |||
} | |||
@Override | |||
public void afterTextChanged(Editable s) { | |||
//如果文本框长度大于0,则显示删除图标,否则不显示 | |||
if (s.length() > 0) { | |||
iv.setVisibility(View.VISIBLE); | |||
} else { | |||
iv.setVisibility(View.INVISIBLE); | |||
} | |||
} | |||
}); | |||
} | |||
/** | |||
* 重写返回键,实现双击退出程序效果 | |||
*/ | |||
@Override | |||
public boolean onKeyDown(int keyCode, KeyEvent event) { | |||
if (keyCode == KeyEvent.KEYCODE_BACK) { | |||
if (System.currentTimeMillis() - exitTime > 2000) { | |||
// ToastUtil.showInfo("再按一次退出程序"); | |||
exitTime = System.currentTimeMillis(); | |||
} else { | |||
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); | |||
android.os.Process.killProcess(android.os.Process.myPid()); | |||
System.exit(1); | |||
} | |||
return true; | |||
} | |||
return super.onKeyDown(keyCode, event); | |||
} | |||
@Override | |||
protected void onNewIntent(Intent intent) { | |||
super.onNewIntent(intent); | |||
} | |||
@Override | |||
public void onWindowFocusChanged(boolean hasFocus) { | |||
super.onWindowFocusChanged(hasFocus); | |||
} | |||
} |
@@ -10,20 +10,17 @@ import androidx.annotation.Nullable; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.bigkoo.pickerview.TimePickerView; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeInfoDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeUseDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeUseDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.record.RecipeBillingAdapter; | |||
import com.jdzh.jdzhandroid.UI.dialog.RecipeNameRecordDialog; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.ActivityRecipeBillingBinding; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import org.greenrobot.greendao.query.QueryBuilder; | |||
import java.text.ParseException; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
@@ -26,7 +26,7 @@ import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.edit.RecipeEditAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.edit.RecipeGroupEditAdapter; | |||
import com.jdzh.jdzhandroid.UI.dialog.RecipeEditDialog; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.ActivityRecipeManagerBinding; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.RecipeEditUtil; | |||
@@ -0,0 +1,42 @@ | |||
package com.jdzh.jdzhandroid.UI.activity; | |||
import android.annotation.SuppressLint; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import com.jdzh.jdzhandroid.MainActivity; | |||
import com.jdzh.jdzhandroid.databinding.ActivityWelcomeBinding; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
public class WelcomeActivity extends AppCompatActivity { | |||
private ActivityWelcomeBinding binding; | |||
@SuppressLint("ResourceAsColor") | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
binding = ActivityWelcomeBinding.inflate(getLayoutInflater()); | |||
setContentView(binding.getRoot()); | |||
DisplayManager.setReferenceMaxWidthHeight(1280, 800); | |||
DisplayManager.updateDisplayInfo(this); | |||
Intent intent = new Intent(WelcomeActivity.this, LoginActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
} | |||
@Override | |||
protected void onNewIntent(Intent intent) { | |||
super.onNewIntent(intent); | |||
Intent intent2 = new Intent(WelcomeActivity.this, LoginActivity.class); | |||
intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent2); | |||
} | |||
@Override | |||
public void onWindowFocusChanged(boolean hasFocus) { | |||
super.onWindowFocusChanged(hasFocus); | |||
} | |||
} |
@@ -19,7 +19,7 @@ import com.jdzh.jdzhandroid.R; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeGroupDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeGroup; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.util.RecipeEditUtil; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
@@ -1,17 +1,11 @@ | |||
package com.jdzh.jdzhandroid.UI.dialog; | |||
import android.app.Dialog; | |||
import android.content.Context; | |||
import android.graphics.Color; | |||
import android.graphics.Rect; | |||
import android.graphics.drawable.ColorDrawable; | |||
import android.os.Build; | |||
import android.os.Bundle; | |||
import android.util.DisplayMetrics; | |||
import android.view.Gravity; | |||
import android.view.KeyEvent; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.view.Window; | |||
@@ -20,24 +14,12 @@ import android.view.WindowManager; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.fragment.app.DialogFragment; | |||
import androidx.recyclerview.widget.GridLayoutManager; | |||
import androidx.recyclerview.widget.LinearLayoutManager; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.jdzh.jdzhandroid.R; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeGroupDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeInfoDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeGroup; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeGroupAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.record.BatchingNameAdapter; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.databinding.DialogBatchingNameListBinding; | |||
import com.jdzh.jdzhandroid.databinding.DialogBatchingNameListRecordBinding; | |||
import com.jdzh.jdzhandroid.databinding.DialogRecipeNameListRecordBinding; | |||
import com.jdzh.jdzhandroid.model.NameColorBean; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
@@ -7,7 +7,6 @@ import android.view.KeyEvent; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.view.WindowManager; | |||
import android.widget.Toast; | |||
import androidx.annotation.NonNull; | |||
@@ -32,17 +31,14 @@ import com.jdzh.jdzhandroid.UI.adapter.attribute.AttributeGroupNameAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.attribute.AttributeGroupTabAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.edit.RecipeAttribute2Adapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeDetailValueAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.attribute.RecipeAttributeAdapter; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.DialogRecipeEditBinding; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.Comparator; | |||
import java.util.Date; | |||
import java.util.List; | |||
public class RecipeEditDialog extends Dialog { | |||
@@ -1,6 +1,5 @@ | |||
package com.jdzh.jdzhandroid.UI.dialog; | |||
import android.content.pm.ActivityInfo; | |||
import android.graphics.Color; | |||
import android.graphics.drawable.ColorDrawable; | |||
import android.os.Build; | |||
@@ -12,7 +11,6 @@ import android.os.Message; | |||
import android.util.Log; | |||
import android.view.Gravity; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.view.Window; | |||
@@ -48,7 +46,7 @@ import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeattributeValue; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.Task.TaskManager; | |||
import com.jdzh.jdzhandroid.UI.adapter.attribute.RecipeAttributeAdapter; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.DialogRecipeExcuteBinding; | |||
import com.jdzh.jdzhandroid.util.Dialog.DialogManager; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
@@ -433,7 +431,6 @@ public class RecipeExecuteDialog extends DialogFragment { | |||
public void onTick(long millisUntilFinished) { | |||
if(millisUntilFinished>0){ | |||
double time = millisUntilFinished/1000.0; | |||
binding.progress.setProgress((int) ((total-millisUntilFinished)*100)); | |||
String formattedTime = String.format("%.1f", time); | |||
binding.tvTime.setText("剩余: "+formattedTime+" 秒"); | |||
@@ -22,9 +22,8 @@ import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeGroupAdapter; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.DialogRecipeNameListRecordBinding; | |||
import com.jdzh.jdzhandroid.databinding.DialogRecipeNameRecordBinding; | |||
import com.jdzh.jdzhandroid.model.NameColorBean; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
@@ -1,59 +1,34 @@ | |||
package com.jdzh.jdzhandroid.UI.dialog; | |||
import android.app.AlertDialog; | |||
import android.app.Dialog; | |||
import android.content.Context; | |||
import android.graphics.Color; | |||
import android.graphics.Rect; | |||
import android.util.DisplayMetrics; | |||
import android.view.KeyEvent; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.view.WindowManager; | |||
import android.widget.Toast; | |||
import androidx.annotation.NonNull; | |||
import androidx.recyclerview.widget.GridLayoutManager; | |||
import androidx.recyclerview.widget.LinearLayoutManager; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.R; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeBaseConfigDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeConfigDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeConfigDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeGroupDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeInfoDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeattributeDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeBaseConfig; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeConfig; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeConfigDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeGroup; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Recipeattribute; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeattributeValue; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.attribute.AttributeGroupNameAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.attribute.AttributeGroupTabAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.attribute.RecipeAttributeAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeDetailValueAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeGroupAdapter; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.databinding.DialogRecipeEditBinding; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.DialogRecipeNameRecordBinding; | |||
import com.jdzh.jdzhandroid.model.NameColorBean; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.util.ArrayList; | |||
import java.util.Collections; | |||
import java.util.Comparator; | |||
import java.util.List; | |||
import lecho.lib.hellocharts.util.ChartUtils; | |||
public class RecipeNameRecordDialog extends Dialog { | |||
private DialogRecipeNameRecordBinding binding; | |||
@@ -25,7 +25,7 @@ import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeAdapter; | |||
import com.jdzh.jdzhandroid.UI.adapter.recipe.RecipeGroupAdapter; | |||
import com.jdzh.jdzhandroid.UI.dialog.RecipeExecuteDialog; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.FragmentHomeBinding; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.PreferenceUtils; | |||
@@ -11,17 +11,14 @@ import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.fragment.app.Fragment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.Business.ElectoronicScales; | |||
import com.jdzh.jdzhandroid.Business.PlcControl; | |||
import com.jdzh.jdzhandroid.Enum.DialogButton; | |||
import com.jdzh.jdzhandroid.Enum.SiloChannel; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.databinding.FragmentColumnChartBinding; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.FragmentMaterialSiloBinding; | |||
import com.jdzh.jdzhandroid.databinding.FragmentPowderSiloBinding; | |||
import com.jdzh.jdzhandroid.util.Dialog.DialogManager; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
@@ -11,8 +11,12 @@ import androidx.annotation.Nullable; | |||
import androidx.fragment.app.Fragment; | |||
import com.jdzh.jdzhandroid.Enum.DialogButton; | |||
import com.jdzh.jdzhandroid.Interface.IRunT; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeGroup; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.Task.TaskManager; | |||
import com.jdzh.jdzhandroid.UI.activity.ChannelManagerActivity; | |||
import com.jdzh.jdzhandroid.UI.activity.MaterialManagerActivity; | |||
import com.jdzh.jdzhandroid.UI.activity.RecipeManagerActivity; | |||
@@ -20,12 +24,13 @@ import com.jdzh.jdzhandroid.UI.view.WaitProcessUtil; | |||
import com.jdzh.jdzhandroid.api.IHttpCallBack; | |||
import com.jdzh.jdzhandroid.api.ServerManager; | |||
import com.jdzh.jdzhandroid.databinding.FragmentParSetBinding; | |||
import com.jdzh.jdzhandroid.model.ResUpload; | |||
import com.jdzh.jdzhandroid.model.UploadTData; | |||
import com.jdzh.jdzhandroid.model.get.BatchingBean; | |||
import com.jdzh.jdzhandroid.model.get.RecipeListBean; | |||
import com.jdzh.jdzhandroid.util.Dialog.DialogManager; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
public class ParSetFragment extends Fragment { | |||
@@ -66,7 +71,14 @@ public class ParSetFragment extends Fragment { | |||
}); | |||
binding.btnDownloadRecipe.setOnClickListener(v->{ | |||
DialogManager.showWarn("下载云端数据将会删除并覆盖本地配方,您可以先将数据上传到云端再下载,请记录物料与通道绑定关系,若绑定关系变化则需重新校准,请确认?", DialogButton.OKCancel, new IRunT<Boolean>() { | |||
@Override | |||
public void Run(Boolean aBoolean) { | |||
if (aBoolean){ | |||
getBatchingList(); | |||
} | |||
} | |||
}); | |||
}); | |||
binding.btnUploadRecipe.setOnClickListener(v->{ | |||
@@ -75,6 +87,154 @@ public class ParSetFragment extends Fragment { | |||
} | |||
/** | |||
* 获取所有物料 | |||
*/ | |||
private void getBatchingList(){ | |||
WaitProcessUtil.getInstance().show(getContext(),"请稍等","正在获取物料数据,请耐心等待...",false); | |||
ServerManager.getBatching(new IHttpCallBack<ArrayList<BPA_Batching>>() { | |||
@Override | |||
public void onSuccess(ArrayList<BPA_Batching> bpaBatchings) { | |||
getRecipeList(bpaBatchings); | |||
} | |||
@Override | |||
public void onError(int failCode, String msg) { | |||
DialogManager.showWarn("获取物料接口请求报错:failCode="+failCode+"description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
public void onFailed(int failCode, Throwable throwable, String message) { | |||
DialogManager.showWarn("获取物料接口请求失败:failCode="+failCode+"description="+message, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
}); | |||
} | |||
/** | |||
* 获取所有配方 | |||
*/ | |||
private void getRecipeList(ArrayList<BPA_Batching> bpaBatchings){ | |||
WaitProcessUtil.getInstance().show(getContext(),"请稍等","正在获取所有配方,请耐心等待...",false); | |||
ServerManager.getRecipeList(new IHttpCallBack<RecipeListBean>() { | |||
@Override | |||
public void onSuccess(RecipeListBean recipeListBean) { | |||
WaitProcessUtil.getInstance().dismiss(); | |||
synchronizeData(bpaBatchings,recipeListBean); | |||
} | |||
@Override | |||
public void onError(int failCode, String msg) { | |||
DialogManager.showWarn("获取所有配方接口请求报错:failCode="+failCode+"description="+msg, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
public void onFailed(int failCode, Throwable throwable, String message) { | |||
DialogManager.showWarn("获取所有配方请求失败:failCode="+failCode+"description="+message, DialogButton.OK,null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
}); | |||
} | |||
/** | |||
* 同步数据 | |||
* @param bpaBatchings 物料数据 | |||
* @param recipeListBean 配方数据 | |||
*/ | |||
private void synchronizeData(ArrayList<BPA_Batching> bpaBatchings,RecipeListBean recipeListBean){ | |||
DialogManager.showWarn("获取获取所有配方成功,即将删除本地配方和物料数据并使用云端数据,物料通道绑定关系若有变动需重新校准,请确认?", DialogButton.OKCancel, new IRunT<Boolean>() { | |||
@Override | |||
public void Run(Boolean aBoolean) { | |||
if (aBoolean){ | |||
WaitProcessUtil.getInstance().show(getContext(),"同步数据","正在替换云端数据,请耐心等待...",false); | |||
TaskManager.get().execute(new Runnable() { | |||
@Override | |||
public void run() { | |||
StringBuilder result = new StringBuilder(); | |||
try { | |||
//替换物料数据 | |||
ToastUtil.showInfo("删除并替换本地物料数据..."); | |||
result.append("同步云端数据记录:\n").append("删除本地物料数据..."); | |||
List<BPA_Batching> oldList = SqliteHelper.get().queryAll(BPA_Batching.class); | |||
for(BPA_Batching bean: bpaBatchings){ | |||
for(BPA_Batching old:oldList){ | |||
if(bean.getId().equals(old.getId())){ | |||
bean.setSiloChannelNum(old.getSiloChannelNum()); | |||
} | |||
} | |||
} | |||
SqliteHelper.get().deleteMulti(SqliteHelper.get().queryAll(BPA_Batching.class)); | |||
SqliteHelper.get().insertMulti(bpaBatchings); | |||
result.append("同步云端物料成功"); | |||
//删除所有配方 | |||
ToastUtil.showInfo("删除所有配方数据..."); | |||
result.append("删除所有配方数据..."); | |||
SqliteHelper.get().deleteMulti(SqliteHelper.get().queryAll(BPA_RecipeGroup.class)); | |||
SqliteHelper.get().deleteMulti(SqliteHelper.get().queryAll(BPA_RecipeGroup.class)); | |||
SqliteHelper.get().deleteMulti(SqliteHelper.get().queryAll(BPA_RecipeGroup.class)); | |||
SqliteHelper.get().deleteMulti(SqliteHelper.get().queryAll(BPA_RecipeGroup.class)); | |||
result.append("删除所有配方数据完成"); | |||
if(recipeListBean!=null){ | |||
if(recipeListBean.getRecipeGroupList()!=null){ | |||
SqliteHelper.get().insertMulti(recipeListBean.getRecipeGroupList()); | |||
ToastUtil.showInfo("同步配方分组成功..."); | |||
result.append("同步配方分组成功"); | |||
} | |||
if(recipeListBean.getRecipeInfoList()!=null){ | |||
SqliteHelper.get().insertMulti(recipeListBean.getRecipeInfoList()); | |||
ToastUtil.showInfo("同步配方信息成功..."); | |||
result.append("同步配方信息成功"); | |||
} | |||
if(recipeListBean.getRecipeAttrList()!=null){ | |||
SqliteHelper.get().insertMulti(recipeListBean.getRecipeAttrList()); | |||
ToastUtil.showInfo("同步配方属性成功..."); | |||
result.append("同步配方属性成功"); | |||
} | |||
if(recipeListBean.getRecipeAttrValueList()!=null){ | |||
SqliteHelper.get().insertMulti(recipeListBean.getRecipeAttrValueList()); | |||
ToastUtil.showInfo("同步配方属性值成功..."); | |||
result.append("同步配方属性值成功"); | |||
} | |||
if(recipeListBean.getRecipeBaseConfigList()!=null){ | |||
SqliteHelper.get().insertMulti(recipeListBean.getRecipeBaseConfigList()); | |||
ToastUtil.showInfo("同步基础配方成功..."); | |||
result.append("同步基础配方成功"); | |||
} | |||
if(recipeListBean.getRecipeAttrConfigList()!=null){ | |||
SqliteHelper.get().insertMulti(recipeListBean.getRecipeAttrConfigList()); | |||
ToastUtil.showInfo("同步属性组合配方成功..."); | |||
result.append("同步属性组合配方成功"); | |||
} | |||
if(recipeListBean.getRecipeConfigDetailList()!=null){ | |||
SqliteHelper.get().insertMulti(recipeListBean.getRecipeConfigDetailList()); | |||
ToastUtil.showInfo("同步配方物料详情成功..."); | |||
result.append("同步配方物料详情成功"); | |||
} | |||
} | |||
DialogManager.showWarn("同步完成,请检查物料通道绑定是否有变动,若有变动则需重新校准", DialogButton.OK,null); | |||
}catch (Exception e){ | |||
DialogManager.showWarn("同步数据异常! mgs="+ e.getMessage() +"\n"+result.toString(), DialogButton.OK,null); | |||
}finally { | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
} | |||
}); | |||
}else { | |||
ToastUtil.showInfo("已取消同步"); | |||
} | |||
} | |||
}); | |||
} | |||
/** | |||
* 上传物料信息 | |||
*/ | |||
private void uploadBatching(){ | |||
ServerManager.uploadBatching(getContext(), new IHttpCallBack<Object>() { | |||
@Override | |||
@@ -97,6 +257,9 @@ public class ParSetFragment extends Fragment { | |||
}); | |||
} | |||
/** | |||
* 上传配方分组 | |||
*/ | |||
private void uploadRecipeGroup(){ | |||
ServerManager.uploadRecipeGroup(getContext(), new IHttpCallBack<Object>() { | |||
@Override | |||
@@ -119,6 +282,10 @@ public class ParSetFragment extends Fragment { | |||
}); | |||
} | |||
/** | |||
* 上次配方信息 按分组上传 | |||
* @param position | |||
*/ | |||
private void uploadRecipeInfo(int position){ | |||
List<BPA_RecipeGroup> list = SqliteHelper.get().queryAll(BPA_RecipeGroup.class); | |||
if(position>=list.size()){ | |||
@@ -147,6 +314,9 @@ public class ParSetFragment extends Fragment { | |||
} | |||
} | |||
/** | |||
* 上传多属性 | |||
*/ | |||
private void uploadRecipeAttr(){ | |||
ServerManager.uploadRecipeAttr(getContext(),new IHttpCallBack<Object>() { | |||
@Override | |||
@@ -170,6 +340,9 @@ public class ParSetFragment extends Fragment { | |||
} | |||
/** | |||
* 上传配方物料详情 | |||
*/ | |||
private void uploadRecipeBatching(){ | |||
ServerManager.uploadRecipeBatching(getContext(),new IHttpCallBack<Object>() { | |||
@Override | |||
@@ -1,60 +1,29 @@ | |||
package com.jdzh.jdzhandroid.UI.fragment; | |||
import android.annotation.SuppressLint; | |||
import android.graphics.Color; | |||
import android.os.Bundle; | |||
import android.util.Log; | |||
import android.view.LayoutInflater; | |||
import android.view.MotionEvent; | |||
import android.view.View; | |||
import android.view.ViewGroup; | |||
import android.widget.TextView; | |||
import androidx.annotation.NonNull; | |||
import androidx.annotation.Nullable; | |||
import androidx.fragment.app.Fragment; | |||
import com.bigkoo.pickerview.TimePickerView; | |||
import com.jdzh.jdzhandroid.Business.ElectoronicScales; | |||
import com.jdzh.jdzhandroid.Business.PlcControl; | |||
import com.jdzh.jdzhandroid.Enum.DialogButton; | |||
import com.jdzh.jdzhandroid.Enum.SiloChannel; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeInfoDao; | |||
import com.jdzh.jdzhandroid.Sqlite.DAO.BPA_RecipeUseDetailDao; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeUseDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.record.RecipeNameRecordAdapter; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.databinding.FragmentColumnChartBinding; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.FragmentPowderSiloBinding; | |||
import com.jdzh.jdzhandroid.model.RecipeUseNum; | |||
import com.jdzh.jdzhandroid.util.Dialog.DialogManager; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.text.ParseException; | |||
import java.text.SimpleDateFormat; | |||
import java.util.ArrayList; | |||
import java.util.Calendar; | |||
import java.util.Collections; | |||
import java.util.Comparator; | |||
import java.util.Date; | |||
import java.util.HashSet; | |||
import java.util.List; | |||
import java.util.Set; | |||
import lecho.lib.hellocharts.gesture.ZoomType; | |||
import lecho.lib.hellocharts.listener.ColumnChartOnValueSelectListener; | |||
import lecho.lib.hellocharts.listener.ViewportChangeListener; | |||
import lecho.lib.hellocharts.model.Axis; | |||
import lecho.lib.hellocharts.model.AxisValue; | |||
import lecho.lib.hellocharts.model.Column; | |||
import lecho.lib.hellocharts.model.ColumnChartData; | |||
import lecho.lib.hellocharts.model.SubcolumnValue; | |||
import lecho.lib.hellocharts.model.Viewport; | |||
import lecho.lib.hellocharts.util.ChartUtils; | |||
/** | |||
* @author: liup | |||
@@ -21,7 +21,7 @@ import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeUseDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.record.NameColorListAdapter; | |||
import com.jdzh.jdzhandroid.UI.dialog.RecipeNameListRecordDialog; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.FragmentRoundLineChartBinding; | |||
import com.jdzh.jdzhandroid.model.NameColorBean; | |||
import com.jdzh.jdzhandroid.model.RecipeUseNum; | |||
@@ -19,7 +19,7 @@ import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeUseDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.adapter.record.RecipeNameRecordAdapter; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.databinding.FragmentColumnChartBinding; | |||
import com.jdzh.jdzhandroid.model.RecipeUseNum; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
@@ -1,5 +1,6 @@ | |||
package com.jdzh.jdzhandroid.UI.fragment; | |||
import android.content.Intent; | |||
import android.os.Bundle; | |||
import android.view.LayoutInflater; | |||
import android.view.View; | |||
@@ -10,10 +11,19 @@ import androidx.annotation.Nullable; | |||
import androidx.fragment.app.Fragment; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.Enum.DialogButton; | |||
import com.jdzh.jdzhandroid.UI.activity.LoginActivity; | |||
import com.jdzh.jdzhandroid.UI.activity.WelcomeActivity; | |||
import com.jdzh.jdzhandroid.UI.view.WaitProcessUtil; | |||
import com.jdzh.jdzhandroid.api.IHttpCallBack; | |||
import com.jdzh.jdzhandroid.api.ServerManager; | |||
import com.jdzh.jdzhandroid.databinding.FragmentSystemSetBinding; | |||
import com.jdzh.jdzhandroid.model.get.DeviceInfoDataBean; | |||
import com.jdzh.jdzhandroid.util.Dialog.DialogManager; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.PreferenceUtils; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
public class SystemSetFragment extends Fragment { | |||
private FragmentSystemSetBinding binding; | |||
@@ -35,12 +45,81 @@ public class SystemSetFragment extends Fragment { | |||
binding.edtDeviceKey.setText(PreferenceUtils.getString(Config.SHARE_KEY_autoKey,"")); | |||
Config.getInstance().autoKey = PreferenceUtils.getString(Config.SHARE_KEY_autoKey,""); | |||
LogUtils.d(" Config.getInstance().autoKey="+Config.getInstance().autoKey); | |||
DeviceInfoDataBean dataBean = new DeviceInfoDataBean(); | |||
dataBean.setDeviceId(PreferenceUtils.getString(Config.SHARE_KEY_deviceId,"")); | |||
dataBean.setOrgName(PreferenceUtils.getString(Config.SHARE_KEY_company,"")); | |||
dataBean.setDevicePosition(PreferenceUtils.getString(Config.SHARE_KEY_deviceLocation,"")); | |||
dataBean.setStoreName(PreferenceUtils.getString(Config.SHARE_KEY_storeName,"")); | |||
dataBean.setStorePhone(PreferenceUtils.getString(Config.SHARE_KEY_storePhone,"")); | |||
dataBean.setContactPhone(PreferenceUtils.getString(Config.SHARE_KEY_wePhone,"")); | |||
changeView(dataBean); | |||
binding.btnSave.setOnClickListener(v->{ | |||
Config.getInstance().autoKey = binding.edtDeviceKey.getText().toString(); | |||
PreferenceUtils.setString(Config.SHARE_KEY_autoKey,Config.getInstance().autoKey); | |||
WaitProcessUtil.getInstance().show(getContext(),"请稍等","正在获取设备信息,请耐心等待...",false); | |||
ServerManager.getDeviceInfo(new IHttpCallBack<DeviceInfoDataBean>() { | |||
@Override | |||
public void onSuccess(DeviceInfoDataBean deviceInfoDataBean) { | |||
ToastUtil.showInfo("获取设备信息成功"); | |||
changeView(deviceInfoDataBean); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
public void onError(int failCode, String msg) { | |||
DialogManager.showWarn("获取设备信息报错:failCode="+failCode+" description="+msg, DialogButton.OK,null); | |||
changeView(null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
@Override | |||
public void onFailed(int failCode, Throwable throwable, String message) { | |||
DialogManager.showWarn("获取设备信息失败:failCode="+failCode+" description="+message, DialogButton.OK,null); | |||
changeView(null); | |||
WaitProcessUtil.getInstance().dismiss(); | |||
} | |||
}); | |||
}); | |||
binding.btnLogout.setOnClickListener(v->{ | |||
if(getActivity()!=null){ | |||
getActivity().finish(); | |||
} | |||
Intent intent = new Intent(getContext(), LoginActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
}); | |||
} | |||
private void changeView(DeviceInfoDataBean data){ | |||
if(data!=null){ | |||
PreferenceUtils.setString(Config.SHARE_KEY_deviceId,data.getDeviceId()); | |||
PreferenceUtils.setString(Config.SHARE_KEY_company,data.getOrgName()); | |||
PreferenceUtils.setString(Config.SHARE_KEY_deviceLocation,data.getDevicePosition()); | |||
PreferenceUtils.setString(Config.SHARE_KEY_storeName,data.getStoreName()); | |||
PreferenceUtils.setString(Config.SHARE_KEY_storePhone,data.getStorePhone()); | |||
PreferenceUtils.setString(Config.SHARE_KEY_wePhone,data.getContactPhone()); | |||
binding.tvDeviceKey.setText("设备编号:"+data.getDeviceId()); | |||
binding.tvCompanyName.setText("主体单位:"+data.getOrgName()); | |||
binding.tvDeviceLocation.setText("设备位置:"+data.getDevicePosition()); | |||
binding.tvStoreLocation.setText("门店信息:"+data.getStoreName()); | |||
binding.tvPhoneNumber.setText("联系电话:"+data.getStorePhone()); | |||
binding.tvPhoneAdmin.setText("联系我们:"+data.getContactPhone()); | |||
// binding.tvLocationAdmin.setText(""); | |||
}else { | |||
binding.tvDeviceKey.setText("设备编号:"); | |||
binding.tvCompanyName.setText("主体单位:"); | |||
binding.tvDeviceLocation.setText("设备位置:"); | |||
binding.tvStoreLocation.setText("门店信息:"); | |||
binding.tvPhoneNumber.setText("联系电话:"); | |||
// binding.tvPhoneAdmin.setText(""); | |||
// binding.tvLocationAdmin.setText(""); | |||
} | |||
} | |||
@Override | |||
@@ -1,63 +0,0 @@ | |||
package com.jdzh.jdzhandroid; | |||
import android.annotation.SuppressLint; | |||
import android.content.Intent; | |||
import android.graphics.drawable.ColorDrawable; | |||
import android.os.Bundle; | |||
import android.view.View; | |||
import android.view.WindowManager; | |||
import androidx.activity.ComponentActivity; | |||
import androidx.activity.EdgeToEdge; | |||
import androidx.appcompat.app.ActionBarDrawerToggle; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.core.graphics.Insets; | |||
import androidx.core.view.GravityCompat; | |||
import androidx.core.view.ViewCompat; | |||
import androidx.core.view.WindowInsetsCompat; | |||
import com.jdzh.jdzhandroid.Business.ElectoronicScales; | |||
import com.jdzh.jdzhandroid.Business.Global; | |||
import com.jdzh.jdzhandroid.Business.PlcControl; | |||
import com.jdzh.jdzhandroid.Business.RecipeModeMgr; | |||
import com.jdzh.jdzhandroid.Task.Task; | |||
import com.jdzh.jdzhandroid.Test.EnumParse; | |||
import com.jdzh.jdzhandroid.UI.activity.ChannelCalibrationActivity; | |||
import com.jdzh.jdzhandroid.UI.fragment.DebugFragment; | |||
import com.jdzh.jdzhandroid.UI.fragment.HomeFragment; | |||
import com.jdzh.jdzhandroid.UI.fragment.ParSetFragment; | |||
import com.jdzh.jdzhandroid.UI.fragment.RecordFragment; | |||
import com.jdzh.jdzhandroid.UI.fragment.SystemSetFragment; | |||
import com.jdzh.jdzhandroid.databinding.ActivityMainBinding; | |||
import com.jdzh.jdzhandroid.databinding.ActivityWelcomeBinding; | |||
import com.jdzh.jdzhandroid.util.DisplayManager; | |||
import com.jdzh.jdzhandroid.util.GlobalContext; | |||
public class WelcomeActivity extends AppCompatActivity { | |||
private ActivityWelcomeBinding binding; | |||
@SuppressLint("ResourceAsColor") | |||
@Override | |||
protected void onCreate(Bundle savedInstanceState) { | |||
super.onCreate(savedInstanceState); | |||
binding = ActivityWelcomeBinding.inflate(getLayoutInflater()); | |||
setContentView(binding.getRoot()); | |||
Intent intent = new Intent(WelcomeActivity.this, MainActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent); | |||
} | |||
@Override | |||
protected void onNewIntent(Intent intent) { | |||
super.onNewIntent(intent); | |||
Intent intent2 = new Intent(WelcomeActivity.this, MainActivity.class); | |||
intent2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | |||
startActivity(intent2); | |||
} | |||
@Override | |||
public void onWindowFocusChanged(boolean hasFocus) { | |||
super.onWindowFocusChanged(hasFocus); | |||
} | |||
} |
@@ -2,14 +2,19 @@ package com.jdzh.jdzhandroid.api; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Batching; | |||
import com.jdzh.jdzhandroid.model.ResUpload; | |||
import com.jdzh.jdzhandroid.model.ResResult; | |||
import com.jdzh.jdzhandroid.model.UploadTData; | |||
import com.jdzh.jdzhandroid.model.get.BatchingBean; | |||
import com.jdzh.jdzhandroid.model.get.DeviceInfoDataBean; | |||
import com.jdzh.jdzhandroid.model.get.RecipeListBean; | |||
import com.jdzh.jdzhandroid.model.get.UsersDataBean; | |||
import java.util.ArrayList; | |||
import okhttp3.RequestBody; | |||
import retrofit2.Call; | |||
import retrofit2.http.Body; | |||
import retrofit2.http.GET; | |||
import retrofit2.http.POST; | |||
import retrofit2.http.Url; | |||
@@ -20,14 +25,32 @@ public interface Api { | |||
/** | |||
* 获取物料 | |||
*/ | |||
@POST | |||
Call<ResUpload<ArrayList<BPA_Batching>>> getBatching(@Url String url); | |||
@GET | |||
Call<ResResult<ArrayList<BPA_Batching>>> getBatching(@Url String url); | |||
/** | |||
* 获取所有账号 | |||
*/ | |||
@GET | |||
Call<ResResult<ArrayList<UsersDataBean>>> getUsers(@Url String url); | |||
/** | |||
* 获取设备信息 | |||
*/ | |||
@GET | |||
Call<ResResult<DeviceInfoDataBean>> getDeviceInfo(@Url String url); | |||
/** | |||
* 获取所有配方 | |||
*/ | |||
@GET | |||
Call<ResResult<RecipeListBean>> getRecipeList(@Url String url); | |||
/** | |||
* 上传物料 | |||
*/ | |||
@POST | |||
Call<ResUpload<UploadTData>> uploadBatching(@Url String url, | |||
Call<ResResult<ArrayList<UploadTData>>> uploadBatching(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
@@ -35,21 +58,21 @@ public interface Api { | |||
* isWeight 分组模式(true:称重模式 false:标准模式) | |||
*/ | |||
@POST | |||
Call<ResUpload<UploadTData>> uploadRecipeGroup(@Url String url, | |||
Call<ResResult<ArrayList<UploadTData>>> uploadRecipeGroup(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
* 上传配方信息 | |||
*/ | |||
@POST | |||
Call<ResUpload<UploadTData>> uploadRecipeInfo(@Url String url, | |||
Call<ResResult<ArrayList<UploadTData>>> uploadRecipeInfo(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
* 上传配方属性 | |||
*/ | |||
@POST | |||
Call<ResUpload<UploadTData>> uploadRecipeAttr(@Url String url, | |||
Call<ResResult<ArrayList<UploadTData>>> uploadRecipeAttr(@Url String url, | |||
@Body RequestBody body); | |||
@@ -57,7 +80,7 @@ public interface Api { | |||
* 上传配方物料详情 | |||
*/ | |||
@POST | |||
Call<ResUpload<UploadTData>> uploadRecipeBatching(@Url String url, | |||
Call<ResResult<ArrayList<UploadTData>>> uploadRecipeBatching(@Url String url, | |||
@Body RequestBody body); | |||
@@ -65,15 +88,13 @@ public interface Api { | |||
* 上传配方使用详情 | |||
*/ | |||
@POST | |||
Call<ResUpload<UploadTData>> uploadRecipeUseDetail(@Url String url, | |||
Call<ResResult<ArrayList<UploadTData>>> uploadRecipeUseDetail(@Url String url, | |||
@Body RequestBody body); | |||
/** | |||
* 上传上传设备日志文件 | |||
*/ | |||
@POST | |||
Call<ResUpload<UploadTData>> uploadDeviceLog(@Url String url, | |||
@Body RequestBody body | |||
// @Part MultipartBody.Part file | |||
); | |||
Call<ResResult<ArrayList<UploadTData>>> uploadDeviceLog(@Url String url, | |||
@Body RequestBody body); | |||
} |
@@ -1,19 +1,20 @@ | |||
package com.jdzh.jdzhandroid.api; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.UI.view.WaitProcessUtil; | |||
import com.jdzh.jdzhandroid.model.ResResult; | |||
import com.jdzh.jdzhandroid.model.UploadTData; | |||
import java.net.SocketTimeoutException; | |||
import java.util.List; | |||
import retrofit2.Call; | |||
import retrofit2.Callback; | |||
import retrofit2.Response; | |||
/** | |||
* @author Nov | |||
* @date 19.11.25 | |||
*/ | |||
public class CommonResponse<T> implements Callback<T> { | |||
public class BaseResponse implements Callback<ResResult> { | |||
/** | |||
* 回调 | |||
@@ -21,27 +22,31 @@ public class CommonResponse<T> implements Callback<T> { | |||
private IHttpCallBack callback; | |||
public CommonResponse(IHttpCallBack callback) { | |||
public BaseResponse(IHttpCallBack callback) { | |||
this.callback = callback; | |||
} | |||
@Override | |||
public void onResponse(Call<T> call, Response<T> response) { | |||
T data = response.body(); | |||
public void onResponse(Call<ResResult> call, Response<ResResult> response) { | |||
ResResult body = response.body(); | |||
if (null == response) { | |||
callError("response=null", Constant.APP_DATA_ERROR, "response =null"); | |||
return; | |||
} | |||
if (null == data) { | |||
callError("data=null", Constant.APP_DATA_ERROR, response.message()); | |||
if (null == body) { | |||
callError("body=null", Constant.APP_DATA_ERROR, response.message()); | |||
return; | |||
} | |||
if (body.getStatusCode() != Constant.CMS_STATUS_OK) { | |||
callError("code!=200", body.getStatusCode(), body.getErrors()); | |||
return; | |||
} | |||
callSuccess(data); | |||
callSuccess( body.getData()); | |||
} | |||
@Override | |||
public void onFailure(Call<T> call, Throwable t) { | |||
public void onFailure(Call<ResResult> call, Throwable t) { | |||
LogUtils.d("接口出错....."+t.getMessage() + " "+call.request().url()); | |||
callFail(Constant.APP_NET_ERROR, t); | |||
@@ -54,13 +59,14 @@ public class CommonResponse<T> implements Callback<T> { | |||
* @param e | |||
*/ | |||
private void callFail(final int code, final Throwable e) { | |||
if (null == callback) { | |||
return; | |||
} | |||
if (e instanceof SocketTimeoutException) { | |||
callback.onFailed(code, e, "请求超时"); | |||
} else { | |||
callback.onFailed(code, e, "接口请求错误"); | |||
callback.onFailed(code, e, "接口请求错误,请检查网络"); | |||
} | |||
e.printStackTrace(); | |||
@@ -77,7 +83,7 @@ public class CommonResponse<T> implements Callback<T> { | |||
if (null == callback) { | |||
return; | |||
} | |||
LogUtils.d("请求数据处理错误....."); | |||
//LogUtils.d("请求数据处理错误....."); | |||
callback.onError(code,msg); | |||
reportErrorInfo(code + "", msg); | |||
} |
@@ -2,9 +2,8 @@ package com.jdzh.jdzhandroid.api; | |||
import com.apkfuns.logutils.LogUtils; | |||
import com.jdzh.jdzhandroid.model.ResUpload; | |||
import com.jdzh.jdzhandroid.model.ResResult; | |||
import com.jdzh.jdzhandroid.model.UploadTData; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
import java.net.SocketTimeoutException; | |||
import java.util.List; | |||
@@ -15,7 +14,7 @@ import retrofit2.Response; | |||
/** | |||
*/ | |||
public class BaseUpResponse implements Callback<ResUpload> { | |||
public class BaseUpResponse implements Callback<ResResult> { | |||
/** | |||
* 回调 | |||
@@ -29,8 +28,8 @@ public class BaseUpResponse implements Callback<ResUpload> { | |||
@Override | |||
public void onResponse(Call<ResUpload> call, Response<ResUpload> response) { | |||
ResUpload body = response.body(); | |||
public void onResponse(Call<ResResult> call, Response<ResResult> response) { | |||
ResResult body = response.body(); | |||
if (null == response) { | |||
callError("response=null", Constant.APP_DATA_ERROR, "response =null"); | |||
return; | |||
@@ -45,25 +44,26 @@ public class BaseUpResponse implements Callback<ResUpload> { | |||
} | |||
List<UploadTData> data = body.getData(); | |||
StringBuilder desc = new StringBuilder(); | |||
if(data!=null && !data.isEmpty()){ | |||
for(UploadTData bean:data){ | |||
if(bean.code!=30000){ | |||
desc.append("{").append(bean.getCode()).append(bean.getMessage()).append("[").append(bean.getName()).append("]}"); | |||
if(body.getData()!=null){ | |||
List<UploadTData> data = (List<UploadTData>) body.getData(); | |||
StringBuilder desc = new StringBuilder(); | |||
if(data!=null && !data.isEmpty()){ | |||
for(UploadTData bean:data){ | |||
if(bean.code!=30000){ | |||
desc.append("{").append(bean.getCode()).append(bean.getMessage()).append("[").append(bean.getName()).append("]}"); | |||
} | |||
} | |||
if(desc.length()>0){ | |||
callError("",body.statusCode,desc.toString()); | |||
return; | |||
} | |||
} | |||
if(desc.length()>0){ | |||
callError("",body.statusCode,desc.toString()); | |||
return; | |||
} | |||
} | |||
callSuccess( body.getData()); | |||
} | |||
@Override | |||
public void onFailure(Call<ResUpload> call, Throwable t) { | |||
public void onFailure(Call<ResResult> call, Throwable t) { | |||
LogUtils.d("接口出错....."+t.getMessage() + " "+call.request().url()); | |||
callFail(Constant.APP_NET_ERROR, t); | |||
@@ -83,7 +83,7 @@ public class BaseUpResponse implements Callback<ResUpload> { | |||
if (e instanceof SocketTimeoutException) { | |||
callback.onFailed(code, e, "请求超时"); | |||
} else { | |||
callback.onFailed(code, e, "接口请求错误"); | |||
callback.onFailed(code, e, "接口请求错误,请检查网络"); | |||
} | |||
e.printStackTrace(); | |||
@@ -23,9 +23,11 @@ import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeattributeValue; | |||
import com.jdzh.jdzhandroid.Sqlite.SqliteHelper; | |||
import com.jdzh.jdzhandroid.UI.view.WaitProcessUtil; | |||
import com.jdzh.jdzhandroid.api.net.HttpUtil; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.model.ResUpload; | |||
import com.jdzh.jdzhandroid.model.UploadTData; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.model.get.BatchingBean; | |||
import com.jdzh.jdzhandroid.model.get.DeviceInfoDataBean; | |||
import com.jdzh.jdzhandroid.model.get.RecipeListBean; | |||
import com.jdzh.jdzhandroid.model.get.UsersDataBean; | |||
import com.jdzh.jdzhandroid.model.upload.BatchBean; | |||
import com.jdzh.jdzhandroid.model.upload.RecipeAttributeBean; | |||
import com.jdzh.jdzhandroid.model.upload.RecipeBatchBean; | |||
@@ -56,7 +58,34 @@ public class ServerManager { | |||
public static void getBatching(IHttpCallBack<ArrayList<BPA_Batching>> callback) { | |||
String url = mainUrl + "/api/interface/getBatching"; | |||
Call call = HttpUtil.getService(Api.class).getBatching(url); | |||
resUpEnqueue(call, callback); | |||
resEnqueue(call, callback); | |||
} | |||
/** | |||
* 获取账号 | |||
*/ | |||
public static void getUsers(IHttpCallBack<ArrayList<UsersDataBean>> callback) { | |||
String url = mainUrl + "/api/interface/getUsers"; | |||
Call call = HttpUtil.getService(Api.class).getUsers(url); | |||
resEnqueue(call, callback); | |||
} | |||
/** | |||
* 获取设备信息 | |||
*/ | |||
public static void getDeviceInfo(IHttpCallBack<DeviceInfoDataBean> callback) { | |||
String url = mainUrl + "/api/interface/getDeviceInfo"; | |||
Call call = HttpUtil.getService(Api.class).getDeviceInfo(url); | |||
resEnqueue(call, callback); | |||
} | |||
/** | |||
* 获取所有配方 | |||
*/ | |||
public static void getRecipeList(IHttpCallBack<RecipeListBean> callback) { | |||
String url = mainUrl + "/api/interface/getRecipeList"; | |||
Call call = HttpUtil.getService(Api.class).getRecipeList(url); | |||
resEnqueue(call, callback); | |||
} | |||
/** | |||
@@ -297,6 +326,18 @@ public class ServerManager { | |||
resUpEnqueue(call, callback); | |||
} | |||
public static void uploadCrashLog(File file,IHttpCallBack<Object> callback) { | |||
String url = mainUrl + "/api/interface/uploadDeviceLog"; | |||
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM) | |||
.addFormDataPart("formFile",file.getName()+"-"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()), | |||
RequestBody.create(MediaType.parse("application/octet-stream"),file)) | |||
.addFormDataPart("storeName",PreferenceUtils.getString(Config.SHARE_KEY_storeName,"")) | |||
.addFormDataPart("deviceName",PreferenceUtils.getString(Config.SHARE_KEY_deviceName,"")) | |||
.build(); | |||
Call call = HttpUtil.getService(Api.class).uploadDeviceLog(url,body); | |||
resUpEnqueue(call, callback); | |||
} | |||
/** | |||
* @param call | |||
* @param callBack | |||
@@ -306,4 +347,12 @@ public class ServerManager { | |||
call.enqueue(response); | |||
} | |||
/** | |||
* @param call | |||
* @param callBack | |||
*/ | |||
private static void resEnqueue(Call call, IHttpCallBack callBack) { | |||
BaseResponse response = new BaseResponse(callBack); | |||
call.enqueue(response); | |||
} | |||
} |
@@ -1,6 +1,6 @@ | |||
package com.jdzh.jdzhandroid.api.net.interceptor; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import java.io.IOException; | |||
@@ -1,23 +1,21 @@ | |||
package com.jdzh.jdzhandroid.model; | |||
import com.google.gson.GsonBuilder; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
import retrofit2.http.Body; | |||
public class ResResult<T> { | |||
public int statusCode ; | |||
public List<T> data ;// | |||
public boolean succeeded ; | |||
public String errors ; | |||
public String extras ; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/7/25 15:21. | |||
*/ | |||
public class ResResult<T> implements Serializable { | |||
public long timestamp ; | |||
public int statusCode; | |||
public T data; | |||
public boolean succeeded; | |||
public String errors; | |||
public String extras; | |||
public int timestamp; | |||
public int getStatusCode() { | |||
return statusCode; | |||
@@ -27,11 +25,11 @@ public class ResResult<T> { | |||
this.statusCode = statusCode; | |||
} | |||
public List<T> getData() { | |||
public T getData() { | |||
return data; | |||
} | |||
public void setData(List<T> data) { | |||
public void setData(T data) { | |||
this.data = data; | |||
} | |||
@@ -59,11 +57,11 @@ public class ResResult<T> { | |||
this.extras = extras; | |||
} | |||
public long getTimestamp() { | |||
public int getTimestamp() { | |||
return timestamp; | |||
} | |||
public void setTimestamp(long timestamp) { | |||
public void setTimestamp(int timestamp) { | |||
this.timestamp = timestamp; | |||
} | |||
} |
@@ -1,67 +0,0 @@ | |||
package com.jdzh.jdzhandroid.model; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: | |||
* @date: 2024/7/25 15:21. | |||
*/ | |||
public class ResUpload<T> implements Serializable { | |||
public int statusCode; | |||
public List<T> data; | |||
public boolean succeeded; | |||
public String errors; | |||
public String extras; | |||
public int timestamp; | |||
public int getStatusCode() { | |||
return statusCode; | |||
} | |||
public void setStatusCode(int statusCode) { | |||
this.statusCode = statusCode; | |||
} | |||
public List<T> getData() { | |||
return data; | |||
} | |||
public void setData(List<T> data) { | |||
this.data = data; | |||
} | |||
public boolean isSucceeded() { | |||
return succeeded; | |||
} | |||
public void setSucceeded(boolean succeeded) { | |||
this.succeeded = succeeded; | |||
} | |||
public String getErrors() { | |||
return errors; | |||
} | |||
public void setErrors(String errors) { | |||
this.errors = errors; | |||
} | |||
public String getExtras() { | |||
return extras; | |||
} | |||
public void setExtras(String extras) { | |||
this.extras = extras; | |||
} | |||
public int getTimestamp() { | |||
return timestamp; | |||
} | |||
public void setTimestamp(int timestamp) { | |||
this.timestamp = timestamp; | |||
} | |||
} |
@@ -0,0 +1,75 @@ | |||
package com.jdzh.jdzhandroid.model.get; | |||
import java.io.Serializable; | |||
/** | |||
* @author: liup | |||
* @description: 物料 | |||
* @date: 2024/10/23 9:37. | |||
*/ | |||
public class BatchingBean implements Serializable { | |||
private String id; | |||
private String code; | |||
private String name; | |||
private String createAt; | |||
private int stockUint; | |||
private int type; | |||
private String key; | |||
public String getId() { | |||
return id; | |||
} | |||
public void setId(String id) { | |||
this.id = id; | |||
} | |||
public String getCode() { | |||
return code; | |||
} | |||
public void setCode(String code) { | |||
this.code = code; | |||
} | |||
public String getName() { | |||
return name; | |||
} | |||
public void setName(String name) { | |||
this.name = name; | |||
} | |||
public String getCreateAt() { | |||
return createAt; | |||
} | |||
public void setCreateAt(String createAt) { | |||
this.createAt = createAt; | |||
} | |||
public int getStockUint() { | |||
return stockUint; | |||
} | |||
public void setStockUint(int stockUint) { | |||
this.stockUint = stockUint; | |||
} | |||
public int getType() { | |||
return type; | |||
} | |||
public void setType(int type) { | |||
this.type = type; | |||
} | |||
public String getKey() { | |||
return key; | |||
} | |||
public void setKey(String key) { | |||
this.key = key; | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
package com.jdzh.jdzhandroid.model.get; | |||
import java.io.Serializable; | |||
/** | |||
* @author: liup | |||
* @description: 设备信息 | |||
* @date: 2024/10/23 9:34. | |||
*/ | |||
public class DeviceInfoDataBean implements Serializable { | |||
private String storeId; | |||
private String storeName; | |||
private String storePhone; | |||
private String deviceId; | |||
private String deviceName; | |||
private String deviceAutokey; | |||
private String devicePosition; | |||
private String orgName; | |||
private String contactPhone; | |||
public String getStoreId() { | |||
return storeId; | |||
} | |||
public void setStoreId(String storeId) { | |||
this.storeId = storeId; | |||
} | |||
public String getStoreName() { | |||
return storeName; | |||
} | |||
public void setStoreName(String storeName) { | |||
this.storeName = storeName; | |||
} | |||
public String getStorePhone() { | |||
return storePhone; | |||
} | |||
public void setStorePhone(String storePhone) { | |||
this.storePhone = storePhone; | |||
} | |||
public String getDeviceId() { | |||
return deviceId; | |||
} | |||
public void setDeviceId(String deviceId) { | |||
this.deviceId = deviceId; | |||
} | |||
public String getDeviceName() { | |||
return deviceName; | |||
} | |||
public void setDeviceName(String deviceName) { | |||
this.deviceName = deviceName; | |||
} | |||
public String getDeviceAutokey() { | |||
return deviceAutokey; | |||
} | |||
public void setDeviceAutokey(String deviceAutokey) { | |||
this.deviceAutokey = deviceAutokey; | |||
} | |||
public String getDevicePosition() { | |||
return devicePosition; | |||
} | |||
public void setDevicePosition(String devicePosition) { | |||
this.devicePosition = devicePosition; | |||
} | |||
public String getOrgName() { | |||
return orgName; | |||
} | |||
public void setOrgName(String orgName) { | |||
this.orgName = orgName; | |||
} | |||
public String getContactPhone() { | |||
return contactPhone; | |||
} | |||
public void setContactPhone(String contactPhone) { | |||
this.contactPhone = contactPhone; | |||
} | |||
} |
@@ -0,0 +1,84 @@ | |||
package com.jdzh.jdzhandroid.model.get; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeBaseConfig; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeConfig; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeConfigDetail; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeGroup; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeInfo; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_Recipeattribute; | |||
import com.jdzh.jdzhandroid.Sqlite.Model.BPA_RecipeattributeValue; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
/** | |||
* @author: liup | |||
* @description: 所有配方 | |||
* @date: 2024/10/23 9:35. | |||
*/ | |||
public class RecipeListBean implements Serializable { | |||
private List<BPA_RecipeGroup> recipeGroupList; | |||
private List<BPA_RecipeInfo> recipeInfoList; | |||
private List<BPA_Recipeattribute> recipeAttrList; | |||
private List<BPA_RecipeattributeValue> recipeAttrValueList; | |||
private List<BPA_RecipeBaseConfig> recipeBaseConfigList; | |||
private List<BPA_RecipeConfig> recipeAttrConfigList; | |||
private List<BPA_RecipeConfigDetail> recipeConfigDetailList; | |||
public List<BPA_RecipeGroup> getRecipeGroupList() { | |||
return recipeGroupList; | |||
} | |||
public void setRecipeGroupList(List<BPA_RecipeGroup> recipeGroupList) { | |||
this.recipeGroupList = recipeGroupList; | |||
} | |||
public List<BPA_RecipeInfo> getRecipeInfoList() { | |||
return recipeInfoList; | |||
} | |||
public void setRecipeInfoList(List<BPA_RecipeInfo> recipeInfoList) { | |||
this.recipeInfoList = recipeInfoList; | |||
} | |||
public List<BPA_Recipeattribute> getRecipeAttrList() { | |||
return recipeAttrList; | |||
} | |||
public void setRecipeAttrList(List<BPA_Recipeattribute> recipeAttrList) { | |||
this.recipeAttrList = recipeAttrList; | |||
} | |||
public List<BPA_RecipeattributeValue> getRecipeAttrValueList() { | |||
return recipeAttrValueList; | |||
} | |||
public void setRecipeAttrValueList(List<BPA_RecipeattributeValue> recipeAttrValueList) { | |||
this.recipeAttrValueList = recipeAttrValueList; | |||
} | |||
public List<BPA_RecipeBaseConfig> getRecipeBaseConfigList() { | |||
return recipeBaseConfigList; | |||
} | |||
public void setRecipeBaseConfigList(List<BPA_RecipeBaseConfig> recipeBaseConfigList) { | |||
this.recipeBaseConfigList = recipeBaseConfigList; | |||
} | |||
public List<BPA_RecipeConfig> getRecipeAttrConfigList() { | |||
return recipeAttrConfigList; | |||
} | |||
public void setRecipeAttrConfigList(List<BPA_RecipeConfig> recipeAttrConfigList) { | |||
this.recipeAttrConfigList = recipeAttrConfigList; | |||
} | |||
public List<BPA_RecipeConfigDetail> getRecipeConfigDetailList() { | |||
return recipeConfigDetailList; | |||
} | |||
public void setRecipeConfigDetailList(List<BPA_RecipeConfigDetail> recipeConfigDetailList) { | |||
this.recipeConfigDetailList = recipeConfigDetailList; | |||
} | |||
} |
@@ -0,0 +1,93 @@ | |||
package com.jdzh.jdzhandroid.model.get; | |||
import java.io.Serializable; | |||
/** | |||
* @author: liup | |||
* @description: 账号 密码信息 | |||
* @date: 2024/10/23 9:33. | |||
*/ | |||
public class UsersDataBean implements Serializable { | |||
private String id; | |||
private String name; | |||
private String account; | |||
private String password; | |||
private String phone; | |||
private int adminType; | |||
private String sysOrgId; | |||
private String companyName; | |||
private String createAt; | |||
public String getId() { | |||
return id; | |||
} | |||
public void setId(String id) { | |||
this.id = id; | |||
} | |||
public String getName() { | |||
return name; | |||
} | |||
public void setName(String name) { | |||
this.name = name; | |||
} | |||
public String getAccount() { | |||
return account; | |||
} | |||
public void setAccount(String account) { | |||
this.account = account; | |||
} | |||
public String getPassword() { | |||
return password; | |||
} | |||
public void setPassword(String password) { | |||
this.password = password; | |||
} | |||
public String getPhone() { | |||
return phone; | |||
} | |||
public void setPhone(String phone) { | |||
this.phone = phone; | |||
} | |||
public int getAdminType() { | |||
return adminType; | |||
} | |||
public void setAdminType(int adminType) { | |||
this.adminType = adminType; | |||
} | |||
public String getSysOrgId() { | |||
return sysOrgId; | |||
} | |||
public void setSysOrgId(String sysOrgId) { | |||
this.sysOrgId = sysOrgId; | |||
} | |||
public String getCompanyName() { | |||
return companyName; | |||
} | |||
public void setCompanyName(String companyName) { | |||
this.companyName = companyName; | |||
} | |||
public String getCreateAt() { | |||
return createAt; | |||
} | |||
public void setCreateAt(String createAt) { | |||
this.createAt = createAt; | |||
} | |||
} |
@@ -0,0 +1,157 @@ | |||
package com.jdzh.jdzhandroid.util; | |||
import android.app.Activity; | |||
import android.content.Context; | |||
import android.view.View; | |||
import android.view.inputmethod.InputMethodManager; | |||
import android.widget.EditText; | |||
/** | |||
* Created by LY on 2019/3/28. | |||
* 软键盘工具类 | |||
*/ | |||
public class KeyboardToolUtils { | |||
/** | |||
* 避免输入法面板遮挡 | |||
* <p>在manifest.xml中activity中设置</p> | |||
* <p>android:windowSoftInputMode="stateVisible|adjustResize"</p> | |||
*/ | |||
/** | |||
* 动态隐藏软键盘 | |||
* | |||
* @param activity activity | |||
*/ | |||
public static void hideSoftInput(Activity activity) { | |||
View view = activity.getWindow().peekDecorView(); | |||
if (view != null) { | |||
InputMethodManager inputManger = (InputMethodManager) activity | |||
.getSystemService(Context.INPUT_METHOD_SERVICE); | |||
if (inputManger != null) { | |||
inputManger.hideSoftInputFromWindow(view.getWindowToken(), 0); | |||
} | |||
} | |||
} | |||
/** | |||
* 点击隐藏软键盘 | |||
* | |||
* @param activity | |||
* @param view | |||
*/ | |||
public static void hideKeyboard(Activity activity, View view) { | |||
InputMethodManager imm = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE); | |||
if (imm != null) { | |||
imm.hideSoftInputFromWindow(view.getWindowToken(), 0); | |||
} | |||
} | |||
/** | |||
* 动态隐藏软键盘 | |||
* | |||
* @param context 上下文 | |||
* @param edit 输入框 | |||
*/ | |||
public static void hideSoftInput(Context context, EditText edit) { | |||
edit.clearFocus(); | |||
InputMethodManager inputManger = (InputMethodManager) context | |||
.getSystemService(Context.INPUT_METHOD_SERVICE); | |||
if (inputManger != null) { | |||
inputManger.hideSoftInputFromWindow(edit.getWindowToken(), 0); | |||
} | |||
} | |||
/** | |||
* 点击屏幕空白区域隐藏软键盘(方法1) | |||
* <p>在onTouch中处理,未获焦点则隐藏</p> | |||
* <p>参照以下注释代码</p> | |||
*/ | |||
public static void clickBlankArea2HideSoftInput0() { | |||
/* | |||
@Override | |||
public boolean onTouchEvent (MotionEvent event){ | |||
if (null != this.getCurrentFocus()) { | |||
InputMethodManager mInputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); | |||
return mInputMethodManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0); | |||
} | |||
return super.onTouchEvent(event); | |||
} | |||
*/ | |||
} | |||
/** | |||
* 点击屏幕空白区域隐藏软键盘(方法2) | |||
* <p>根据EditText所在坐标和用户点击的坐标相对比,来判断是否隐藏键盘</p> | |||
* <p>需重写dispatchTouchEvent</p> | |||
* <p>参照以下注释代码</p> | |||
*/ | |||
public static void clickBlankArea2HideSoftInput1() { | |||
/* | |||
@Override | |||
public boolean dispatchTouchEvent(MotionEvent ev) { | |||
if (ev.getAction() == MotionEvent.ACTION_DOWN) { | |||
View v = getCurrentFocus(); | |||
if (isShouldHideKeyboard(v, ev)) { | |||
hideKeyboard(v.getWindowToken()); | |||
} | |||
} | |||
return super.dispatchTouchEvent(ev); | |||
} | |||
// 根据EditText所在坐标和用户点击的坐标相对比,来判断是否隐藏键盘 | |||
private boolean isShouldHideKeyboard(View v, MotionEvent event) { | |||
if (v != null && (v instanceof EditText)) { | |||
int[] l = {0, 0}; | |||
v.getLocationInWindow(l); | |||
int left = l[0], | |||
top = l[1], | |||
bottom = top + v.getHeight(), | |||
right = left + v.getWidth(); | |||
return !(event.getX() > left && event.getX() < right | |||
&& event.getY() > top && event.getY() < bottom); | |||
} | |||
return false; | |||
} | |||
// 获取InputMethodManager,隐藏软键盘 | |||
private void hideKeyboard(IBinder token) { | |||
if (token != null) { | |||
InputMethodManager im = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); | |||
im.hideSoftInputFromWindow(token, InputMethodManager.HIDE_NOT_ALWAYS); | |||
} | |||
} | |||
*/ | |||
} | |||
/** | |||
* 动态显示软键盘 | |||
* | |||
* @param context 上下文 | |||
* @param edit 输入框 | |||
*/ | |||
public static void showSoftInput(Context context, EditText edit) { | |||
edit.setFocusable(true); | |||
edit.setFocusableInTouchMode(true); | |||
edit.requestFocus(); | |||
InputMethodManager inputManager = (InputMethodManager) context | |||
.getSystemService(Context.INPUT_METHOD_SERVICE); | |||
if (inputManager != null) { | |||
inputManager.showSoftInput(edit, 0); | |||
} | |||
} | |||
/** | |||
* 切换键盘显示与否状态 | |||
* | |||
* @param context 上下文 | |||
* @param edit 输入框 | |||
*/ | |||
public static void toggleSoftInput(Context context, EditText edit) { | |||
edit.setFocusable(true); | |||
edit.setFocusableInTouchMode(true); | |||
edit.requestFocus(); | |||
InputMethodManager inputManager = (InputMethodManager) context | |||
.getSystemService(Context.INPUT_METHOD_SERVICE); | |||
if (inputManager != null) { | |||
inputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); | |||
} | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
package com.jdzh.jdzhandroid.util; | |||
import java.security.MessageDigest; | |||
import java.security.NoSuchAlgorithmException; | |||
/** | |||
* Md5加密 | |||
* 已经加密的就不在加密 | |||
*/ | |||
public class MD5Encoder { | |||
/** | |||
* 加密 | |||
* @param pwd | |||
* @return | |||
*/ | |||
public static String encode(String pwd) { | |||
try { | |||
MessageDigest digest = MessageDigest.getInstance("MD5"); | |||
byte[] bytes = digest.digest(pwd.getBytes()); | |||
StringBuffer sb = new StringBuffer(); | |||
for(int i = 0;i<bytes.length;i++){ | |||
String s = Integer.toHexString(0xff&bytes[i]); | |||
if(s.length()==1){ | |||
sb.append("0"+s); | |||
}else{ | |||
sb.append(s); | |||
} | |||
} | |||
return sb.toString(); | |||
} catch (NoSuchAlgorithmException e) { | |||
return "buhuifasheng"; | |||
} | |||
} | |||
} |
@@ -12,7 +12,7 @@ import com.jdzh.jdzhandroid.Enum.DialogButton; | |||
import com.jdzh.jdzhandroid.Enum.Status; | |||
import com.jdzh.jdzhandroid.Log.MessageLog; | |||
import com.jdzh.jdzhandroid.Task.Task; | |||
import com.jdzh.jdzhandroid.config.Config; | |||
import com.jdzh.jdzhandroid.Config.Config; | |||
import com.jdzh.jdzhandroid.util.Dialog.DialogManager; | |||
import com.jdzh.jdzhandroid.util.GlobalContext; | |||
import com.jdzh.jdzhandroid.util.ToastUtil; | |||
@@ -152,7 +152,7 @@ public class ChannelViewModel extends ViewModel { | |||
double p = finalI*100/13.0; | |||
String process = String.format("%.1f", p); | |||
progress.setValue(process+"%"); | |||
curChannelName.setValue("#"+ finalI); | |||
curChannelName.setValue("#"+ (finalI>6?finalI-6:finalI)); | |||
progressNum.setValue(finalI); | |||
}); | |||
@@ -229,7 +229,7 @@ public class ChannelViewModel extends ViewModel { | |||
double p = finalI*100/13.0; | |||
String process = String.format("%.1f", p); | |||
progress.setValue(process+"%"); | |||
curChannelName.setValue("#"+ finalI); | |||
curChannelName.setValue("#"+ (finalI>6?finalI-6:finalI)); | |||
progressNum.setValue(finalI); | |||
}); | |||
@@ -0,0 +1,27 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<ripple xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:color="#7FEF5362" | |||
android:radius="-1dp"> | |||
<item android:state_pressed="true"> | |||
<shape> | |||
<solid android:color="#FF9800" /> | |||
<corners android:radius="10dp" /> | |||
</shape> | |||
</item> | |||
<item android:state_enabled="false"> | |||
<shape> | |||
<solid android:color="#cccccc" /> | |||
<corners android:radius="10dp" /> | |||
</shape> | |||
</item> | |||
<item> | |||
<shape> | |||
<solid android:color="@color/light_blue_600" /> | |||
<corners android:radius="10dp" /> | |||
</shape> | |||
</item> | |||
</ripple> |
@@ -3,14 +3,14 @@ | |||
<item android:state_pressed="true"> | |||
<shape> | |||
<corners android:bottomLeftRadius="25dp"/> | |||
<corners android:bottomLeftRadius="@dimen/dp40"/> | |||
<solid android:color="#8477FE"/> | |||
</shape> | |||
</item> | |||
<item> | |||
<shape> | |||
<corners android:bottomLeftRadius="25dp"/> | |||
<corners android:bottomLeftRadius="@dimen/dp40"/> | |||
<solid android:color="#1a8477FE"/> | |||
</shape> | |||
@@ -0,0 +1,7 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<selector xmlns:android="http://schemas.android.com/apk/res/android"> | |||
<!--<item android:state_pressed="true" android:drawable="@drawable/search_clear_pressed" /> | |||
<item android:drawable="@drawable/search_clear_normal" />--> | |||
<item android:state_pressed="true" android:drawable="@drawable/icon_delete_fill" /> | |||
<item android:drawable="@drawable/icon_delete_fill_select" /> | |||
</selector> |
@@ -326,42 +326,42 @@ | |||
<TextView | |||
android:layout_width="80dp" | |||
android:text="#7" | |||
android:text="#1" | |||
android:textSize="22sp" | |||
android:gravity="center" | |||
android:textColor="@color/black" | |||
android:layout_height="wrap_content"/> | |||
<TextView | |||
android:layout_width="80dp" | |||
android:text="#8" | |||
android:text="#2" | |||
android:textSize="22sp" | |||
android:gravity="center" | |||
android:textColor="@color/black" | |||
android:layout_height="wrap_content"/> | |||
<TextView | |||
android:layout_width="80dp" | |||
android:text="#9" | |||
android:text="#3" | |||
android:textSize="22sp" | |||
android:gravity="center" | |||
android:textColor="@color/black" | |||
android:layout_height="wrap_content"/> | |||
<TextView | |||
android:layout_width="80dp" | |||
android:text="#10" | |||
android:text="#4" | |||
android:textSize="22sp" | |||
android:gravity="center" | |||
android:textColor="@color/black" | |||
android:layout_height="wrap_content"/> | |||
<TextView | |||
android:layout_width="80dp" | |||
android:text="#11" | |||
android:text="#5" | |||
android:textSize="22sp" | |||
android:gravity="center" | |||
android:textColor="@color/black" | |||
android:layout_height="wrap_content"/> | |||
<TextView | |||
android:layout_width="80dp" | |||
android:text="#12" | |||
android:text="#6" | |||
android:textSize="22sp" | |||
android:gravity="center" | |||
android:textColor="@color/black" | |||
@@ -0,0 +1,220 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:id="@+id/root" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:background="@color/main_bg" | |||
> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<RelativeLayout | |||
android:id="@+id/rl_title" | |||
android:layout_width="500dp" | |||
android:layout_height="match_parent" | |||
android:background="@color/light_blue_600"> | |||
<ImageView | |||
android:id="@+id/logo" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:src="@mipmap/login_ico" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerHorizontal="true" | |||
android:layout_below="@id/logo" | |||
android:textColor="@color/white" | |||
android:textSize="32sp" | |||
android:text="配料系统" | |||
/> | |||
</RelativeLayout> | |||
<TextView | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginBottom="@dimen/dp_10" | |||
android:layout_toEndOf="@id/rl_title" | |||
android:layout_alignParentBottom="true" | |||
android:text="BY © 四川黑菠萝Black pineapple" | |||
android:textSize="@dimen/sp_24" | |||
android:gravity="center" | |||
android:textColor="@color/text_gray" /> | |||
<LinearLayout | |||
android:layout_toEndOf="@id/rl_title" | |||
android:id="@+id/content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginEnd="100dp" | |||
android:layout_marginStart="100dp" | |||
android:layout_centerVertical="true" | |||
android:layout_marginTop="@dimen/dp_100" | |||
android:layout_marginLeft="@dimen/dp_100" | |||
android:layout_marginRight="@dimen/dp_100" | |||
android:orientation="vertical"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:gravity="center_vertical" | |||
android:orientation="horizontal"> | |||
<ImageView | |||
android:id="@+id/imgAccount" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_marginStart="15dp" | |||
android:layout_marginEnd="15dp" | |||
android:layout_marginTop="@dimen/dp_15" | |||
android:layout_marginBottom="@dimen/dp_15" | |||
android:src="@mipmap/login_u" /> | |||
<EditText | |||
android:id="@+id/et_account" | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_weight="1" | |||
android:background="@null" | |||
android:hint="请输入用户名" | |||
android:imeOptions="actionNext" | |||
android:textColor="@color/text_gray" | |||
android:textColorHint="@color/text_gray" | |||
android:inputType="text" | |||
android:maxLength="20" | |||
android:maxLines="1" | |||
android:singleLine="true" | |||
android:textSize="@dimen/sp_32" /> | |||
<ImageView | |||
android:id="@+id/iv_clean_account" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:scaleType="fitXY" | |||
android:src="@drawable/delete_selector" | |||
tools:visibility="visible" | |||
android:visibility="gone" /> | |||
</LinearLayout> | |||
<View | |||
android:layout_width="match_parent" | |||
android:layout_height="2px" | |||
android:layout_marginBottom="30dp" | |||
android:background="@color/main_bar_bg" /> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:gravity="center_vertical" | |||
android:orientation="horizontal"> | |||
<ImageView | |||
android:id="@+id/imgPass" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:layout_marginStart="15dp" | |||
android:layout_marginEnd="15dp" | |||
android:layout_marginTop="@dimen/dp_15" | |||
android:layout_marginBottom="@dimen/dp_15" | |||
android:src="@mipmap/login_p" /> | |||
<EditText | |||
android:id="@+id/et_password" | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_weight="1" | |||
android:background="@null" | |||
android:hint="请输入密码" | |||
android:inputType="textPassword" | |||
android:maxLength="50" | |||
android:singleLine="true" | |||
android:textColor="@color/text_gray" | |||
android:textColorHint="@color/text_gray" | |||
android:text="" | |||
android:textSize="@dimen/sp_32" /> | |||
<ImageView | |||
android:id="@+id/clean_password" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:scaleType="fitXY" | |||
android:src="@drawable/delete_selector" | |||
tools:visibility="visible" | |||
android:visibility="gone" /> | |||
<ImageView | |||
android:id="@+id/iv_show_pwd" | |||
android:layout_width="@dimen/dp_70" | |||
android:layout_height="@dimen/dp_70" | |||
android:scaleType="fitXY" | |||
android:src="@drawable/icon_pass_gone" /> | |||
</LinearLayout> | |||
<View | |||
android:layout_width="match_parent" | |||
android:layout_height="2px" | |||
android:layout_marginBottom="50dp" | |||
android:background="@color/main_bar_bg" /> | |||
<Button | |||
android:id="@+id/btn_login" | |||
android:layout_width="match_parent" | |||
android:layout_marginStart="100dp" | |||
android:layout_marginEnd="100dp" | |||
android:layout_height="@dimen/dp_90" | |||
android:layout_marginBottom="10dp" | |||
android:background="@drawable/btn_bg_blue" | |||
android:text="登 录" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/sp_32" /> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
<!--<LinearLayout | |||
android:id="@+id/service" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:gravity="center" | |||
android:orientation="horizontal" | |||
android:padding="10dp"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="end" | |||
android:text="联系客服" | |||
android:textColor="#b0b8b2" | |||
android:textSize="14sp"/> | |||
<View | |||
android:layout_width="1dp" | |||
android:layout_height="match_parent" | |||
android:layout_marginLeft="10dp" | |||
android:layout_marginRight="10dp" | |||
android:background="?android:attr/listDivider"/> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="end" | |||
android:text="关于我们" | |||
android:textColor="#b0b8b2" | |||
android:textSize="14sp"/> | |||
</LinearLayout>--> | |||
</RelativeLayout> |
@@ -6,8 +6,24 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical" | |||
android:background="@color/black" | |||
android:background="@color/light_blue_600" | |||
tools:context=".MainActivity"> | |||
<ImageView | |||
android:id="@+id/logo" | |||
android:layout_width="@dimen/dp_500" | |||
android:layout_height="@dimen/dp_500" | |||
android:layout_centerInParent="true" | |||
android:src="@mipmap/login_ico" /> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerHorizontal="true" | |||
android:layout_below="@id/logo" | |||
android:textColor="@color/white" | |||
android:textSize="32sp" | |||
android:text="配料系统" | |||
/> | |||
</RelativeLayout> |
@@ -1,5 +1,5 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
@@ -8,6 +8,7 @@ | |||
xmlns:app="http://schemas.android.com/apk/res-auto"> | |||
<RelativeLayout | |||
android:id="@+id/content1" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="40dp" | |||
@@ -74,6 +75,8 @@ | |||
</RelativeLayout> | |||
<LinearLayout | |||
android:id="@+id/content2" | |||
android:layout_below="@id/content1" | |||
android:layout_marginStart="40dp" | |||
android:layout_marginTop="20dp" | |||
android:layout_marginBottom="20dp" | |||
@@ -107,24 +110,24 @@ | |||
android:textSize="22sp" | |||
android:background="@drawable/textview_border"/> | |||
<TextView | |||
android:layout_marginLeft="20dp" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商家编号:" | |||
android:textSize="22sp" | |||
android:textColor="#000000"/> | |||
<EditText | |||
android:id="@+id/edt_store_key" | |||
android:layout_width="200dp" | |||
android:layout_height="50dp" | |||
android:textColor="#000000" | |||
android:inputType="number" | |||
android:hint="请输入商家编号" | |||
android:textColorHint="#9A9696" | |||
android:textSize="22sp" | |||
android:background="@drawable/textview_border"/> | |||
<!-- <TextView--> | |||
<!-- android:layout_marginLeft="20dp"--> | |||
<!-- android:layout_width="wrap_content"--> | |||
<!-- android:layout_height="wrap_content"--> | |||
<!-- android:text="商家编号:"--> | |||
<!-- android:textSize="22sp"--> | |||
<!-- android:textColor="#000000"/>--> | |||
<!-- <EditText--> | |||
<!-- android:id="@+id/edt_store_key"--> | |||
<!-- android:layout_width="200dp"--> | |||
<!-- android:layout_height="50dp"--> | |||
<!-- android:textColor="#000000"--> | |||
<!-- android:inputType="number"--> | |||
<!-- android:hint="请输入商家编号"--> | |||
<!-- android:textColorHint="#9A9696"--> | |||
<!-- android:textSize="22sp"--> | |||
<!-- android:background="@drawable/textview_border"/>--> | |||
<Button | |||
android:id="@+id/btn_save" | |||
@@ -140,6 +143,8 @@ | |||
<LinearLayout | |||
android:id="@+id/content3" | |||
android:layout_below="@id/content2" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginStart="40dp" | |||
@@ -168,4 +173,16 @@ | |||
</LinearLayout> | |||
</LinearLayout> | |||
<Button | |||
android:id="@+id/btn_logout" | |||
android:layout_width="150dp" | |||
android:layout_height="50dp" | |||
android:layout_marginLeft="20dp" | |||
android:background="@drawable/btn_normal_bg" | |||
android:layout_alignParentBottom="true" | |||
android:layout_alignParentEnd="true" | |||
android:layout_marginEnd="50dp" | |||
android:layout_marginBottom="40dp" | |||
android:textSize="22sp" | |||
android:text="退出登录"/> | |||
</RelativeLayout> |
@@ -24,8 +24,8 @@ | |||
<TextView | |||
android:id="@+id/delete" | |||
android:layout_width="25dp" | |||
android:layout_height="25dp" | |||
android:layout_width="@dimen/dp40" | |||
android:layout_height="@dimen/dp40" | |||
android:background="@drawable/btn_delete_bg" | |||
android:textColor="@color/black" | |||
android:layout_alignParentEnd="true" | |||
@@ -0,0 +1,4 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<network-security-config> | |||
<base-config cleartextTrafficPermitted="true" /> | |||
</network-security-config> |