OurPlay v5.5.9版本的 MD5 值为:d4e139798f4c2243a1145c8af5e21046

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


package com.excelliance.kxqp.community.widgets.dialog;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import com.excean.ggspace.main.R;
import com.excelliance.kxqp.community.helper.c;
import com.excelliance.kxqp.community.helper.r;
import com.excelliance.kxqp.community.model.entity.AppComment;
import com.excelliance.kxqp.community.widgets.AvatarView;
import com.excelliance.kxqp.gs.thpool.tp;
import com.excelliance.kxqp.gs.ui.medal.a.k;
import com.excelliance.kxqp.gs.ui.share.core.config.SocializeMedia;
import com.excelliance.kxqp.gs.ui.share.core.helper.ShareHelper;
import com.excelliance.kxqp.gs.ui.share.core.param.BigImageShareParam;
import com.excelliance.kxqp.gs.ui.share.core.param.ShareImage;
import com.excelliance.kxqp.gs.util.ad;
import com.excelliance.kxqp.gs.util.bq;
import com.excelliance.kxqp.gs.util.bv;
import com.excelliance.kxqp.gs.util.bx;
import com.excelliance.kxqp.gs.util.t;
import com.excelliance.kxqp.platforms.ExcellianceAppInfo;
import com.excelliance.kxqp.ui.detail.RankingDetailInfo;
import com.excelliance.kxqp.widget.SimpleRatingBar;
import java.io.File;
import java.io.IOException;

public class f extends Dialog implements View.OnClickListener {

    private final Context f3608a;

    private TextView f3609b;
    private ViewGroup c;
    private ImageView d;
    private ImageView e;
    private TextView f;
    private AvatarView g;
    private TextView h;
    private SimpleRatingBar i;
    private TextView j;
    private ImageView k;
    private ViewGroup l;
    private ViewGroup m;
    private ViewGroup n;
    private ViewGroup o;
    private View p;
    private String q;
    private int r;
    private boolean s;

    private static void a(Context context, boolean z) {
        Activity d;
        if (!z || (d = com.excelliance.kxqp.gs.ui.medal.a.d.d(context)) == null) {
            return;
        }
        d.finish();
    }

    @Override
    public boolean onKeyDown(int i, @NonNull KeyEvent keyEvent) {
        if (i == 4) {
            a(this.f3608a, this.s);
        }
        return super.onKeyDown(i, keyEvent);
    }

    private f(@NonNull Context context) {
        this(context, R.style.FullScreenDialogTheme);
    }

    private f(@NonNull Context context, int i) {
        super(context, i);
        this.f3608a = context;
    }

    public static void a(Fragment fragment, AppComment appComment, boolean z) {
        if (fragment == null || appComment == null) {
            return;
        }
        a((Activity) fragment.getActivity(), appComment, appComment.appInfo, z);
    }

    public static void a(Activity activity, AppComment appComment, ExcellianceAppInfo excellianceAppInfo, boolean z) {
        if (com.excelliance.kxqp.gs.ui.medal.a.d.a(activity) || appComment == null || excellianceAppInfo == null) {
            return;
        }
        a((Context) activity, appComment, excellianceAppInfo, z);
    }

    public static void a(Fragment fragment, AppComment appComment, RankingDetailInfo rankingDetailInfo, boolean z) {
        if (fragment == null) {
            return;
        }
        a((Activity) fragment.getActivity(), appComment, rankingDetailInfo, z);
    }

    public static void a(Activity activity, AppComment appComment, RankingDetailInfo rankingDetailInfo, boolean z) {
        if (com.excelliance.kxqp.gs.ui.medal.a.d.a(activity) || appComment == null || rankingDetailInfo == null) {
            return;
        }
        a((Context) activity, appComment, rankingDetailInfo, z);
    }

    private static void a(Context context, AppComment appComment, RankingDetailInfo rankingDetailInfo, boolean z) {
        if (appComment == null || rankingDetailInfo == null || rankingDetailInfo.getAppInfo() == null) {
            a(context, z);
            return;
        }
        f fVar = new f(context);
        fVar.show();
        fVar.b(appComment.nickname);
        fVar.a(appComment.header, appComment.avatarFrame);
        fVar.a(appComment.id);
        fVar.c(appComment.reviewed ? appComment.content : "");
        fVar.d(rankingDetailInfo.getIcon());
        fVar.e(rankingDetailInfo.getName());
        fVar.f(String.valueOf(rankingDetailInfo.getSeoGameId()));
        fVar.a(rankingDetailInfo.getTitlepic());
        fVar.a(appComment.stars);
        fVar.a(z);
        c.e.g(context, rankingDetailInfo.getPkgname());
    }

    private static void a(Context context, AppComment appComment, ExcellianceAppInfo excellianceAppInfo, boolean z) {
        if (appComment == null || excellianceAppInfo == null) {
            a(context, z);
            return;
        }
        f fVar = new f(context);
        fVar.show();
        fVar.b(appComment.nickname);
        fVar.a(appComment.header, appComment.avatarFrame);
        fVar.a(appComment.id);
        fVar.c(appComment.reviewed ? appComment.content : "");
        fVar.d(excellianceAppInfo.getIconPath());
        fVar.e(excellianceAppInfo.getAppName());
        fVar.f(String.valueOf(excellianceAppInfo.getSeoGameId()));
        fVar.a(excellianceAppInfo.coverUrl);
        fVar.a(appComment.stars);
        fVar.a(z);
    }

    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(LayoutInflater.from(getContext()).inflate(R.layout.dialog_share_comment, (ViewGroup) null));
        WindowManager.LayoutParams attributes = getWindow().getAttributes();
        attributes.width = a(getWindow().getWindowManager());
        attributes.height = -2;
        attributes.gravity = 17;
        getWindow().setAttributes(attributes);
        setCanceledOnTouchOutside(false);
        a();
        b();
    }

    protected int a(WindowManager windowManager) {
        return (windowManager.getDefaultDisplay().getWidth() - ad.a(getContext(), 30.0f)) - ad.a(getContext(), 30.0f);
    }

    private void a() {
        this.f3609b = (TextView) findViewById(R.id.tv_title);
        this.c = (ViewGroup) findViewById(R.id.layout_content);
        this.d = (ImageView) findViewById(R.id.iv_cover_round);
        this.e = (ImageView) findViewById(R.id.iv_game_icon);
        this.f = (TextView) findViewById(R.id.tv_game_name);
        this.g = (AvatarView) findViewById(R.id.v_avatar);
        this.h = (TextView) findViewById(R.id.tv_nickname);
        this.j = (TextView) findViewById(R.id.tv_comment);
        this.i = (SimpleRatingBar) findViewById(R.id.srb);
        this.k = (ImageView) findViewById(R.id.iv_square_code);
        this.l = (ViewGroup) findViewById(R.id.layout_share_wechat);
        this.m = (ViewGroup) findViewById(R.id.layout_share_moment);
        this.n = (ViewGroup) findViewById(R.id.layout_share_qq);
        this.o = (ViewGroup) findViewById(R.id.layout_save_album);
        this.p = findViewById(R.id.iv_close);
    }

    public static AppComment a(Context context, AppComment appComment) {
        SharedPreferences sharedPreferences = context.getSharedPreferences("USERINFO", 4);
        appComment.nickname = bx.a().a(sharedPreferences, t.c);
        appComment.header = bx.a().a(sharedPreferences, t.f);
        return appComment;
    }

    private void b() {
        this.i.setIndicator(true);
        this.i.a(14.0f, 1);
        this.i.setDrawBorderEnabled(false);
        this.i.b(10.0f, 1);
        this.l.setOnClickListener(this);
        this.m.setOnClickListener(this);
        this.n.setOnClickListener(this);
        this.o.setOnClickListener(this);
        this.p.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == this.l.getId()) {
            a(new Runnable() {
                @Override
                public void run() {
                    f.this.a(SocializeMedia.WEIXIN);
                    f.this.c();
                    c.b.e(f.this.f3608a, "微信按钮", null, f.this.r);
                }
            });
            return;
        }
        if (view.getId() == this.m.getId()) {
            a(new Runnable() {
                @Override
                public void run() {
                    f.this.a(SocializeMedia.WEIXIN_MONMENT);
                    f.this.c();
                    c.b.e(f.this.f3608a, "微信朋友圈按钮", null, f.this.r);
                }
            });
            return;
        }
        if (view.getId() == this.n.getId()) {
            a(new Runnable() {
                @Override
                public void run() {
                    f.this.a(SocializeMedia.QQ);
                    f.this.c();
                    c.b.e(f.this.f3608a, "QQ按钮", null, f.this.r);
                }
            });
            return;
        }
        if (view.getId() == this.o.getId()) {
            a(new Runnable() {
                @Override
                public void run() {
                    f.this.e();
                    f.this.c();
                    c.b.e(f.this.f3608a, "保存本地按钮", null, f.this.r);
                }
            });
        } else if (view == this.p) {
            dismiss();
            a(this.f3608a, this.s);
            c.b.e(this.f3608a, "取消按钮", null, this.r);
        }
    }

    public void c() {
        com.excelliance.kxqp.community.model.a.b.e(getContext(), this.r);
    }

    public void a(String str) {
        k.a(getContext(), str, this.d, R.drawable.comment_success_poster_cover_raw);
    }

    public void a(float f) {
        this.i.setRating(r.b(f));
    }

    public void a(boolean z) {
        Context context;
        int i;
        this.s = z;
        TextView textView = this.f3609b;
        if (z) {
            context = this.f3608a;
            i = R.string.comment_success;
        } else {
            context = this.f3608a;
            i = R.string.share;
        }
        textView.setText(context.getString(i));
    }

    public void b(String str) {
        this.h.setText(str);
    }

    public void a(String str, String str2) {
        this.g.a(str, str2);
    }

    public void a(int i) {
        this.r = i;
    }

    public void c(String str) {
        this.j.setText(str);
    }

    public void d(String str) {
        k.d(getContext(), str, this.e, R.drawable.default_icon);
    }

    public void e(String str) {
        this.f.setText(str);
    }

    public void f(String str) {
        this.q = "https://m.ourplay.net/rank/detail/" + str;
        tp.f(new Runnable() {
            @Override
            public void run() {
                final Bitmap a2 = bv.a(f.this.q, ad.a(f.this.getContext(), 45.0f), ad.a(f.this.getContext(), 45.0f));
                tp.i(new Runnable() {
                    @Override
                    public void run() {
                        if (a2 != null) {
                            f.this.k.setImageBitmap(a2);
                        }
                    }
                });
            }
        });
    }

    private Bitmap d() {
        return a(this.c);
    }

    private Bitmap a(View view) {
        if (view == null) {
            return null;
        }
        view.buildDrawingCache();
        Bitmap drawingCache = view.getDrawingCache();
        if (drawingCache != null) {
            return drawingCache;
        }
        Bitmap createBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(createBitmap);
        canvas.translate(-view.getScrollX(), -view.getScrollY());
        view.draw(canvas);
        return createBitmap;
    }

    public void a(SocializeMedia socializeMedia) {
        Bitmap d = d();
        String charSequence = this.f.getText().toString();
        String charSequence2 = this.j.getText().toString();
        if (d == null) {
            Toast.makeText(this.f3608a, "生成失败", 0).show();
            return;
        }
        ShareHelper instance = ShareHelper.instance((Activity) this.f3608a);
        instance.from(1);
        BigImageShareParam bigImageShareParam = new BigImageShareParam("#" + charSequence + "#" + charSequence2, "OurPlay评论成功", this.q);
        ShareImage shareImage = new ShareImage();
        shareImage.setLocalFile(new File(com.excelliance.kxqp.gs.ui.make_money.f.b(d)));
        bigImageShareParam.setThumb(shareImage);
        instance.shareMediaTo(socializeMedia, bigImageShareParam);
    }

    private void a(Runnable runnable) {
        if (bq.b(this.f3608a)) {
            runnable.run();
        } else {
            bq.a(this.f3608a, new Runnable() {
                @Override
                public void run() {
                    ActivityCompat.requestPermissions((Activity) f.this.f3608a, new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 99);
                }
            });
        }
    }

    public void e() {
        Bitmap d = d();
        if (d == null) {
            Toast.makeText(this.f3608a, "生成失败", 0).show();
            return;
        }
        File file = new File(com.excelliance.kxqp.gs.ui.make_money.f.b(d));
        try {
            MediaStore.Images.Media.insertImage(getContext().getContentResolver(), file.getAbsolutePath(), file.getName(), (String) null);
            Toast.makeText(getContext(), R.string.comment_save_album_success, 0).show();
        } catch (IOException e) {
            e.printStackTrace();
            Toast.makeText(getContext(), R.string.comment_save_album_failed, 0).show();
        }
    }
}