导航菜单

页面标题

页面副标题

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

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

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


package com.clash.legends.ui.activities;

import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
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.Base64;
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 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 java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class MyRewardedActivity extends AppCompatActivity {
    ImageView back;
    Context context;
    TextView datetitle;
    TextView earningstitle;
    String from = "";
    LoadingDialog loadingDialog;
    RequestQueue mQueue;
    TextView myrefferlslisttitle;
    TextView myrewardssumarytitle;
    TextView myrewardstitle;
    TextView reawrdstitle;
    LinearLayout refLl;
    TextView refTv;
    Resources resources;
    CurrentUser user;
    UserLocalStore userLocalStore;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(2131558461);
        Context locale = LocaleHelper.setLocale(this);
        this.context = locale;
        this.resources = locale.getResources();
        LoadingDialog loadingDialog = new LoadingDialog(this);
        this.loadingDialog = loadingDialog;
        loadingDialog.show();
        Intent intent = getIntent();
        this.from = intent.getStringExtra("FROM");
        ImageView imageView = (ImageView) findViewById(2131361981);
        this.back = imageView;
        imageView.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                MyRewardedActivity.this.m130xd0f53ac3(view);
            }
        });
        this.myrewardstitle = (TextView) findViewById(2131362785);
        this.myrewardssumarytitle = (TextView) findViewById(2131362786);
        this.myrefferlslisttitle = (TextView) findViewById(2131362778);
        this.datetitle = (TextView) findViewById(2131362220);
        this.reawrdstitle = (TextView) findViewById(2131363187);
        this.earningstitle = (TextView) findViewById(2131362267);
        this.myrewardstitle.setText(this.resources.getString(2131886613));
        this.myrewardssumarytitle.setText(this.resources.getString(2131886615));
        this.datetitle.setText(this.resources.getString(2131886406));
        this.reawrdstitle.setText(this.resources.getString(2131886966));
        this.earningstitle.setText(this.resources.getString(2131886422));
        final TextView refnumber = (TextView) findViewById(2131363137);
        final TextView earnings = (TextView) findViewById(2131362266);
        this.refTv = (TextView) findViewById(2131363139);
        this.refLl = (LinearLayout) findViewById(2131363136);
        this.refTv.setText(this.resources.getString(2131886636));
        UserLocalStore userLocalStore = new UserLocalStore(getApplicationContext());
        this.userLocalStore = userLocalStore;
        this.user = userLocalStore.getLoggedInUser();
        RequestQueue newRequestQueue = Volley.newRequestQueue(getApplicationContext());
        this.mQueue = newRequestQueue;
        newRequestQueue.getCache().clear();
        String url = this.resources.getString(2131886167) + "watch_earn_detail/" + this.user.getMemberid();
        JsonObjectRequest request = new JsonObjectRequest(url, null, new Response.Listener() {
            public final void onResponse(Object obj) {
                MyRewardedActivity.this.m131xfecdd522(refnumber, earnings, (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 = MyRewardedActivity.this.userLocalStore.getLoggedInUser();
                String credentials = user.getUsername() + ":" + user.getPassword();
                String str = "Basic " + Base64.encodeToString(credentials.getBytes(), 2);
                String token = "Bearer " + user.getToken();
                headers.put("Content-Type", "application/json");
                headers.put("Authorization", token);
                headers.put("x-localization", LocaleHelper.getPersist(MyRewardedActivity.this.context));
                return headers;
            }
        };
        request.setShouldCache(false);
        this.mQueue.add(request);
    }

    void m130xd0f53ac3(View view) {
        onBackPressed();
    }

    void m131xfecdd522(TextView refnumber, TextView earnings, JSONObject response) {
        try {
            if (TextUtils.equals(response.getString("total_rewards"), "null")) {
                refnumber.setText(Html.fromHtml(this.resources.getString(2131886966) + "<br><b>0"));
            } else {
                refnumber.setText(Html.fromHtml(this.resources.getString(2131886966) + "<br><b>" + response.getString("total_rewards")));
            }
            refnumber.setClickable(true);
            refnumber.setMovementMethod(LinkMovementMethod.getInstance());
            getSharedPreferences("currencyinfo", 0);
            new SpannableStringBuilder();
            if (TextUtils.equals(response.getString("total_earning"), "null")) {
                SpannableStringBuilder builder = new SpannableStringBuilder();
                builder.append((CharSequence) Html.fromHtml(this.resources.getString(2131886422) + "<br>")).append(" ", new ImageSpan(getApplicationContext(), 2131231393, 1), 0).append((CharSequence) " ").append((CharSequence) Html.fromHtml("<b>0"));
                earnings.setText(builder);
            } else {
                SpannableStringBuilder builder2 = new SpannableStringBuilder();
                builder2.append((CharSequence) Html.fromHtml(this.resources.getString(2131886422) + "<br>")).append(" ", new ImageSpan(getApplicationContext(), 2131231393, 1), 0).append((CharSequence) " ").append((CharSequence) Html.fromHtml("<b>" + response.getString("total_earning")));
                earnings.setText(builder2);
            }
            JSONArray arr = response.getJSONArray("watch_earn_data");
            if (!TextUtils.equals(response.getString("watch_earn_data"), "[]")) {
                this.refTv.setVisibility(8);
            }
            JSON_PARSE_DATA_AFTER_WEBCALL(arr);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        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 view = getLayoutInflater().inflate(2131558765, (ViewGroup) null);
                TextView rdate = (TextView) view.findViewById(2131363124);
                TextView rplayername = (TextView) view.findViewById(2131363267);
                TextView rstatus = (TextView) view.findViewById(2131363268);
                rdate.setText(json.getString("watch_earn_date"));
                rplayername.setText(json.getString("rewards"));
                SpannableStringBuilder builder = new SpannableStringBuilder();
                builder.append((CharSequence) Html.fromHtml("")).append(" ", new ImageSpan(getApplicationContext(), 2131231393, 1), 0).append((CharSequence) " ").append((CharSequence) Html.fromHtml("" + json.getString("earning")));
                rstatus.setText(builder);
                this.refLl.addView(view);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void onBackPressed() {
        super.onBackPressed();
    }
}