Browse Source

Merge branch 'developer' of https://gitlab.com/Arisono/SkWeiChat-Baidu into developer

# Conflicts:
#	WeiChat/src/main/res/values/colors.xml
RaoMeng 9 years ago
parent
commit
7d5044cf0d

+ 1 - 3
WeiChat/build.gradle

@@ -4,7 +4,7 @@ apply plugin: 'com.getkeepsafe.dexcount'
 android {
     signingConfigs {
         config {
-            storeFile file('C:/CompanyProject/applicationsignname[20150409]')
+            storeFile file('C:/Users/Arison/Desktop/applicationsignname[20150409]')
             storePassword '13237658359'
             keyAlias 'jie-20150409'
             keyPassword '13237658359'
@@ -94,6 +94,4 @@ dependencies {
     compile 'me.gujun.android.taggroup:library:1.4@aar'
     compile 'com.umeng.analytics:analytics:latest.integration'
     compile 'com.android.support:multidex:1.0.1'
-    compile project(':library-viewpager-indicator')
-    compile project(':library-swipemenu_lv')
 }

+ 2 - 3
WeiChat/src/main/AndroidManifest.xml

@@ -61,14 +61,14 @@
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.GET_TASKS" />
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
-
+    <!--全局样式不要随意改动  @style/AppTheme-->
     <application
         android:largeHeap="true"
         android:name=".MyApplication"
         android:allowBackup="true"
         android:icon="@drawable/uuu"
         android:label="@string/app_name"
-        android:theme="@style/StyledIndicators">
+        android:theme="@style/AppTheme">
         <meta-data
             android:name="UMENG_APPKEY"
             android:value="574504a167e58eec520017df" />
@@ -415,7 +415,6 @@
         <activity
             android:name=".ui.erp.activity.oa.StatisticsActivity"
             android:label="考勤统计" />
-        <activity android:name=".ui.erp.activity.TextErpActivity" />
         <activity android:name=".ui.erp.activity.crm.BusinessActivity"
             android:theme="@style/CrmThemeBlue"/>
         <activity android:name=".ui.erp.activity.crm.BusinessDetailActivty"

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/TaskActivity.java

@@ -355,7 +355,7 @@ public class TaskActivity extends BaseActivity {
     public class getallprocess_run implements Runnable {
         @Override
         public void run() {
-            if (!HttpClient.isNetworkAvailable(TaskActivity.this)) {
+            if (!CommonUtil.isNetWorkConnected(ct)) {
                 handler.sendEmptyMessage(0);
                 return;
             }

+ 0 - 31
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/TextErpActivity.java

@@ -1,31 +0,0 @@
-package com.xzjmyk.pm.activity.ui.erp.activity;
-
-import android.os.Bundle;
-import android.view.View;
-
-import com.xzjmyk.pm.activity.R;
-import com.xzjmyk.pm.activity.ui.base.BaseActivity;
-import com.xzjmyk.pm.activity.ui.erp.net.ViewUtil;
-import com.xzjmyk.pm.activity.ui.erp.util.Constants;
-
-public class TextErpActivity extends BaseActivity implements View.OnClickListener {
-    TextErpActivity ct = this;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_text_erp);
-        findViewById(R.id.btn1).setOnClickListener(this);
-    }
-
-    @Override
-    public void onClick(View view) {
-        switch (view.getId()) {
-            case R.id.btn1:
-                String url = Constants.getAppBaseUrl(ct);
-                ViewUtil.ct = ct;
-                ViewUtil.LoginERPTask(ct, url, "UAS", "15972129063", 1 + "");
-                break;
-        }
-    }
-}

+ 7 - 3
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/crm/BusinessAddActivity.java

@@ -23,7 +23,6 @@ import com.xzjmyk.pm.activity.ui.erp.util.Constants;
 import com.xzjmyk.pm.activity.ui.erp.util.LogUtil;
 import com.xzjmyk.pm.activity.ui.erp.view.SingleDialog;
 import com.xzjmyk.pm.activity.util.DateFormatUtil;
-import com.xzjmyk.pm.activity.util.ToastUtil;
 import com.xzjmyk.pm.activity.view.wheel.DatePicker;
 
 import org.json.JSONException;
@@ -196,8 +195,13 @@ public class BusinessAddActivity extends BaseActivity implements View.OnClickLis
                     break;
                 case Constants.HTTP_SUCCESS_INIT:
                     progressDialog.dismiss();
-                    ToastUtil.showToast(BusinessAddActivity.this, "添加商机成功");
-                    finish();
+                    ViewUtil.ToastMessage(activity, "添加商机成功");
+                    mHandler.postDelayed(new Runnable() {
+                        @Override
+                        public void run() {
+                            finish();
+                        }
+                    },3000);
                     break;
                 case LOAD_BUSINESS://商机库
                     progressDialog.dismiss();

+ 14 - 3
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/crm/ClientActivity.java

@@ -209,10 +209,17 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
     private void initData() {
         sendHttpResquest();
         isHasSubordinate(6);//下属
-//        setData(4, 50);
-     //   setData1(7, 50);
+       /* loadLocalServer();*/
     }
-
+    
+   /* private void loadLocalServer(){
+        String url = "http://192.168.253.200:8080/spring-mvc-showcase/client/info";
+        final Map<String, Object> param = new HashMap<>();
+        LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
+        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
+        ViewUtil.httpSendRequest(ct, url, param, mHandler, headers, 100, null, null, "get");
+    }*/
+    
     private void initBarChart() {
         mv = new MyMarkerView(this, R.layout.custom_marker_view);
         mChart.setMarkerView(mv);
@@ -525,6 +532,10 @@ public class ClientActivity extends BaseActivity implements View.OnClickListener
         @Override
         public void handleMessage(Message msg) {
             switch (msg.what) {
+              /*  case 100:
+                    progressDialog.dismiss();
+                    Log.i(TAG, "handleMessage:10 0:" + msg.getData().getString("result"));
+                    break;*/
                 case Constants.HTTP_SUCCESS_INIT:
                     progressDialog.dismiss();
                     Log.i(TAG, "handleMessage:" + msg.getData().getString("result"));

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/fragment/WorksFragment.java

@@ -112,7 +112,7 @@ public class WorksFragment extends XutilsFragment implements View.OnClickListene
                 String phone = CommonUtil.getSharedPreferences(getActivity(), "user_phone");
                 String password = CommonUtil.getSharedPreferences(getActivity(), "user_password");
                 String url = "http://www.ubtob.com/signin#/redirect/" + phone + "/" + password;
-                ViewUtil.WebLinks(ct, url, "我的商务");
+                ViewUtil.webLinks(ct, url, "我的商务");
                 break;
             case R.id.rl_uas_sys:
                 if (falg.equals("1")){

+ 19 - 38
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/net/HttpClient.java

@@ -1,9 +1,5 @@
 package com.xzjmyk.pm.activity.ui.erp.net;
 
-import android.content.Context;
-import android.location.LocationManager;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
 import android.text.TextUtils;
 import android.util.Log;
 
@@ -15,19 +11,15 @@ import com.xzjmyk.pm.activity.util.PreferenceUtils;
 
 import org.apache.http.HttpResponse;
 import org.apache.http.NameValuePair;
-import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.CookieStore;
 import org.apache.http.client.entity.UrlEncodedFormEntity;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
-import org.apache.http.conn.HttpHostConnectException;
 import org.apache.http.impl.client.AbstractHttpClient;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.message.BasicNameValuePair;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.params.CoreProtocolPNames;
-import org.apache.http.params.HttpConnectionParams;
-import org.apache.http.params.HttpParams;
 import org.apache.http.protocol.HTTP;
 import org.apache.http.util.EntityUtils;
 
@@ -45,9 +37,10 @@ import java.util.Set;
 
 @Deprecated
 public class HttpClient {
-    private static CookieStore cookieStore;
 
-    public String getConntionPostByValues(String url, Object[][] values)
+    private static CookieStore cookieStore;
+/*     
+      public String getConntionPostByValues(String url, Object[][] values)
             throws ClientProtocolException, IOException {
         String result = null;
         HttpPost request = null;
@@ -103,15 +96,10 @@ public class HttpClient {
 
         }
         return result;
-    }
+    }*/
 
-    /**
-     * 函数说明:判断wify是否连接上
-     *
-     * @param context
-     * @return
-     */
-    public boolean isWiFiActive(Context context) {
+
+/*    public boolean isWiFiActive(Context context) {
         ConnectivityManager connectivity = (ConnectivityManager) context
                 .getSystemService(Context.CONNECTIVITY_SERVICE);
         if (connectivity != null) {
@@ -125,9 +113,9 @@ public class HttpClient {
             }
         }
         return false;
-    }
+    }*/
 
-    public static boolean isWifi(Context context) {
+/*    public static boolean isWifi(Context context) {
         ConnectivityManager cm = (ConnectivityManager) context
                 .getSystemService(Context.CONNECTIVITY_SERVICE);
         NetworkInfo networkINfo = cm.getActiveNetworkInfo();
@@ -136,9 +124,9 @@ public class HttpClient {
             return true;
         }
         return false;
-    }
+    }*/
 
-    public static boolean is3rd(Context context) {
+   /* public static boolean is3rd(Context context) {
         ConnectivityManager cm = (ConnectivityManager) context
                 .getSystemService(Context.CONNECTIVITY_SERVICE);
         NetworkInfo networkINfo = cm.getActiveNetworkInfo();
@@ -147,9 +135,9 @@ public class HttpClient {
             return true;
         }
         return false;
-    }
+    }*/
 
-    public static boolean isNetworkAvailable(Context context) {
+/*    public static boolean isNetworkAvailable(Context context) {
         ConnectivityManager cm = (ConnectivityManager) context
                 .getSystemService(Context.CONNECTIVITY_SERVICE);
         if (cm == null) {
@@ -164,14 +152,14 @@ public class HttpClient {
             }
         }
         return false;
-    }
-
+    }*/
+/*
     public static boolean isGpsEnabled(Context context) {
         LocationManager lm = ((LocationManager) context
                 .getSystemService(Context.LOCATION_SERVICE));
         List<String> accessibleProviders = lm.getProviders(true);
         return accessibleProviders != null && accessibleProviders.size() > 0;
-    }
+    }*/
 
     /**
      * 发送GET请求
@@ -230,14 +218,7 @@ public class HttpClient {
     }
 
 
-    /**
-     * 发送GET请求
-     *
-     * @param url
-     * @param params
-     * @return
-     * @throws Exception
-     */
+ /*   
     public String sendGetRequest(Context ct, String url, Map<String, String> params)
             throws Exception {
         String result = null;
@@ -287,7 +268,7 @@ public class HttpClient {
             result = prinInfo(response, response.getStatusLine().getStatusCode());
         }
         return result;
-    }
+    }*/
 
     public String sendPostRequest(String url, Map<String, String> params)
             throws IOException {
@@ -383,7 +364,7 @@ public class HttpClient {
      * @param params
      * @return
      * @throws Exception
-     */
+     *//*
     public String sendGetRequest(String url, Map<String, String> params, boolean isB2B)
             throws Exception {
         String result = null;
@@ -428,5 +409,5 @@ public class HttpClient {
             result = prinInfo(response, response.getStatusLine().getStatusCode());
         }
         return result;
-    }
+    }*/
 }

+ 10 - 69
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/net/HttpUtil.java

@@ -6,14 +6,12 @@ import com.xzjmyk.pm.activity.ui.erp.hmac.HmacUtils;
 
 import org.apache.http.HttpResponse;
 import org.apache.http.NameValuePair;
-import org.apache.http.client.CookieStore;
 import org.apache.http.client.entity.UrlEncodedFormEntity;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.methods.HttpPost;
 import org.apache.http.entity.StringEntity;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.params.CoreProtocolPNames;
 import org.apache.http.protocol.HTTP;
 
 import java.io.ByteArrayOutputStream;
@@ -24,7 +22,6 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
-import java.net.ProtocolException;
 import java.net.SocketException;
 import java.net.SocketTimeoutException;
 import java.net.URL;
@@ -46,10 +43,7 @@ import java.util.Set;
  */
 @SuppressWarnings("deprecation")
 public class HttpUtil {
-    /**
-     * @author LiuJie
-     * @功能:Get 参数, 请求头
-     */
+
     public static Response sendGetRequest(
             String url,
             Map<String, Object> params,
@@ -83,15 +77,13 @@ public class HttpUtil {
             } else
                 buf.deleteCharAt(buf.length() - 1);
             HttpGet httpGet = new HttpGet(buf.toString());
-//            httpGet.setHeader(key, headers.get(key).toString());
             httpGet.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
             if (headers != null) {
                 for (String key : headers.keySet()) {
                     System.out.println("add header:" + key + " value:" + headers.get(key).toString());
-                    httpGet.setHeader(key, headers.get(key).toString());
+                    httpGet.addHeader(key, headers.get(key).toString());
                 }
             }
-          //  httpClient.getParams().setParameter(CoreProtocolPNames.HTTP_CONTENT_CHARSET, "UTF-8");
             response = httpClient.execute(httpGet);
             return Response.getResponse(response);
         } finally {
@@ -99,10 +91,7 @@ public class HttpUtil {
         }
     }
 
-    /**
-     * @author LiuJie
-     * @功能:post请求 添加请求头参数
-     */
+
     public static Response sendPostRequest(
             String url,
             Map<String, Object> params,
@@ -130,23 +119,20 @@ public class HttpUtil {
                 }
             }
             httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
+            httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
             if (headers != null) {
                 for (String key : headers.keySet()) {
                     System.out.println("add header:" + key + " value:" + headers.get(key).toString());
-                    httpPost.setHeader(key, headers.get(key).toString());
+                    httpPost.addHeader(key, headers.get(key).toString());
                 }
             }
-            httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
             response = httpClient.execute(httpPost);
             return Response.getResponse(response);
         } finally {
         }
     }
 
-    /**
-     * @author LiuJie
-     * @功能: post  json参数
-     */
+
     public static Response sendPostRequest(
             String url,
             LinkedHashMap<String, Object> headers,
@@ -180,59 +166,26 @@ public class HttpUtil {
     public static class Response {
         public int statusCode;
         public String responseText;
-        public static CookieStore cookieStore;
-
         public int getStatusCode() {
             return statusCode;
         }
-
-        public void setStatusCode(int statusCode) {
-            this.statusCode = statusCode;
-        }
-
         public String getResponseText() {
             return responseText;
         }
-
-        public void setResponseText(String responseText) {
-            this.responseText = responseText;
-        }
-
-        public CookieStore getCookieStore() {
-            return cookieStore;
-        }
-
-        public void setCookieStore(CookieStore cookieStore) {
-            Response.cookieStore = cookieStore;
-        }
-
-        public Response() {
-        }
-
-        public Response(HttpResponse response) throws IllegalStateException,
-                IOException, Exception {
+        public Response(HttpResponse response) throws Exception {
             this.statusCode = response.getStatusLine().getStatusCode();
             this.responseText = HttpUtil.read2String(response.getEntity()
                     .getContent());
         }
 
-        private static Response sResponse;
-
         public static Response getResponse(HttpResponse response)
-                throws IllegalStateException, IOException, Exception {
-//            if (sResponse == null) {
-//                synchronized (Response.class) {// 1
-            if (response != null) {// 2
-                return new Response(response);// 3
+                throws Exception {
+            if (response != null) {
+                return new Response(response);
             }
-//                }
-//            }
-//            return sResponse;
             return null;
         }
     }
-
-
     /**
      * @author Administrator
      * @功能:待封装
@@ -260,13 +213,11 @@ public class HttpUtil {
         return new String(outSteam.toByteArray(), "UTF-8");
     }
 
-
     /**
      * @author Administrator
      * @功能:HttpUrlConnection download
      */
     public static String download(String httpurl, String path) {
-        System.out.println("start:" + new SimpleDateFormat("MM-dd:HH:mm:ss:SS").format(new Date()));
         try {
             URL url = new URL(httpurl);
             HttpURLConnection connection = (HttpURLConnection) url.openConnection();
@@ -278,7 +229,6 @@ public class HttpUtil {
             int file_leng = connection.getContentLength();
             System.out.println("file length---->" + file_leng);
             InputStream bin = connection.getInputStream();
-
             File file = new File(path);
             if (!file.getParentFile().exists()) {
                 file.getParentFile().mkdirs();
@@ -290,23 +240,14 @@ public class HttpUtil {
             while ((size = bin.read(buf)) != -1) {
                 len += size;
                 out.write(buf, 0, size);
-                /* android 中为了更新进度条
-				Message msg = handler.obtainMessage();
-				msg.arg1=len*100/file_leng;
-				handler.sendMessage(msg);
-				*/
-                //Thread.sleep(1000);
                 System.out.println("下载了: " + len * 100 / file_leng + "%\n");
             }
             bin.close();
             out.close();
-
             System.out.println("end:" + new SimpleDateFormat("MM-dd:HH:mm:ss:SS").format(new Date()));
             return path;
         } catch (MalformedURLException e) {
             e.printStackTrace();
-        } catch (ProtocolException e) {
-            e.printStackTrace();
         } catch (SocketException e) {
             e.printStackTrace();
         } catch (SocketTimeoutException e) {

+ 28 - 152
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/net/ViewUtil.java

@@ -1,20 +1,15 @@
 package com.xzjmyk.pm.activity.ui.erp.net;
 
 import android.app.Activity;
-import android.app.ActivityManager;
-import android.app.ActivityManager.RunningTaskInfo;
-import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
 import android.support.v4.content.LocalBroadcastManager;
-import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.EditText;
 import android.widget.ListAdapter;
 import android.widget.ListView;
 import android.widget.Toast;
@@ -23,6 +18,7 @@ import com.afollestad.materialdialogs.MaterialDialog;
 import com.afollestad.materialdialogs.MaterialDialog.ButtonCallback;
 import com.alibaba.fastjson.JSON;
 import com.xzjmyk.pm.activity.MyApplication;
+import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.ui.MainActivity;
 import com.xzjmyk.pm.activity.ui.account.DataDownloadActivity;
 import com.xzjmyk.pm.activity.ui.base.BaseActivity;
@@ -34,10 +30,8 @@ import com.xzjmyk.pm.activity.ui.erp.util.FlexJsonUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.JsonValidator;
 import com.xzjmyk.pm.activity.ui.erp.util.LogUtil;
 import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
+import com.xzjmyk.pm.activity.view.crouton.Crouton;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.io.Writer;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -66,44 +60,16 @@ public class ViewUtil {
     public static String erp_company;
     public static MaterialDialog mdProcessDialog;
     private static MaterialDialog loginERPDialog;
-
-    /**
-     * 获取Listview的高度
-     *
-     * @param listView
-     * @return
-     */
-    public static void setListViewHeightBasedOnChildren(ListView listView) {
-        ListAdapter listAdapter = listView.getAdapter();
-        if (listAdapter == null) {
-            return;
-        }
-
-        int totalHeight = 0;
-        for (int i = 0; i < listAdapter.getCount(); i++) {
-            View listItem = listAdapter.getView(i, null, listView);
-            listItem.measure(0, 0);
-            totalHeight += listItem.getMeasuredHeight();
-        }
-
-        ViewGroup.LayoutParams params = listView.getLayoutParams();
-        params.height = totalHeight
-                + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
-        listView.setLayoutParams(params);
-    }
-
-
+    private static List<LoginEntity> erpEntities;
+    private static boolean hasErp = true;//是否有erp
     /**
      * 获取Listview的高度,然后设置ViewPager的高度
-     *
      * @param listView
      * @return
      */
     public static int setListViewHeightBasedOnChildren1(ListView listView) {
-        // 获取ListView对应的Adapter
         ListAdapter listAdapter = listView.getAdapter();
         if (listAdapter == null) {
-            // pre-condition
             return 0;
         }
         int totalHeight = 0;
@@ -112,12 +78,9 @@ public class ViewUtil {
             listItem.measure(0, 0); // 计算子项View 的宽高
             totalHeight += listItem.getMeasuredHeight(); // 统计所有子项的总高度
         }
-
         ViewGroup.LayoutParams params = listView.getLayoutParams();
         params.height = totalHeight
                 + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
-        // listView.getDividerHeight()获取子项间分隔符占用的高度
-        // params.height最后得到整个ListView完整显示需要的高度
         listView.setLayoutParams(params);
         return params.height;
     }
@@ -125,29 +88,19 @@ public class ViewUtil {
 
     /**
      * 弹出Toast消息
-     *
      * @param msg
      */
     public static void ToastMessage(Context cont, String msg) {
-        Toast.makeText(cont, msg, Toast.LENGTH_SHORT).show();
-    }
-
-    public static void ToastMessage(Context cont, int msg) {
-        Toast.makeText(cont, msg, Toast.LENGTH_SHORT).show();
-    }
-
-    public static void ToastMessage(Context cont, String msg, int time) {
-        Toast.makeText(cont, msg, time).show();
-    }
-
-    public static void ShowAppCrashTitle(Context ct) {
-        new MaterialDialog.Builder(ct).title("信息提示").content("系统出现未知错误,很抱歉!")
-                .show();
+        if (cont instanceof Activity){
+            Crouton.makeText((Activity)cont,msg,cont.getResources().getColor(R.color.light_green),2000).show();
+        }else{
+            Toast.makeText(cont, msg, Toast.LENGTH_SHORT).show();
+        }
+        
     }
-
-
+    
     public static void ShowMessageTitle(Context ct, String msg) {
-        final MaterialDialog messageDialog = new MaterialDialog.Builder(ct).title("系統提示").content(msg)
+         new MaterialDialog.Builder(ct).title("系統提示").content(msg)
                 .positiveText("关闭").autoDismiss(false)
                 .callback(new ButtonCallback() {
                     @Override
@@ -156,8 +109,7 @@ public class ViewUtil {
                     }
                 }).show();
     }
-
-
+    
     public static void ShowMessageTitleAutoDismiss(Context ct, String msg, long time) {
         final MaterialDialog messageDialog = new MaterialDialog.Builder(ct).title("系統提示").content(msg)
                 .positiveText("关闭").autoDismiss(false)
@@ -176,11 +128,6 @@ public class ViewUtil {
     }
 
 
-    private static EditText phone;
-    private static EditText password;// 密码
-    private static View positiveAction;
-
-
     public static String getDataFromServer(String url,
                                            Map<String, String> params, String method) {
         String result = null;
@@ -243,7 +190,6 @@ public class ViewUtil {
                                       final int what, final Message message, final Bundle bundle,
                                       final String request) {
         new Thread(new Runnable() {
-
             @Override
             public void run() {
                 boolean isNetHas = CommonUtil.isNetWorkConnected(ct);
@@ -302,7 +248,7 @@ public class ViewUtil {
                 bundle, "get");
     }
 
-    public static void LoginTaskERP(String user_phone, String user_password, Context ct) {
+/*    public static void LoginTaskERP(String user_phone, String user_password, Context ct) {
         ViewUtil.ct = ct;
         String url = Constants.BASE_URL_LOGIN;
         Map<String, String> params = new HashMap<String, String>();
@@ -314,7 +260,7 @@ public class ViewUtil {
         bundle.putString("password", user_password);
         startNetThread(url, params, handler, Constants.SUCCESS_LOGIN, message,
                 bundle, "get");
-    }
+    }*/
 
     // 登录B2B
     public static void LoginB2BTask(String phone, String password) {
@@ -328,16 +274,15 @@ public class ViewUtil {
     }
 
 
-    private static List<LoginEntity> erpEntities;
+   
     public static Handler handler = new Handler() {
         public void handleMessage(Message msg) {
             switch (msg.what) {
                 case Constants.SUCCESS_LOGIN:
                     LoginSucess(msg);
                     break;
-                case Constants.SUCCESS_ERP://切换公司成功
+                case Constants.SUCCESS_ERP:
                     String result = msg.getData().getString("result");
-                    Log.i("Arison", "" + result);
                     boolean success = JSON.parseObject(result).getBoolean("success");
                     if (success) {
                         Intent intent = new Intent("com.app.home.update");
@@ -346,7 +291,6 @@ public class ViewUtil {
                         ChangeStatusERP(msg.getData().getString("result"));
                     } else {
                         String reason = JSON.parseObject(result).getString("reason");
-
                         ToastMessage(ct, reason);
                     }
                     break;
@@ -495,7 +439,7 @@ public class ViewUtil {
                                             }
                                         }
                                     }
-                                    return true; // allow selection
+                                    return true; 
                                 }
                             }).positiveText("确定").show();
         }
@@ -509,7 +453,7 @@ public class ViewUtil {
      */
     public static void LoginSucess(Message msg) {
         String json = msg.getData().getString("result");
-        CommonUtil.setSharedPreferences(ct, "loginJson", json);// 保存在本地
+        CommonUtil.setSharedPreferences(ct, "loginJson", json);
         String phone = msg.getData().getString("phone");
         String password = msg.getData().getString("password");
         Log.i("Login", "login sucess:" + json);
@@ -559,7 +503,7 @@ public class ViewUtil {
 
     ;
 
-    private static boolean hasErp = true;//是否有erp
+  
 
     /**
      * @author LiuJie
@@ -592,27 +536,7 @@ public class ViewUtil {
         startNetThread(url, param, handler, what, null, null, "get");
     }
 
-    /**
-     * 判断某个界面是否在前台
-     *
-     * @param context
-     * @param className 某个界面名称
-     */
-    public static boolean isForeground(Context context, String className) {
-        if (context == null || TextUtils.isEmpty(className)) {
-            return false;
-        }
-        ActivityManager am = (ActivityManager) context
-                .getSystemService(Context.ACTIVITY_SERVICE);
-        List<RunningTaskInfo> list = am.getRunningTasks(1);
-        if (list != null && list.size() > 0) {
-            ComponentName cpn = list.get(0).topActivity;
-            if (className.equals(cpn.getClassName())) {
-                return true;
-            }
-        }
-        return false;
-    }
+   
 
 
     /**
@@ -634,16 +558,16 @@ public class ViewUtil {
             public void run() {
                 boolean isNetHas = CommonUtil.isNetWorkConnected(ct);
                 if (isNetHas) {
+                    headers.put("sessionUser", CommonUtil.getSharedPreferences(ct, "erp_username"));
                     Log.i("result", "url=" + url);
                     HttpUtil.Response result = httpSendTask(url, params, headers, request);
                     if (result != null) {
-                        Log.i("result", "http 请求-----------------------------------------");
-                        Log.i("result", "result:" + result);
+                        Log.i("result", "http 发送请求-----------------------------------------");
                         Log.i("result", "url:" + url);
-                        Log.i("result", "parm:" + params.toString());
+                        Log.i("result", "parms:" + params.toString());
                         Log.i("result", "statusCode:" + result.getStatusCode());
                         LogUtil.prinlnLongMsg("result", result.getResponseText());
-                        Log.i("result", "http 响应-----------------------------------------");
+                        Log.i("result", "http 接收响应-----------------------------------------");
                         if (result.getStatusCode() == 200) {
                             if (bundle == null || message == null) {
                                 Bundle bundle = new Bundle();
@@ -718,64 +642,19 @@ public class ViewUtil {
         return response;
     }
 
-    public static String getExceptionMsg(Context ct, Throwable ex) {
-        StringBuffer sb = new StringBuffer();
-        sb.append("----------------------异常信息输出-------------------------------------\n");
-        Writer writer = new StringWriter();
-        PrintWriter printWriter = new PrintWriter(writer);
-        ex.printStackTrace(printWriter);
-        // 原因打印
-        Throwable cause = ex.getCause();
-        while (cause != null) {
-            cause.printStackTrace(printWriter);
-            cause = cause.getCause();
-        }
-        printWriter.close();
-        String result = writer.toString();
-        String phone = CommonUtil.getSharedPreferences(ct, "user_phone");
-        String password = CommonUtil.getSharedPreferences(ct, "user_password");
-        String master_ch = CommonUtil.getSharedPreferences(ct, "Master_ch");
-        String company = CommonUtil.getSharedPreferences(ct, "erp_commpany");
-        sb.append(result);
-        sb.append("\n----------------------用户信息输出-------------------------------------");
-        sb.append("\n phone:" + phone);
-        sb.append("\n password:" + password);
-        sb.append("\n master_ch:" + master_ch);
-        sb.append("\n company:" + company);
-        sb.append("\n----------------------设备信息输出-------------------------------------");
-        //获取设备大小
-        String deviceInfo = CommonUtil.getDeviceInfo(ct);
-        System.out.println("deviceInfo=" + deviceInfo);
-        sb.append("\n" + deviceInfo);
-        sb.append("\n手机型号:" + CommonUtil.getDeviceModel());
-        sb.append("\n手机生产厂商:" + CommonUtil.getDeviceManufacturer());
-        //获取应用程序内存使用情况
-        sb.append("\n----------------------内存信息输出-------------------------------------\n");
-        sb.append(CommonUtil.getMemory());
-        //获取应用程序的当前版本号
-        sb.append("\n----------------------版本信息输出-------------------------------------\n");
-        sb.append("\n应用版本号:" + CommonUtil.ApkVersionCode(ct));
-        return sb.toString();
-    }
-
+    
     /**
      * @注释:ERP自动登录
      */
     public static void AutoLoginErp(Context ct) {
-        Log.i("LoginErp", "自动登录...");
         if (!StringUtils.isEmpty(Constants.getAppBaseUrl(ct))) {
             ViewUtil.ct = ct;
             String url = Constants.getAppBaseUrl(ct);
             String master = CommonUtil.getSharedPreferences(ct, "erp_master");
             String phone = CommonUtil.getSharedPreferences(ct, "user_phone");
             String password = CommonUtil.getSharedPreferences(ct, "user_password");
-            Log.i("LoginErp", "自动登录..." + url);
-            Log.i("LoginErp", "master..." + master);
-            Log.i("LoginErp", "phone..." + phone);
-            Log.i("LoginErp", "password..." + password);
             LoginERPTask(ct, url, master, phone, password);
         }
-
     }
 
     // 登录ERP
@@ -785,7 +664,6 @@ public class ViewUtil {
         params.put("username", username);
         params.put("password", password);
         params.put("master", master);
-        Log.i("Arison", "erp login:" + JSON.toJSONString(params));
         httpSendRequest(ct, url, params, handler, null, Constants.SUCCESS_ERP, null, null, "post");
     }
 
@@ -814,7 +692,6 @@ public class ViewUtil {
         params.put("master", master);
 //        httpSendRequest(ct, url, params, handler, null, Constants.SUCCESS_ERP, null, null, "post");
         startNetThread(url, params, handler, Constants.SUCCESS_ERP, null, null, "post");
-
     }
 
 
@@ -823,7 +700,7 @@ public class ViewUtil {
      * @param: url 经过登录验证之后的URL路径跳转
      * text 客户端嵌入网页页面动态显示文字
      */
-    public static void WebLinks(Context ct, String url, String text) {
+    public static void webLinks(Context ct, String url, String text) {
         Intent intent_web = new Intent(ct, WebViewCommActivity.class);
         intent_web.putExtra("url", url);
         intent_web.putExtra("p", text);
@@ -835,7 +712,7 @@ public class ViewUtil {
      * @param: url 经过登录验证之后的URL路径跳转
      * text 客户端嵌入网页页面动态显示文字
      */
-    public static void WebLinks(Context ct, String url, String text, boolean isCookie) {
+    public static void webLinks(Context ct, String url, String text, boolean isCookie) {
         Intent intent_web = new Intent(ct, WebViewCommActivity.class);
         intent_web.putExtra("url", url);
         intent_web.putExtra("p", text);
@@ -853,6 +730,5 @@ public class ViewUtil {
         CommonUtil.clearSharedPreferences(ct, "b2b_login");
         CommonUtil.clearSharedPreferences(ct, "b2b_uu");
         CommonUtil.clearSharedPreferences(ct, "Master_ch");
-
     }
 }

+ 25 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/util/CommonUtil.java

@@ -6,6 +6,7 @@ import android.annotation.SuppressLint;
 import android.app.ActivityManager;
 import android.app.ActivityManager.RunningTaskInfo;
 import android.app.Dialog;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
@@ -22,6 +23,7 @@ import android.os.Build;
 import android.os.Handler;
 import android.text.Spannable;
 import android.text.SpannableStringBuilder;
+import android.text.TextUtils;
 import android.text.style.ForegroundColorSpan;
 import android.text.style.StyleSpan;
 import android.text.style.UnderlineSpan;
@@ -719,4 +721,27 @@ public class CommonUtil {
         headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
         ViewUtil.httpSendRequest(ct, url, param, mHandler, headers, codeWhat, null, null, "post");
     }
+
+
+    /**
+     * 判断某个界面是否在前台
+     *
+     * @param context
+     * @param className 某个界面名称
+     */
+    public static boolean isForeground(Context context, String className) {
+        if (context == null || TextUtils.isEmpty(className)) {
+            return false;
+        }
+        ActivityManager am = (ActivityManager) context
+                .getSystemService(Context.ACTIVITY_SERVICE);
+        List<RunningTaskInfo> list = am.getRunningTasks(1);
+        if (list != null && list.size() > 0) {
+            ComponentName cpn = list.get(0).topActivity;
+            if (className.equals(cpn.getClassName())) {
+                return true;
+            }
+        }
+        return false;
+    }
 }

+ 0 - 55
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/util/LoginERPUilt.java

@@ -1,55 +0,0 @@
-package com.xzjmyk.pm.activity.ui.erp.util;
-
-import android.content.Context;
-import android.os.Handler;
-import android.os.Message;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * Created by gongpengming on 2016/9/5.
- */
-public class LoginERPUilt {
-    private static LoginERPUilt instance;
-    private LoginListener listener = null;
-    private Handler handler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            if (msg.what == 0x11) {
-                if (listener == null) return;
-                listener.result(true);
-            }
-        }
-    };
-    private LoginERPUilt() {
-    }
-    public static LoginERPUilt getInstance() {
-        if (instance == null) {
-            synchronized (LoginERPUilt.class) {
-                instance = new LoginERPUilt();
-            }
-        }
-        return instance;
-    }
-
-
-    // 登录ERP gongpengming
-    public void LoginERPTask(Context ct, LoginListener listener) {
-        this.listener = listener;
-        String url = Constants.getAppBaseUrl(ct) + "mobile/login.action";
-        String master = CommonUtil.getSharedPreferences(ct, "erp_master");
-        String phone = CommonUtil.getSharedPreferences(ct, "user_phone");
-        String password = CommonUtil.getSharedPreferences(ct, "user_password");
-        Map<String, String> params = new HashMap<String, String>();
-        params.put("username", phone);
-        params.put("password", password);
-        params.put("master", master);
-        com.xzjmyk.pm.activity.ui.erp.net.ViewUtil.startNetThread(url, params, handler, 0x11, null, null, "post");
-    }
-
-    public interface LoginListener {
-        void result(boolean isLogin);
-    }
-}

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/SubscriptionActivity.java

@@ -521,7 +521,7 @@ public class SubscriptionActivity extends BaseActivity {
                             "&mainId=" + bean.getINSTANCE_ID_() + "&insId=" + bean.getID_() +
                             "&title=" + bean.getTITLE_();
                     String title = TimeUtils.ym_long_2_str(sortSubsrciprions.get(position).tiem) + "  " + bean.getTITLE_();
-                    ViewUtil.WebLinks(activity, url, title, true);
+                    ViewUtil.webLinks(activity, url, title, true);
                     if (bean.getSTATUS_() == 0) {//当点击未读消息
                         SubscriptionDao.getInstance().UpdateStatus(bean.getID_() + "", true);
                         sortSubsrciprions.get(position).beans.get(i).setSTATUS_(-1);

+ 1 - 1
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/uas/B2bMsgActivity.java

@@ -105,7 +105,7 @@ public class B2bMsgActivity extends BaseActivity {
               /*  String phone = CommonUtil.getSharedPreferences(B2bMsgActivity.this, "user_phone");
                 String password = CommonUtil.getSharedPreferences(B2bMsgActivity.this, "user_password");
                 String url = "http://www.ubtob.com/signin#/redirect/" + phone + "/" + password;
-                ViewUtil.WebLinks(B2bMsgActivity.this, url, "我的商务");*/
+                ViewUtil.webLinks(B2bMsgActivity.this, url, "我的商务");*/
                 B2BMsg msg = new B2BMsg();
                 Log.i("Arison", "id=" + holder.id);
                 msg.setId(holder.id);