导航菜单

页面标题

页面副标题

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

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

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


package com.clash.legends.ui.activities;

import android.content.ActivityNotFoundException;
import android.content.ComponentName;
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.telephony.PhoneNumberUtils;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
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 CustomerSupportActivity extends AppCompatActivity {
    LinearLayout addll;
    LinearLayout contactsupport;
    Context context;
    TextView customersuporttitle;
    LinearLayout emailll;
    LinearLayout install;
    LoadingDialog loadingDialog;
    RequestQueue mQueue;
    TextView nocontactsupport;
    LinearLayout phonell;
    Resources resources;
    LinearLayout streetll;
    LinearLayout timell;
    String custAdd = "";
    String custPhone = "";
    String custCode = "";
    String custEmail = "";
    String custStreet = "";
    String custTime = "";
    String custInstaId = "";

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(2131558443);
        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();
        LoadingDialog loadingDialog = new LoadingDialog(this);
        this.loadingDialog = loadingDialog;
        loadingDialog.show();
        this.customersuporttitle = (TextView) findViewById(2131362207);
        this.addll = (LinearLayout) findViewById(2131361893);
        this.phonell = (LinearLayout) findViewById(2131363020);
        this.emailll = (LinearLayout) findViewById(2131362287);
        this.install = (LinearLayout) findViewById(2131362455);
        this.streetll = (LinearLayout) findViewById(2131363403);
        this.timell = (LinearLayout) findViewById(2131363518);
        ImageView back = (ImageView) findViewById(2131361976);
        final TextView addressView = (TextView) findViewById(2131361895);
        final TextView phoneView = (TextView) findViewById(2131363019);
        final TextView emailView = (TextView) findViewById(2131362286);
        final TextView streetView = (TextView) findViewById(2131363402);
        final TextView timeView = (TextView) findViewById(2131363515);
        final TextView instagramView = (TextView) findViewById(2131362454);
        final ImageView call = (ImageView) findViewById(2131362083);
        final ImageView sms = (ImageView) findViewById(2131363351);
        final ImageView mail = (ImageView) findViewById(2131362674);
        final ImageView insta = (ImageView) findViewById(2131362453);
        this.customersuporttitle.setText(this.resources.getString(2131886404));
        RequestQueue newRequestQueue = Volley.newRequestQueue(this);
        this.mQueue = newRequestQueue;
        newRequestQueue.getCache().clear();
        this.contactsupport = (LinearLayout) findViewById(2131362179);
        this.nocontactsupport = (TextView) findViewById(2131362833);
        String url = this.resources.getString(2131886167) + "customer_support";
        JsonObjectRequest request = new JsonObjectRequest(0, url, null, new Response.Listener() {
            public final void onResponse(Object obj) {
                CustomerSupportActivity.this.m29x364cb4ca(addressView, phoneView, emailView, instagramView, streetView, timeView, call, sms, mail, insta, (JSONObject) obj);
            }
        }, 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(CustomerSupportActivity.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(CustomerSupportActivity.this.context));
                return headers;
            }
        };
        request.setShouldCache(false);
        this.mQueue.add(request);
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public final void onClick(View view) {
                CustomerSupportActivity.this.m30x8174c6cc(view);
            }
        });
    }

    void m29x364cb4ca(TextView addressView, TextView phoneView, TextView emailView, TextView instagramView, TextView streetView, TextView timeView, ImageView call, ImageView sms, ImageView mail, ImageView insta, JSONObject response) {
        this.loadingDialog.dismiss();
        try {
            try {
                JSONObject jsonObject = new JSONObject(response.getString("customer_support"));
                this.custAdd = jsonObject.getString("company_address");
                this.custPhone = jsonObject.getString("comapny_phone");
                this.custCode = jsonObject.getString("comapny_country_code");
                this.custEmail = jsonObject.getString("company_email");
                this.custStreet = jsonObject.getString("company_street");
                this.custTime = jsonObject.getString("company_time");
                this.custInstaId = jsonObject.getString("insta_link");
                if (TextUtils.equals(this.custAdd, "") || TextUtils.equals(this.custAdd, "null")) {
                    this.addll.setVisibility(8);
                }
                if (TextUtils.equals(this.custPhone, "") || TextUtils.equals(this.custPhone, "null")) {
                    this.phonell.setVisibility(8);
                }
                if (TextUtils.equals(this.custEmail, "") || TextUtils.equals(this.custEmail, "null")) {
                    this.emailll.setVisibility(8);
                }
                if (TextUtils.equals(this.custInstaId, "") || TextUtils.equals(this.custInstaId, "null")) {
                    this.install.setVisibility(8);
                }
                if (TextUtils.equals(this.custStreet, "") || TextUtils.equals(this.custStreet, "null")) {
                    this.streetll.setVisibility(8);
                }
                if (TextUtils.equals(this.custTime, "") || TextUtils.equals(this.custTime, "null")) {
                    this.timell.setVisibility(8);
                }
                if (this.addll.getVisibility() == 8 && this.phonell.getVisibility() == 8 && this.emailll.getVisibility() == 8 && this.install.getVisibility() == 8 && this.streetll.getVisibility() == 8 && this.timell.getVisibility() == 8) {
                    this.contactsupport.setVisibility(8);
                    this.nocontactsupport.setVisibility(0);
                }
            } catch (JSONException e) {
                e = e;
            }
        } catch (JSONException e2) {
            e = e2;
        }
        try {
            addressView.setText(this.resources.getString(2131886155) + this.custAdd);
            try {
                phoneView.setText(this.resources.getString(2131886887) + this.custCode + this.custPhone);
                try {
                    emailView.setText(this.resources.getString(2131886426) + this.custEmail);
                    try {
                        instagramView.setText(this.resources.getString(2131886482) + this.custInstaId);
                        try {
                            streetView.setText(this.resources.getString(2131887018) + this.custStreet);
                            try {
                                timeView.setText(this.resources.getString(2131887030) + this.custTime);
                                try {
                                    call.setOnClickListener(new View.OnClickListener() {
                                        @Override
                                        public final void onClick(View view) {
                                            CustomerSupportActivity.this.m25x9ffc90c6(view);
                                        }
                                    });
                                    try {
                                        sms.setOnClickListener(new View.OnClickListener() {
                                            @Override
                                            public final void onClick(View view) {
                                                CustomerSupportActivity.this.m26xc59099c7(view);
                                            }
                                        });
                                    } catch (JSONException e3) {
                                        e = e3;
                                        e.printStackTrace();
                                    }
                                } catch (JSONException e4) {
                                    e = e4;
                                    e.printStackTrace();
                                }
                            } catch (JSONException e5) {
                                e = e5;
                                e.printStackTrace();
                            }
                        } catch (JSONException e6) {
                            e = e6;
                            e.printStackTrace();
                        }
                    } catch (JSONException e7) {
                        e = e7;
                        e.printStackTrace();
                    }
                } catch (JSONException e8) {
                    e = e8;
                    e.printStackTrace();
                }
            } catch (JSONException e9) {
                e = e9;
                e.printStackTrace();
            }
            try {
                mail.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public final void onClick(View view) {
                        CustomerSupportActivity.this.m27xeb24a2c8(view);
                    }
                });
                try {
                    insta.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public final void onClick(View view) {
                            CustomerSupportActivity.this.m28x10b8abc9(view);
                        }
                    });
                } catch (JSONException e10) {
                    e = e10;
                    e.printStackTrace();
                }
            } catch (JSONException e11) {
                e = e11;
                e.printStackTrace();
            }
        } catch (JSONException e12) {
            e = e12;
            e.printStackTrace();
        }
    }

    void m25x9ffc90c6(View view) {
        Intent call_intent = new Intent("android.intent.action.DIAL");
        call_intent.setData(Uri.parse("tel:" + this.custCode + this.custPhone));
        startActivity(call_intent);
    }

    void m26xc59099c7(View view) {
        openWhatsApp(this.custCode + this.custPhone);
    }

    void m27xeb24a2c8(View view) {
        Intent i = new Intent("android.intent.action.SEND");
        i.setType("message/rfc822");
        i.putExtra("android.intent.extra.EMAIL", new String[]{this.custEmail});
        try {
            startActivity(Intent.createChooser(i, this.resources.getString(2131886991)));
        } catch (ActivityNotFoundException e) {
            Toast.makeText(getApplicationContext(), this.resources.getString(2131887027), 0).show();
        }
    }

    void m28x10b8abc9(View v) {
        Uri uri = Uri.parse("https://www.instagram.com/" + this.custInstaId + "/");
        Intent likeIng = new Intent("android.intent.action.VIEW", uri);
        likeIng.setPackage("com.instagram.android");
        try {
            startActivity(likeIng);
        } catch (ActivityNotFoundException e) {
            startActivity(new Intent("android.intent.action.VIEW", uri));
        }
    }

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

    private void openWhatsApp(String number) {
        try {
            String number2 = number.replace(" ", "").replace("+", "");
            Intent sendIntent = new Intent("android.intent.action.SEND");
            sendIntent.setComponent(new ComponentName("com.whatsapp", "com.whatsapp.Conversation"));
            sendIntent.putExtra("jid", PhoneNumberUtils.stripSeparators(number2) + "@s.whatsapp.net");
            startActivity(sendIntent);
        } catch (Exception e) {
            Toast.makeText(getApplicationContext(), this.resources.getString(2131887078), 0).show();
        }
    }
}