Explorar o código

封装了网络请求,添加tags

Bitliker %!s(int64=8) %!d(string=hai) anos
pai
achega
c95ab41c9d

+ 2 - 0
app_core/common/build.gradle

@@ -40,6 +40,8 @@ dependencies {
     compile deps.stickyGridHeaders
     compile 'com.squareup.okhttp3:okhttp:3.9.0'
 
+    compile project(':network')
+
     compile project(':pullToRefershLibraryMy')
     compile project(':MPAndroidChart')
     compile project(':libedittextformlibrary')

+ 118 - 117
app_core/common/src/main/java/com/core/dao/Dao.java

@@ -18,122 +18,123 @@ import java.util.List;
 public abstract class Dao<T> {
 
 
-    public boolean insert(List<T> datas) {
-        if (ListUtils.isEmpty(datas)) return false;
-        long i = 0;
-        try {
-            SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
-            db.beginTransaction();
-            for (int j = 0; j < datas.size(); j++) {
-                T t = datas.get(j);
-                i = db.insert(getTable(), null, getValues(t));
-            }
-            db.setTransactionSuccessful();
-            db.endTransaction();
-        } finally {
-            DatabaseManager.getInstance().closeDatabase();
-            return i > 0;
-        }
-    }
-
-    public boolean insertAndUpdate(String where, String[][] whereArgss, List<T> datas) {
-        if (ListUtils.isEmpty(datas)) return false;
-        long i = 0;
-        try {
-            SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
-            db.beginTransaction();
-            for (int j = 0; j < datas.size(); j++) {
-                T t = datas.get(j);
-                i = db.insert(getTable(), null, getValues(t));
-                if (i < 0 && !StringUtil.isEmpty(where) && whereArgss != null && whereArgss.length > j) {
-                    i = db.update(getTable(), getValues(t), where, whereArgss[j]);
-                }
-            }
-            db.setTransactionSuccessful();
-            db.endTransaction();
-        } finally {
-            DatabaseManager.getInstance().closeDatabase();
-            return i > 0;
-        }
-    }
-
-    public boolean insert(T t, String updateWhere, String[] updateWhereArgs) {
-        if (t == null) return false;
-        long i = 0;
-        try {
-            SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
-            ContentValues values = getValues(t);
-            i = db.insert(getTable(), null, values);
-            if (i < 0) {
-                i = db.update(getTable(), values, updateWhere, updateWhereArgs);
-            }
-        } finally {
-            DatabaseManager.getInstance().closeDatabase();
-            return i > 0;
-        }
-    }
-
-
-    public boolean update(T t, String where, String[] whereArgs) {
-        if (t == null) return false;
-        long i = 0;
-        try {
-            SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
-            i = db.update(getTable(), getValues(t), where, whereArgs);
-        } finally {
-            DatabaseManager.getInstance().closeDatabase();
-            return i > 0;
-        }
-    }
-
-    public List<T> query(String where, String[] whereArgs) {
-        return query(null, where, whereArgs, null, null, null);
-    }
-
-    public List<T> query(String[] columns, String where, String[] whereArgs) {
-        return query(columns, where, whereArgs, null, null, null);
-    }
-
-    public List<T> query(String[] columns, String where, String[] whereArgs, String orderBy) {
-        return query(columns, where, whereArgs, null, null, orderBy);
-    }
-
-    public List<T> query(String[] columns, String where, String[] whereArgs, String groupBy, String having, String orderBy) {
-        List<T> datas = new ArrayList<T>();
-        try {
-            SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
-            Cursor c = db.query(getTable(), columns, where, whereArgs, groupBy, having, orderBy);
-            while (c.moveToNext()) {
-                T t = getData(c);
-                if (t != null) {
-                    datas.add(t);
-                }
-            }
-        } finally {
-            DatabaseManager.getInstance().closeDatabase();
-            return datas;
-        }
-    }
-
-    public boolean clear() {
-        return delete(null, null);
-    }
-
-    public boolean delete(String where, String[] whereArgs) {
-        long i = 0;
-        try {
-            SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
-            i = db.delete(getTable(), where, whereArgs);
-        } finally {
-            DatabaseManager.getInstance().closeDatabase();
-            return i > 0;
-        }
-    }
-
-    protected abstract String getTable();
-
-    protected abstract ContentValues getValues(T t) throws Exception;
-
-    protected abstract T getData(Cursor c) throws Exception;
+	public boolean insert(List<T> datas) {
+		if (ListUtils.isEmpty(datas)) return false;
+		long i = 0;
+		try {
+			SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
+			db.beginTransaction();
+			for (int j = 0; j < datas.size(); j++) {
+				T t = datas.get(j);
+				i = db.insert(getTable(), null, getValues(t));
+			}
+			db.setTransactionSuccessful();
+			db.endTransaction();
+		} finally {
+			DatabaseManager.getInstance().closeDatabase();
+			return i > 0;
+		}
+	}
+
+	public boolean insertAndUpdate(String where, String[][] whereArgss, List<T> datas) {
+		if (ListUtils.isEmpty(datas)) return false;
+		long i = 0;
+		try {
+			SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
+			db.beginTransaction();
+			for (int j = 0; j < datas.size(); j++) {
+				T t = datas.get(j);
+				i = db.insert(getTable(), null, getValues(t));
+				if (i < 0 && !StringUtil.isEmpty(where) && whereArgss != null && whereArgss.length > j) {
+					i = db.update(getTable(), getValues(t), where, whereArgss[j]);
+				}
+			}
+			db.setTransactionSuccessful();
+			db.endTransaction();
+		} finally {
+			DatabaseManager.getInstance().closeDatabase();
+			return i > 0;
+		}
+	}
+
+	public boolean insert(T t, String updateWhere, String[] updateWhereArgs) {
+		if (t == null) return false;
+		long i = 0;
+		try {
+			SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
+			ContentValues values = getValues(t);
+			i = db.insert(getTable(), null, values);
+			if (i < 0) {
+				i = db.update(getTable(), values, updateWhere, updateWhereArgs);
+			}
+		} finally {
+			DatabaseManager.getInstance().closeDatabase();
+			return i > 0;
+		}
+	}
+
+
+	public boolean update(T t, String where, String[] whereArgs) {
+		if (t == null) return false;
+		long i = 0;
+		try {
+			SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
+			i = db.update(getTable(), getValues(t), where, whereArgs);
+		} finally {
+			DatabaseManager.getInstance().closeDatabase();
+			return i > 0;
+		}
+	}
+
+	public List<T> query(String where, String[] whereArgs) {
+		return query(null, where, whereArgs, null, null, null);
+	}
+
+	public List<T> query(String[] columns, String where, String[] whereArgs) {
+		return query(columns, where, whereArgs, null, null, null);
+	}
+
+	public List<T> query(String[] columns, String where, String[] whereArgs, String orderBy) {
+		return query(columns, where, whereArgs, null, null, orderBy);
+	}
+
+	public List<T> query(String[] columns, String where, String[] whereArgs, String groupBy, String having, String orderBy) {
+		List<T> datas = new ArrayList<T>();
+		try {
+			SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
+			Cursor c = db.query(getTable(), columns, where, whereArgs, groupBy, having, orderBy);
+			while (c.moveToNext()) {
+				T t = getData(c);
+				if (t != null) {
+					datas.add(t);
+				}
+			}
+			c.close();
+		} finally {
+			DatabaseManager.getInstance().closeDatabase();
+			return datas;
+		}
+	}
+
+	public boolean clear() {
+		return delete(null, null);
+	}
+
+	public boolean delete(String where, String[] whereArgs) {
+		long i = 0;
+		try {
+			SQLiteDatabase db = DatabaseManager.getInstance().openDatabase();
+			i = db.delete(getTable(), where, whereArgs);
+		} finally {
+			DatabaseManager.getInstance().closeDatabase();
+			return i > 0;
+		}
+	}
+
+	protected abstract String getTable();
+
+	protected abstract ContentValues getValues(T t) throws Exception;
+
+	protected abstract T getData(Cursor c) throws Exception;
 
 }

+ 17 - 0
app_core/common/src/main/java/com/core/net/listener/OnSmartHttpListener.java

@@ -0,0 +1,17 @@
+package com.core.net.listener;
+
+import com.core.net.smart.Failure;
+import com.core.net.smart.Success;
+
+/**
+ * Created by Bitliker on 2017/9/29.
+ */
+
+public interface OnSmartHttpListener {
+
+	void onSuccess(Success success);
+
+	void onFailure(Failure failure);
+
+
+}

+ 33 - 0
app_core/common/src/main/java/com/core/net/smart/Failure.java

@@ -0,0 +1,33 @@
+package com.core.net.smart;
+
+
+import com.common.data.JSONUtil;
+import com.common.data.StringUtil;
+
+/**
+ * Created by Bitliker on 2017/6/14.
+ */
+
+public class Failure extends Result {
+	public Failure(Result result) {
+		super(result);
+	}
+
+	@Override
+	public String getMessage() {
+		if (message == null) {
+			return "";
+		} else {
+			if (isJSON()) {
+				String message = JSONUtil.getText(getMessage(), "exceptionInfo");
+				if (!StringUtil.isEmpty(message)) {
+					return message;
+				} else {
+					return super.getMessage();
+				}
+			} else {
+				return super.getMessage();
+			}
+		}
+	}
+}

+ 110 - 0
app_core/common/src/main/java/com/core/net/smart/Parameter.java

@@ -0,0 +1,110 @@
+package com.core.net.smart;
+
+import android.support.annotation.IntDef;
+
+import com.me.network.app.http.HttpClient;
+import com.me.network.app.http.Method;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Created by Bitliker on 2017/9/29.
+ */
+
+public class Parameter {
+
+	private boolean neetCommon;
+	private String baseUrl;
+	private String action;
+	private Tags tags;
+	private HttpClient.Builder httpBuilder;
+
+	private Parameter() {
+	}
+
+	public boolean isNeetCommon() {
+		return neetCommon;
+	}
+
+	public String getBaseUrl() {
+		return baseUrl;
+	}
+
+	public String getAction() {
+		return action;
+	}
+
+	public HttpClient.Builder getHttpBuilder() {
+		return httpBuilder;
+	}
+
+	public Tags getTags() {
+		return tags;
+	}
+
+	public static class Builder {
+
+		private Parameter parameter;
+
+		public Builder(boolean neetCommon) {
+			parameter = new Parameter();
+			parameter.tags=new Tags();
+			parameter.neetCommon = neetCommon;
+			parameter.httpBuilder = new HttpClient.Builder();
+		}
+
+		public Builder() {
+			parameter.neetCommon = true;
+			parameter.tags=new Tags();
+			parameter.httpBuilder = new HttpClient.Builder();
+		}
+
+		public Builder setBaseUrl(String baseUrl) {
+			parameter.baseUrl = baseUrl;
+			return this;
+		}
+
+		public Builder setAction(String action) {
+			parameter.action = action;
+			return this;
+		}
+
+		public Builder add(String key, Object value) {
+			parameter.httpBuilder.add(key, value);
+			return this;
+		}
+
+		public Builder header(String key, Object value) {
+			parameter.httpBuilder.header(key, value);
+			return this;
+		}
+
+		public Builder tag(int key, Object value) {
+			parameter.tags.put(key, value);
+			return this;
+		}
+
+		public Builder tag(Object value) {
+			parameter.tags.put(Tags.DEF_TAG, value);
+			return this;
+		}
+
+		public Builder record(int value) {
+			parameter.tags.put(Tags.RECORD_TAG, value);
+			return this;
+		}
+
+		public Builder setTags(Tags tags) {
+			if (tags != null) {
+				parameter.tags = tags;
+			}
+			return this;
+		}
+
+		public Parameter build() {
+			return parameter;
+		}
+	}
+
+}

+ 106 - 0
app_core/common/src/main/java/com/core/net/smart/Result.java

@@ -0,0 +1,106 @@
+package com.core.net.smart;
+
+import android.text.TextUtils;
+
+import com.alibaba.fastjson.JSON;
+
+/**
+ * Created by Bitliker on 2017/7/19.
+ */
+
+public class Result {
+    public static final int NETWORK_OUT = 543 >> 1;//网络连接失败
+    public static final int DATA_EXCEPTION = 542 >> 1;//数据处理异常
+    public static final int PARAMETER_ERROR = 541 >> 1;//参数错误
+    public static final int REQUEST_ERROR = 500;//请求失败
+    public static final int REQUEST_OK = 200;//请求成功
+
+    protected int code;
+    protected String message;
+    protected Tags tag;
+
+    public Result(Result result) {
+        this.code = result.code;
+        this.message = result.message;
+        this.tag = result.tag;
+    }
+
+    public Result(int code, String message) {
+        this.code = code;
+        this.message = message;
+    }
+
+
+    public Tags getTags() {
+        return tag == null ? new Tags() : tag;
+    }
+
+    public Object getTag() {
+        return getTags().getTag();
+    }
+
+    public Object getTag(int key) {
+        return getTags().get(key);
+    }
+
+    public void setTag(Tags tag) {
+        this.tag = tag;
+    }
+
+    public int getRecord() {
+        return getTags().getRecord();
+    }
+
+    public Result(int code) {
+        this.code = code;
+    }
+
+    public Result() {
+        this.code = REQUEST_ERROR;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public boolean isJSON() {
+        return isJsonObject() || isJsonArray();
+    }
+
+    public boolean isJsonObject() {
+        if (TextUtils.isEmpty(message)) return false;
+        try {
+            JSON.parseObject(message);
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    public boolean isJsonArray() {
+        if (TextUtils.isEmpty(message)) return false;
+        try {
+            JSON.parseArray(message);
+            return true;
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    public boolean requestOK() {
+        return code == 200;
+    }
+}
+

+ 138 - 0
app_core/common/src/main/java/com/core/net/smart/SmartHttpClient.java

@@ -0,0 +1,138 @@
+package com.core.net.smart;
+
+import android.support.annotation.IntDef;
+
+import com.common.LogUtil;
+import com.common.config.BaseConfig;
+import com.core.net.listener.OnSmartHttpListener;
+import com.core.utils.CommonUtil;
+import com.me.network.app.http.HttpClient;
+import com.me.network.app.http.Method;
+import com.me.network.app.http.rx.Result2Listener;
+import com.me.network.app.http.rx.ResultSubscriber;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Created by Bitliker on 2017/9/29.
+ */
+
+public class SmartHttpClient {
+
+	private static SmartHttpClient api;
+	private static HttpClient httpClient;
+	private static HttpClient httpClientErp;
+	private boolean isB2b;
+
+	public static SmartHttpClient api() {
+		SmartHttpClient inst = api;
+		if (inst == null) {
+			synchronized (SmartHttpClient.class) {
+				inst = api;
+				if (inst == null) {
+					inst = new SmartHttpClient();
+					api = inst;
+				}
+			}
+		}
+		return inst;
+	}
+
+	private SmartHttpClient() {
+		isB2b = false;
+	}
+
+	public void get(Parameter parameter, OnSmartHttpListener onSmartHttpListener) {
+		send(Method.GET, parameter, onSmartHttpListener);
+	}
+
+	public void post(Parameter parameter, OnSmartHttpListener onSmartHttpListener) {
+		send(Method.POST, parameter, onSmartHttpListener);
+	}
+
+	private void send(@Duration int mothod, final Parameter parameter, final OnSmartHttpListener onSmartHttpListener) {
+		if (parameter == null) {
+			return;
+		}
+		HttpClient httpClient = null;
+		if (parameter.isNeetCommon()) {
+			httpClient = getHttpClientErp(parameter.getBaseUrl());
+		} else {
+			httpClient = getHttpClient(parameter.getBaseUrl());
+		}
+		HttpClient.Builder builder = parameter.getHttpBuilder();
+		builder.method(mothod);
+		httpClient.Api().post(builder.build(), new ResultSubscriber<>(new Result2Listener<Object>() {
+			@Override
+			public void onResponse(Object t) {
+				try {
+					Result result = new Result(200, t.toString());
+					onSmartHttpListener.onSuccess(new Success(result));
+				} catch (Exception e) {
+					if (e != null) {
+						LogUtil.d("httpError", e.getMessage());
+					}
+				}
+
+			}
+
+			@Override
+			public void onFailure(Object t) {
+				try {
+					Result result = new Result(500, t.toString());
+					onSmartHttpListener.onFailure(new Failure(result));
+				} catch (Exception e) {
+					if (e != null) {
+						LogUtil.d("httpError", e.getMessage());
+					}
+				}
+			}
+		}));
+	}
+
+	private HttpClient getHttpClient(String baseUrl) {
+		if (httpClient == null) {
+			if (baseUrl == null || baseUrl.length() <= 0 || !baseUrl.startsWith("http")) {
+				baseUrl = CommonUtil.getAppBaseUrl(BaseConfig.getContext());
+			}
+			httpClient = new HttpClient.Builder(baseUrl)
+					.isDebug(BaseConfig.isDebug())
+					.connectTimeout(5000)
+					.readTimeout(5000)
+					.build();
+		}
+		return httpClient;
+	}
+
+
+	public static HttpClient getHttpClientErp(String baseUrl) {
+		if (httpClientErp == null) {
+			if (baseUrl == null || baseUrl.length() <= 0 || !baseUrl.startsWith("http")) {
+				baseUrl = CommonUtil.getAppBaseUrl(BaseConfig.getContext());
+			}
+			String sessionId = CommonUtil.getSharedPreferences(BaseConfig.getContext(), "sessionId");
+			httpClientErp = new HttpClient.Builder(baseUrl)
+					.isDebug(BaseConfig.isDebug())
+					.header("Cookie", "JSESSIONID=" + sessionId)
+					.add("master", CommonUtil.getMaster())
+					.add("sessionUser", CommonUtil.getEmcode())
+					.add("sessionId", sessionId)
+					.connectTimeout(5000)
+					.readTimeout(5000)
+					.build();
+		}
+		return httpClientErp;
+	}
+
+	public void updateB2b(boolean isB2b) {
+		this.isB2b = isB2b;
+		//TODO 进行HttpClient的初始化
+	}
+
+
+	@IntDef({Method.GET, Method.POST})
+	@Retention(RetentionPolicy.SOURCE)
+	public @interface Duration {
+	}
+}

+ 57 - 0
app_core/common/src/main/java/com/core/net/smart/Success.java

@@ -0,0 +1,57 @@
+package com.core.net.smart;
+
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+
+/**
+ * Created by Bitliker on 2017/6/14.
+ */
+
+public class Success extends Result {
+
+
+    public Success(Result result) {
+        super(result);
+    }
+
+
+    public JSONObject getJsonObject() {
+        if (isJSON())
+            return JSON.parseObject(message);
+        else return new JSONObject();
+    }
+
+    public JSONObject getJsonObject(String... keys) {
+        if (isJSON()) {
+            JSONObject object = JSON.parseObject(message);
+            if (object != null && keys != null && keys.length > 0) {
+                for (String key : keys) {
+                    if (object.containsKey(key) && object.get(key) instanceof JSONObject) {
+                        return object.getJSONObject(key);
+                    }
+                }
+            }
+        }
+        return new JSONObject();
+    }
+
+    public JSONArray getJSONArray() {
+        if (isJSON())
+            return JSON.parseArray(message);
+        else return new JSONArray();
+    }
+
+    public JSONArray getJSONArray(String key) {
+        if (isJSON()) {
+            try {
+                return JSON.parseObject(message).getJSONArray(key);
+            } catch (Exception e) {
+                return new JSONArray();
+            }
+        } return new JSONArray();
+    }
+
+
+}

+ 31 - 0
app_core/common/src/main/java/com/core/net/smart/Tags.java

@@ -0,0 +1,31 @@
+package com.core.net.smart;
+
+import android.util.SparseArray;
+
+/**
+ * Created by Bitliker on 2017/8/16.
+ */
+
+public class Tags extends SparseArray<Object> {
+
+    public static final int DEF_TAG = 2054;
+    public static final int RECORD_TAG = 2055;
+
+
+    public int getRecord() {
+        Object t = get(RECORD_TAG);
+        return t != null && t instanceof Integer ? (int) t : -1;
+    }
+
+    public Object getTag() {
+        return get(DEF_TAG);
+    }
+
+    public void tag(Object t) {
+        put(DEF_TAG, t);
+    }
+
+    public void record(int code) {
+        put(RECORD_TAG, code);
+    }
+}

+ 0 - 3
app_core/network/build.gradle

@@ -25,9 +25,6 @@ dependencies {
     })
     testCompile deps.junit
     compile deps.appcompatV7
-    
-    compile project(":common")
-    
     compile deps.rxjava
     compile deps.rxandroid
     compile deps.okhttp

+ 1 - 0
app_modular/apptasks/.gitignore

@@ -0,0 +1 @@
+/build

+ 27 - 0
app_modular/apptasks/build.gradle

@@ -0,0 +1,27 @@
+apply plugin: 'com.android.library'
+
+
+android {
+    compileSdkVersion rootProject.ext.android.compileSdkVersion
+    buildToolsVersion rootProject.ext.android.buildToolsVersion
+    defaultConfig {
+        minSdkVersion rootProject.ext.android.minSdkVersion
+        targetSdkVersion rootProject.ext.android.targetSdkVersion
+        versionCode rootProject.ext.android.versionCode
+        versionName rootProject.ext.android.versionName
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    compile fileTree(include: ['*.jar'], dir: 'libs')
+    testCompile deps.junit
+    compile deps.appcompatV7
+    compile project(':common')
+    compile project(':network')
+}

+ 25 - 0
app_modular/apptasks/proguard-rules.pro

@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in C:\Users\Bitliker\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 13 - 0
app_modular/apptasks/src/main/AndroidManifest.xml

@@ -0,0 +1,13 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+
+          package="com.modular.apptasks"
+>
+
+    <application android:allowBackup="true"
+                 android:label="@string/app_name"
+                 android:supportsRtl="true"
+    >
+
+    </application>
+
+</manifest>

+ 33 - 0
app_modular/apptasks/src/main/java/com/modular/apptasks/AutoTasks.java

@@ -0,0 +1,33 @@
+package com.modular.apptasks;
+
+/**
+ * Created by Bitliker on 2017/9/29.
+ */
+
+public class AutoTasks {
+	private static AutoTasks instance;
+
+	public static AutoTasks getInstance() {
+		AutoTasks inst = instance;
+		if (inst == null) {
+			synchronized (AutoTasks.class) {
+				inst = instance;
+				if (inst == null) {
+					inst = new AutoTasks();
+					instance = inst;
+				}
+			}
+		}
+		return inst;
+	}
+
+	private AutoTasks() {
+
+	}
+
+
+
+
+
+
+}

+ 3 - 0
app_modular/apptasks/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">AppTasks</string>
+</resources>

+ 2 - 0
settings.gradle

@@ -15,6 +15,7 @@ include ':appbooking'
 include ':appme'
 include ':appworks'
 include ':appmoments'
+include  ':apptasks'
 
 //第三库模块
 include ':lib-zxing'
@@ -44,6 +45,7 @@ project(':appcontact').projectDir = new File('app_modular/appcontact')
 project(':appmessages').projectDir = new File('app_modular/appmessages')
 project(':appbooking').projectDir = new File('app_modular/appbooking')
 project(':appmoments').projectDir = new File('app_modular/appmoments')
+project(':apptasks').projectDir = new File('app_modular/apptasks')
 
 //第三库模块
 project(':lib-zxing').projectDir = new File('app_third/lib-zxing')