正在查看: Clash Legends v0.0.1 应用的 LudoActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 LudoActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clash.legends.ui.activities;
import android.app.Dialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Base64;
import android.util.Log;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;
import com.android.volley.AuthFailureError;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.TimeoutError;
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.ui.activities.LudoActivity;
import com.clash.legends.ui.adapters.TabAdapter;
import com.clash.legends.ui.fragments.MyContestLudoFragment;
import com.clash.legends.ui.fragments.OnGoingLudoFragment;
import com.clash.legends.ui.fragments.ResultLudoFragment;
import com.clash.legends.utils.LoadingDialog;
import com.clash.legends.utils.LocaleHelper;
import com.clash.legends.utils.UserLocalStore;
import com.google.android.material.tabs.TabLayout;
import com.google.android.material.textfield.TextInputLayout;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class LudoActivity extends AppCompatActivity {
private TabAdapter adapter;
ImageView back;
LinearLayout closesearch;
Context context;
TextView createcontest;
TextView follow;
TextView friends;
String gameid;
TextView home;
RequestQueue jQueue;
LoadingDialog loadingDialog;
LinearLayout ludoactivitytool;
TextView ludotitle;
RequestQueue mQueue;
int n = 0;
LinearLayout noti;
LinearLayout notification;
String page;
RequestQueue rQueue;
TextView refersh;
JsonObjectRequest request;
Resources resources;
LinearLayout searchbtn;
ImageView searchicon;
EditText searchludogame;
LinearLayout searchtab;
private TabLayout tabLayout;
CurrentUser user;
UserLocalStore userLocalStore;
private ViewPager viewPager;
protected void onResume() {
super.onResume();
this.loadingDialog = new LoadingDialog(this);
Context locale = LocaleHelper.setLocale(this);
this.context = locale;
this.resources = locale.getResources();
SharedPreferences searchsp = getApplicationContext().getSharedPreferences("ludosearch", 0);
final SharedPreferences.Editor spedit = searchsp.edit();
spedit.putString("searchdata", "***********");
spedit.putString("btnstatus", "off");
spedit.apply();
ImageView imageView = (ImageView) findViewById(2131361998);
this.back = imageView;
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.this.m66lambda$onResume$0$comclashlegendsuiactivitiesLudoActivity(view);
}
});
this.ludoactivitytool = (LinearLayout) findViewById(2131362661);
UserLocalStore userLocalStore = new UserLocalStore(this);
this.userLocalStore = userLocalStore;
this.user = userLocalStore.getLoggedInUser();
this.searchicon = (ImageView) findViewById(2131363313);
RequestQueue newRequestQueue = Volley.newRequestQueue(this);
this.mQueue = newRequestQueue;
newRequestQueue.getCache().clear();
RequestQueue newRequestQueue2 = Volley.newRequestQueue(this);
this.rQueue = newRequestQueue2;
newRequestQueue2.getCache().clear();
EditText editText = (EditText) findViewById(2131363314);
this.searchludogame = editText;
editText.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (LudoActivity.this.searchludogame.getText().toString().length() > 0) {
spedit.putString("searchdata", LudoActivity.this.searchludogame.getText().toString());
} else {
spedit.putString("searchdata", "***********");
}
spedit.apply();
}
@Override
public void afterTextChanged(Editable s) {
}
});
SharedPreferences sp = getSharedPreferences("gameinfo", 0);
this.gameid = sp.getString("gameid", "");
this.page = sp.getString("SHAREPAGE", "");
followunfollowapi();
LinearLayout linearLayout = (LinearLayout) findViewById(2131362863);
this.notification = linearLayout;
linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.this.m67lambda$onResume$1$comclashlegendsuiactivitiesLudoActivity(view);
}
});
this.follow = (TextView) findViewById(2131362363);
this.searchbtn = (LinearLayout) findViewById(2131363312);
this.searchtab = (LinearLayout) findViewById(2131363315);
this.searchbtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.this.m71lambda$onResume$2$comclashlegendsuiactivitiesLudoActivity(spedit, view);
}
});
LinearLayout linearLayout2 = (LinearLayout) findViewById(2131362150);
this.closesearch = linearLayout2;
linearLayout2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LudoActivity.this.searchtab.setVisibility(8);
LudoActivity.this.searchludogame.setText("");
LudoActivity.this.searchicon.setImageResource(2131231032);
spedit.putString("searchdata", "***********");
spedit.putString("btnstatus", "off");
spedit.apply();
InputMethodManager imm = (InputMethodManager) LudoActivity.this.getSystemService("input_method");
imm.hideSoftInputFromWindow(LudoActivity.this.searchludogame.getWindowToken(), 0);
}
});
this.viewPager = findViewById(2131363744);
this.tabLayout = findViewById(2131363430);
this.noti = (LinearLayout) findViewById(2131362854);
TabAdapter tabAdapter = new TabAdapter(getSupportFragmentManager());
this.adapter = tabAdapter;
tabAdapter.addFragment(new OnGoingLudoFragment(), getResources().getString(2131886653));
this.adapter.addFragment(new MyContestLudoFragment(), getResources().getString(2131886618));
this.adapter.addFragment(new ResultLudoFragment(), getResources().getString(2131886959));
this.viewPager.setAdapter(this.adapter);
this.tabLayout.setupWithViewPager(this.viewPager);
this.tabLayout.setTabTextColors(-1, getResources().getColor(2131100323));
this.tabLayout.addOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
public void onTabSelected(TabLayout.Tab tab) {
LudoActivity.this.n = tab.getPosition();
}
public void onTabUnselected(TabLayout.Tab tab) {
}
public void onTabReselected(TabLayout.Tab tab) {
LudoActivity.this.n = tab.getPosition();
}
});
try {
Intent intent = getIntent();
String N = intent.getStringExtra("N");
this.n = Integer.parseInt(N);
} catch (NumberFormatException e) {
if (this.page.matches("SHARE")) {
this.n = 1;
SharedPreferences sp111 = this.context.getSharedPreferences("gameinfo", 0);
SharedPreferences.Editor editor1111 = sp111.edit();
editor1111.putString("SHAREPAGE", "FIRST");
editor1111.apply();
}
e.printStackTrace();
}
this.viewPager.setCurrentItem(this.n);
this.viewPager.setOffscreenPageLimit(3);
this.ludotitle = (TextView) findViewById(2131362671);
this.home = (TextView) findViewById(2131362421);
this.createcontest = (TextView) findViewById(2131362193);
this.friends = (TextView) findViewById(2131362372);
this.refersh = (TextView) findViewById(2131363135);
SharedPreferences sp1 = getSharedPreferences("gameinfo", 0);
String gamename = sp1.getString("gametitle", "");
this.ludotitle.setText(gamename);
this.refersh.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.this.m72lambda$onResume$3$comclashlegendsuiactivitiesLudoActivity(view);
}
});
this.home.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.this.m73lambda$onResume$4$comclashlegendsuiactivitiesLudoActivity(view);
}
});
this.friends.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.this.m74lambda$onResume$5$comclashlegendsuiactivitiesLudoActivity(view);
}
});
this.noti.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.this.m68lambda$onResume$10$comclashlegendsuiactivitiesLudoActivity(view);
}
});
this.follow.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.this.m70lambda$onResume$13$comclashlegendsuiactivitiesLudoActivity(view);
}
});
this.createcontest.setOnClickListener(new AnonymousClass6(gamename));
}
void m66lambda$onResume$0$comclashlegendsuiactivitiesLudoActivity(View v) {
onBackPressed();
}
void m67lambda$onResume$1$comclashlegendsuiactivitiesLudoActivity(View v) {
startActivity(new Intent(getApplicationContext(), (Class<?>) LudoNotificationActivity.class));
}
void m71lambda$onResume$2$comclashlegendsuiactivitiesLudoActivity(SharedPreferences.Editor spedit, View v) {
if (this.searchtab.getVisibility() == 0) {
this.searchtab.setVisibility(8);
this.searchicon.setImageResource(2131231032);
this.searchludogame.setText("");
spedit.putString("searchdata", "***********");
spedit.putString("btnstatus", "on");
InputMethodManager imm = (InputMethodManager) getSystemService("input_method");
imm.hideSoftInputFromWindow(this.searchludogame.getWindowToken(), 0);
} else {
spedit.putString("searchdata", "***********");
spedit.putString("btnstatus", "off");
this.searchtab.setVisibility(0);
this.searchicon.setImageResource(2131231033);
this.searchludogame.requestFocus();
InputMethodManager imm2 = (InputMethodManager) getSystemService("input_method");
imm2.showSoftInput(this.searchludogame, 1);
}
spedit.apply();
}
void m72lambda$onResume$3$comclashlegendsuiactivitiesLudoActivity(View v) {
finish();
overridePendingTransition(0, 0);
Intent intent = getIntent();
intent.putExtra("N", String.valueOf(this.n));
startActivity(intent);
overridePendingTransition(0, 0);
}
void m73lambda$onResume$4$comclashlegendsuiactivitiesLudoActivity(View v) {
searchdisable();
InputMethodManager imm = (InputMethodManager) getSystemService("input_method");
imm.hideSoftInputFromWindow(this.searchludogame.getWindowToken(), 0);
Intent intent = new Intent(getApplicationContext(), (Class<?>) LudoLeaderBoardActivity.class);
startActivity(intent);
}
void m74lambda$onResume$5$comclashlegendsuiactivitiesLudoActivity(View view) {
searchdisable();
InputMethodManager imm = (InputMethodManager) getSystemService("input_method");
imm.hideSoftInputFromWindow(this.searchludogame.getWindowToken(), 0);
Intent intent = new Intent(getApplicationContext(), (Class<?>) FriendsActivity.class);
startActivity(intent);
}
void m68lambda$onResume$10$comclashlegendsuiactivitiesLudoActivity(View v) {
searchdisable();
InputMethodManager imm = (InputMethodManager) getSystemService("input_method");
imm.hideSoftInputFromWindow(this.searchludogame.getWindowToken(), 0);
final Dialog builder = new Dialog(this);
builder.getWindow().setSoftInputMode(4);
builder.getWindow().setBackgroundDrawable(new ColorDrawable(0));
builder.setContentView(2131558726);
ImageView spincancel = (ImageView) builder.findViewById(2131363370);
TextView notititle = (TextView) builder.findViewById(2131362855);
Switch notitoggle = (Switch) builder.findViewById(2131362866);
notitoggle.setChecked(this.follow.getText().toString().trim().matches("Follow"));
notitoggle.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(CompoundButton compoundButton, boolean z) {
LudoActivity.this.m76lambda$onResume$8$comclashlegendsuiactivitiesLudoActivity(compoundButton, z);
}
});
notititle.setText("Remind me for Lineup\nAnnouncement");
spincancel.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
builder.dismiss();
}
});
builder.show();
}
void m76lambda$onResume$8$comclashlegendsuiactivitiesLudoActivity(CompoundButton buttonView, boolean isChecked) {
String status;
String rurl = this.resources.getString(2131886167) + "follow_unfollow_game";
if (this.follow.getText().toString().trim().matches("Follow")) {
status = "0";
} else {
status = "1";
}
HashMap<String, String> params = new HashMap<>();
params.put("status", status);
params.put("game_id", this.gameid);
params.put("member_id", this.user.getMemberid());
JsonObjectRequest rrequest = new JsonObjectRequest(rurl, new JSONObject(params), new Response.Listener() {
public final void onResponse(Object obj) {
LudoActivity.this.m75lambda$onResume$6$comclashlegendsuiactivitiesLudoActivity((JSONObject) obj);
}
}, new Response.ErrorListener() {
public final void onErrorResponse(VolleyError volleyError) {
Log.e("**VolleyError", "error" + volleyError.getMessage());
}
}) {
public Map<String, String> getHeaders() {
Map headers = new HashMap();
CurrentUser user = LudoActivity.this.userLocalStore.getLoggedInUser();
String credentials = user.getUsername() + ":" + user.getPassword();
String str = "Basic " + Base64.encodeToString(credentials.getBytes(), 2);
Log.d("token", user.token);
String token = "Bearer " + user.getToken();
headers.put("Content-Type", "application/json");
headers.put("Authorization", token);
headers.put("x-localization", LocaleHelper.getPersist(LudoActivity.this.context));
return headers;
}
};
rrequest.setShouldCache(false);
this.rQueue.add(rrequest);
}
void m75lambda$onResume$6$comclashlegendsuiactivitiesLudoActivity(JSONObject response) {
try {
if (response.getString("status").matches("true")) {
if (response.getString("message").matches("Game Follow Successfully")) {
this.follow.setText("Follow");
} else {
this.follow.setText("Unfollow");
}
} else {
Toast.makeText(getApplicationContext(), response.getString("message"), 0).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
void m70lambda$onResume$13$comclashlegendsuiactivitiesLudoActivity(View v) {
String status;
searchdisable();
InputMethodManager imm = (InputMethodManager) getSystemService("input_method");
imm.hideSoftInputFromWindow(this.searchludogame.getWindowToken(), 0);
String rurl = this.resources.getString(2131886167) + "follow_unfollow_game";
if (this.follow.getText().toString().trim().matches("Follow")) {
status = "0";
} else {
status = "1";
}
HashMap<String, String> params = new HashMap<>();
params.put("status", status);
params.put("game_id", this.gameid);
params.put("member_id", this.user.getMemberid());
JsonObjectRequest rrequest = new JsonObjectRequest(rurl, new JSONObject(params), new Response.Listener() {
public final void onResponse(Object obj) {
LudoActivity.this.m69lambda$onResume$11$comclashlegendsuiactivitiesLudoActivity((JSONObject) obj);
}
}, new Response.ErrorListener() {
public final void onErrorResponse(VolleyError volleyError) {
Log.e("**VolleyError", "error" + volleyError.getMessage());
}
}) {
public Map<String, String> getHeaders() {
Map headers = new HashMap();
CurrentUser user = LudoActivity.this.userLocalStore.getLoggedInUser();
Log.d("token", user.token);
String token = "Bearer " + user.getToken();
headers.put("Content-Type", "application/json");
headers.put("Authorization", token);
headers.put("x-localization", LocaleHelper.getPersist(LudoActivity.this.context));
return headers;
}
};
rrequest.setShouldCache(false);
this.rQueue.add(rrequest);
}
void m69lambda$onResume$11$comclashlegendsuiactivitiesLudoActivity(JSONObject response) {
try {
if (response.getString("status").matches("true")) {
if (response.getString("message").matches("Game Follow Successfully")) {
this.follow.setText("Follow");
} else {
this.follow.setText("Unfollow");
}
} else {
Toast.makeText(getApplicationContext(), response.getString("message"), 0).show();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
class AnonymousClass6 implements View.OnClickListener {
final String val$gamename;
AnonymousClass6(String str) {
this.val$gamename = str;
}
@Override
public void onClick(View v1) {
LudoActivity.this.searchdisable();
InputMethodManager imm = (InputMethodManager) LudoActivity.this.getSystemService("input_method");
imm.hideSoftInputFromWindow(LudoActivity.this.searchludogame.getWindowToken(), 0);
Dialog builder = new Dialog(LudoActivity.this);
builder.getWindow().setSoftInputMode(4);
builder.setContentView(2131558567);
EditText newplayernameuser = (EditText) builder.findViewById(2131363728);
SharedPreferences sp = LudoActivity.this.getSharedPreferences("LUDO", 0);
newplayernameuser.setText(sp.getString("ludoname", ""));
EditText newplayernamecoin = (EditText) builder.findViewById(2131362153);
TextInputLayout pnamehintusername = builder.findViewById(2131363494);
TextInputLayout pnamehintcoin = builder.findViewById(2131363493);
pnamehintusername.setHint(this.val$gamename + " " + LudoActivity.this.getResources().getString(2131886110));
pnamehintcoin.setHint("Amount");
newplayernameuser.setCompoundDrawablesWithIntrinsicBounds(2131231018, 0, 0, 0);
newplayernamecoin.setCompoundDrawablesWithIntrinsicBounds(2131231392, 0, 0, 0);
Button newcancel = (Button) builder.findViewById(2131362813);
RadioGroup pwradiogroup_ed = (RadioGroup) builder.findViewById(2131363110);
ImageView privateinfo = (ImageView) builder.findViewById(2131363050);
privateinfo.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.AnonymousClass6.this.m77lambda$onClick$1$comclashlegendsuiactivitiesLudoActivity$6(view);
}
});
RadioButton pw1 = (RadioButton) builder.findViewById(2131363108);
final TextInputLayout passwordtextinputlayout = builder.findViewById(2131362991);
EditText passwordid = (EditText) builder.findViewById(2131362990);
pw1.setChecked(true);
pwradiogroup_ed.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public final void onCheckedChanged(RadioGroup radioGroup, int i) {
LudoActivity.AnonymousClass6.lambda$onClick$2(passwordtextinputlayout, radioGroup, i);
}
});
newcancel.setOnClickListener(new AnonymousClass1(passwordtextinputlayout, newplayernameuser, newplayernamecoin, passwordid, builder));
builder.create();
builder.show();
}
void m77lambda$onClick$1$comclashlegendsuiactivitiesLudoActivity$6(View v) {
final Dialog builderinfo = new Dialog(LudoActivity.this);
builderinfo.getWindow().setSoftInputMode(4);
builderinfo.getWindow().setBackgroundDrawable(new ColorDrawable(0));
builderinfo.setContentView(2131558761);
ImageView cancelbtn = (ImageView) builderinfo.findViewById(2131362088);
cancelbtn.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
builderinfo.dismiss();
}
});
builderinfo.show();
}
static void lambda$onClick$2(TextInputLayout passwordtextinputlayout, RadioGroup group, int checkedId) {
switch (checkedId) {
case 2131363108:
passwordtextinputlayout.setVisibility(0);
break;
case 2131363109:
passwordtextinputlayout.setVisibility(8);
break;
default:
passwordtextinputlayout.setVisibility(0);
break;
}
}
class AnonymousClass1 implements View.OnClickListener {
final Dialog val$builder;
final EditText val$newplayernamecoin;
final EditText val$newplayernameuser;
final EditText val$passwordid;
final TextInputLayout val$passwordtextinputlayout;
AnonymousClass1(TextInputLayout textInputLayout, EditText editText, EditText editText2, EditText editText3, Dialog dialog) {
this.val$passwordtextinputlayout = textInputLayout;
this.val$newplayernameuser = editText;
this.val$newplayernamecoin = editText2;
this.val$passwordid = editText3;
this.val$builder = dialog;
}
@Override
public void onClick(View view) {
int rdbtn;
if (this.val$passwordtextinputlayout.getVisibility() == 0) {
rdbtn = 1;
} else {
rdbtn = 0;
}
String cludouser = this.val$newplayernameuser.getText().toString().trim();
String ccoin = this.val$newplayernamecoin.getText().toString().trim();
String password = this.val$passwordid.getText().toString().trim();
if (TextUtils.isEmpty(cludouser)) {
this.val$newplayernameuser.setError("Required Field");
return;
}
if (TextUtils.isEmpty(ccoin)) {
this.val$newplayernamecoin.setError("Required Field");
return;
}
if (Integer.parseInt(ccoin) < 10) {
this.val$newplayernamecoin.setError("Minimum 10 coin");
return;
}
if (Integer.parseInt(ccoin) % 10 != 0) {
this.val$newplayernamecoin.setError("Contest amount should be multiple of 10,like 10 20 50 100");
return;
}
if (String.valueOf(rdbtn).matches("1") && password.length() < 6) {
this.val$passwordid.setError("Password is too short");
return;
}
LudoActivity.this.loadingDialog.show();
SharedPreferences sp = LudoActivity.this.getSharedPreferences("gameinfo", 0);
String gameid = sp.getString("gameid", "");
LudoActivity.this.jQueue = Volley.newRequestQueue(LudoActivity.this.getApplicationContext());
String jurl = LudoActivity.this.getResources().getString(2131886167) + "add_challenge";
final UserLocalStore userLocalStore = new UserLocalStore(LudoActivity.this.getApplicationContext());
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("member_id", LudoActivity.this.user.getMemberid());
jsonObject.put("ludo_king_username", cludouser);
jsonObject.put("coin", ccoin);
jsonObject.put("submit", "addChallenge");
jsonObject.put("game_id", gameid);
jsonObject.put("with_password", String.valueOf(rdbtn));
try {
if (String.valueOf(rdbtn).equals("0")) {
jsonObject.put("challenge_password", "");
} else {
jsonObject.put("challenge_password", this.val$passwordid.getText().toString());
}
} catch (Exception e) {
if (String.valueOf(rdbtn).equals("0")) {
jsonObject.put("challenge_password", "");
} else {
jsonObject.put("challenge_password", this.val$passwordid.getText().toString());
}
}
} catch (JSONException e2) {
e2.printStackTrace();
}
Log.e(jurl, jsonObject.toString());
final Dialog dialog = this.val$builder;
final EditText editText = this.val$passwordid;
final String str = AnonymousClass6.this.val$gamename;
JsonObjectRequest jrequest = new JsonObjectRequest(jurl, jsonObject, new Response.Listener() {
public final void onResponse(Object obj) {
LudoActivity.AnonymousClass6.AnonymousClass1.this.m79x88d1a2e7(dialog, editText, str, (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 = userLocalStore.getLoggedInUser();
String credentials = user.getUsername() + ":" + user.getPassword();
String str2 = "Basic " + Base64.encodeToString(credentials.getBytes(), 2);
String token = "Bearer " + user.getToken();
headers.put("Content-Type", "application/json");
headers.put("Authorization", token);
return headers;
}
};
LudoActivity.this.jQueue.add(jrequest);
}
void m79x88d1a2e7(Dialog builder, EditText passwordid, String gamename, JSONObject response) {
Log.d("nk", response.toString());
try {
LudoActivity.this.loadingDialog.dismiss();
try {
if (!TextUtils.equals(response.getString("status"), "true")) {
Toast.makeText(LudoActivity.this.getApplicationContext(), response.getString("message"), 0).show();
} else {
builder.dismiss();
try {
passwordid.setText("");
final Dialog bbuilder = new Dialog(LudoActivity.this);
bbuilder.setContentView(2131558567);
TextView maintitle = (TextView) bbuilder.findViewById(2131362678);
maintitle.setText("Wow\nContest create successfully");
TextView rules = (TextView) bbuilder.findViewById(2131363269);
rules.setText("1. You can see your contest in my contest section\n2. Now wait for someone who accept your contest.\n3. After that create room in " + gamename + " app and update it.\n4. When your match complete take winning screen shot and upload.");
EditText newplayername = (EditText) bbuilder.findViewById(2131363728);
EditText newplayername1 = (EditText) bbuilder.findViewById(2131362153);
TextInputLayout pnamehintusername1 = bbuilder.findViewById(2131363494);
TextInputLayout pnamehintcoin1 = bbuilder.findViewById(2131363493);
RadioGroup pwradiogroup = (RadioGroup) bbuilder.findViewById(2131363110);
TextInputLayout passwordtext = bbuilder.findViewById(2131362991);
ImageView privateinfo1 = (ImageView) bbuilder.findViewById(2131363050);
newplayername.setVisibility(8);
pnamehintusername1.setVisibility(8);
newplayername1.setVisibility(8);
pnamehintcoin1.setVisibility(8);
pwradiogroup.setVisibility(8);
passwordtext.setVisibility(8);
privateinfo1.setVisibility(8);
newplayername.setCompoundDrawablesWithIntrinsicBounds(2131231018, 0, 0, 0);
Button newcancel1 = (Button) bbuilder.findViewById(2131362813);
newcancel1.setText("OK");
newcancel1.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoActivity.AnonymousClass6.AnonymousClass1.this.m78x9727fcc8(bbuilder, view);
}
});
bbuilder.create();
bbuilder.show();
} catch (JSONException e) {
e = e;
e.printStackTrace();
}
}
} catch (JSONException e2) {
e = e2;
e.printStackTrace();
}
} catch (JSONException e3) {
e = e3;
}
}
void m78x9727fcc8(Dialog bbuilder, View view1) {
bbuilder.dismiss();
LudoActivity.this.finish();
LudoActivity.this.overridePendingTransition(0, 0);
Intent intent = LudoActivity.this.getIntent();
intent.putExtra("N", String.valueOf(1));
LudoActivity.this.startActivity(intent);
LudoActivity.this.overridePendingTransition(0, 0);
}
}
}
public void searchdisable() {
SharedPreferences searchsp = getApplicationContext().getSharedPreferences("ludosearch", 0);
SharedPreferences.Editor sp = searchsp.edit();
this.searchtab.setVisibility(8);
this.searchludogame.setText("");
this.searchicon.setImageResource(2131231032);
sp.putString("searchdata", "***********");
sp.putString("btnstatus", "off");
sp.apply();
}
public void followunfollowapi() {
this.loadingDialog.show();
SharedPreferences sp = getSharedPreferences("gameinfo", 0);
String gameid = sp.getString("gameid", "");
CurrentUser user = this.userLocalStore.getLoggedInUser();
String url = this.resources.getString(2131886167) + "get_game_follow_status/" + gameid + "/" + user.memberId;
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(0, url, null, new Response.Listener() {
public final void onResponse(Object obj) {
LudoActivity.this.m64x859b6bc((JSONObject) obj);
}
}, new Response.ErrorListener() {
public final void onErrorResponse(VolleyError volleyError) {
LudoActivity.this.m65xc1d1445b(volleyError);
}
}) {
protected Map<String, String> getParams() throws AuthFailureError {
return super.getParams();
}
public Map<String, String> getHeaders() {
Map<String, String> headers = new HashMap<>();
LudoActivity ludoActivity = LudoActivity.this;
ludoActivity.userLocalStore = new UserLocalStore(ludoActivity.getApplicationContext());
CurrentUser user2 = LudoActivity.this.userLocalStore.getLoggedInUser();
String credentials = user2.getUsername() + ":" + user2.getPassword();
String str = "Basic " + Base64.encodeToString(credentials.getBytes(), 2);
String token = "Bearer " + user2.getToken();
headers.put("Content-Type", "application/json");
headers.put("Authorization", token);
headers.put("x-localization", LocaleHelper.getPersist(LudoActivity.this.context));
return headers;
}
};
this.request = jsonObjectRequest;
jsonObjectRequest.setShouldCache(false);
this.mQueue.add(this.request);
}
void m64x859b6bc(JSONObject response) {
this.loadingDialog.dismiss();
try {
if (TextUtils.equals(response.getString("status"), "true")) {
if (TextUtils.equals(response.getString("is_follower"), "true")) {
this.follow.setText("Follow");
} else {
this.follow.setText("Unfollow");
}
}
} catch (JSONException e) {
e.printStackTrace();
}
}
void m65xc1d1445b(VolleyError error) {
Log.e("**VolleyError", "error" + error.getMessage());
if (error instanceof TimeoutError) {
this.request.setShouldCache(false);
this.mQueue.add(this.request);
}
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(2131558453);
}
public void onBackPressed() {
Intent intent = new Intent(getApplicationContext(), (Class<?>) HomeActivity.class);
intent.putExtra("N", "1");
startActivity(intent);
}
}