Browse Source

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

raomeng 8 years ago
parent
commit
a70cb51b08
27 changed files with 883 additions and 32 deletions
  1. 6 12
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/message/ProcessMsgActivity.java
  2. 16 11
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/adapter/oa/ApprovalAdapter.java
  3. 1 0
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/db/DBManager.java
  4. 6 7
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/presenter/ApprovaPresenter.java
  5. 1 0
      app_core/message/.gitignore
  6. 29 0
      app_core/message/build.gradle
  7. 25 0
      app_core/message/proguard-rules.pro
  8. 26 0
      app_core/message/src/androidTest/java/com/umano/message/supertoasts/ExampleInstrumentedTest.java
  9. 3 0
      app_core/message/src/main/AndroidManifest.xml
  10. 102 0
      app_core/message/src/main/java/com/uas/message/supertoasts/imp/BaseToastImpl.java
  11. 221 0
      app_core/message/src/main/java/com/uas/message/supertoasts/imp/ToastCustomizedImpl.java
  12. 37 0
      app_core/message/src/main/java/com/uas/message/supertoasts/interfacepack/BaseToast.java
  13. 78 0
      app_core/message/src/main/java/com/uas/message/supertoasts/interfacepack/CustomizedToast.java
  14. 194 0
      app_core/message/src/main/java/com/uas/message/supertoasts/utils/ToastUtils.java
  15. 36 0
      app_core/message/src/main/java/com/uas/message/supertoasts/utils/Utils.java
  16. 10 0
      app_core/message/src/main/java/com/uas/message/supertoasts/utils/ViewUtils.java
  17. 33 0
      app_core/message/src/main/res/anim/anim_in.xml
  18. 7 0
      app_core/message/src/main/res/anim/anim_out.xml
  19. BIN
      app_core/message/src/main/res/drawable-hdpi/uuu.png
  20. BIN
      app_core/message/src/main/res/drawable-xhdpi/uuu.png
  21. BIN
      app_core/message/src/main/res/drawable-xxhdpi/uuu.png
  22. 8 0
      app_core/message/src/main/res/drawable/blue_toastborder.xml
  23. 14 0
      app_core/message/src/main/res/layout/my_customized_toast.xml
  24. 3 0
      app_core/message/src/main/res/values/strings.xml
  25. 7 0
      app_core/message/src/main/res/values/style.xml
  26. 17 0
      app_core/message/src/test/java/com/umano/message/supertoasts/ExampleUnitTest.java
  27. 3 2
      settings.gradle

+ 6 - 12
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/activity/message/ProcessMsgActivity.java

@@ -633,20 +633,19 @@ public class ProcessMsgActivity extends BaseActivity implements View.OnClickList
                     String jn_dealresult = jsonArray.getJSONObject(position).getString("JN_DEALRESULT");
                     int done_emid = OACheckUtil.getJsonIntager(jsonArray.getJSONObject(position), "EM_IMID");
                     model.name.setText(jn_dealmanname + "的" + jp_name);
-                    Long L = TimeUtils.s_str_2_long(jn_dealtime);
-                    model.date.setText(DateFormatUtil.getStrDate4Date(new Date(L), "MM-dd HH:mm"));
-//                    model.date.setText(jn_dealtime);
+                    if (!StringUtils.isEmpty(jn_dealtime)){
+                        Long L = TimeUtils.s_str_2_long(jn_dealtime);
+                        model.date.setText(DateFormatUtil.getStrDate4Date(new Date(L), "MM-dd HH:mm"));
+                    }else {
+                        model.date.setText("");
+                    }
                     if (!StringUtils.isEmpty(jn_dealresult)) {
                         if ("不同意".equals(jn_dealresult)) {
-//                            CommonUtil.textSpanForStyle(model.status, getString(R.string.status_approved) + "(" + jn_dealresult + ")",
-//                                    jn_dealresult, mContext.getResources().getColor(R.color.red));
                             model.status.setTextColor(getResources().getColor(R.color.red));
                             model.status.setText("已拒绝");
 
                         } else {
                             if ("变更处理人".equals(jn_dealresult)) {
-//                                CommonUtil.textSpanForStyle(model.status, getString(R.string.status_approved) + "(" + jn_dealresult + ")",
-//                                        jn_dealresult, mContext.getResources().getColor(R.color.done_approval));
                                 model.status.setTextColor(getResources().getColor(R.color.done_approval));
                                 if (!StringUtils.isEmpty(jsonArray.getJSONObject(position).getString("JN_OPERATEDDESCRIPTION"))) {
                                     model.status.setText("已变更处理人(" + jsonArray.getJSONObject(position).getString("JN_OPERATEDDESCRIPTION") + ")");
@@ -654,8 +653,6 @@ public class ProcessMsgActivity extends BaseActivity implements View.OnClickList
                                     model.status.setText("已变更处理人");
                                 }
                             } else {
-//                                CommonUtil.textSpanForStyle(model.status, getString(R.string.status_approved) + "(" + jn_dealresult + ")",
-//                                        jn_dealresult, mContext.getResources().getColor(R.color.blue));
                                 model.status.setTextColor(getResources().getColor(R.color.titleBlue));
                                 model.status.setText("已同意");
                             }
@@ -705,7 +702,6 @@ public class ProcessMsgActivity extends BaseActivity implements View.OnClickList
                             status = " ";
                         }
                         if (!StringUtils.isEmpty(name)) name = name.substring(0, name.length() - 2);
-//                        model.name.setText(name + "-" + code);
                         model.name.setText(name);
                         if (time != null) {
                             model.date.setText(DateFormatUtil.getStrDate4Date(new Date(time), "MM-dd HH:mm"));
@@ -713,8 +709,6 @@ public class ProcessMsgActivity extends BaseActivity implements View.OnClickList
                             model.date.setText("");
                         }
                         if (status.contains("未通过")) {
-//                            CommonUtil.textSpanForStyle(model.status, status,
-//                                    status, mContext.getResources().getColor(R.color.red));
                             model.status.setTextColor(mContext.getResources().getColor(R.color.red));
 
                         }

+ 16 - 11
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/adapter/oa/ApprovalAdapter.java

@@ -91,16 +91,20 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
 
     @Override
     public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
-        if (holder instanceof TitleViewHolder) {
-            bindTitleView((TitleViewHolder) holder, position);
-        } else if (holder instanceof BaseRVViewHodler) {
-            bindBaseRVView((BaseRVViewHodler) holder, position);
-        } else if (holder instanceof TagViewHolder) {
-            bindTAGView((TagViewHolder) holder, position);
-        } else if (holder instanceof PointsViewHolder) {
-            bindPointsView((PointsViewHolder) holder, position);
-        } else if (holder instanceof NodeViewHolder) {
-            bindNodeView((NodeViewHolder) holder, position);
+        try {
+            if (holder instanceof TitleViewHolder) {
+                bindTitleView((TitleViewHolder) holder, position);
+            } else if (holder instanceof BaseRVViewHodler) {
+                bindBaseRVView((BaseRVViewHodler) holder, position);
+            } else if (holder instanceof TagViewHolder) {
+                bindTAGView((TagViewHolder) holder, position);
+            } else if (holder instanceof PointsViewHolder) {
+                bindPointsView((PointsViewHolder) holder, position);
+            } else if (holder instanceof NodeViewHolder) {
+                bindNodeView((NodeViewHolder) holder, position);
+            }
+        } catch (Exception e) {
+
         }
     }
 
@@ -379,7 +383,8 @@ public class ApprovalAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolde
         AvatarHelper.getInstance().display(approval.getIdKey(), holder.handIv, true, false);
         if (approval.getId() > 0) {
             holder.statusIv.setVisibility(View.VISIBLE);
-            holder.statusIv.setImageResource(approval.getId());
+            if (approval.getId() > 0)
+                holder.statusIv.setImageResource(approval.getId());
         } else {
             holder.statusIv.setVisibility(View.GONE);
         }

+ 1 - 0
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/db/DBManager.java

@@ -49,6 +49,7 @@ public class DBManager {
 
     ;
 
+    @Deprecated
     public DBManager() {
         db = DatabaseManager.getInstance().openDatabase();
     }

+ 6 - 7
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/erp/presenter/ApprovaPresenter.java

@@ -65,7 +65,6 @@ public class ApprovaPresenter implements OnHttpResultListener {
 
     private IApproval iApproval;
     private ApprovalRecord record;
-    private DBManager manager;
     public String chchePoints = "";//审批要点缓存
     private String title;
     private String master;
@@ -140,10 +139,10 @@ public class ApprovaPresenter implements OnHttpResultListener {
     }
 
     public void closeDB() {
-        if (manager != null) {
-            manager.closeDB();
-            manager = null;
-        }
+//        if (manager != null) {
+//            manager.closeDB();
+//            manager = null;
+//        }
     }
 
     public String getUrl(String baseUrl, String title) {
@@ -982,7 +981,7 @@ public class ApprovaPresenter implements OnHttpResultListener {
                     }
                 }
                 int reId = -1;
-                if ("未通过".equals(record.status)||"已结束".equals(record.status)) {
+                if ("未通过".equals(record.status) || "已结束".equals(record.status)) {
                     reId = R.drawable.unapproved;
                 } else if (!hanNotApproval) {
                     reId = R.drawable.approved;
@@ -1225,7 +1224,7 @@ public class ApprovaPresenter implements OnHttpResultListener {
     }
 
     private int getImByCode(String emCode) {
-        if (manager == null) manager = new DBManager();
+        DBManager manager = DBManager.getInstance();
         String whichsys = CommonUtil.getMaster();
         if (StringUtils.isEmpty(emCode) || StringUtils.isEmpty(whichsys)) return 0;
         String[] selectionArgs = {emCode, whichsys};

+ 1 - 0
app_core/message/.gitignore

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

+ 29 - 0
app_core/message/build.gradle

@@ -0,0 +1,29 @@
+apply plugin: 'com.android.library'
+
+
+android {
+    compileSdkVersion 24
+    buildToolsVersion "25.0.0"
+
+
+    defaultConfig {
+        minSdkVersion 16
+        targetSdkVersion 24
+        versionCode 1
+        versionName "1.0"
+
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    compile fileTree(dir: 'libs', include: ['*.jar'])
+    compile 'com.android.support:appcompat-v7:24.2.1'
+    testCompile 'junit:junit:4.12'
+    compile 'com.github.johnpersano:supertoasts:2.0'
+}

+ 25 - 0
app_core/message/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 E:\Android-Studio\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

+ 26 - 0
app_core/message/src/androidTest/java/com/umano/message/supertoasts/ExampleInstrumentedTest.java

@@ -0,0 +1,26 @@
+package com.umano.message.supertoasts;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumentation test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+    @Test
+    public void useAppContext() throws Exception {
+        // Context of the app under test.
+        Context appContext = InstrumentationRegistry.getTargetContext();
+
+        assertEquals("com.umano.fanglh.supertoasts.test", appContext.getPackageName());
+    }
+}

+ 3 - 0
app_core/message/src/main/AndroidManifest.xml

@@ -0,0 +1,3 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.umano.message.supertoasts">
+</manifest>

+ 102 - 0
app_core/message/src/main/java/com/uas/message/supertoasts/imp/BaseToastImpl.java

@@ -0,0 +1,102 @@
+package com.uas.message.supertoasts.imp;
+
+import android.app.Activity;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.BitmapFactory;
+import android.support.v7.app.NotificationCompat;
+import android.view.Gravity;
+
+import com.github.johnpersano.supertoasts.library.Style;
+import com.github.johnpersano.supertoasts.library.SuperToast;
+import com.github.johnpersano.supertoasts.library.utils.PaletteUtils;
+import com.uas.message.supertoasts.interfacepack.BaseToast;
+import com.uas.message.supertoasts.utils.Utils;
+import com.umano.message.supertoasts.R;
+
+/**
+ * 暂时做成工具类,后面调整灵活切换,这里不设置颜色
+ * Created by Arison on 2017/5/25.
+ * 自定义工具实现,主要是位置,其他默认
+ */
+public class BaseToastImpl implements BaseToast {
+    
+    private static BaseToastImpl instance;
+    
+    public static BaseToastImpl getInstance(){
+        if (instance==null){
+            synchronized (BaseToastImpl.class){
+                if (instance==null){
+                    instance=new BaseToastImpl();
+                }
+            }
+        }
+        return  instance;
+    }
+    @Override
+    public void show(Context ct, String text) {
+        if (ct == null) ct = Utils.getContext();
+        new SuperToast(ct).setText(text)
+                .setDuration(Style.DURATION_VERY_LONG)
+                .setColor(PaletteUtils.getTransparentColor(PaletteUtils.DARK_GREY))
+                .setAnimations(Style.ANIMATIONS_FADE)
+                .setFrame(Style.FRAME_STANDARD)
+                .show();
+    }
+
+    @Override
+    public void showAtTop(Context ct, String text) {
+        if (ct == null) ct = Utils.getContext();
+        new SuperToast(ct).setText(text)
+                .setDuration(Style.DURATION_VERY_LONG)
+                .setColor(PaletteUtils.getTransparentColor(PaletteUtils.DARK_GREY))
+                .setAnimations(Style.ANIMATIONS_FADE)
+                .setFrame(Style.FRAME_STANDARD)
+                .setGravity(Gravity.TOP)
+                .show();
+    }
+
+    @Override
+    public void showAtCenter(Context ct, String text) {
+        if (ct == null) ct = Utils.getContext();
+        new SuperToast(ct).setText(text)
+                .setDuration(Style.DURATION_VERY_LONG)
+                .setColor(PaletteUtils.getTransparentColor(PaletteUtils.DARK_GREY))
+                .setAnimations(Style.ANIMATIONS_FADE)
+                .setFrame(Style.FRAME_STANDARD)
+                .setGravity(Gravity.CENTER)
+                .show();
+    }
+
+    @Override
+    public void showAtBottom(Context ct, String text) {
+        if (ct == null) ct = Utils.getContext();
+        new SuperToast(ct).setText(text)
+                .setDuration(Style.DURATION_VERY_LONG)
+                .setColor(PaletteUtils.getTransparentColor(PaletteUtils.DARK_GREY))
+                .setAnimations(Style.ANIMATIONS_FADE)
+                .setFrame(Style.FRAME_STANDARD)
+                .setGravity(Gravity.BOTTOM)
+                .show();
+    }
+
+    @Override
+    public void showAtNotiftion(Context ct, Class<? extends Activity> clazz, String title, String text) {
+        if (ct == null) ct = Utils.getContext();
+        NotificationManager mNotificationManager = (NotificationManager) ct.getSystemService(Context.NOTIFICATION_SERVICE);
+        NotificationCompat.Builder builder = new NotificationCompat.Builder(ct.getApplicationContext());
+        builder.setSmallIcon(R.drawable.uuu);
+        builder.setLargeIcon(BitmapFactory.decodeResource(ct.getResources(), R.drawable.uuu)); // 设置下拉列表中的图标(大图标)
+        builder.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
+        builder.setAutoCancel(true);
+        builder.setContentTitle(title);
+        builder.setContentText(text);
+        Intent intent = new Intent(ct, clazz);
+        PendingIntent pendingIntent = PendingIntent.getActivity(ct.getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+        builder.setContentIntent(pendingIntent);
+        mNotificationManager.notify(1000, builder.build());
+    }
+}

+ 221 - 0
app_core/message/src/main/java/com/uas/message/supertoasts/imp/ToastCustomizedImpl.java

@@ -0,0 +1,221 @@
+package com.uas.message.supertoasts.imp;
+
+import android.app.Activity;
+import android.app.Notification;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.BitmapFactory;
+import android.graphics.PixelFormat;
+import android.support.annotation.LayoutRes;
+import android.support.v7.app.NotificationCompat;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.uas.message.supertoasts.interfacepack.CustomizedToast;
+import com.uas.message.supertoasts.utils.Utils;
+import com.umano.message.supertoasts.R;
+
+import java.util.Timer;
+import java.util.TimerTask;
+
+
+/**
+ * Created by FANGlh on 2017/8/10.
+ * function: 自定义工具实现,主要有颜色,动画效果,自定义布局,自定义通知设置图片
+ */
+
+public class ToastCustomizedImpl implements CustomizedToast {
+    private static ToastCustomizedImpl instance;
+    public static ToastCustomizedImpl getInstance(){
+        if (instance==null){
+            synchronized (ToastCustomizedImpl.class){
+                if (instance==null){
+                    instance=new ToastCustomizedImpl();
+                }
+            }
+        }
+        return  instance;
+    }
+
+    @Override
+    public void show(Context ct, String text,int messageColor, int backgroundcolor,int duration) {
+        if (ct == null) ct = Utils.getContext();
+        Toast toast = null;
+        if (duration == 1)
+            toast = Toast.makeText(ct, text, Toast.LENGTH_LONG);
+        else
+            toast = Toast.makeText(ct, text, Toast.LENGTH_SHORT);
+        View view = toast.getView();
+        TextView message=((TextView) view.findViewById(android.R.id.message));
+        if (backgroundcolor != -1)
+            message.setBackgroundResource(backgroundcolor);
+        if (messageColor != -1)
+            message.setTextColor(messageColor);
+        toast.show();
+    }
+
+    @Override
+    public void showAtTop(Context ct, String text,int messageColor, int backgroundcolor,int duration) {
+        if (ct == null) ct = Utils.getContext();
+        Toast toast = null;
+        if (duration == 1)
+            toast = Toast.makeText(ct, text, Toast.LENGTH_LONG);
+        else
+            toast = Toast.makeText(ct, text, Toast.LENGTH_SHORT);
+        //设置Toast的位置
+        toast.setGravity(Gravity.TOP, toast.getXOffset()/2, toast.getYOffset()/5);
+        View view = toast.getView();
+        TextView message=((TextView) view.findViewById(android.R.id.message));
+        if (backgroundcolor != -1)
+            message.setBackgroundResource(backgroundcolor);
+        if (messageColor != -1)
+            message.setTextColor(messageColor);
+        toast.show();
+    }
+
+    @Override
+    public void showAtCenter(Context ct, String text,int messageColor, int backgroundcolor,int duration) {
+        if (ct == null) ct = Utils.getContext();
+        Toast toast = null;
+        if (duration == 1)
+            toast = Toast.makeText(ct, text, Toast.LENGTH_LONG);
+        else
+            toast = Toast.makeText(ct, text, Toast.LENGTH_SHORT);
+        //设置Toast的位置
+        toast.setGravity(Gravity.CENTER, toast.getXOffset()/2, toast.getYOffset()/2);
+
+        View view = toast.getView();
+        TextView message=((TextView) view.findViewById(android.R.id.message));
+        if (backgroundcolor != -1)
+            message.setBackgroundResource(backgroundcolor);
+        if (messageColor != -1)
+            message.setTextColor(messageColor);
+        toast.show();
+    }
+
+    @Override
+    public void showAtBottom(Context ct, String text,int messageColor, int backgroundcolor,int duration) {
+        if (ct == null) ct = Utils.getContext();
+        Toast toast = null;
+        if (duration == 1)
+            toast = Toast.makeText(ct, text, Toast.LENGTH_LONG);
+        else
+            toast = Toast.makeText(ct, text, Toast.LENGTH_SHORT);
+        //设置Toast的位置
+        toast.setGravity(Gravity.BOTTOM, toast.getXOffset()/2, toast.getYOffset()/5);
+        View view = toast.getView();
+        TextView message=((TextView) view.findViewById(android.R.id.message));
+        if (backgroundcolor != -1)
+            message.setBackgroundResource(backgroundcolor);
+        if (messageColor != -1)
+            message.setTextColor(messageColor);
+//        message.setTextSize(18);
+        toast.show();
+    }
+
+    @Override
+    public void showAtNotiftion(Context ct,Class<? extends Activity> clazz, String title, String text, int pictureid) {
+        if (ct == null) ct = Utils.getContext();
+        NotificationManager mNotificationManager = (NotificationManager) ct.getSystemService(Context.NOTIFICATION_SERVICE);
+        NotificationCompat.Builder builder = new NotificationCompat.Builder(ct.getApplicationContext());
+        builder.setSmallIcon(pictureid);
+        builder.setLargeIcon(BitmapFactory.decodeResource(ct.getResources(),pictureid)); // 设置下拉列表中的图标(大图标)
+        builder.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
+        builder.setAutoCancel(true);
+        builder.setContentTitle(title);
+        builder.setContentText(text);
+        Intent intent = new Intent(ct, clazz);
+        PendingIntent pendingIntent = PendingIntent.getActivity(ct.getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
+        builder.setContentIntent(pendingIntent);
+        mNotificationManager.notify(1000, builder.build());
+    }
+
+    @Override
+    public void showCuslayoutToast(Context ct, String text,@LayoutRes int resource,int location) {
+        if (ct == null) ct = Utils.getContext();
+        View toastRoot = LayoutInflater.from(ct).inflate(resource, null);
+        Toast toast=new Toast(ct.getApplicationContext());
+        toast.setGravity(location, toast.getXOffset()/2, toast.getYOffset()/5);
+        toast.setView(toastRoot);
+        TextView tv=(TextView)toastRoot.findViewById(R.id.TextViewInfo);  //TODO 这里的控件监听事件和传统一致,但是得单独写,不能用工具类实现
+        tv.setText(text);
+        toast.show();
+    }
+
+    @Override
+    public void showWithPicuure(Context ct, String text, int pictureid, int duration, int messageColor,int location) {
+        if (ct == null) ct = Utils.getContext();
+        Toast toast = null;
+        if (duration == 1)
+            toast = Toast.makeText(ct, text, Toast.LENGTH_LONG);
+        else
+            toast = Toast.makeText(ct, text, Toast.LENGTH_SHORT);
+        toast.setGravity(location, 0, 0);
+        LinearLayout toastView = (LinearLayout) toast.getView();
+        ImageView imageCodeProject = new ImageView(ct);
+        imageCodeProject.setImageResource(pictureid);
+        toastView.addView(imageCodeProject, 0);
+        View view = toast.getView();
+        TextView message=((TextView) view.findViewById(android.R.id.message));
+        if (messageColor != -1)
+            message.setTextColor(messageColor);
+        toast.show();
+    }
+
+    @Override
+    public void showMiuiText(Context context, String text, int duration,int location) {
+
+        final WindowManager mWdm;
+        final View mToastView;
+        WindowManager.LayoutParams mParams;
+        Timer mTimer;
+        boolean mShowTime;//记录Toast的显示长短类型
+        final boolean[] mIsShow = new boolean[1];//记录当前Toast的内容是否已经在显示
+        if (duration == 1)
+            mShowTime = true;//记录Toast的显示长短类型
+        else
+            mShowTime = false;
+        mIsShow[0] = false;//记录当前Toast的内容是否已经在显示
+        mWdm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+        //通过Toast实例获取当前android系统的默认Toast的View布局
+        mToastView = Toast.makeText(context, text, Toast.LENGTH_SHORT).getView();
+        mTimer = new Timer();
+
+        mParams = new WindowManager.LayoutParams();
+        mParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
+        mParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
+        mParams.format = PixelFormat.TRANSLUCENT;
+        mParams.windowAnimations = R.style.anim_view;//设置进入退出动画效果
+        mParams.type = WindowManager.LayoutParams.TYPE_TOAST;
+        mParams.flags = WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
+                | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+                | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
+        mParams.gravity = location;
+        mParams.y = 250;
+
+
+        if(!mIsShow[0]){//如果Toast没有显示,则开始加载显示
+            mIsShow[0] = true;
+            mWdm.addView(mToastView, mParams);//将其加载到windowManager上
+            mTimer.schedule(new TimerTask() {
+                @Override
+                public void run() {
+                    mWdm.removeView(mToastView);
+                    mIsShow[0] = false;
+                }
+            }, (long)(mShowTime ? 3500 : 2000));
+        }
+
+        mToastView.showContextMenu();
+    }
+
+
+}

+ 37 - 0
app_core/message/src/main/java/com/uas/message/supertoasts/interfacepack/BaseToast.java

@@ -0,0 +1,37 @@
+package com.uas.message.supertoasts.interfacepack;
+
+import android.app.Activity;
+import android.content.Context;
+
+/**
+ * 统一规范消息组件的调用
+ * 方向:底部,中部,顶部
+ * 监听事件:
+ * 样式:
+ * 第一步:构建指定参数的公共接口
+ * 第二步:通过builder模式传入大量自定义化参数的接口
+ */
+public interface BaseToast {
+    /**
+     *  与Activity生命周期无关,则传null
+      * @desc:Activity 生命周期绑定的消息提示
+      * @author:FANGLH
+      */
+
+
+    /**
+     *最Base的Toast,默认的位置 duration == 1 ,默认的方形
+     * Context:可传可不传
+     * text:toast的内容
+     */
+    void show(Context ct, String text);
+    void showAtTop(Context ct, String text);
+    void showAtCenter(Context ct, String text);
+    void showAtBottom(Context ct, String text);
+    void showAtNotiftion(Context ct, Class<? extends Activity> clazz, String title, String text);
+
+    /**
+     * 自定义布局
+     */
+
+}

+ 78 - 0
app_core/message/src/main/java/com/uas/message/supertoasts/interfacepack/CustomizedToast.java

@@ -0,0 +1,78 @@
+package com.uas.message.supertoasts.interfacepack;
+
+import android.app.Activity;
+import android.content.Context;
+import android.support.annotation.LayoutRes;
+
+/**
+ * 统一规范消息组件的调用
+ * 方向:底部,中部,顶部
+ * 监听事件:
+ * 样式:
+ * 第一步:构建指定参数的公共接口
+ * 第二步:通过builder模式传入大量自定义化参数的接口
+ * Created by Arison on 2017/5/25.
+ * messageColor:字体颜色,不设置传-1
+ * backgroundcolor:字体背景颜色,不设置传-1
+ */
+public interface CustomizedToast {
+    /**
+      * @desc:Activity 生命周期绑定的消息提示,与Activity生命周期无关则传null
+      * @author:FANGLH
+      */
+
+
+    /**
+     * 自定义的的Toast, 圆角型
+     * Context:可传可不传
+     * text:toast的内容
+     * messageColor:字体颜色 不设置传-1
+     * backgroundcolor:字体背景的颜色 不设置传-1
+     * duration:toast的时间长短 1:LONG,else:SHORT
+     */
+    void show(Context ct, String text,int messageColor, int backgroundcolor,int duration);
+    void showAtTop(Context ct, String text,int messageColor, int backgroundcolor,int duration);
+    void showAtCenter(Context ct, String text,int messageColor, int backgroundcolor,int duration);
+    void showAtBottom(Context ct, String text,int messageColor, int backgroundcolor,int duration);
+
+
+    /**
+     * 自定义的通知栏提醒
+     * @param ct
+     * @param clazz
+     * @param title
+     * @param text
+     * @param pictureid  通知栏显示的图片,不设置默认则传入null
+     */
+    void showAtNotiftion(Context ct, Class<? extends Activity> clazz, String title, String text, int pictureid);
+
+
+    /**
+     * 自定义布局Toast,只做显示,暂不加入点击事件
+     * @param ct
+     * @param text
+     * @param resource   自定义的布局 :R.layout.xxx
+     * @param location  Toast弹出的位置:Gravity.BOTTOM
+     */
+    void showCuslayoutToast(Context ct,String text,@LayoutRes int resource,int location);
+
+    /**
+     * 简单的图片+text Toast 方式
+     * @param ct
+     * @param text
+     * @param pictureid
+     * @param duration
+     * @param messageColor
+     * @param location
+     */
+    void showWithPicuure(Context ct,String text,int pictureid,int duration,int messageColor,int location);
+
+    /**
+     * 自定义动画 支持底部弹出,自下而上。
+     * @param ct
+     * @param text
+     * @param duration
+     * @param location
+     */
+    void showMiuiText(Context ct, String text,  int duration,int location);
+}

+ 194 - 0
app_core/message/src/main/java/com/uas/message/supertoasts/utils/ToastUtils.java

@@ -0,0 +1,194 @@
+package com.uas.message.supertoasts.utils;
+
+import android.content.Context;
+import android.view.View;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+import android.widget.Toast;
+
+/**
+ * Created by FANGlh on 2017/8/10.
+ * function:
+ */
+
+public class ToastUtils  {
+    private  Toast toast;
+    private LinearLayout toastView;
+
+    /**
+     * 修改原布局的Toast
+     */
+    public ToastUtils() {
+
+    }
+
+    /**
+     * 完全自定义布局Toast
+     * @param context
+     * @param view
+     */
+    public ToastUtils(Context context, View view, int duration){
+        toast=new Toast(context);
+        toast.setView(view);
+        toast.setDuration(duration);
+    }
+
+    /**
+     * 向Toast中添加自定义view
+     * @param view
+     * @param postion
+     * @return
+     */
+    public  ToastUtils addView(View view,int postion) {
+        toastView = (LinearLayout) toast.getView();
+        toastView.addView(view, postion);
+
+        return this;
+    }
+
+    /**
+     * 设置Toast字体及背景颜色
+     * @param messageColor
+     * @param backgroundColor
+     * @return
+     */
+    public ToastUtils setToastColor(int messageColor, int backgroundColor) {
+        View view = toast.getView();
+        if(view!=null){
+            TextView message=((TextView) view.findViewById(android.R.id.message));
+            message.setBackgroundColor(backgroundColor);
+            message.setTextColor(messageColor);
+        }
+        return this;
+    }
+
+    /**
+     * 设置Toast字体及背景图片
+     * @param messageColor
+     * @param background
+     * @return
+     */
+    public ToastUtils setToastBackground(int messageColor, int background) {
+        View view = toast.getView();
+        if(view!=null){
+            TextView message=((TextView) view.findViewById(android.R.id.message));
+            message.setBackgroundResource(background);
+            message.setTextColor(messageColor);
+        }
+        return this;
+    }
+
+    /**
+     * 短时间显示Toast
+     */
+    public  ToastUtils Short(Context context, CharSequence message){
+        if(toast==null||(toastView!=null&&toastView.getChildCount()>1)){
+            toast= Toast.makeText(context, message, Toast.LENGTH_SHORT);
+            toastView=null;
+        }else{
+            toast.setText(message);
+            toast.setDuration(Toast.LENGTH_SHORT);
+        }
+        return this;
+    }
+
+    /**
+     * 短时间显示Toast
+     */
+    public ToastUtils Short(Context context, int message) {
+        if(toast==null||(toastView!=null&&toastView.getChildCount()>1)){
+            toast= Toast.makeText(context, message, Toast.LENGTH_SHORT);
+            toastView=null;
+        }else{
+            toast.setText(message);
+            toast.setDuration(Toast.LENGTH_SHORT);
+        }
+        return this;
+    }
+
+    /**
+     * 长时间显示Toast
+     */
+    public ToastUtils Long(Context context, CharSequence message){
+        if(toast==null||(toastView!=null&&toastView.getChildCount()>1)){
+            toast= Toast.makeText(context, message, Toast.LENGTH_LONG);
+            toastView=null;
+        }else{
+            toast.setText(message);
+            toast.setDuration(Toast.LENGTH_LONG);
+        }
+        return this;
+    }
+
+    /**
+     * 长时间显示Toast
+     *
+     * @param context
+     * @param message
+     */
+    public ToastUtils Long(Context context, int message) {
+        if(toast==null||(toastView!=null&&toastView.getChildCount()>1)){
+            toast= Toast.makeText(context, message, Toast.LENGTH_LONG);
+            toastView=null;
+        }else{
+            toast.setText(message);
+            toast.setDuration(Toast.LENGTH_LONG);
+        }
+        return this;
+    }
+
+    /**
+     * 自定义显示Toast时间
+     *
+     * @param context
+     * @param message
+     * @param duration
+     */
+    public ToastUtils Indefinite(Context context, CharSequence message, int duration) {
+        if(toast==null||(toastView!=null&&toastView.getChildCount()>1)){
+            toast= Toast.makeText(context, message,duration);
+            toastView=null;
+        }else{
+            toast.setText(message);
+            toast.setDuration(duration);
+        }
+        return this;
+    }
+
+    /**
+     * 自定义显示Toast时间
+     *
+     * @param context
+     * @param message
+     * @param duration
+     */
+    public ToastUtils Indefinite(Context context, int message, int duration) {
+        if(toast==null||(toastView!=null&&toastView.getChildCount()>1)){
+            toast= Toast.makeText(context, message,duration);
+            toastView=null;
+        }else{
+            toast.setText(message);
+            toast.setDuration(duration);
+        }
+        return this;
+    }
+
+    /**
+     * 显示Toast
+     * @return
+     */
+    public ToastUtils show (){
+        toast.show();
+
+        return this;
+    }
+
+    /**
+     * 获取Toast
+     * @return
+     */
+    public Toast getToast(){
+        return toast;
+    }
+
+}

+ 36 - 0
app_core/message/src/main/java/com/uas/message/supertoasts/utils/Utils.java

@@ -0,0 +1,36 @@
+package com.uas.message.supertoasts.utils;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+
+/**
+ * 需要注意Context对象为空的情况
+ * Created by Arison on 2017/5/24.
+ */
+public class Utils {
+    @SuppressLint("StaticFieldLeak")
+    private static Context context;
+
+    private Utils() {
+        throw new UnsupportedOperationException("u can't instantiate me...");
+    }
+
+    /**
+     * 初始化工具类
+     *
+     * @param context 上下文
+     */
+    public static void init(Context context) {
+        Utils.context = context.getApplicationContext();
+    }
+
+    /**
+     * 获取ApplicationContext
+     *
+     * @return ApplicationContext
+     */
+    public static Context getContext() {
+        if (context != null) return context;
+        throw new NullPointerException("u should init first");
+    }
+}

+ 10 - 0
app_core/message/src/main/java/com/uas/message/supertoasts/utils/ViewUtils.java

@@ -0,0 +1,10 @@
+package com.uas.message.supertoasts.utils;
+
+/**
+ * Created by FANGlh on 2017/8/10.
+ * function:
+ */
+
+public class ViewUtils {
+
+}

+ 33 - 0
app_core/message/src/main/res/anim/anim_in.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+    <translate
+        android:fromXDelta="0"
+        android:fromYDelta="0"
+        android:toXDelta="0"
+        android:toYDelta="85"
+        android:duration="1"
+        />
+    <translate
+        android:fromXDelta="0"
+        android:fromYDelta="0"
+        android:toXDelta="0"
+        android:toYDelta="-105"
+        android:duration="350"
+        android:fillAfter="true"
+        android:interpolator="@android:anim/decelerate_interpolator"
+        />
+    <alpha 
+        android:fromAlpha="0"
+        android:toAlpha="1"
+        android:duration="100"
+        />
+    <translate
+        android:fromXDelta="0"
+        android:fromYDelta="0"
+        android:toXDelta="0"
+        android:toYDelta="20"
+        android:duration="80"
+        android:fillAfter="true"
+        android:startOffset="350"
+        />
+</set>

+ 7 - 0
app_core/message/src/main/res/anim/anim_out.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<set xmlns:android="http://schemas.android.com/apk/res/android">
+    <alpha 
+        android:fromAlpha="1"
+        android:toAlpha="0"
+        android:duration="800"/>
+</set>

BIN
app_core/message/src/main/res/drawable-hdpi/uuu.png


BIN
app_core/message/src/main/res/drawable-xhdpi/uuu.png


BIN
app_core/message/src/main/res/drawable-xxhdpi/uuu.png


+ 8 - 0
app_core/message/src/main/res/drawable/blue_toastborder.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+    <solid android:color="#ff0000ff"/>
+    <stroke android:width="1dp" android:color="#FFFFFFFF" />
+    <padding android:left="7dp" android:top="7dp"
+        android:right="7dp" android:bottom="7dp" />
+    <corners android:radius="4dp" />
+</shape>

+ 14 - 0
app_core/message/src/main/res/layout/my_customized_toast.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content" android:layout_height="wrap_content"
+    android:background="@drawable/blue_toastborder">
+
+    <TextView
+        android:padding="10dp"
+        android:layout_width="wrap_content"
+        android:id="@+id/TextViewInfo"
+        android:layout_height="wrap_content"
+        android:text="这是一个自定义背x景颜色的提示框"
+        android:layout_gravity="center_vertical"
+        android:textColor="#ff00ff00"></TextView>
+</LinearLayout>

+ 3 - 0
app_core/message/src/main/res/values/strings.xml

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

+ 7 - 0
app_core/message/src/main/res/values/style.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <style name="anim_view">
+        <item name="@android:windowEnterAnimation">@anim/anim_in</item>
+        <item name="@android:windowExitAnimation">@anim/anim_out</item>
+    </style>
+</resources>

+ 17 - 0
app_core/message/src/test/java/com/umano/message/supertoasts/ExampleUnitTest.java

@@ -0,0 +1,17 @@
+package com.umano.message.supertoasts;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+    @Test
+    public void addition_isCorrect() throws Exception {
+        assertEquals(4, 2 + 2);
+    }
+}

+ 3 - 2
settings.gradle

@@ -1,11 +1,11 @@
 //主工程
-include ':WeiChat'
+include ':WeiChat', 'message'
 
 //核心模块
 include ':network'
 include ':imageload'
 include ':common'
-
+include ':message'
 //第三库模块
 include ':lib-zxing'
 include ':libbdupdatesdk'
@@ -22,6 +22,7 @@ include ':pullToRefershLibraryMy'
 project(':network').projectDir = new File('app_core/network')
 project(':imageload').projectDir = new File('app_core/imageload')
 project(':common').projectDir = new File('app_core/common')
+project(':message').projectDir = new File('app_core/message')
 
 
 //第三库模块