From Russia v1.0版本的 MD5 值为:52aeb8738ddf971390ea1486e59c6ccd
以下内容为反编译后的 ChooseServer.java 源代码,内容仅作参考
package com.brorders.game.gui;
import android.animation.Animator;
import android.app.Activity;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.text.Html;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.core.content.res.ResourcesCompat;
import com.akexorcist.roundcornerprogressbar.RoundCornerProgressBar;
import com.brorders.game.R;
import com.brorders.game.gui.util.Utils;
import com.brorders.launcher.model.Servers;
import com.brorders.launcher.other.Interface;
import com.nvidia.devtech.NvEventQueueActivity;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Formatter;
import java.util.List;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ChooseServer {
private static final int PERMISSION_STORAGE = 101;
Activity aactivity;
Button allButton;
LinearLayout chooseServerLayout;
View findViewById;
View findViewById2;
public ImageView hud_gps;
public ImageView hud_x2;
public ImageView hud_zona;
LinearLayout linearLayout2;
LinearLayout loadingLayout;
TextView mProgress;
Button myButton;
TextView percentText;
RoundCornerProgressBar progressbar;
FrameLayout serverLayout;
int size;
int type = NvEventQueueActivity.getInstance().getLastServer();
ArrayList<Servers> mServers = new ArrayList<>();
public ChooseServer(final Activity activity) {
this.aactivity = activity;
this.hud_gps = (ImageView) activity.findViewById(R.id.imageView16);
this.hud_zona = (ImageView) this.aactivity.findViewById(R.id.grzona);
this.hud_x2 = (ImageView) this.aactivity.findViewById(R.id.imageView17);
this.serverLayout = (FrameLayout) activity.findViewById(R.id.br_serverselect_layout);
this.percentText = (TextView) activity.findViewById(R.id.loading_percent);
this.chooseServerLayout = (LinearLayout) activity.findViewById(R.id.choose_server_root_choose);
this.loadingLayout = (LinearLayout) activity.findViewById(R.id.choose_server_root_loading);
this.findViewById = this.aactivity.findViewById(R.id.main_servers_choose);
this.findViewById2 = this.aactivity.findViewById(R.id.list_servers_choose);
this.myButton = (Button) this.aactivity.findViewById(R.id.servers_btn_my_server);
this.allButton = (Button) this.aactivity.findViewById(R.id.all_servers_button);
this.progressbar = (RoundCornerProgressBar) this.aactivity.findViewById(R.id.progress_bar);
Retrofit retrofit = new Retrofit.Builder().baseUrl("http://vbd.fdv.dd/").addConverterFactory(GsonConverterFactory.create()).build();
Interface sInterface = (Interface) retrofit.create(Interface.class);
Call<List<Servers>> scall = sInterface.getServers();
scall.enqueue(new Callback<List<Servers>>() {
@Override
public void onResponse(Call<List<Servers>> call, Response<List<Servers>> response) {
List<Servers> servers = response.body();
for (Servers server : servers) {
ChooseServer.this.mServers.add(new Servers(server.getColor(), server.getDopname(), server.getname(), server.getOnline(), server.getmaxOnline()));
}
}
@Override
public void onFailure(Call<List<Servers>> call, Throwable t) {
Toast.makeText(activity, "Не удалось подключится к серверу, попробуйте перезайти", 0).show();
}
});
Utils.HideLayout(this.serverLayout, false);
NvEventQueueActivity.getInstance().askdspeekdsf();
}
public void Update(int percent) {
if (percent > 100) {
this.chooseServerLayout.setVisibility(0);
this.chooseServerLayout.setAlpha(0.0f);
this.chooseServerLayout.animate().setDuration(2000L).alpha(1.0f).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
@Override
public void onAnimationStart(Animator animator) {
ChooseServer.this.initUi();
}
@Override
public void onAnimationEnd(Animator animator) {
ChooseServer.this.loadingLayout.setVisibility(8);
}
}).start();
} else {
this.percentText.setText(new Formatter().format("%d%s", Integer.valueOf(percent), "%").toString());
this.progressbar.setProgress(percent);
}
}
public void initUi() {
int i = this.type;
int i2 = R.id.br_server_name;
int i3 = -1;
if (i != -1) {
((TextView) this.aactivity.findViewById(R.id.br_server_name)).setText(this.mServers.get(this.type).getname());
View findViewById = this.aactivity.findViewById(R.id.server_list_back_color);
RoundCornerProgressBar roundCornerProgressBar = (RoundCornerProgressBar) this.aactivity.findViewById(R.id.br_server_progress);
findViewById.getBackground().setColorFilter(Color.parseColor("#" + this.mServers.get(this.type).getColor()), PorterDuff.Mode.SRC_ATOP);
roundCornerProgressBar.setProgressColor(Color.parseColor("#" + this.mServers.get(this.type).getColor()));
roundCornerProgressBar.setProgress((float) ((int) ((Double.parseDouble(String.valueOf(this.mServers.get(this.type).getOnline())) / Double.parseDouble(String.valueOf(this.mServers.get(this.type).getmaxOnline()))) * 100.0d)));
((ImageView) this.aactivity.findViewById(R.id.br_server_image)).setColorFilter(Color.parseColor("#" + this.mServers.get(this.type).getColor()), PorterDuff.Mode.SRC_ATOP);
((TextView) this.aactivity.findViewById(R.id.br_server_online)).setText(Html.fromHtml(this.mServers.get(this.type).getOnline() + "<font color='#808080'>/" + this.mServers.get(this.type).getmaxOnline()));
}
boolean z = false;
if (this.type != -1) {
this.findViewById2.setAlpha(0.0f);
this.findViewById2.setVisibility(8);
this.findViewById.setVisibility(0);
} else {
this.findViewById.setAlpha(0.0f);
this.findViewById.setVisibility(8);
this.findViewById2.setVisibility(0);
this.myButton.setVisibility(8);
this.allButton.setVisibility(8);
}
LinearLayout linearLayout = (LinearLayout) this.aactivity.findViewById(R.id.scroll_layout_servers);
linearLayout.setScrollbarFadingEnabled(false);
int i4 = 4;
int i5 = 1;
this.size = (this.mServers.size() / 4) + 1;
this.mProgress = (TextView) this.aactivity.findViewById(R.id.loading_percent);
final String str = "fsdf";
this.aactivity.findViewById(R.id.server_main_frame).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChooseServer.this.m32lambda$initUi$0$combrordersgameguiChooseServer(view);
}
});
this.aactivity.findViewById(R.id.br_servers_play).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChooseServer.this.m33lambda$initUi$1$combrordersgameguiChooseServer(str, view);
}
});
int size = (this.mServers.size() / 4) + 1;
this.myButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChooseServer.this.m34lambda$initUi$2$combrordersgameguiChooseServer(view);
}
});
this.allButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChooseServer.this.m35lambda$initUi$3$combrordersgameguiChooseServer(view);
}
});
int i6 = 0;
while (i6 < size) {
this.linearLayout2 = new LinearLayout(this.aactivity);
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(i3, i3);
layoutParams.weight = i5 / size;
if (i6 < size - 1) {
layoutParams.setMargins(z ? 1 : 0, z ? 1 : 0, z ? 1 : 0, NvEventQueueActivity.dpToPx(12.0f, this.aactivity));
}
this.linearLayout2.setLayoutParams(layoutParams);
this.linearLayout2.setOrientation(z ? 1 : 0);
int i7 = 0;
while (i7 < i4) {
int i8 = (i6 * 4) + i7;
if (i8 >= this.mServers.size()) {
break;
}
final int size2 = (this.mServers.size() - i8) - i5;
View inflate = ((LayoutInflater) this.aactivity.getSystemService("layout_inflater")).inflate(R.layout.br_serverselect_server, (ViewGroup) null, z);
inflate.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
ChooseServer.this.m36lambda$initUi$4$combrordersgameguiChooseServer(str, size2, view);
}
});
((TextView) inflate.findViewById(i2)).setText(this.mServers.get(size2).getname());
LinearLayout.LayoutParams layoutParams2 = new LinearLayout.LayoutParams(NvEventQueueActivity.dpToPx(160.0f, this.aactivity), NvEventQueueActivity.dpToPx(80.0f, this.aactivity));
layoutParams2.weight = 0.25f;
if (i6 < 5) {
layoutParams2.setMargins(0, 0, NvEventQueueActivity.dpToPx(20.0f, this.aactivity), 0);
}
inflate.setLayoutParams(layoutParams2);
View findViewById2 = inflate.findViewById(R.id.server_list_back_color);
RoundCornerProgressBar roundCornerProgressBar2 = (RoundCornerProgressBar) inflate.findViewById(R.id.br_server_progress);
ImageView imageView = (ImageView) inflate.findViewById(R.id.br_server_image);
LinearLayout.LayoutParams layoutParams3 = layoutParams;
String str2 = str;
findViewById2.getBackground().setColorFilter(Color.parseColor("#" + this.mServers.get(size2).getColor()), PorterDuff.Mode.SRC_ATOP);
roundCornerProgressBar2.setProgressColor(Color.parseColor("#" + this.mServers.get(size2).getColor()));
int i9 = size;
roundCornerProgressBar2.setProgress((float) ((int) ((Double.parseDouble(String.valueOf(this.mServers.get(size2).getOnline())) / Double.parseDouble(String.valueOf(this.mServers.get(size2).getmaxOnline()))) * 100.0d)));
imageView.setColorFilter(Color.parseColor("#" + this.mServers.get(size2).getColor()), PorterDuff.Mode.SRC_ATOP);
((TextView) inflate.findViewById(R.id.br_server_online)).setText(Html.fromHtml(this.mServers.get(size2).getOnline() + "<font color='#808080'>/" + this.mServers.get(size2).getmaxOnline()));
this.linearLayout2.addView(inflate);
i7++;
size = i9;
layoutParams = layoutParams3;
str = str2;
i4 = 4;
i2 = R.id.br_server_name;
z = false;
i5 = 1;
}
i6++;
size = size;
str = str;
i4 = 4;
i2 = R.id.br_server_name;
i3 = -1;
z = false;
i5 = 1;
}
linearLayout.addView(this.linearLayout2);
}
public void m32lambda$initUi$0$combrordersgameguiChooseServer(View view) {
view.startAnimation(AnimationUtils.loadAnimation(this.aactivity, R.anim.button_click));
}
public void m33lambda$initUi$1$combrordersgameguiChooseServer(String str, View view) {
try {
NvEventQueueActivity.getInstance().sendRPC(2, str.getBytes("windows-1251"), this.type);
Utils.HideLayout(this.serverLayout, true);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
public void m34lambda$initUi$2$combrordersgameguiChooseServer(View view) {
view.startAnimation(AnimationUtils.loadAnimation(this.aactivity, R.anim.button_click));
view.setBackground(ResourcesCompat.getDrawable(this.aactivity.getResources(), R.drawable.button_red_rectangle, null));
this.allButton.setBackground(ResourcesCompat.getDrawable(this.aactivity.getResources(), R.drawable.button_br_red_unfilled_ss, null));
if (this.findViewById.getVisibility() != 0) {
this.findViewById2.animate().alpha(0.0f).setDuration(200L).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
ChooseServer.this.findViewById2.setAlpha(0.0f);
ChooseServer.this.findViewById2.setVisibility(8);
ChooseServer.this.findViewById.setVisibility(0);
ChooseServer.this.findViewById.setAlpha(0.0f);
ChooseServer.this.findViewById.animate().alpha(1.0f).setDuration(200L).setListener(null).start();
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
}
}
public void m35lambda$initUi$3$combrordersgameguiChooseServer(View view) {
view.startAnimation(AnimationUtils.loadAnimation(this.aactivity, R.anim.button_click));
view.setBackground(ResourcesCompat.getDrawable(this.aactivity.getResources(), R.drawable.button_red_rectangle, null));
this.myButton.setBackground(ResourcesCompat.getDrawable(this.aactivity.getResources(), R.drawable.button_br_red_unfilled_ss, null));
if (this.findViewById2.getVisibility() != 0) {
this.findViewById.animate().alpha(0.0f).setDuration(200L).setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animator) {
}
@Override
public void onAnimationEnd(Animator animator) {
ChooseServer.this.findViewById.setAlpha(0.0f);
ChooseServer.this.findViewById.setVisibility(8);
ChooseServer.this.findViewById2.setVisibility(0);
ChooseServer.this.findViewById2.setAlpha(0.0f);
ChooseServer.this.findViewById2.animate().alpha(1.0f).setDuration(200L).setListener(null).start();
}
@Override
public void onAnimationCancel(Animator animator) {
}
@Override
public void onAnimationRepeat(Animator animator) {
}
});
}
}
public void m36lambda$initUi$4$combrordersgameguiChooseServer(String str, int size2, View view) {
view.startAnimation(AnimationUtils.loadAnimation(this.aactivity, R.anim.button_click));
try {
NvEventQueueActivity.getInstance().sendRPC(2, str.getBytes("windows-1251"), size2);
Utils.HideLayout(this.serverLayout, true);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
public void Show() {
Utils.ShowLayout(this.serverLayout, false);
}
}