九游游戏中心HD v4.6.8.1版本的 MD5 值为:78c397802cc5ffdcc7f5502ede90502e

以下内容为反编译后的 g.java 源代码,内容仅作参考


package cn.ninegame.library.util;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.text.TextUtils;
import cn.ninegame.b.a.a;
import cn.ninegame.framework.NineGameClientApplication;
import cn.ninegame.gamemanager.activity.MainActivity;
import cn.ninegame.gamemanager.activity.MessageBoxActivity;
import cn.ninegame.gamemanager.game.follow.model.InterestedGame;
import cn.ninegame.gamemanager.video.VideoActivity;
import cn.ninegame.gamemanager.video.parcel.ArticleVideoInfo;
import cn.ninegame.gamemanagerhd.R;
import cn.ninegame.library.stat.StatInfo;
import cn.ninegame.share.core.ShareParameter;
import cn.ninegame.sns.favorite.model.pojo.WebFavoriteParameterInfo;
import com.UCMobile.Apollo.MediaPlayer;
import java.io.File;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public final class g {
    public static String f2785a = "gameId";
    public static String b = InterestedGame.PACKAGE_NAME;
    public static String c = "state";
    public static String d = "orientation";

    public static String a(String str, String str2) {
        a.C0021a.a();
        StringBuffer append = new StringBuffer(cn.ninegame.b.a.a.a()).append(str);
        if (str2 != null) {
            append.append("?keyword=").append(str2);
        }
        return append.toString();
    }

    public static void b(String str, String str2) {
        NineGameClientApplication a2 = NineGameClientApplication.a();
        Intent intent = new Intent(a2, MainActivity.class);
        intent.setAction("cn.ninegame.gamemanager.action.PULLUP");
        intent.addFlags(335544320);
        intent.putExtra("request", "request_jump_to_fragment");
        intent.putExtra("main_fragment_name", str);
        if (!TextUtils.isEmpty(str2)) {
            intent.putExtra("url", str2);
        }
        cn.ninegame.library.stat.b.b.a("init# handle openPage 2", new Object[0]);
        a2.startActivity(intent);
    }

    public static void a(Class cls, JSONObject jSONObject) {
        NineGameClientApplication a2 = NineGameClientApplication.a();
        Intent intent = new Intent(a2, MainActivity.class);
        intent.setAction("android.intent.action.MAIN");
        intent.addFlags(335544320);
        intent.putExtra("request", "request_jump_to_fragment");
        intent.putExtra("main_fragment_name", cls.getName());
        intent.putExtra(WebFavoriteParameterInfo.PARAMS, jSONObject.toString());
        cn.ninegame.library.stat.b.b.a("init# handle openPage 4", new Object[0]);
        a2.startActivity(intent);
    }

    public static void a(String str, JSONObject jSONObject) {
        NineGameClientApplication a2 = NineGameClientApplication.a();
        Intent intent = new Intent(a2, MainActivity.class);
        intent.setAction("android.intent.action.MAIN");
        intent.addFlags(335544320);
        intent.putExtra("request", "request_jump_to_fragment");
        intent.putExtra("main_fragment_name", str);
        if (jSONObject != null) {
            intent.putExtra(WebFavoriteParameterInfo.PARAMS, jSONObject.toString());
        }
        cn.ninegame.library.stat.b.b.a("init# handle openPage 5", new Object[0]);
        a2.startActivity(intent);
    }

    public static void c(String str, String str2) {
        NineGameClientApplication a2 = NineGameClientApplication.a();
        Intent intent = new Intent(a2, MainActivity.class);
        intent.setAction("android.intent.action.MAIN");
        intent.addFlags(335544320);
        intent.putExtra("request", "request_jump_to_fragment");
        intent.putExtra("main_fragment_name", str);
        intent.putExtra("url", str2);
        intent.putExtra("is_quick_download", true);
        cn.ninegame.library.stat.b.b.a("init# handle openPageForQuickDownload", new Object[0]);
        a2.startActivity(intent);
    }

    public static void a(int i, Bundle bundle) {
        NineGameClientApplication a2 = NineGameClientApplication.a();
        Intent intent = new Intent(a2, MessageBoxActivity.class);
        intent.putExtra("dialog_id", i);
        intent.putExtra("extra_bundle", bundle);
        intent.addFlags(MediaPlayer.MEDIA_ERROR_UNKNOWN);
        a2.startActivity(intent);
    }

    public static void a(Activity activity, Intent intent, int i) {
        if (activity != null && !activity.isFinishing()) {
            if (i == 0 || Build.VERSION.SDK_INT < 14) {
                a(activity, intent);
                return;
            }
            cn.ninegame.library.stat.a.b.b().a("游戏安装", new String[0]);
            cn.ninegame.library.i.i.a((cn.ninegame.library.i.a.b.i) new h(cn.ninegame.library.i.a.b.j.OTHER, intent, activity, i));
        }
    }

    public static void a(Context context, Intent intent) {
        cn.ninegame.library.stat.a.b.b().a("游戏安装", new String[0]);
        cn.ninegame.library.i.i.a((cn.ninegame.library.i.a.b.i) new i(cn.ninegame.library.i.a.b.j.OTHER, intent, context));
    }

    public static Intent a(File file) {
        return a(Uri.fromFile(file));
    }

    public static Intent a(String str) {
        return a(Uri.parse("file://" + str));
    }

    private static Intent a(Uri uri) {
        Intent intent = new Intent("android.intent.action.VIEW");
        intent.setDataAndType(uri, "application/vnd.android.package-archive");
        intent.setFlags(1610612736);
        return intent;
    }

    public static void a(Context context, String str) {
        cn.ninegame.library.stat.a.b.b().a("游戏卸载", new String[0]);
        try {
            context.startActivity(new Intent("android.intent.action.DELETE", Uri.fromParts("package", str, null)));
        } catch (Exception e) {
            cn.ninegame.library.stat.b.b.a(e);
            cc.b((int) R.string.txt_delete_pkg_fail_tip);
        }
    }

    public static boolean b(Context context, String str) {
        Intent launchIntentForPackage;
        NineGameClientApplication a2 = NineGameClientApplication.a();
        if (str.equals(context.getPackageName())) {
            cc.b((int) R.string.already_start_nine_game);
            return true;
        }
        try {
            launchIntentForPackage = a2.getPackageManager().getLaunchIntentForPackage(str);
        } catch (Exception e) {
            cn.ninegame.library.stat.b.b.a(e);
        }
        if (launchIntentForPackage != null) {
            launchIntentForPackage.setPackage(null);
            a2.startActivity(launchIntentForPackage);
            cn.ninegame.library.stat.a.b.b().a("游戏安装", new String[0]);
            cn.ninegame.hybird.api.bridge.data.j.a("start_game_app");
            return true;
        }
        cc.i("启动应用失败!");
        return false;
    }

    public static boolean a(Context context, String str, String str2) {
        if (TextUtils.isEmpty(str) || TextUtils.isEmpty(str2)) {
            return false;
        }
        Intent intent = new Intent();
        intent.setClassName(str, str2);
        return context.getPackageManager().resolveActivity(intent, 0) != null;
    }

    public static void b(String str) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(str);
        a(arrayList);
    }

    public static void a(ArrayList<String> arrayList) {
        a(arrayList, null, null, null, null);
    }

    public static void a(ArrayList<String> arrayList, ArrayList<ArticleVideoInfo> arrayList2, ShareParameter shareParameter, StatInfo statInfo, StatInfo statInfo2) {
        NineGameClientApplication a2 = NineGameClientApplication.a();
        Intent intent = new Intent(a2, VideoActivity.class);
        intent.putStringArrayListExtra(VideoActivity.f1640a, arrayList);
        intent.putExtra(VideoActivity.b, (Parcelable) null);
        if (arrayList2 != null && arrayList2.size() > 0) {
            intent.putExtra(VideoActivity.c, arrayList2);
            intent.putExtra(VideoActivity.d, true);
        }
        if (statInfo != null) {
            intent.putExtra(VideoActivity.e, statInfo);
        }
        if (statInfo2 != null) {
            intent.putExtra(VideoActivity.f, statInfo2);
        }
        intent.addFlags(MediaPlayer.MEDIA_ERROR_UNKNOWN);
        a2.startActivity(intent);
        cn.ninegame.library.stat.a.j.b().a("btn_video", "all_all");
    }

    public static void a(String str, ArticleVideoInfo articleVideoInfo) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(str);
        ArrayList arrayList2 = new ArrayList();
        arrayList2.add(articleVideoInfo);
        a(arrayList, arrayList2);
    }

    public static void a(ArrayList<String> arrayList, ArrayList<ArticleVideoInfo> arrayList2) {
        a(arrayList, arrayList2, null, null, null);
    }

    public static ArticleVideoInfo c(String str) {
        JSONObject jSONObject = new JSONObject();
        try {
            jSONObject.put("apolloUA", "UCWEB/2.0 (####) U2/1.0.0 UCBrowser/8.6.0.199 U2/1.0.0 Mobile");
            jSONObject.put("title", "游戏视频");
            JSONArray jSONArray = new JSONArray();
            JSONObject jSONObject2 = new JSONObject();
            JSONArray jSONArray2 = new JSONArray();
            JSONObject jSONObject3 = new JSONObject();
            jSONObject3.put("duration", 0);
            jSONObject3.put("url", str);
            jSONArray2.put(jSONObject3);
            jSONObject2.put("fragment", jSONArray2);
            jSONObject2.put("duration", 0);
            jSONArray.put(jSONObject2);
            jSONObject.put("videoList", jSONArray);
        } catch (JSONException e) {
            cn.ninegame.library.stat.b.b.a(e);
        }
        try {
            return new ArticleVideoInfo(jSONObject.toString());
        } catch (Exception e2) {
            cn.ninegame.library.stat.b.b.a(e2);
            return null;
        }
    }

    public static void a(ShareParameter shareParameter) {
        NineGameClientApplication a2 = NineGameClientApplication.a();
        Intent intent = new Intent(a2, MainActivity.class);
        intent.setAction("cn.ninegame.gamemanager.action.PULLUP");
        intent.addFlags(335544320);
        intent.putExtra("request", "intent_sdk_share");
        if (shareParameter != null) {
            intent.putExtra("bundle_share_parameter", shareParameter);
        }
        cn.ninegame.library.stat.b.b.a("init# handle openPage 2", new Object[0]);
        a2.startActivity(intent);
    }
}