去除volley
This commit is contained in:
@ -19,8 +19,6 @@ import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.volley.Response;
|
||||
import com.gh.base.AppController;
|
||||
import com.gh.base.BaseActivity;
|
||||
import com.gh.common.constant.Config;
|
||||
import com.gh.common.util.FileUtils;
|
||||
@ -31,13 +29,14 @@ import com.gh.common.util.Utils;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.DownloadService;
|
||||
import com.gh.gamecenter.db.info.FilterInfo;
|
||||
import com.gh.gamecenter.entity.PlatformEntity;
|
||||
import com.gh.gamecenter.eventbus.EBReuse;
|
||||
import com.gh.gamecenter.manager.DataCollectionManager;
|
||||
import com.gh.gamecenter.manager.FilterManager;
|
||||
import com.gh.gamecenter.volley.extended.JsonArrayExtendedRequest;
|
||||
import com.gh.gamecenter.volley.extended.JsonObjectExtendedRequest;
|
||||
import com.gh.gamecenter.retrofit.JSONObjectResponse;
|
||||
import com.gh.gamecenter.retrofit.Response;
|
||||
import com.gh.gamecenter.retrofit.RetrofitManager;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@ -54,6 +53,8 @@ import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
import de.greenrobot.event.EventBus;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 引导页面
|
||||
@ -278,9 +279,10 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
* 获取界面设置
|
||||
*/
|
||||
private void getUISetting() {
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
|
||||
Config.HOST + "support/setting/ui",
|
||||
new Response.Listener<JSONObject>() {
|
||||
RetrofitManager.getApi().getUISetting()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new JSONObjectResponse() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
if (response.length() != 0) {
|
||||
@ -298,8 +300,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
AppController.addToRequestQueue(request);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
@ -308,10 +309,10 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
private void getDownloadStatus() {
|
||||
String TD_CHANNEL_ID = (String) PackageUtils.getMetaData(this,
|
||||
getPackageName(), "TD_CHANNEL_ID");
|
||||
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
|
||||
Config.HOST + "support/download_status?version=" + PackageUtils.getVersion(getApplicationContext())
|
||||
+ "&channel=" + TD_CHANNEL_ID,
|
||||
new Response.Listener<JSONObject>() {
|
||||
RetrofitManager.getApi().getDownloadStatus(PackageUtils.getVersion(getApplicationContext()), TD_CHANNEL_ID)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new JSONObjectResponse() {
|
||||
@Override
|
||||
public void onResponse(JSONObject response) {
|
||||
if (response.length() != 0) {
|
||||
@ -331,8 +332,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
AppController.addToRequestQueue(request);
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
@ -359,34 +359,20 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void getPlatform() {
|
||||
JsonArrayExtendedRequest request = new JsonArrayExtendedRequest(
|
||||
Config.HOST + "support/setting/platform",
|
||||
new Response.Listener<JSONArray>() {
|
||||
RetrofitManager.getApi().getGamePlatform()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<PlatformEntity>>(){
|
||||
@Override
|
||||
public void onResponse(JSONArray response) {
|
||||
try {
|
||||
Set<String> pset = new HashSet<>();
|
||||
for (int i = 0; i < response.length(); i++) {
|
||||
JSONObject jsonObject = response
|
||||
.getJSONObject(i);
|
||||
String code = jsonObject.getString("code");
|
||||
String name = jsonObject.getString("name");
|
||||
String pic = jsonObject.getString("pic");
|
||||
String color = jsonObject.getString("color");
|
||||
pset.add(code + "=" + name + "=" + pic + "="
|
||||
+ color);
|
||||
}
|
||||
SharedPreferences sharedPreferences = getSharedPreferences(
|
||||
"gh_platform", Context.MODE_PRIVATE);
|
||||
Editor editor = sharedPreferences.edit();
|
||||
editor.putStringSet("platform", pset);
|
||||
editor.apply();
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
public void onResponse(List<PlatformEntity> response) {
|
||||
Set<String> platformSet = new HashSet<>();
|
||||
for (PlatformEntity platformEntity : response) {
|
||||
platformSet.add(platformEntity.toString());
|
||||
}
|
||||
SharedPreferences sharedPreferences = getSharedPreferences("gh_platform", Context.MODE_PRIVATE);
|
||||
sharedPreferences.edit().putStringSet("platform", platformSet).apply();
|
||||
}
|
||||
}, null);
|
||||
AppController.addToRequestQueue(request);
|
||||
});
|
||||
}
|
||||
|
||||
// 跳转到主界面
|
||||
|
||||
Reference in New Issue
Block a user