导航菜单

页面标题

页面副标题

Clash Legends v0.0.1 - SelectedResultActivity.java 源代码

正在查看: Clash Legends v0.0.1 应用的 SelectedResultActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.clash.legends.ui.activities;

import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.text.style.ImageSpan;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import com.android.volley.AuthFailureError;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;
import com.clash.legends.models.CurrentUser;
import com.clash.legends.utils.LoadingDialog;
import com.clash.legends.utils.LocaleHelper;
import com.clash.legends.utils.UserLocalStore;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.LoadAdError;
import com.squareup.picasso.Picasso;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class SelectedResultActivity extends AppCompatActivity {
    int N = 0;
    ImageView back;
    Context context;
    LinearLayout fullResultLl;
    TextView fullresulttitle;
    CardView imageViewSelectedCardview;
    ImageView imgeviewSelected;
    TextView killstitle;
    TextView killtitle;
    LoadingDialog loadingDialog;
    RequestQueue mQueue;
    TextView matchresulttitle;
    TextView playernametitle;
    TextView playrnametitle;
    SwipeRefreshLayout pullToRefresh;
    Resources resources;
    TextView resultEntryFee;
    TextView resultNotification;
    LinearLayout resultNotificationCardview;
    TextView resultPerKill;
    TextView resultPrizePool;
    TextView resultTime;
    TextView resultTitleAndNumber;
    CurrentUser user;
    UserLocalStore userLocalStore;
    LinearLayout winResultLl;
    TextView winnertitle;
    TextView winngtitle;
    TextView winningtitle;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(2131558480);
        SharedPreferences spb = getSharedPreferences("SMINFO", 0);
        if (TextUtils.equals(spb.getString("baner", "no"), "yes")) {
            final AdView mAdView = findViewById(2131361885);
            AdRequest adRequest = new AdRequest.Builder().build();
            mAdView.loadAd(adRequest);
            mAdView.setAdListener(new AdListener() {
                public void onAdLoaded() {
                    mAdView.setVisibility(0);
                }

                public void onAdFailedToLoad(LoadAdError adError) {
                    mAdView.setVisibility(8);
                }

                public void onAdOpened() {
                }

                public void onAdClicked() {
                }

                public void onAdLeftApplication() {
                }

                public void onAdClosed() {
                }
            });
        }
        Context locale = LocaleHelper.setLocale(this);
        this.context = locale;
        this.resources = locale.getResources();
        LoadingDialog loadingDialog = new LoadingDialog(this);
        this.loadingDialog = loadingDialog;
        loadingDialog.show();
        SwipeRefreshLayout findViewById = findViewById(2131363104);
        this.pullToRefresh = findViewById;
        findViewById.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            public final void onRefresh() {
                SelectedResultActivity.this.m200x89bbe481();
            }
        });
        this.matchresulttitle = (TextView) findViewById(2131362696);
        this.winnertitle = (TextView) findViewById(2131363799);
        this.playernametitle = (TextView) findViewById(2131363033);
        this.killstitle = (TextView) findViewById(2131362559);
        this.winningtitle = (TextView) findViewById(2131363805);
        this.fullresulttitle = (TextView) findViewById(2131362378);
        this.playrnametitle = (TextView) findViewById(2131363036);
        this.killtitle = (TextView) findViewById(2131362560);
        this.winngtitle = (TextView) findViewById(2131363804);
        this.matchresulttitle.setText(this.resources.getString(2131886542));
        this.winnertitle.setText(this.resources.getString(2131887080));
        this.playernametitle.setText(this.resources.getString(2131886893));
        this.killstitle.setText(this.resources.getString(2131886503));
        this.winningtitle.setText(this.resources.getString(2131887081));
        this.fullresulttitle.setText(this.resources.getString(2131886542));
        this.playrnametitle.setText(this.resources.getString(2131886893));
        this.killtitle.setText(this.resources.getString(2131886503));
        this.winngtitle.setText(this.resources.getString(2131887081));
        this.resultTitleAndNumber = (TextView) findViewById(2131363180);
        this.resultTime = (TextView) findViewById(2131363179);
        this.resultPrizePool = (TextView) findViewById(2131363177);
        this.resultPerKill = (TextView) findViewById(2131363176);
        this.resultEntryFee = (TextView) findViewById(2131363171);
        this.resultNotificationCardview = (LinearLayout) findViewById(2131363175);
        this.resultNotification = (TextView) findViewById(2131363174);
        this.winResultLl = (LinearLayout) findViewById(2131363806);
        this.fullResultLl = (LinearLayout) findViewById(2131362377);
        ImageView imageView = (ImageView) findViewById(2131361987);
        this.back = imageView;
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                SelectedResultActivity.this.m201x8af23760(view);
            }
        });
        Intent intent = getIntent();
        String mid = intent.getStringExtra("M_ID");
        String baner = intent.getStringExtra("BANER");
        this.imageViewSelectedCardview = findViewById(2131362444);
        this.imgeviewSelected = (ImageView) findViewById(2131362443);
        if (!TextUtils.equals(baner, "")) {
            this.imageViewSelectedCardview.setVisibility(0);
            Picasso.get().load(Uri.parse(baner)).placeholder(2131231003).fit().into(this.imgeviewSelected);
        } else {
            this.imageViewSelectedCardview.setVisibility(8);
        }
        getSharedPreferences("currencyinfo", 0);
        RequestQueue newRequestQueue = Volley.newRequestQueue(getApplicationContext());
        this.mQueue = newRequestQueue;
        newRequestQueue.getCache().clear();
        UserLocalStore userLocalStore = new UserLocalStore(getApplicationContext());
        this.userLocalStore = userLocalStore;
        this.user = userLocalStore.getLoggedInUser();
        String url = this.resources.getString(2131886167) + "single_game_result/" + mid;
        JsonObjectRequest request = new JsonObjectRequest(url, null, new Response.Listener() {
            public final void onResponse(Object obj) {
                SelectedResultActivity.this.m202x8c288a3f((JSONObject) obj);
            }
        }, new Response.ErrorListener() {
            public final void onErrorResponse(VolleyError volleyError) {
                Log.e("**VolleyError", "error" + volleyError.getMessage());
            }
        }) {
            protected Map<String, String> getParams() throws AuthFailureError {
                return super.getParams();
            }

            public Map<String, String> getHeaders() {
                Map<String, String> headers = new HashMap<>();
                CurrentUser user = SelectedResultActivity.this.userLocalStore.getLoggedInUser();
                String token = "Bearer " + user.getToken();
                headers.put("Content-Type", "application/json");
                headers.put("Authorization", token);
                headers.put("x-localization", LocaleHelper.getPersist(SelectedResultActivity.this.context));
                return headers;
            }
        };
        request.setShouldCache(false);
        this.mQueue.add(request);
    }

    void m200x89bbe481() {
        this.pullToRefresh.setRefreshing(true);
        finish();
        overridePendingTransition(0, 0);
        startActivity(getIntent());
        overridePendingTransition(0, 0);
        this.pullToRefresh.setRefreshing(false);
    }

    void m201x8af23760(View view) {
        Intent intent = new Intent(getApplicationContext(), (Class<?>) SelectedGameActivity.class);
        intent.putExtra("N", "2");
        startActivity(intent);
    }

    void m202x8c288a3f(JSONObject response) {
        JSONObject obj;
        try {
            obj = response.getJSONObject("match_deatils");
            this.resultTitleAndNumber.setText(obj.getString("match_name") + " - " + this.resources.getString(2131886537) + " #" + obj.getString("m_id"));
            this.resultTime.setText(Html.fromHtml(this.resources.getString(2131886658) + " <b>" + obj.getString("match_time") + "</b>"));
            this.resultTime.setClickable(true);
            this.resultTime.setMovementMethod(LinkMovementMethod.getInstance());
            SpannableStringBuilder builder = new SpannableStringBuilder();
            builder.append((CharSequence) Html.fromHtml(this.resources.getString(2131887082) + " : ")).append(" ", new ImageSpan(getApplicationContext(), 2131231393, 1), 0).append((CharSequence) " ").append((CharSequence) Html.fromHtml("<b>" + obj.getString("win_prize"))).append((CharSequence) "");
            this.resultPrizePool.setText(builder);
            SpannableStringBuilder builder2 = new SpannableStringBuilder();
            builder2.append((CharSequence) Html.fromHtml(this.resources.getString(2131886879) + " : ")).append(" ", new ImageSpan(getApplicationContext(), 2131231393, 1), 0).append((CharSequence) " ").append((CharSequence) Html.fromHtml("<b>" + obj.getString("per_kill"))).append((CharSequence) "");
            this.resultPerKill.setText(builder2);
            SpannableStringBuilder builder3 = new SpannableStringBuilder();
            builder3.append((CharSequence) Html.fromHtml(this.resources.getString(2131886440) + " : ")).append(" ", new ImageSpan(getApplicationContext(), 2131231393, 1), 0).append((CharSequence) " ").append((CharSequence) Html.fromHtml("<b>" + obj.getString("entry_fee")));
            this.resultEntryFee.setText(builder3);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        if (!TextUtils.equals(obj.getString("result_notification"), "null") && !TextUtils.equals(obj.getString("result_notification"), "")) {
            this.resultNotificationCardview.setVisibility(0);
            this.resultNotification.setText(obj.getString("result_notification"));
            JSONArray winarr = response.getJSONArray("match_winner");
            JSON_PARSE_DATA_AFTER_WEBCALL(winarr);
            JSONArray fullarr = response.getJSONArray("full_result");
            JSON_PARSE_DATA_AFTER_WEBCALL_FULL(fullarr);
            this.loadingDialog.dismiss();
        }
        this.resultNotificationCardview.setVisibility(8);
        JSONArray winarr2 = response.getJSONArray("match_winner");
        JSON_PARSE_DATA_AFTER_WEBCALL(winarr2);
        JSONArray fullarr2 = response.getJSONArray("full_result");
        JSON_PARSE_DATA_AFTER_WEBCALL_FULL(fullarr2);
        this.loadingDialog.dismiss();
    }

    public void JSON_PARSE_DATA_AFTER_WEBCALL(JSONArray array) {
        for (int i = 0; i < array.length(); i++) {
            try {
                JSONObject json = array.getJSONObject(i);
                View view1 = getLayoutInflater().inflate(2131558779, (ViewGroup) null);
                TextView winno = (TextView) view1.findViewById(2131362821);
                TextView winpname = (TextView) view1.findViewById(2131363038);
                TextView winkills = (TextView) view1.findViewById(2131362558);
                TextView winwining = (TextView) view1.findViewById(2131363790);
                winno.setText(String.valueOf(i + 1));
                winpname.setText(json.getString("pubg_id"));
                winkills.setText(json.getString("killed"));
                if (isDouble(json.getString("total_win"))) {
                    winwining.setText(String.format("%.2f", Double.valueOf(Double.parseDouble(json.getString("total_win")))));
                } else {
                    winwining.setText(json.getString("total_win"));
                }
                this.winResultLl.addView(view1);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    boolean isDouble(String str) {
        try {
            Double.parseDouble(str);
            return true;
        } catch (NumberFormatException e) {
            return false;
        }
    }

    public void JSON_PARSE_DATA_AFTER_WEBCALL_FULL(JSONArray array) {
        for (int i = 0; i < array.length(); i++) {
            try {
                JSONObject json = array.getJSONObject(i);
                View view2 = getLayoutInflater().inflate(2131558779, (ViewGroup) null);
                TextView winno = (TextView) view2.findViewById(2131362821);
                TextView winpname = (TextView) view2.findViewById(2131363038);
                TextView winkills = (TextView) view2.findViewById(2131362558);
                TextView winwining = (TextView) view2.findViewById(2131363790);
                winno.setText(String.valueOf(i + 1));
                winpname.setText(json.getString("pubg_id"));
                winkills.setText(json.getString("killed"));
                winwining.setText(json.getString("total_win"));
                if (TextUtils.equals(json.getString("user_name"), this.user.getUsername())) {
                    int i2 = this.N;
                    if (i2 == 0) {
                        this.fullResultLl.addView(view2, 0);
                    } else if (i2 == 1) {
                        this.fullResultLl.addView(view2, 1);
                    } else if (i2 == 2) {
                        this.fullResultLl.addView(view2, 2);
                    } else if (i2 == 3) {
                        this.fullResultLl.addView(view2, 3);
                    } else if (i2 == 4) {
                        this.fullResultLl.addView(view2, 4);
                    }
                    this.N++;
                } else {
                    this.fullResultLl.addView(view2);
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }
}