Browse Source

UI改版:修改标题栏

Arison 7 years ago
parent
commit
0ca634b1e9

+ 4 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/me/MeFragment.java

@@ -631,4 +631,8 @@ public class MeFragment extends SupportToolBarFragment implements View.OnClickLi
     public void onFailure(String resultStatus, String resultInfo) {
         showToact(  "支付失败");
     }
+    
+    
+    
+    
 }

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Wed May 16 18:19:30 CST 2018
-debugName=262
+#Thu May 17 13:49:13 CST 2018
+debugName=274
 versionName=630
-debugCode=262
+debugCode=274
 versionCode=170

+ 41 - 38
app_core/common/src/main/java/com/core/net/http/ViewUtil.java

@@ -17,7 +17,6 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.common.LogUtil;
-import com.common.config.BaseConfig;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
@@ -671,7 +670,7 @@ public class ViewUtil {
     }
 
 
-    //解析登录信息
+
     public static void showLoginDialog(String loginResult, final String phone, final String password) {
         List<LoginEntity> loginMsg = JSON.parseArray(loginResult, LoginEntity.class);
         List<LoginEntity> loginEntities = new ArrayList<>();
@@ -750,42 +749,7 @@ public class ViewUtil {
                                     @Override
                                     public boolean onSelection(MaterialDialog dialog,
                                                                View view, int which, CharSequence text) {
-                                        if (!CommonUtil.isNetWorkConnected(ct)) {
-                                            ToastUtil.showToast(ct, R.string.networks_out);
-                                            return true;
-                                        }
-                                        if (!StringUtil.isEmpty(text.toString())) {
-                                            LoginEntity entity = erpEntities.get(which);
-                                            erp_phone = phone;
-                                            erp_password = password;
-                                            mBusinessCode = entity.getBusinessCode();
-                                            if ("ERP".equals(entity.getPlatform())) {
-                                                erp_username = entity.getAccount();
-                                                erp_master = entity.getMaster();
-                                                erp_baseurl = entity.getWebsite();
-                                                erp_company = entity.getName();
-                                                erp_uu = String.valueOf(entity.getEnuu());
-                                                erp_masterId = String.valueOf(entity.getMasterId());
-                                                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "userRole", "2");
-                                                LoginERPTask(entity.getWebsite(), erp_uu, entity.getMaster(), phone, password);
-                                                CommonUtil.clearSharedPreferences(MyApplication.getInstance(), "erp_masterlist");  //清除账套列表缓存
-                                            }
-                                            if ("B2B".equals(entity.getPlatform())) {
-                                                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "spaceId", String.valueOf(entity.getSpaceId()));
-                                                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "companyName", String.valueOf(entity.getName()));
-                                                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "companyEnUu", String.valueOf(entity.getEnuu()));
-                                                //兼容uas
-                                                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "erp_uu", String.valueOf(entity.getEnuu()));
-                                                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "erp_commpany", String.valueOf(entity.getName()));
-                                                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "userRole", "3");
-                                                LoginB2BTask(phone, password, entity.getEnuu() + "");//登录B2B
-                                            }
-                                            if ("个人".equals(entity.getPlatform())) {
-                                                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "userRole", "1");
-                                                ct.startActivity(new Intent("com.modular.main.DataDownloadActivity"));
-                                            }
-                                        }
-                                        return true;
+                                        return selectCompanyItems(which, text, phone, password);
                                     }
                                 }).positiveText(ct.getString(R.string.common_sure)).show();
 
@@ -793,6 +757,45 @@ public class ViewUtil {
         }
     }
 
+    private static boolean selectCompanyItems(int which, CharSequence text, String phone, String password) {
+        if (!CommonUtil.isNetWorkConnected(ct)) {
+            ToastUtil.showToast(ct, R.string.networks_out);
+            return true;
+        }
+        if (!StringUtil.isEmpty(text.toString())) {
+            LoginEntity entity = erpEntities.get(which);
+            erp_phone = phone;
+            erp_password = password;
+            mBusinessCode = entity.getBusinessCode();
+            if ("ERP".equals(entity.getPlatform())) {
+                erp_username = entity.getAccount();
+                erp_master = entity.getMaster();
+                erp_baseurl = entity.getWebsite();
+                erp_company = entity.getName();
+                erp_uu = String.valueOf(entity.getEnuu());
+                erp_masterId = String.valueOf(entity.getMasterId());
+                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "userRole", "2");
+                LoginERPTask(entity.getWebsite(), erp_uu, entity.getMaster(), phone, password);
+                CommonUtil.clearSharedPreferences(MyApplication.getInstance(), "erp_masterlist");  //清除账套列表缓存
+            }
+            if ("B2B".equals(entity.getPlatform())) {
+                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "spaceId", String.valueOf(entity.getSpaceId()));
+                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "companyName", String.valueOf(entity.getName()));
+                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "companyEnUu", String.valueOf(entity.getEnuu()));
+                //兼容uas
+                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "erp_uu", String.valueOf(entity.getEnuu()));
+                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "erp_commpany", String.valueOf(entity.getName()));
+                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "userRole", "3");
+                LoginB2BTask(phone, password, entity.getEnuu() + "");//登录B2B
+            }
+            if ("个人".equals(entity.getPlatform())) {
+                CommonUtil.setSharedPreferences(MyApplication.getInstance(), "userRole", "1");
+                ct.startActivity(new Intent("com.modular.main.DataDownloadActivity"));
+            }
+        }
+        return true;
+    }
+
 
     @Deprecated
     private static void showDialogCompany(String json, String phone, String password) {

+ 85 - 13
app_modular/appme/src/main/java/com/uas/appme/settings/activity/SettingActivity.java

@@ -4,8 +4,10 @@ import android.annotation.TargetApi;
 import android.app.ActivityManager;
 import android.app.AlertDialog;
 import android.app.ProgressDialog;
+import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
+import android.graphics.drawable.BitmapDrawable;
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Build;
@@ -17,6 +19,8 @@ import android.view.LayoutInflater;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.PopupWindow;
@@ -24,6 +28,8 @@ import android.widget.RelativeLayout;
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.afollestad.materialdialogs.GravityEnum;
+import com.afollestad.materialdialogs.MaterialDialog;
 import com.alibaba.fastjson.JSON;
 import com.baidu.android.pushservice.PushManager;
 import com.baidu.autoupdatesdk.AppUpdateInfo;
@@ -58,6 +64,7 @@ import com.me.network.app.http.HttpClient;
 import com.me.network.app.http.Method;
 import com.me.network.app.http.rx.ResultListener;
 import com.me.network.app.http.rx.ResultSubscriber;
+import com.scwang.smartrefresh.layout.util.DensityUtil;
 import com.uas.appme.R;
 import com.uas.appme.pedometer.view.NewStepActivity;
 import com.uas.appme.pedometer.view.StepSplashActivity;
@@ -112,7 +119,6 @@ public class SettingActivity extends SupportToolBarActivity implements View.OnCl
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_setting);
-        //getSupportActionBar().setTitle(getString(R.string.user_setting));
         super.setTitle(getString(R.string.user_setting));
         initView();
     }
@@ -177,7 +183,8 @@ public class SettingActivity extends SupportToolBarActivity implements View.OnCl
         mExitBtn.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                showExitDialog();
+              //  showExitDialog();
+                showExitPop();
             }
         });
         mCacheTv = (TextView) findViewById(R.id.cache_tv);
@@ -335,17 +342,35 @@ public class SettingActivity extends SupportToolBarActivity implements View.OnCl
     }
 
     private void showExitDialog() {
-        new AlertDialog.Builder(mContext).setTitle(R.string.app_name).setMessage(R.string.exit_tips).setNegativeButton(R.string.common_cancel, null)
-                .setPositiveButton(R.string.common_sure, new DialogInterface.OnClickListener() {
-                    @Override
-                    public void onClick(DialogInterface dialog, int which) {
-                        UserSp.getInstance(mContext).clearUserInfo();
-                        ViewUtil.clearAccount(mContext);
-                        LoginHelper.broadcastLogout(mContext);
-                        SettingActivity.this.finish();
-
-                    }
-                }).create().show();
+        new MaterialDialog.Builder(this)
+                .title(R.string.app_name)
+                .titleGravity(GravityEnum.CENTER)
+                
+                .content(R.string.exit_tips)
+                .positiveText(R.string.common_sure)
+                .positiveColorRes(R.color.white)
+                .btnSelector(R.drawable.btn_dialog_selector)
+                .btnStackedGravity(GravityEnum.CENTER)
+                .itemsGravity(GravityEnum.CENTER)
+                .buttonsGravity(GravityEnum.CENTER)
+                .negativeText(R.string.common_cancel)
+                .negativeColorRes(R.color.white)
+                .show();
+        
+//        new AlertDialog.Builder(mContext)
+//                .setTitle(R.string.app_name)
+//                .setMessage(R.string.exit_tips)
+//                .setNegativeButton(R.string.common_cancel, null)
+//                .setPositiveButton(R.string.common_sure, new DialogInterface.OnClickListener() {
+//                    @Override
+//                    public void onClick(DialogInterface dialog, int which) {
+//                        UserSp.getInstance(mContext).clearUserInfo();
+//                        ViewUtil.clearAccount(mContext);
+//                        LoginHelper.broadcastLogout(mContext);
+//                        SettingActivity.this.finish();
+//
+//                    }
+//                }).create().show();
     }
 
 
@@ -624,4 +649,51 @@ public class SettingActivity extends SupportToolBarActivity implements View.OnCl
             setWindow.dismiss();
         DisplayUtil.backgroundAlpha(this, 1f);
     }
+
+    private  PopupWindow popupWindow;
+    public void showExitPop() {
+        View view = null;
+        WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
+        if (popupWindow == null) {
+            LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            view = layoutInflater.inflate(R.layout.pop_simple_dialog, null);
+            TextView tv_title= view.findViewById(R.id.tv_title);
+            TextView tv_content= view.findViewById(R.id.tv_content);
+            TextView tv_cancel=view.findViewById(R.id.tv_cancel);
+            TextView tv_sure= view.findViewById(R.id.tv_sure);
+            tv_content.setText(R.string.exit_tips);
+            popupWindow = new PopupWindow(view, windowManager.getDefaultDisplay().getWidth()- DensityUtil.dp2px(50), LinearLayout.LayoutParams.MATCH_PARENT);
+            tv_sure.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View view) {
+                    popupWindow.dismiss();
+                    UserSp.getInstance(mContext).clearUserInfo();
+                    ViewUtil.clearAccount(mContext);
+                    LoginHelper.broadcastLogout(mContext);
+                    SettingActivity.this.finish();
+                }
+            });
+            tv_cancel.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View view) {
+                    popupWindow.dismiss();
+                }
+            });
+           
+        }
+
+        popupWindow.setFocusable(true);
+        popupWindow.setOutsideTouchable(true);
+        popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+            @Override
+            public void onDismiss() {
+                DisplayUtil.backgroundAlpha(activity, 1f);
+            }
+        });
+        DisplayUtil.backgroundAlpha(this, 0.5f);
+        popupWindow.setBackgroundDrawable(new BitmapDrawable());
+        popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+        popupWindow.showAtLocation(activity.getWindow().getDecorView(), Gravity.CENTER, 0, 0);
+    }
+    
 }

+ 21 - 0
app_modular/apputils/src/main/res/drawable/shape_border_withe.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+    <corners
+        android:topLeftRadius="10dp"
+        android:topRightRadius="10dp"
+        android:bottomRightRadius="10dp"
+        android:bottomLeftRadius="10dp">
+    </corners>
+    <stroke
+        android:width="2dp"
+        android:color="#ffffff">
+    </stroke>
+    <solid
+        android:color="#fefefe">
+    </solid>
+    <padding
+        android:left="3dp"
+        android:top="3dp"
+        android:right="3dp"
+        android:bottom="3dp" />
+</shape>

+ 57 - 0
app_modular/apputils/src/main/res/layout/pop_simple_dialog.xml

@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@drawable/shape_border_withe"
+    android:padding="@dimen/dp_10">
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center"
+        android:orientation="horizontal">
+        <TextView
+            android:id="@+id/tv_title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content" 
+            android:textSize="@dimen/sp_16"
+            android:layout_margin="@dimen/dp_10"
+            android:textStyle="bold"
+            android:text="@string/app_name"/>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal">
+        <TextView
+            android:id="@+id/tv_content"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content" 
+            android:layout_margin="@dimen/dp_10"
+            android:text="######################"/>
+    </LinearLayout>
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:weightSum="2"
+        android:orientation="horizontal">
+        <Button
+            android:id="@+id/tv_cancel"
+            android:layout_width="wrap_content"
+            android:layout_height="40dp"
+            android:layout_weight="1"
+            android:background="@drawable/selector_cancel_bg"
+            android:layout_margin="10dp"
+            android:textColor="@color/titleBlue"
+            android:text="@string/cancel"/>
+        <Button
+            android:id="@+id/tv_sure"
+            android:layout_width="wrap_content"
+            android:layout_height="40dp"
+            android:layout_weight="1"
+            android:layout_alignParentRight="true"
+            android:layout_margin="10dp"
+            android:textColor="@color/white"
+            android:background="@drawable/selector_confirm_bg"
+            android:text="@string/sure"/>
+    </LinearLayout>
+</LinearLayout>