|
|
@@ -11,6 +11,7 @@ import android.support.v7.app.NotificationCompat;
|
|
|
|
|
|
import com.xzjmyk.pm.activity.MyApplication;
|
|
|
import com.xzjmyk.pm.activity.R;
|
|
|
+import com.xzjmyk.pm.activity.ui.erp.util.StringUtils;
|
|
|
|
|
|
/**
|
|
|
* 通知工具类
|
|
|
@@ -29,6 +30,10 @@ public class NotificationManage {
|
|
|
* @param clazz 点击跳转的界面
|
|
|
*/
|
|
|
private void sendNotification(Context context, int icon, String title, String content, Class<? extends Activity> clazz) {
|
|
|
+ sendNotification(context, icon, title, null, content, clazz);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void sendNotification(Context context, int icon, String title, String group, String content, Class<? extends Activity> clazz) {
|
|
|
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(context.getApplicationContext());
|
|
|
builder.setSmallIcon(icon);
|
|
|
@@ -36,6 +41,8 @@ public class NotificationManage {
|
|
|
builder.setAutoCancel(true);
|
|
|
builder.setContentTitle(title);
|
|
|
builder.setContentText(content);
|
|
|
+ if (!StringUtils.isEmpty(group))
|
|
|
+ builder.setGroup(group);
|
|
|
Intent intent = new Intent(context, clazz);
|
|
|
PendingIntent pendingIntent = PendingIntent.getActivity(context.getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
|
builder.setContentIntent(pendingIntent);
|
|
|
@@ -45,6 +52,7 @@ public class NotificationManage {
|
|
|
public void sendNotification(Context context, Class<? extends Activity> clazz) {
|
|
|
sendNotification(context, R.drawable.uuu, "提醒", "提醒", clazz);
|
|
|
}
|
|
|
+
|
|
|
public void sendNotification(Context context, int action, Class<? extends Activity> clazz) {
|
|
|
SharedPreferences sharePrefer = MyApplication.getInstance().getSharedPreferences("SIGNIN", Context.MODE_APPEND);
|
|
|
long oldTime = sharePrefer.getLong("SIGNIN_TIME", -1);
|
|
|
@@ -55,6 +63,7 @@ public class NotificationManage {
|
|
|
//无效
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public void sendNotification(Context context, String action, Class<? extends Activity> clazz) {
|
|
|
SharedPreferences sharePrefer = MyApplication.getInstance().getSharedPreferences("SIGNIN", Context.MODE_APPEND);
|
|
|
long oldTime = sharePrefer.getLong("SIGNIN_TIME", -1);
|