正在查看: Clash Legends v0.0.1 应用的 SelectedLotteryActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Clash Legends v0.0.1 应用的 SelectedLotteryActivity.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 android.widget.Toast;
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.activities.SelectedLotteryActivity;
import com.clash.legends.ui.adapters.TabAdapter;
import com.clash.legends.ui.fragments.FragmentSelectedLotteryDescription;
import com.clash.legends.ui.fragments.FragmentSelectedLotteryJoinedeMember;
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 SelectedLotteryActivity extends AppCompatActivity {
private TabAdapter adapter;
ImageView back;
Context context;
CardView imageViewSelectedCardview;
ImageView imgeViewSelected;
Button joinNow;
LoadingDialog loadingDialog;
RequestQueue mQueue;
TextView matchTitleBar;
Resources resources;
private TabLayout tabLayout;
CurrentUser user;
UserLocalStore userLocalStore;
private ViewPager viewPager;
String joinStatus = "";
String from = "";
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(2131558478);
Context locale = LocaleHelper.setLocale(this);
this.context = locale;
this.resources = locale.getResources();
this.viewPager = findViewById(2131363745);
this.tabLayout = findViewById(2131363431);
TabAdapter tabAdapter = new TabAdapter(getSupportFragmentManager());
this.adapter = tabAdapter;
tabAdapter.addFragment(new FragmentSelectedLotteryDescription(), this.resources.getString(2131886413));
this.adapter.addFragment(new FragmentSelectedLotteryJoinedeMember(), this.resources.getString(2131886496));
this.viewPager.setAdapter(this.adapter);
this.tabLayout.setupWithViewPager(this.viewPager);
this.tabLayout.setTabTextColors(-1, getResources().getColor(2131100323));
this.loadingDialog = new LoadingDialog(this);
UserLocalStore userLocalStore = new UserLocalStore(getApplicationContext());
this.userLocalStore = userLocalStore;
this.user = userLocalStore.getLoggedInUser();
this.back = (ImageView) findViewById(2131361985);
this.joinNow = (Button) findViewById(2131362536);
this.matchTitleBar = (TextView) findViewById(2131362648);
this.back.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
SelectedLotteryActivity.this.m168x831de9e3(view);
}
});
Intent intent = getIntent();
this.from = intent.getStringExtra("FROM");
String lid = intent.getStringExtra("LID");
String title = intent.getStringExtra("TITLE");
String baner = intent.getStringExtra("BANER");
String status = intent.getStringExtra("STATUS");
this.matchTitleBar.setText(title);
if (!TextUtils.equals(this.from, "ONGOING")) {
this.joinNow.setVisibility(8);
}
this.joinNow.setText(status);
if (!TextUtils.equals(status, this.resources.getString(2131886951))) {
if (TextUtils.equals(status, this.resources.getString(2131886952))) {
this.joinNow.setBackgroundColor(getResources().getColor(2131100328));
} else if (TextUtils.equals(status, this.resources.getString(2131886459))) {
this.joinNow.setBackgroundColor(getResources().getColor(2131100328));
this.joinNow.setEnabled(false);
}
}
this.imageViewSelectedCardview = findViewById(2131362442);
this.imgeViewSelected = (ImageView) findViewById(2131362441);
if (!TextUtils.equals(baner, "")) {
this.imageViewSelectedCardview.setVisibility(0);
Picasso.get().load(Uri.parse(baner)).placeholder(2131231003).fit().into(this.imgeViewSelected);
} else {
this.imgeViewSelected.setImageDrawable(getDrawable(2131231003));
}
this.joinNow.setOnClickListener(new AnonymousClass1(status, lid));
}
void m168x831de9e3(View view) {
onBackPressed();
}
class AnonymousClass1 implements View.OnClickListener {
final String val$lid;
final String val$status;
AnonymousClass1(String str, String str2) {
this.val$status = str;
this.val$lid = str2;
}
@Override
public void onClick(View view) {
if (TextUtils.equals(this.val$status, SelectedLotteryActivity.this.resources.getString(2131886952))) {
Toast.makeText(SelectedLotteryActivity.this.getApplicationContext(), SelectedLotteryActivity.this.resources.getString(2131887099), 0).show();
return;
}
SelectedLotteryActivity.this.loadingDialog.show();
SelectedLotteryActivity selectedLotteryActivity = SelectedLotteryActivity.this;
selectedLotteryActivity.mQueue = Volley.newRequestQueue(selectedLotteryActivity.getApplicationContext());
String url = SelectedLotteryActivity.this.resources.getString(2131886167) + "lottery_join";
HashMap<String, String> params = new HashMap<>();
params.put("submit", "joinnow");
params.put("lottery_id", this.val$lid);
params.put("member_id", SelectedLotteryActivity.this.user.getMemberid());
JsonObjectRequest request = new JsonObjectRequest(url, new JSONObject(params), new Response.Listener() {
public final void onResponse(Object obj) {
SelectedLotteryActivity.AnonymousClass1.this.m169x612882c4((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 = SelectedLotteryActivity.this.userLocalStore.getLoggedInUser();
String token = "Bearer " + user.getToken();
headers.put("Content-Type", "application/json");
headers.put("Authorization", token);
headers.put("x-localization", LocaleHelper.getPersist(SelectedLotteryActivity.this.context));
return headers;
}
};
SelectedLotteryActivity.this.mQueue.add(request);
}
void m169x612882c4(JSONObject response) {
SelectedLotteryActivity.this.loadingDialog.dismiss();
try {
Toast.makeText(SelectedLotteryActivity.this.getApplicationContext(), response.getString("message"), 0).show();
if (TextUtils.equals(response.getString("status"), "true")) {
SelectedLotteryActivity.this.joinNow.setText(SelectedLotteryActivity.this.resources.getString(2131886952));
SelectedLotteryActivity.this.joinNow.setBackgroundColor(SelectedLotteryActivity.this.getResources().getColor(2131100329));
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
public void onBackPressed() {
super.onBackPressed();
if (!TextUtils.equals(this.from, "ONGOING")) {
TextUtils.equals(this.from, "RESULT");
}
}
}