导航菜单

页面标题

页面副标题

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

正在查看: Clash Legends v0.0.1 应用的 TermsandConditionActivity.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.os.Bundle;
import android.text.Html;
import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
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 java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;

public class TermsandConditionActivity extends AppCompatActivity {
    ImageView back;
    Context context;
    String from = "";
    LoadingDialog loadingDialog;
    RequestQueue mQueue;
    TextView noterms;
    Resources resources;
    ScrollView scrolltermscondition;
    TextView tcview;
    TextView termandcondtiontitle;

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(2131558487);
        SharedPreferences sp = getSharedPreferences("SMINFO", 0);
        if (TextUtils.equals(sp.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();
        TextView textView = (TextView) findViewById(2131363459);
        this.termandcondtiontitle = textView;
        textView.setText(this.resources.getString(2131887025));
        Intent intent = getIntent();
        this.from = intent.getStringExtra("FROM");
        this.back = (ImageView) findViewById(2131361991);
        this.noterms = (TextView) findViewById(2131362853);
        this.back.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                TermsandConditionActivity.this.m215x39ffb740(view);
            }
        });
        LoadingDialog loadingDialog = new LoadingDialog(this);
        this.loadingDialog = loadingDialog;
        loadingDialog.show();
        this.tcview = (TextView) findViewById(2131363454);
        this.scrolltermscondition = (ScrollView) findViewById(2131363299);
        RequestQueue newRequestQueue = Volley.newRequestQueue(this);
        this.mQueue = newRequestQueue;
        newRequestQueue.getCache().clear();
        String url = this.resources.getString(2131886167) + "terms_conditions";
        JsonObjectRequest request = new JsonObjectRequest(0, url, null, new Response.Listener<JSONObject>() {
            public void onResponse(JSONObject response) {
                TermsandConditionActivity.this.loadingDialog.dismiss();
                try {
                    JSONObject jsonObject = new JSONObject(response.getString("terms_conditions"));
                    String about = jsonObject.getString("terms_conditions");
                    if (TextUtils.equals(about, "")) {
                        TermsandConditionActivity.this.noterms.setVisibility(0);
                        TermsandConditionActivity.this.scrolltermscondition.setVisibility(8);
                    } else {
                        TermsandConditionActivity.this.tcview.setText(Html.fromHtml(about));
                        TermsandConditionActivity.this.tcview.setClickable(true);
                        TermsandConditionActivity.this.tcview.setMovementMethod(LinkMovementMethod.getInstance());
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }, new Response.ErrorListener() {
            public final void onErrorResponse(VolleyError volleyError) {
                Log.e("error", volleyError.toString());
            }
        }) {
            public Map<String, String> getHeaders() {
                Map<String, String> headers = new HashMap<>();
                UserLocalStore userLocalStore = new UserLocalStore(TermsandConditionActivity.this.getApplicationContext());
                CurrentUser user = userLocalStore.getLoggedInUser();
                String token = "Bearer " + user.getToken();
                headers.put("Content-Type", "application/json");
                headers.put("Authorization", token);
                headers.put("x-localization", LocaleHelper.getPersist(TermsandConditionActivity.this.context));
                return headers;
            }
        };
        request.setShouldCache(false);
        this.mQueue.add(request);
    }

    void m215x39ffb740(View view) {
        if (TextUtils.equals(this.from, "REFERNEARN")) {
            startActivity(new Intent(getApplicationContext(), (Class<?>) ReferandEarnActivity.class));
        } else {
            if (TextUtils.equals(this.from, "WATCHNEARN")) {
                startActivity(new Intent(getApplicationContext(), (Class<?>) WatchAndEarnActivity.class));
                return;
            }
            Intent intent1 = new Intent(getApplicationContext(), (Class<?>) HomeActivity.class);
            intent1.putExtra("N", "2");
            startActivity(intent1);
        }
    }

    public void onBackPressed() {
        super.onBackPressed();
        if (TextUtils.equals(this.from, "REFERNEARN")) {
            startActivity(new Intent(getApplicationContext(), (Class<?>) ReferandEarnActivity.class));
        } else {
            if (TextUtils.equals(this.from, "WATCHNEARN")) {
                startActivity(new Intent(getApplicationContext(), (Class<?>) WatchAndEarnActivity.class));
                return;
            }
            Intent intent = new Intent(getApplicationContext(), (Class<?>) HomeActivity.class);
            intent.putExtra("N", "2");
            startActivity(intent);
        }
    }
}