MD5 校验值:27cf44ec6e0720408f5ef017a90a3331
a.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.jb.gokeyboard.theme.template.httpwecloud.controller; import android.app.AlarmManager; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.support.v4.app.NotificationCompat; import android.text.TextUtils; import android.widget.RemoteViews; import com.jb.gokeyboard.theme.emojiztfors9.getjar.R; import com.jb.gokeyboard.theme.template.d.a.c; import com.jb.gokeyboard.theme.template.httpwecloud.bean.message.NotifyMessageBean; import com.jb.gokeyboard.theme.template.httpwecloud.controller.b; import com.jb.gokeyboard.theme.template.util.j; import com.jiubang.commerce.ad.intelligent.api.IntelligentApi; import com.jiubang.commerce.database.model.AdShowClickBean; import com.nostra13.universalimageloader.core.d; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Iterator; import java.util.List; import java.util.UUID; public class a { private final int a = 3600000; private final int b = 28800000; private Context c; public a(Context context) { this.c = context; } public void a(final boolean z) { long time = new Date().getTime() - com.jb.gokeyboard.theme.template.httpwecloud.a.a.a(); if (z || time >= 28800000) { if (z) { j.a("HttpWecloudController", "距离上次请求失败1小时,开始再次请求推送数据"); } else { j.a("HttpWecloudController", "距离上次请求" + (time / 3600000.0d) + "小时,开始请求推送数据"); } b bVar = new b(com.jb.gokeyboard.theme.template.httpwecloud.bean.a.b.b()); bVar.a(new b.a() { @Override public void a(com.jb.gokeyboard.theme.template.httpwecloud.bean.b.a aVar) { j.a("HttpWecloudController", "收到解析回调:responseBean=" + (aVar == null ? "null" : aVar.toString())); if (aVar == null) { com.jb.gokeyboard.theme.template.httpwecloud.a.a.a(0L, false); if (!z) { a.this.a(System.currentTimeMillis() + 3600000, true); return; } else { a.this.a(System.currentTimeMillis() + 28800000, false); return; } } com.jb.gokeyboard.theme.template.httpwecloud.a.a.a(System.currentTimeMillis(), true); a.this.a(System.currentTimeMillis() + 28800000, false); a.this.a(aVar); } }); bVar.a(); return; } j.a("HttpWecloudController", "距离上次请求没有超过8小时,不进行请求"); com.jb.gokeyboard.theme.template.httpwecloud.a.a.a(0L, false); a(System.currentTimeMillis() + 28800000, false); } public void a(long j, boolean z) { Intent intent = new Intent("com.jb.gokeyboard.theme.WecloudTimingReceiver"); intent.putExtra("packageName", this.c.getPackageName()); intent.putExtra("isForce", z); intent.putExtra(IntelligentApi.COMMAND, 1); PendingIntent broadcast = PendingIntent.getBroadcast(this.c, com.jb.gokeyboard.theme.template.httpwecloud.a.a.c(), intent, 134217728); AlarmManager alarmManager = (AlarmManager) this.c.getSystemService(NotificationCompat.CATEGORY_ALARM); alarmManager.cancel(broadcast); alarmManager.set(1, j, broadcast); } public void a(com.jb.gokeyboard.theme.template.httpwecloud.bean.b.a aVar) { if (aVar != null) { com.jb.gokeyboard.theme.template.httpwecloud.bean.b.b a = aVar.a(); List<NotifyMessageBean> b = aVar.b(); if (a.a().intValue() == 1) { for (NotifyMessageBean notifyMessageBean : b) { if (com.jb.gokeyboard.theme.template.httpwecloud.a.a.a(this.c, notifyMessageBean)) { d(notifyMessageBean); } else { j.a("HttpWecloudController", "消息无效:" + notifyMessageBean.toString()); } } return; } j.a("HttpWecloudController", "推送消息异常,返回结果:" + a.toString()); } } private void d(NotifyMessageBean notifyMessageBean) { a(notifyMessageBean, "push"); if (TextUtils.isEmpty(notifyMessageBean.getImageUrl())) { d.a().a(notifyMessageBean.getImageUrl(), (com.nostra13.universalimageloader.core.d.a) null); } String effectiveFrom = notifyMessageBean.getEffectiveFrom(); String effectiveTo = notifyMessageBean.getEffectiveTo(); try { Date parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(effectiveFrom); Date parse2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(effectiveTo); a(notifyMessageBean, parse.getTime()); b(notifyMessageBean, parse2.getTime()); } catch (ParseException e) { } } private void a(NotifyMessageBean notifyMessageBean, long j) { long currentTimeMillis = System.currentTimeMillis(); if (j <= currentTimeMillis) { j = currentTimeMillis + 5000; } Intent intent = new Intent("com.jb.gokeyboard.theme.WecloudTimingReceiver"); intent.putExtra("packageName", this.c.getPackageName()); intent.putExtra(IntelligentApi.COMMAND, 2); intent.putExtra("notifyMessageBean", notifyMessageBean); ((AlarmManager) this.c.getSystemService(NotificationCompat.CATEGORY_ALARM)).set(1, j, PendingIntent.getBroadcast(this.c, UUID.randomUUID().hashCode(), intent, 134217728)); } private void b(NotifyMessageBean notifyMessageBean, long j) { long currentTimeMillis = System.currentTimeMillis(); if (j <= currentTimeMillis) { j = currentTimeMillis + 20000; } Intent intent = new Intent("com.jb.gokeyboard.theme.WecloudTimingReceiver"); intent.putExtra("packageName", this.c.getPackageName()); intent.putExtra(IntelligentApi.COMMAND, 3); intent.putExtra("notifyMessageBean", notifyMessageBean); ((AlarmManager) this.c.getSystemService(NotificationCompat.CATEGORY_ALARM)).set(1, j, PendingIntent.getBroadcast(this.c, UUID.randomUUID().hashCode(), intent, 134217728)); } public void a(final NotifyMessageBean notifyMessageBean) { a(notifyMessageBean, AdShowClickBean.OPT_SHOW); c.b(new Runnable() { @Override public void run() { boolean z = true; Iterator<Integer> it = com.jb.gokeyboard.theme.template.httpwecloud.a.a.b().iterator(); while (it.hasNext()) { if (it.next().intValue() == notifyMessageBean.getMessageId().intValue()) { j.a("HttpWecloudController", "消息id=" + notifyMessageBean.getMessageId().intValue() + "的消息已被展示过,无需重复展示"); return; } } Intent intent = new Intent("com.jb.gokeyboard.theme.WecloudTimingReceiver"); intent.putExtra("packageName", a.this.c.getPackageName()); intent.putExtra(IntelligentApi.COMMAND, 4); intent.putExtra("notifyMessageBean", notifyMessageBean); int intValue = notifyMessageBean.getMessageId().intValue(); PendingIntent broadcast = PendingIntent.getBroadcast(a.this.c, UUID.randomUUID().hashCode(), intent, 134217728); Notification notification = new Notification(R.drawable.wecloud_gokeyboard_logo, notifyMessageBean.getTitle(), System.currentTimeMillis()); RemoteViews remoteViews = new RemoteViews(a.this.c.getPackageName(), R.layout.wecloud_notify_content); NotificationManager notificationManager = (NotificationManager) a.this.c.getSystemService("notification"); d a = d.a(); String imageType = notifyMessageBean.getImageType(); if ("1".equals(imageType)) { Bitmap a2 = a.a(notifyMessageBean.getImageUrl()); if (a2 != null) { remoteViews.setImageViewBitmap(R.id.theme_view_image, a2); } else { remoteViews.setImageViewResource(R.id.theme_view_image, R.drawable.icon); } } else if ("2".equals(imageType)) { Bitmap a3 = a.a(notifyMessageBean.getImageUrl()); if (a3 != null) { remoteViews.setViewVisibility(R.id.theme_detail_content, 8); remoteViews.setViewVisibility(R.id.theme_full_screen_icon, 0); remoteViews.setImageViewBitmap(R.id.theme_full_screen_icon, a3); z = false; } else { remoteViews.setImageViewResource(R.id.theme_view_image, R.drawable.icon); } } else { remoteViews.setImageViewResource(R.id.theme_view_image, R.drawable.icon); } if (z) { remoteViews.setViewVisibility(R.id.theme_detail_content, 0); remoteViews.setViewVisibility(R.id.theme_full_screen_icon, 8); remoteViews.setTextViewText(R.id.theme_content, notifyMessageBean.getContent()); remoteViews.setTextViewText(R.id.theme_title, notifyMessageBean.getTitle()); } if (!TextUtils.isEmpty(notifyMessageBean.getWarmType())) { if (notifyMessageBean.getWarmType().contains("1")) { notification.defaults |= 4; } if (notifyMessageBean.getWarmType().contains("2")) { notification.defaults |= 1; } if (notifyMessageBean.getWarmType().contains("3")) { notification.defaults |= 2; } } notification.contentIntent = broadcast; notification.contentView = remoteViews; notification.flags |= 16; com.jb.gokeyboard.theme.template.httpwecloud.a.a.a(intValue); notificationManager.notify(String.valueOf(intValue), intValue, notification); } }); } public void b(NotifyMessageBean notifyMessageBean) { ((NotificationManager) this.c.getSystemService("notification")).cancel(String.valueOf(notifyMessageBean.getMessageId()), notifyMessageBean.getMessageId().intValue()); } public void c(NotifyMessageBean notifyMessageBean) { a(notifyMessageBean, "click"); String actionType = notifyMessageBean.getActionType(); String actionParam = notifyMessageBean.getActionParam(); if ("1".equals(actionType)) { com.jb.gokeyboard.theme.template.httpwecloud.a.b.a(this.c, actionParam); } else if ("2".equals(actionType)) { com.jb.gokeyboard.theme.template.httpwecloud.a.b.a(this.c, actionParam, true, true); } else if ("3".equals(actionType)) { com.jb.gokeyboard.theme.template.httpwecloud.a.b.c(this.c, actionParam); } } private void a(NotifyMessageBean notifyMessageBean, String str) { long j = -1; String str2 = "-1"; if (notifyMessageBean != null) { j = notifyMessageBean.getMessageId().longValue(); str2 = notifyMessageBean.getDisplayType(); } com.jb.gokeyboard.theme.template.statistics.a.a(j, "-1", str, 1, str2, "-1", "-1"); } }