Browse Source

UI改版:修改标题栏

Arison 7 years ago
parent
commit
be3b10e162

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Thu May 17 13:49:13 CST 2018
-debugName=274
+#Thu May 17 19:31:05 CST 2018
+debugName=286
 versionName=630
-debugCode=274
+debugCode=286
 versionCode=170

+ 0 - 2
app_core/common/build.gradle

@@ -40,7 +40,6 @@ dependencies {
     compile deps.stickyListHeaders
     compile deps.stickyGridHeaders
     compile deps.cardviewV7
-//    compile deps.vlayout
     compile deps.BaseRecyclerViewAdapterHelper
     compile deps.design
     compile deps.banner
@@ -58,7 +57,6 @@ dependencies {
     compile project(':lib-zxing')
     compile project(':library-refreshlayout')
     compile project(':recyclerlibrary')
-    //折线库
     compile files('libs/hellocharts-library-1.5.8.jar')
     compile deps.wechatSdk
 }

+ 89 - 0
app_core/common/src/main/java/com/core/adapter/ItemPopListAdapter.java

@@ -0,0 +1,89 @@
+package com.core.adapter;
+
+/**
+ * Created by Arison on 2017/11/8.
+ */
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.CheckBox;
+import android.widget.TextView;
+
+import com.core.app.R;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ItemPopListAdapter extends BaseAdapter {
+
+    private List<ItemsSelectType1> objects = new ArrayList<ItemsSelectType1>();
+    private int selectId=7;
+    private Context context;
+    private LayoutInflater layoutInflater;
+
+    public int getSelectId() {
+        return selectId;
+    }
+
+    public void setSelectId(int selectId) {
+        this.selectId = selectId;
+    }
+
+    public ItemPopListAdapter(Context context, List<ItemsSelectType1> data) {
+        this.context = context;
+        this.objects=data;
+        this.layoutInflater = LayoutInflater.from(context);
+    }
+
+    @Override
+    public int getCount() {
+        return objects.size();
+    }
+
+    @Override
+    public ItemsSelectType1 getItem(int position) {
+        return objects.get(position);
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        if (convertView == null) {
+            convertView = layoutInflater.inflate(R.layout.item_pop_list_select, null);
+            convertView.setTag(new ViewHolder(convertView));
+        }
+        initializeViews((ItemsSelectType1)getItem(position), (ViewHolder) convertView.getTag(),position);
+        return convertView;
+    }
+
+    private void initializeViews(ItemsSelectType1 object, ViewHolder holder,int position) {
+       // holder.tvItemName.setSelected(object.isSelected());
+        holder.tvItemName.setText(object.getName());
+       if (selectId==position) {
+           holder.checkBox.setChecked(true);
+       }else{
+           holder.checkBox.setChecked(false);
+       }
+       holder.checkBox.setFocusable(false);
+       holder.checkBox.setClickable(false);
+    }
+
+    public class ViewHolder {
+//        private LinearLayout llPopTop;
+        public TextView tvItemName;
+        public CheckBox checkBox;
+
+        public ViewHolder(View view) {
+//            llPopTop = (LinearLayout) view.findViewById(R.id.ll_pop_top);
+            tvItemName = (TextView) view.findViewById(R.id.tv_item_name);
+            checkBox= (CheckBox) view.findViewById(R.id.cb_select);
+        }
+    }
+}

+ 26 - 0
app_core/common/src/main/java/com/core/adapter/ItemsSelectType1.java

@@ -0,0 +1,26 @@
+package com.core.adapter;
+
+/**
+ * Created by Arison on 2017/11/8.
+ */
+public class ItemsSelectType1 {
+    
+    private String name;//名称
+    private boolean selected=false;//是否被选中
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public boolean isSelected() {
+        return selected;
+    }
+
+    public void setSelected(boolean selected) {
+        this.selected = selected;
+    }
+}

+ 84 - 24
app_core/common/src/main/java/com/core/net/http/ViewUtil.java

@@ -3,12 +3,22 @@ package com.core.net.http;
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.support.v4.content.LocalBroadcastManager;
 import android.util.Log;
+import android.view.Gravity;
+import android.view.LayoutInflater;
 import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.widget.AdapterView;
+import android.widget.LinearLayout;
+import android.widget.ListView;
+import android.widget.PopupWindow;
 import android.widget.Toast;
 
 import com.afollestad.materialdialogs.MaterialDialog;
@@ -20,8 +30,11 @@ import com.common.LogUtil;
 import com.common.data.JSONUtil;
 import com.common.data.ListUtils;
 import com.common.data.StringUtil;
+import com.common.system.DisplayUtil;
 import com.common.thread.ThreadPool;
 import com.common.thread.ThreadUtil;
+import com.core.adapter.ItemPopListAdapter;
+import com.core.adapter.ItemsSelectType1;
 import com.core.api.wxapi.ApiConfig;
 import com.core.api.wxapi.ApiPlatform;
 import com.core.api.wxapi.ApiUtils;
@@ -41,6 +54,7 @@ import com.me.network.app.base.HttpCallback;
 import com.me.network.app.base.HttpParams;
 import com.me.network.app.http.HttpRequest;
 import com.me.network.app.http.Method;
+import com.scwang.smartrefresh.layout.util.DensityUtil;
 
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -638,16 +652,10 @@ public class ViewUtil {
     }
 
 
-    /**
-     * @author Administrator
-     * @功能:管理平台的返回信息处理
-     */
+   
+      /*@功能:管理平台的返回信息处理*/
     public static void LoginSucess(String json, String phone, String password) {
-//        String json = msg.getData().getString("result");
-//        LogUtil.prinlnLongMsg("HttpLogs", "管理平台登录:" + json);
         CommonUtil.setSharedPreferences(ct, "loginJson", json);
-//        String phone = msg.getData().getString("phone");
-//        String password = msg.getData().getString("password");
         try {
             JSONArray array = JSON.parseArray(json);
             if (!ListUtils.isEmpty(array)) {
@@ -659,7 +667,7 @@ public class ViewUtil {
                 }
             }
         } catch (Exception e) {
-
+             e.printStackTrace();
         }
         if (JSONUtil.validate(json)) {
             // showDialogCompany(json, phone, password);
@@ -693,8 +701,7 @@ public class ViewUtil {
                             boolean isHas = false;
                             for (int k = 0; k < loginMsg.size(); k++) {
                                 if (sModel.get(j).getName().equals(loginMsg.get(k).getName())) {
-                                    //存在  uas系统里面存在同名的
-                                    isHas = true;
+                                    isHas = true; //存在  uas系统里面存在同名的
                                 }
                             }
                             if (!isHas) {
@@ -724,14 +731,17 @@ public class ViewUtil {
                     }
                 }
             }
-            //
             LogUtil.d("HttpLogs", "login dialog:" + JSON.toJSONString(loginEntities));
             if (ListUtils.isEmpty(loginEntities)) return;
             erpEntities = loginEntities;
             String[] items = new String[loginEntities.size()];
             int select = 0;
+            List<ItemsSelectType1> itemsSelectType1s=new ArrayList<>();
             for (int j = 0; j < loginEntities.size(); j++) {
+                ItemsSelectType1 model=new ItemsSelectType1();
+                model.setName(loginEntities.get(j).getName());
                 items[j] = loginEntities.get(j).getName();
+                itemsSelectType1s.add(model);
             }
             if (!DialogUtils.isDialogShowing(loginERPDialog)) {
                 if (loginERPDialog != null) {
@@ -740,23 +750,73 @@ public class ViewUtil {
                 if (select > items.length) {
                     select = 0;
                 }
-                LogUtil.d("AppLogs", "select:" + select + "");
-                loginERPDialog = new MaterialDialog.Builder(ct)
-                        .title(ct.getString(R.string.user_dialog_company))
-                        .items(items)
-                        .itemsCallbackSingleChoice(select,
-                                new MaterialDialog.ListCallbackSingleChoice() {
-                                    @Override
-                                    public boolean onSelection(MaterialDialog dialog,
-                                                               View view, int which, CharSequence text) {
-                                        return selectCompanyItems(which, text, phone, password);
-                                    }
-                                }).positiveText(ct.getString(R.string.common_sure)).show();
+
+                showPopDialog((Activity) ct,itemsSelectType1s,phone,password);
+//                loginERPDialog = new MaterialDialog.Builder(ct)
+//                        .title(ct.getString(R.string.user_dialog_company))
+//                        .items(items)
+//                        .itemsCallbackSingleChoice(select,
+//                                new MaterialDialog.ListCallbackSingleChoice() {
+//                                    @Override
+//                                    public boolean onSelection(MaterialDialog dialog,
+//                                                               View view, int which, CharSequence text) {
+//                                        return selectCompanyItems(which, text, phone, password);
+//                                    }
+//                                }).positiveText(ct.getString(R.string.common_sure)).show();
 
             }
         }
     }
 
+
+    public static PopupWindow popupWindow = null;
+    public static int selectId;
+    public static void  showPopDialog(final Activity ct, List<ItemsSelectType1> itemsSelectType1s
+    , final String phone, final String password){
+        View view = null;
+        if (DialogUtils.isDialogShowing(mdProcessDialog)){
+            mdProcessDialog.dismiss();
+        }
+        WindowManager windowManager = (WindowManager)ct. getSystemService(Context.WINDOW_SERVICE);
+        if (popupWindow == null) {
+            LayoutInflater layoutInflater = (LayoutInflater) ct.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+            view = layoutInflater.inflate(R.layout.pop_dialog_list, null);
+            ListView plist = view.findViewById(R.id.mList);
+            List<ItemsSelectType1> datas =itemsSelectType1s;
+            final ItemPopListAdapter adapter = new ItemPopListAdapter(ct, datas);
+            plist.setAdapter(adapter);
+            Drawable drawable = ct.getResources().getDrawable(R.drawable.selector_check_items);
+            plist.setSelector(drawable);
+            plist.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+                @Override
+                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                    popupWindow.dismiss();
+                    selectId = position;
+                    adapter.setSelectId(selectId);
+                    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);
+        }
+
+        popupWindow.setFocusable(true);
+        popupWindow.setOutsideTouchable(true);
+        popupWindow.setOnDismissListener(new PopupWindow.OnDismissListener() {
+            @Override
+            public void onDismiss() {
+                DisplayUtil.backgroundAlpha(ct, 1f);
+            }
+        });
+        DisplayUtil.backgroundAlpha(ct, 0.5f);
+        popupWindow.setBackgroundDrawable(new BitmapDrawable());
+        popupWindow.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
+        popupWindow.showAtLocation(ct.getWindow().getDecorView(), Gravity.CENTER, 0, 0);
+    }
+        
+  
+
     private static boolean selectCompanyItems(int which, CharSequence text, String phone, String password) {
         if (!CommonUtil.isNetWorkConnected(ct)) {
             ToastUtil.showToast(ct, R.string.networks_out);

+ 9 - 10
app_core/common/src/main/java/com/core/utils/DialogUtils.java

@@ -1,23 +1,22 @@
 package com.core.utils;
 
 import android.app.Dialog;
+import android.widget.PopupWindow;
 
-/**
- * Created by Arison on 2017/8/29.
- */
 
 public class DialogUtils {
-
-    /**
-     * 对话框是否展示
-     *
-     * @param dialog
-     * @return
-     */
+    
     public static boolean isDialogShowing(Dialog dialog) {
         if (dialog != null && dialog.isShowing()) {
             return true;
         }
         return false;
     }
+
+    public static boolean isDialogShowing(PopupWindow dialog) {
+        if (dialog != null && dialog.isShowing()) {
+            return true;
+        }
+        return false;
+    }
 }

+ 6 - 0
app_core/common/src/main/res/drawable/selector_check_items.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:drawable="@drawable/icon_select_sure" android:state_checked="true"/>
+    <item android:drawable="@color/item_line" android:state_checked="false"/>
+    <item android:drawable="@color/item_line" />
+</selector>

+ 13 - 0
app_core/common/src/main/res/drawable/shape_border_bule.xml

@@ -0,0 +1,13 @@
+<?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">
+    </corners>
+    <stroke
+        android:color="#ffffff">
+    </stroke>
+    <solid
+        android:color="@color/titleBlue">
+    </solid>
+</shape>

+ 9 - 0
app_core/common/src/main/res/drawable/shape_border_withe.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
+    <stroke
+        android:color="#ffffff">
+    </stroke>
+    <solid
+        android:color="#fefefe">
+    </solid>/>
+</shape>

+ 28 - 0
app_core/common/src/main/res/layout/item_pop_list_select.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@drawable/selector_me_menu_item_bg">
+    <TextView
+        android:id="@+id/tv_item_name"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:paddingLeft="2dp"
+        android:paddingRight="2dp"
+        android:paddingTop="10dp"
+        android:paddingBottom="10dp"
+        android:textSize="14sp"
+        android:gravity="center"
+        android:text="xxx" />
+    <CheckBox
+        android:id="@+id/cb_select"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:button="@null"
+        android:background="@drawable/selector_check_items"
+        android:checked="true"
+        android:layout_toLeftOf="@+id/tv_item_name"
+        />
+</RelativeLayout>

+ 31 - 0
app_core/common/src/main/res/layout/pop_dialog_list.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:background="@drawable/shape_border_withe">
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@drawable/shape_border_bule"
+            android:gravity="center"
+            android:orientation="horizontal">
+                <TextView
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:layout_margin="@dimen/dp_10"
+                    android:textStyle="bold"
+                    android:textSize="@dimen/sp_16"
+                    android:textColor="@color/white"
+                    android:text="公司选择"/>
+        </LinearLayout>
+        <ListView
+            android:id="@+id/mList"
+            style="@style/ListViewBasic"
+            android:layout_height="300dp"
+            android:layout_marginBottom="20dp"
+            android:dividerHeight="0dp">
+        </ListView>
+</LinearLayout>

+ 1 - 0
app_modular/appme/src/main/java/com/uas/appme/settings/activity/SettingActivity.java

@@ -653,6 +653,7 @@ public class SettingActivity extends SupportToolBarActivity implements View.OnCl
     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);

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

@@ -7,15 +7,9 @@
         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>