正在查看: Clash Legends v0.0.1 应用的 SelectedTournamentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 SelectedTournamentActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.clash.legends.ui.activities;
import android.content.Context;
import android.content.Intent;
import android.content.res.Resources;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.cardview.widget.CardView;
import androidx.viewpager.widget.ViewPager;
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.ui.adapters.TabAdapter;
import com.clash.legends.ui.fragments.FragmentSelectedTournamentDescription;
import com.clash.legends.ui.fragments.FragmentSelectedTournamentJoinedeMember;
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.squareup.picasso.Picasso;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
public class SelectedTournamentActivity extends AppCompatActivity {
String MAP;
ImageView back;
Context context;
String entryFee;
CardView imageViewSelectedCardview;
ImageView imgeViewSelected;
Button joinNow;
LoadingDialog loadingDialog;
String mId;
RequestQueue mQueue;
String matchDesc;
String matchName;
String matchTime;
TextView matchTitleBar;
String matchType;
String matchUrl;
String matchprivateDesc;
String memberId;
String noOfPlayer;
String numberOfPosition;
String perKill;
Resources resources;
String roomId;
String roomPassword;
String type;
String winPrize;
String joinStatus = null;
String gameName = "";
String packagename = "";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(2131558481);
Context locale = LocaleHelper.setLocale(this);
this.context = locale;
this.resources = locale.getResources();
ViewPager viewPager = findViewById(2131363746);
TabLayout tabLayout = findViewById(2131363432);
TabAdapter adapter = new TabAdapter(getSupportFragmentManager());
adapter.addFragment(new FragmentSelectedTournamentDescription(), this.resources.getString(2131886413));
adapter.addFragment(new FragmentSelectedTournamentJoinedeMember(), this.resources.getString(2131886496));
viewPager.setAdapter(adapter);
tabLayout.setupWithViewPager(viewPager);
tabLayout.setTabTextColors(getResources().getColor(2131099832), getResources().getColor(2131100434));
LoadingDialog loadingDialog = new LoadingDialog(this);
this.loadingDialog = loadingDialog;
loadingDialog.show();
this.back = (ImageView) findViewById(2131361986);
this.joinNow = (Button) findViewById(2131362535);
this.matchTitleBar = (TextView) findViewById(2131362700);
this.back.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelectedTournamentActivity.this.m203x9f79c7cd(view);
}
});
Intent intent = getIntent();
String mid = intent.getStringExtra("M_ID");
final String from = intent.getStringExtra("FROM");
String baner = intent.getStringExtra("BANER");
this.gameName = intent.getStringExtra("GAME_NAME");
this.imageViewSelectedCardview = findViewById(2131362440);
this.imgeViewSelected = (ImageView) findViewById(2131362439);
if (!TextUtils.equals(baner, "")) {
this.imageViewSelectedCardview.setVisibility(0);
Picasso.get().load(Uri.parse(baner)).placeholder(2131231003).fit().into(this.imgeViewSelected);
} else {
this.imageViewSelectedCardview.setVisibility(8);
}
getSharedPreferences("currencyinfo", 0);
RequestQueue newRequestQueue = Volley.newRequestQueue(getApplicationContext());
this.mQueue = newRequestQueue;
newRequestQueue.getCache().clear();
final UserLocalStore userLocalStore = new UserLocalStore(getApplicationContext());
CurrentUser user = userLocalStore.getLoggedInUser();
String url = this.resources.getString(2131886167) + "single_match/" + mid + "/" + user.getMemberid();
JsonObjectRequest request = new JsonObjectRequest(url, null, new Response.Listener() {
public final void onResponse(Object obj) {
SelectedTournamentActivity.this.m204xa57d932c(from, (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 user2 = userLocalStore.getLoggedInUser();
String token = "Bearer " + user2.getToken();
headers.put("Content-Type", "application/json");
headers.put("Authorization", token);
headers.put("x-localization", LocaleHelper.getPersist(SelectedTournamentActivity.this.context));
return headers;
}
};
request.setShouldCache(false);
this.mQueue.add(request);
if (TextUtils.equals(from, "LIVE")) {
this.joinNow.setText(this.resources.getString(2131887007));
this.joinNow.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelectedTournamentActivity.this.m205xb18529ea(view);
}
});
} else {
this.joinNow.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelectedTournamentActivity.this.m206xb788f549(view);
}
});
}
}
void m203x9f79c7cd(View view) {
Intent intent = new Intent(getApplicationContext(), (Class<?>) SelectedGameActivity.class);
startActivity(intent);
}
void m204xa57d932c(String from, JSONObject response) {
Log.d("--------------", response.toString());
try {
JSONObject obj = response.getJSONObject("match");
this.mId = obj.getString("m_id");
this.matchName = obj.getString("match_name");
this.matchTime = obj.getString("match_time");
this.winPrize = obj.getString("win_prize");
this.perKill = obj.getString("per_kill");
this.entryFee = obj.getString("entry_fee");
this.type = obj.getString("type");
this.MAP = obj.getString("MAP");
this.matchType = obj.getString("match_type");
this.matchDesc = obj.getString("match_desc");
this.noOfPlayer = obj.getString("no_of_player");
this.numberOfPosition = obj.getString("number_of_position");
this.memberId = obj.getString("member_id");
this.matchUrl = obj.getString("match_url");
this.roomId = obj.getString("room_description");
this.matchprivateDesc = obj.getString("match_private_desc");
this.joinStatus = obj.getString("join_status");
this.packagename = obj.getString("package_name");
this.matchTitleBar.setText(this.matchName);
if ((TextUtils.equals(this.noOfPlayer, this.numberOfPosition) || Integer.parseInt(this.noOfPlayer) >= Integer.parseInt(this.numberOfPosition)) && !TextUtils.equals(from, "LIVE")) {
this.joinNow.setText(this.resources.getString(2131886540));
this.joinNow.setEnabled(false);
this.joinNow.setBackgroundColor(getResources().getColor(2131100323));
this.joinNow.setTextColor(-1);
}
if (this.joinStatus.matches("true")) {
response.getJSONArray("join_position");
if (!TextUtils.equals(from, "LIVE")) {
this.joinNow.setBackgroundColor(getResources().getColor(2131100332));
this.joinNow.setTextColor(-1);
this.joinNow.setText(this.resources.getString(2131886160));
this.joinNow.setEnabled(false);
}
} else if (!TextUtils.equals(this.noOfPlayer, this.numberOfPosition) && Integer.parseInt(this.noOfPlayer) < Integer.parseInt(this.numberOfPosition)) {
this.joinNow.setEnabled(true);
}
} catch (JSONException e) {
e.printStackTrace();
}
this.loadingDialog.dismiss();
}
void m205xb18529ea(View view) {
Intent intent12 = new Intent("android.intent.action.VIEW", Uri.parse(this.matchUrl));
startActivity(intent12);
}
void m206xb788f549(View view) {
Intent intent1 = new Intent(getApplicationContext(), (Class<?>) SelectMatchPositionActivity.class);
intent1.putExtra("MATCH_ID", this.mId);
intent1.putExtra("MATCH_NAME", this.matchName);
intent1.putExtra("TYPE", this.type);
intent1.putExtra("TOTAL", this.numberOfPosition);
intent1.putExtra("JOINSTATUS", this.joinStatus);
intent1.putExtra("GAME_NAME", this.gameName);
startActivity(intent1);
}
}