VegeFruits v7.1版本的 MD5 值为:2ff167dfba698c783e879938fe00b9ce
以下内容为反编译后的 k.java 源代码,内容仅作参考
package com.inmobi.rendering.mraid;
import android.annotation.TargetApi;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.Vibrator;
import android.provider.CalendarContract;
import com.amazon.device.ads.WebRequest;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.plus.PlusShare;
import com.inmobi.commons.core.utilities.Logger;
import com.inmobi.rendering.InMobiAdActivity;
import com.inmobi.rendering.RenderView;
import com.mopub.common.Constants;
import com.tapjoy.TJAdUnitConstants;
import com.vk.sdk.api.model.VKApiCommunityFull;
import java.io.UnsupportedEncodingException;
import java.lang.ref.WeakReference;
import java.net.URLEncoder;
import java.util.GregorianCalendar;
import java.util.HashMap;
import org.json.JSONException;
import org.json.JSONObject;
public class k {
private static final String a = k.class.getSimpleName();
private RenderView b;
private a c;
public k(RenderView renderView) {
this.b = renderView;
HandlerThread handlerThread = new HandlerThread("SystemTasksHandlerThread");
handlerThread.start();
this.c = new a(handlerThread.getLooper(), renderView);
}
@TargetApi(14)
public void a(final String str, final Context context, String str2, final String str3, String str4, String str5, String str6, String str7, final String str8, String str9, String str10, final String str11) {
final int a2 = com.inmobi.rendering.mraid.a.a(context);
GregorianCalendar b = com.inmobi.rendering.mraid.a.b(str3);
if (b == null) {
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Invalid event start date provided. date string: " + str3);
return;
}
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Event start: " + b.get(1) + "-" + b.get(2) + "-" + b.get(5));
GregorianCalendar b2 = com.inmobi.rendering.mraid.a.b(str4);
if (b2 == null) {
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Invalid event end date provided. date string: " + str4);
return;
}
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Event end: " + b2.get(1) + "-" + b2.get(2) + "-" + b2.get(5));
Intent putExtra = new Intent("android.intent.action.INSERT").setData(CalendarContract.Events.CONTENT_URI).putExtra("calendar_id", str2).putExtra("beginTime", b.getTimeInMillis()).putExtra("endTime", b2.getTimeInMillis()).putExtra("allDay", false).putExtra(TJAdUnitConstants.String.TITLE, str6).putExtra("eventLocation", str5).putExtra(VKApiCommunityFull.DESCRIPTION, str7);
if (str9.equals("transparent")) {
putExtra.putExtra("availability", 1);
} else if (str9.equals("opaque")) {
putExtra.putExtra("availability", 0);
}
String a3 = a(str10);
if (a3.length() != 0) {
putExtra.putExtra("rrule", a3);
}
int a4 = InMobiAdActivity.a(putExtra, new InMobiAdActivity.a() {
@Override
public void a(int i, Intent intent) {
int timeInMillis;
Logger.a(Logger.InternalLogLevel.INTERNAL, k.a, "Result code: " + i);
if (a2 == com.inmobi.rendering.mraid.a.a(context)) {
Logger.a(Logger.InternalLogLevel.INTERNAL, k.a, "User cancelled the create calendar event");
return;
}
ContentValues contentValues = new ContentValues();
String str12 = str8;
char c = 65535;
switch (str12.hashCode()) {
case -1320822226:
if (str12.equals("tentative")) {
c = 0;
break;
}
break;
case -804109473:
if (str12.equals("confirmed")) {
c = 1;
break;
}
break;
case 476588369:
if (str12.equals("cancelled")) {
c = 2;
break;
}
break;
}
switch (c) {
case 0:
contentValues.put("eventStatus", (Integer) 0);
break;
case 1:
contentValues.put("eventStatus", (Integer) 1);
break;
case 2:
contentValues.put("eventStatus", (Integer) 2);
break;
}
ContentResolver contentResolver = context.getContentResolver();
contentResolver.update(ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, com.inmobi.rendering.mraid.a.a(context)), contentValues, null, null);
if (str11 != null && !"".equals(str11)) {
try {
if (str11.startsWith("+")) {
timeInMillis = Integer.parseInt(str11.substring(1)) / 60000;
} else {
timeInMillis = Integer.parseInt(str11) / 60000;
}
} catch (NumberFormatException e) {
GregorianCalendar b3 = com.inmobi.rendering.mraid.a.b(str11);
if (b3 == null) {
Logger.a(Logger.InternalLogLevel.INTERNAL, k.a, "Invalid reminder date provided. date string: " + str11);
return;
}
timeInMillis = ((int) (b3.getTimeInMillis() - com.inmobi.rendering.mraid.a.b(str3).getTimeInMillis())) / 60000;
if (timeInMillis > 0) {
k.this.b.a(str, "Reminder format is incorrect. Reminder can be set only before the event starts", "createCalendarEvent");
return;
}
}
int i2 = -timeInMillis;
contentResolver.delete(CalendarContract.Reminders.CONTENT_URI, "event_id=?", new String[]{com.inmobi.rendering.mraid.a.a(context) + ""});
if (i2 < 0) {
k.this.b.a(str, "Reminder format is incorrect. Reminder can be set only before the event starts", "createCalendarEvent");
return;
}
ContentValues contentValues2 = new ContentValues();
contentValues2.put("event_id", Integer.valueOf(com.inmobi.rendering.mraid.a.a(context)));
contentValues2.put("method", (Integer) 1);
contentValues2.put("minutes", Integer.valueOf(i2));
contentResolver.insert(CalendarContract.Reminders.CONTENT_URI, contentValues2);
}
}
});
Intent intent = new Intent(context, (Class<?>) InMobiAdActivity.class);
intent.putExtra("com.inmobi.rendering.InMobiAdActivity.EXTRA_AD_ACTIVITY_TYPE", 103);
intent.putExtra("id", a4);
com.inmobi.commons.a.a.a(context, intent);
}
public void a(String str, Context context, int i, String str2, String str3, String str4) {
if (str2 == null || str2.length() == 0 || str3 == null || str3.length() == 0 || !str3.startsWith(Constants.HTTP) || str4 == null || str4.length() == 0 || !str4.startsWith(Constants.HTTP) || !str4.endsWith(".jpg")) {
this.b.a(str, "Attempting to share with null/empty/invalid parameters", "postToSocial");
return;
}
Intent intent = null;
switch (i) {
case 1:
break;
case 2:
if (b()) {
intent = new PlusShare.Builder(context).setType(WebRequest.CONTENT_TYPE_PLAIN_TEXT).setText(str2 + " " + str3 + " " + str4).setContentUrl(Uri.parse(str4)).getIntent();
break;
}
break;
case 3:
intent = new Intent();
intent.setType(WebRequest.CONTENT_TYPE_PLAIN_TEXT);
intent.setPackage("com.twitter.android");
intent.putExtra("android.intent.extra.TEXT", str2 + " " + str3 + " " + str4);
break;
default:
this.b.a(str, "Unsupported type of social network", "postToSocial");
return;
}
if (intent != null) {
try {
com.inmobi.commons.a.a.a(context, intent);
return;
} catch (ActivityNotFoundException e) {
a(context, i, str2, str3, str4);
return;
}
}
a(context, i, str2, str3, str4);
}
private boolean b() {
if (!com.inmobi.commons.a.a.a()) {
return false;
}
try {
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(com.inmobi.commons.a.a.b()) == 0;
} catch (Error e) {
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Google Play Services is not installed!");
return false;
} catch (Exception e2) {
try {
HashMap hashMap = new HashMap();
hashMap.put("type", "RuntimeException");
hashMap.put("message", e2.getMessage() + "");
com.inmobi.commons.core.d.c.a().a("ads", "ExceptionCaught", hashMap);
return false;
} catch (Exception e3) {
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Error in submitting telemetry event : (" + e3.getMessage() + ")");
return false;
}
}
}
private void a(Context context, int i, String str, String str2, String str3) {
String str4 = str + " " + str2 + " " + str3;
String str5 = null;
try {
switch (i) {
case 1:
str5 = "https://www.facebook.com/dialog/feed?app_id=181821551957328&link=" + URLEncoder.encode(str2, "UTF-8") + "&picture=" + URLEncoder.encode(str3, "UTF-8") + "&name=&description=" + URLEncoder.encode(str, "UTF-8") + "&redirect_uri=" + URLEncoder.encode(str2, "UTF-8");
break;
case 2:
str5 = "https://m.google.com/app/plus/x/?v=compose&content=" + URLEncoder.encode(str4, "UTF-8");
break;
case 3:
str5 = "http://twitter.com/home?status=" + URLEncoder.encode(str4, "UTF-8");
break;
default:
if (str5 == null) {
Intent intent = new Intent("android.intent.action.VIEW");
intent.setData(Uri.parse(str5));
try {
com.inmobi.commons.a.a.a(context, intent);
return;
} catch (ActivityNotFoundException e) {
Logger.a(Logger.InternalLogLevel.INTERNAL, a, e.getMessage());
return;
}
}
Intent intent2 = new Intent();
intent2.setType(WebRequest.CONTENT_TYPE_PLAIN_TEXT);
intent2.putExtra("android.intent.extra.TEXT", str4);
try {
com.inmobi.commons.a.a.a(context, intent2);
return;
} catch (ActivityNotFoundException e2) {
Logger.a(Logger.InternalLogLevel.INTERNAL, a, e2.getMessage());
return;
}
}
if (str5 == null) {
}
} catch (UnsupportedEncodingException e3) {
}
}
public void a(Context context) {
if (this.c != null && this.c.hasMessages(1)) {
this.c.removeMessages(1);
((Vibrator) context.getSystemService("vibrator")).cancel();
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Canceling any pending/ongoing vibrate requests");
}
}
private String a(String str) {
String a2;
String a3;
String a4;
String a5;
String a6;
StringBuilder sb = new StringBuilder();
if (str.length() != 0) {
try {
JSONObject jSONObject = new JSONObject(str);
String optString = jSONObject.optString("frequency");
if (optString != null && !"".equals(optString)) {
if ("daily".equals(optString) || "weekly".equals(optString) || "monthly".equals(optString) || "yearly".equals(optString)) {
sb.append("freq=").append(optString).append(";");
String optString2 = jSONObject.optString(TJAdUnitConstants.String.INTERVAL);
if (optString2 != null && !"".equals(optString2)) {
sb.append("interval=").append(Integer.parseInt(optString2)).append(";");
}
String a7 = com.inmobi.rendering.mraid.a.a(jSONObject.optString("expires"));
if (a7 != null) {
sb.append("until=").append(a7.replace("+", "Z+").replace("-", "Z-")).append(";");
}
if (optString.equals("weekly") && (a6 = com.inmobi.rendering.mraid.a.a(jSONObject.optJSONArray("daysInWeek"))) != null) {
sb.append("byday=").append(a6).append(";");
}
if (optString.equals("monthly") && (a5 = com.inmobi.rendering.mraid.a.a(jSONObject.optJSONArray("daysInMonth"), -31, 31)) != null) {
sb.append("bymonthday=").append(a5).append(";");
}
if (optString.equals("yearly") && (a4 = com.inmobi.rendering.mraid.a.a(jSONObject.optJSONArray("daysInYear"), -366, 366)) != null) {
sb.append("byyearday=").append(a4).append(";");
}
if (optString.equals("monthly") && (a3 = com.inmobi.rendering.mraid.a.a(jSONObject.optJSONArray("weeksInMonth"), -4, 4)) != null) {
sb.append("byweekno=").append(a3).append(";");
}
if (optString.equals("yearly") && (a2 = com.inmobi.rendering.mraid.a.a(jSONObject.optJSONArray("monthsInYear"), 1, 12)) != null) {
sb.append("bymonth=").append(a2).append(";");
}
return sb.toString();
}
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Error Parsing recurrence string. Invalid Frequency supplied");
return "";
}
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Error Parsing recurrence string. Frequency supplied is null");
return "";
} catch (JSONException e) {
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Error Parsing recurrence string" + e.toString());
return "";
}
}
return "";
}
public static final class a extends Handler {
private static final String a = a.class.getSimpleName();
private WeakReference<RenderView> b;
public a(Looper looper, RenderView renderView) {
super(looper);
this.b = new WeakReference<>(renderView);
}
@Override
public void handleMessage(Message message) {
switch (message.what) {
case 1:
String str = (String) message.obj;
RenderView renderView = this.b.get();
if (renderView != null) {
renderView.a(str, "broadcastEvent('vibrateComplete');");
return;
}
return;
default:
Logger.a(Logger.InternalLogLevel.INTERNAL, a, "Unknown message type. Ignoring ...");
return;
}
}
}
}