|
|
@@ -47,6 +47,7 @@ import com.core.utils.CommonUtil;
|
|
|
import com.core.utils.DialogUtils;
|
|
|
import com.core.utils.FlexJsonUtil;
|
|
|
import com.core.utils.ToastUtil;
|
|
|
+import com.core.widget.CustomProgressDialog;
|
|
|
import com.core.widget.crouton.Crouton;
|
|
|
import com.core.widget.crouton.Style;
|
|
|
import com.me.network.app.base.HttpCallback;
|
|
|
@@ -81,16 +82,9 @@ public class ViewUtil {
|
|
|
private static MaterialDialog loginERPDialog;
|
|
|
private static List<LoginEntity> erpEntities;
|
|
|
private static boolean hasErp = true;//是否有erp
|
|
|
-
|
|
|
-
|
|
|
- private static String oldMsg;
|
|
|
- private static long time;
|
|
|
- private static String oldMsg2;
|
|
|
- private static long time2;
|
|
|
-
|
|
|
-
|
|
|
public static Crouton crouton;
|
|
|
|
|
|
+ public static CustomProgressDialog progressDialog;
|
|
|
|
|
|
public static void ToastMessage(Context cont, String msg) {
|
|
|
ToastUtil.showToast(cont,msg);
|
|
|
@@ -99,21 +93,6 @@ public class ViewUtil {
|
|
|
|
|
|
public static void ToastMessage(Context cont, String msg, int toastColor, int toastTime) {
|
|
|
ToastUtil.showToast(cont,msg);
|
|
|
-// if (cont instanceof Activity) {
|
|
|
-// if (crouton != null) {
|
|
|
-// crouton.cancel();
|
|
|
-// crouton = Crouton.makeText((Activity) cont, msg, toastColor, toastTime);
|
|
|
-// crouton.show();
|
|
|
-// } else {
|
|
|
-// crouton = Crouton.makeText((Activity) cont, msg, toastColor, toastTime);
|
|
|
-// crouton.show();
|
|
|
-// }
|
|
|
-// } else {
|
|
|
-// if (cont != null) {
|
|
|
-// Toast.makeText(cont, msg, Toast.LENGTH_SHORT).show();
|
|
|
-// }
|
|
|
-// }
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public static void ShowMessageTitle(Context ct, String msg) {
|
|
|
@@ -275,6 +254,7 @@ public class ViewUtil {
|
|
|
*/
|
|
|
public static void LoginTask(final String user_phone, final String user_password, final Context ct) {
|
|
|
ViewUtil.ct = ct;
|
|
|
+ progressDialog= CustomProgressDialog.createDialog(ct);
|
|
|
LogUtil.d("AppInfo","password:"+user_password+" phone:"+user_phone);
|
|
|
mdProcessDialog = new MaterialDialog.Builder(ct).title(
|
|
|
MyApplication.getInstance().getString(R.string.app_dialog_title))
|
|
|
@@ -285,24 +265,6 @@ public class ViewUtil {
|
|
|
if (!((BaseActivity) ViewUtil.ct).isFinishing()) {
|
|
|
mdProcessDialog.show();
|
|
|
}
|
|
|
-// if (!(ct instanceof LoginActivity)) {
|
|
|
- //取缓存
|
|
|
-// if (!StringUtil.isEmpty(CommonUtil.getSharedPreferences(ct, "loginJson"))) {
|
|
|
-// showDialogCompany(CommonUtil.getSharedPreferences(ct, "loginJson"), user_phone, user_password);
|
|
|
-// }
|
|
|
-// } else {
|
|
|
- //登录界面过来,不走缓存
|
|
|
- /*String url = Constants.BASE_URL_LOGIN;
|
|
|
- Map<String, String> params = new HashMap<String, String>();
|
|
|
- params.put("user", user_phone);
|
|
|
- params.put("password", user_password);
|
|
|
- Message message = new Message();
|
|
|
- Bundle bundle = new Bundle();
|
|
|
- bundle.putString("phone", user_phone);
|
|
|
- bundle.putString("password", user_password);
|
|
|
- startNetThread(url, params, handler, Constants.SUCCESS_LOGIN, message,
|
|
|
- bundle, "get");*/
|
|
|
-// }
|
|
|
HttpRequest.getInstance().sendRequest(Constants.ACCOUNT_CENTER_HOST,
|
|
|
new HttpParams.Builder()
|
|
|
.url("sso/login/mobile")
|
|
|
@@ -772,6 +734,9 @@ public class ViewUtil {
|
|
|
if (DialogUtils.isDialogShowing(mdProcessDialog)){
|
|
|
mdProcessDialog.dismiss();
|
|
|
}
|
|
|
+ if (DialogUtils.isDialogShowing(popupWindow)){
|
|
|
+ popupWindow.dismiss();
|
|
|
+ }
|
|
|
WindowManager windowManager = (WindowManager)ct. getSystemService(Context.WINDOW_SERVICE);
|
|
|
if (popupWindow == null) {
|
|
|
LayoutInflater layoutInflater = (LayoutInflater) ct.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
|
|
@@ -793,6 +758,7 @@ public class ViewUtil {
|
|
|
adapter.notifyDataSetChanged();
|
|
|
ItemPopListAdapter.ViewHolder viewHolder= (ItemPopListAdapter.ViewHolder) view.getTag();
|
|
|
String text= viewHolder.tvItemName.getText().toString();
|
|
|
+
|
|
|
selectCompanyItems(selectId, text, phone, password);
|
|
|
}});
|
|
|
popupWindow = new PopupWindow(view, windowManager.getDefaultDisplay().getWidth()- DensityUtil.dp2px(50), LinearLayout.LayoutParams.WRAP_CONTENT);
|
|
|
@@ -1192,6 +1158,7 @@ public class ViewUtil {
|
|
|
// 登录ERP
|
|
|
public static void LoginERPTask(String url, String enuu, String master, String username, String password) {
|
|
|
mdProcessDialog.setContent(MyApplication.getInstance().getString(R.string.login_progress_erp));
|
|
|
+ progressDialog.show();
|
|
|
String loginToken = CommonUtil.getSharedPreferences(ct, Constants.CACHE.ACCOUNT_CENTER_TOKEN);
|
|
|
HttpRequest.getInstance().sendRequest(url,
|
|
|
new HttpParams.Builder()
|
|
|
@@ -1203,6 +1170,7 @@ public class ViewUtil {
|
|
|
@Override
|
|
|
public void onSuccess(int flag, Object o) throws Exception {
|
|
|
Log.d("erp登录成功", o.toString());
|
|
|
+ progressDialog.dismiss();
|
|
|
if (o != null) {
|
|
|
loginErpSuccess(o.toString());
|
|
|
}
|
|
|
@@ -1211,6 +1179,7 @@ public class ViewUtil {
|
|
|
@Override
|
|
|
public void onFail(int flag, String failStr) throws Exception {
|
|
|
Log.e("erp登录失败", "登录失败:"+failStr);
|
|
|
+ progressDialog.dismiss();
|
|
|
ToastMessage(MyApplication.getInstance(),"登录失败:"+failStr);
|
|
|
mdProcessDialog.setContent("登录失败");
|
|
|
new Handler().postDelayed(new Runnable() {
|