正在查看: Clash Legends v0.0.1 应用的 LudoLeaderBoardActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 LudoLeaderBoardActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clash.legends.ui.activities;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
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.ScrollView;
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.UserLocalStore;
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 LudoLeaderBoardActivity extends AppCompatActivity {
ImageView back;
ScrollView leaderludo;
LinearLayout ll;
LoadingDialog loadingDialog;
LinearLayout noleaderdataludo;
CurrentUser user;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(2131558455);
LoadingDialog loadingDialog = new LoadingDialog(this);
this.loadingDialog = loadingDialog;
loadingDialog.show();
ImageView imageView = (ImageView) findViewById(2131362000);
this.back = imageView;
imageView.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
LudoLeaderBoardActivity.this.m84x7ceded9e(view);
}
});
this.ll = (LinearLayout) findViewById(2131362664);
this.leaderludo = (ScrollView) findViewById(2131362576);
this.noleaderdataludo = (LinearLayout) findViewById(2131362838);
RequestQueue jQueue = Volley.newRequestQueue(this);
jQueue.getCache().clear();
final UserLocalStore userLocalStore = new UserLocalStore(this);
this.user = userLocalStore.getLoggedInUser();
SharedPreferences sp = getSharedPreferences("gameinfo", 0);
String gameid = sp.getString("gameid", "");
Log.d("id", gameid);
String url = getResources().getString(2131886167) + "ludo_leader_board/" + gameid;
JsonObjectRequest request = new JsonObjectRequest(url, null, new Response.Listener() {
public final void onResponse(Object obj) {
LudoLeaderBoardActivity.this.m85xa281f69f((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 str = "Basic " + Base64.encodeToString(credentials.getBytes(), 2);
String token = "Bearer " + user.getToken();
headers.put("Content-Type", "application/json");
headers.put("Authorization", token);
return headers;
}
};
request.setShouldCache(false);
jQueue.add(request);
}
void m84x7ceded9e(View v) {
onBackPressed();
}
void m85xa281f69f(JSONObject response) {
this.loadingDialog.dismiss();
try {
JSONArray arr = response.getJSONArray("list");
JSON_PARSE_DATA_AFTER_WEBCALL(arr);
} catch (JSONException e) {
e.printStackTrace();
}
}
public void JSON_PARSE_DATA_AFTER_WEBCALL(JSONArray array) {
if (TextUtils.equals(String.valueOf(array.length()), "0")) {
this.leaderludo.setVisibility(8);
this.noleaderdataludo.setVisibility(0);
return;
}
for (int i = 0; i < array.length(); i++) {
try {
JSONObject json = array.getJSONObject(i);
View view = getLayoutInflater().inflate(2131558669, (ViewGroup) null);
TextView name = (TextView) view.findViewById(2131362793);
TextView wonamount = (TextView) view.findViewById(2131363819);
TextView wonchallenge = (TextView) view.findViewById(2131363818);
ImageView iv = (ImageView) view.findViewById(2131362509);
TextView number = (TextView) view.findViewById(2131362872);
name.setText(json.getString("first_name") + " " + json.getString("last_name"));
SpannableStringBuilder builder = new SpannableStringBuilder();
try {
builder.append((CharSequence) "Won: ").append(" ", new ImageSpan(getApplicationContext(), 2131231394, 1), 0).append((CharSequence) " ").append((CharSequence) json.getString("total_amount"));
wonamount.setText(builder);
wonchallenge.setText("Won : " + json.getString("total_challenge") + " Challenges");
number.setText("#" + (i + 1));
if (!TextUtils.equals(json.getString("profile_image"), "") && !TextUtils.equals(json.getString("profile_image"), "null")) {
Picasso.get().load(json.getString("profile_image")).placeholder(2131230869).fit().into(iv);
}
this.ll.addView(view);
} catch (JSONException e) {
e = e;
e.printStackTrace();
}
} catch (JSONException e2) {
e = e2;
}
}
}
}