13Poker by gametower unlimited gems v0.4版本的 MD5 值为:51324fc0f195c34821074948ab266846
以下内容为反编译后的 NavIcon.java 源代码,内容仅作参考
package com.adsdk.sdk.video;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.View;
import com.adsdk.sdk.Log;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.net.URL;
public class NavIcon extends AspectRatioImageViewWidth implements View.OnClickListener {
private Context mContext;
private Handler mHandler;
private NavIconData mIcon;
public NavIcon(Context context, NavIconData icon) {
super(context);
int padding = (int) TypedValue.applyDimension(1, 4.0f, getResources().getDisplayMetrics());
this.mContext = context;
this.mIcon = icon;
setPadding(padding, 0, padding, 0);
this.mHandler = new Handler();
setVisibility(8);
setImageDrawable(icon.iconUrl);
setOnClickListener(this);
}
private void setImageDrawable(final String url) {
Thread t = new Thread(new Runnable() {
@Override
public void run() {
final Drawable image = NavIcon.this.fetchImage(url);
if (image != null) {
NavIcon.this.mHandler.post(new Runnable() {
@Override
public void run() {
NavIcon.this.setImageDrawable(image);
NavIcon.this.setVisibility(0);
NavIcon.this.requestLayout();
}
});
}
}
});
t.start();
}
public Drawable fetchImage(String urlString) {
Bitmap b;
InputStream in = null;
try {
try {
URL url = new URL(urlString);
in = (InputStream) url.getContent();
b = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.d("NavIcon cannot load resource " + urlString);
if (in != null) {
try {
in.close();
} catch (Exception e2) {
}
}
}
if (b == null) {
try {
URL url2 = new URL(urlString);
InputStream is = (InputStream) url2.getContent();
return Drawable.createFromStream(is, "src");
} catch (Exception e3) {
Log.e("Cannot fetch image:" + urlString, e3);
return null;
}
}
DisplayMetrics m = this.mContext.getResources().getDisplayMetrics();
int w = b.getWidth();
int h = b.getHeight();
int imageWidth = (int) TypedValue.applyDimension(1, w, m);
int imageHeight = (int) TypedValue.applyDimension(1, h, m);
if (imageWidth != w || imageHeight != h) {
b = Bitmap.createScaledBitmap(b, imageWidth, imageHeight, false);
}
BitmapDrawable bitmapDrawable = new BitmapDrawable(this.mContext.getResources(), b);
if (in != null) {
try {
in.close();
return bitmapDrawable;
} catch (Exception e4) {
return bitmapDrawable;
}
}
return bitmapDrawable;
} finally {
if (in != null) {
try {
in.close();
} catch (Exception e5) {
}
}
}
}
@Override
public void onClick(View v) {
try {
} catch (Exception e) {
Log.w("Couldn't open URL: " + this.mIcon.clickUrl);
}
if (this.mContext instanceof RichMediaActivity) {
RichMediaActivity activity = (RichMediaActivity) this.mContext;
if (this.mIcon.openType == 1) {
Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(this.mIcon.clickUrl));
activity.startActivity(intent);
} else {
String url = this.mIcon.clickUrl;
if (url.startsWith("market:") || url.startsWith("http://market.android.com") || url.startsWith("sms:") || url.startsWith("tel:") || url.startsWith("mailto:") || url.startsWith("voicemail:") || url.startsWith("geo:") || url.startsWith("google.streetview:")) {
Intent intent2 = new Intent("android.intent.action.VIEW", Uri.parse(url));
activity.startActivity(intent2);
} else if (url.startsWith("mfox:external:")) {
Intent intent3 = new Intent("android.intent.action.VIEW", Uri.parse(url.substring(16)));
activity.startActivity(intent3);
} else {
if (url.startsWith("mfox:replayvideo")) {
try {
Method method = activity.getClass().getMethod("replayVideo", new Class[0]);
method.invoke(activity, new Object[0]);
} catch (NoSuchMethodException e2) {
Log.d("Your activity class has no replayVideo method");
} catch (Exception e3) {
Log.d("Couldn't run replayVideo method in your Activity");
}
} else if (url.startsWith("mfox:playvideo")) {
try {
Method method2 = activity.getClass().getMethod("playVideo", new Class[0]);
method2.invoke(activity, new Object[0]);
} catch (NoSuchMethodException e4) {
Log.d("Your activity class has no playVideo method");
} catch (Exception e5) {
Log.d("Couldn't run replayVideo method in your Activity");
}
} else if (url.startsWith("mfox:skip")) {
activity.finish();
} else {
activity.navigate(this.mIcon.clickUrl);
}
Log.w("Couldn't open URL: " + this.mIcon.clickUrl);
}
}
}
}
}