From Russia v1.0版本的 MD5 值为:52aeb8738ddf971390ea1486e59c6ccd
以下内容为反编译后的 SplashActivity.java 源代码,内容仅作参考
package com.brorders.launcher.activity;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.brorders.game.R;
import com.brorders.game.gui.jbl.JblModels;
import com.brorders.launcher.adapter.NewsAdapter;
import com.brorders.launcher.adapter.ServersAdapter;
import com.brorders.launcher.model.News;
import com.brorders.launcher.model.Servers;
import com.brorders.launcher.other.Interface;
import com.brorders.launcher.other.Lists;
import com.google.firebase.database.DatabaseReference;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class SplashActivity extends AppCompatActivity {
private static String CHANNEL_ID = "qq channel";
private static final int NOTIFY_ID = 101;
public static ArrayList<News> nlist;
public static ArrayList<Servers> slist;
private int counter = 101;
DatabaseReference databaseNews;
DatabaseReference databaseServers;
NewsAdapter newsAdapter;
ServersAdapter serversAdapter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Lists.slist = new ArrayList();
Lists.nlist = new ArrayList();
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) {
Lists.slist.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(SplashActivity.this.getApplicationContext(), t.toString(), 0).show();
}
});
Call<List<News>> ncall = sInterface.getNews();
ncall.enqueue(new Callback<List<News>>() {
@Override
public void onResponse(Call<List<News>> call, Response<List<News>> response) {
List<News> news = response.body();
for (News storie : news) {
Lists.nlist.add(new News(storie.getImageUrl(), storie.getTitle(), storie.getUrl()));
}
}
@Override
public void onFailure(Call<List<News>> call, Throwable t) {
Toast.makeText(SplashActivity.this.getApplicationContext(), t.toString(), 0).show();
}
});
Call<List<JblModels>> jcall = sInterface.getMusic();
jcall.enqueue(new Callback<List<JblModels>>() {
@Override
public void onResponse(Call<List<JblModels>> call, Response<List<JblModels>> response) {
List<JblModels> jbls = response.body();
for (JblModels jbl : jbls) {
Lists.jlist.add(new JblModels(jbl.getName(), jbl.getUrl(), jbl.getTime()));
}
}
@Override
public void onFailure(Call<List<JblModels>> call, Throwable t) {
Toast.makeText(SplashActivity.this.getApplicationContext(), t.toString(), 0).show();
}
});
if (Build.VERSION.SDK_INT >= 23) {
if (checkSelfPermission("android.permission.READ_EXTERNAL_STORAGE") == -1 || checkSelfPermission("android.permission.WRITE_EXTERNAL_STORAGE") == -1 || checkSelfPermission("android.permission.RECORD_AUDIO") == -1) {
requestPermissions(new String[]{"android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.RECORD_AUDIO"}, 1000);
return;
} else {
startTimer();
return;
}
}
startTimer();
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == 1000) {
startLauncher();
}
}
public void startLauncher() {
startActivity(new Intent(this, (Class<?>) MainActivity.class));
NotificationCompat.Builder builder = new NotificationCompat.Builder(this, CHANNEL_ID).setSmallIcon(R.drawable.logo_splash).setContentTitle("u").setContentText("Вводи промокод #yаngаy и получай бонус").setPriority(0);
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
notificationManager.notify(101, builder.build());
finish();
}
public static boolean isOnline(Context context) {
ConnectivityManager cm = (ConnectivityManager) context.getSystemService("connectivity");
NetworkInfo netInfo = cm.getActiveNetworkInfo();
if (netInfo != null && netInfo.isConnectedOrConnecting()) {
return true;
}
return false;
}
private void startTimer() {
Timer t = new Timer();
t.schedule(new TimerTask() {
@Override
public void run() {
SplashActivity.this.startLauncher();
}
}, 1000L);
}
}