去除volley

This commit is contained in:
huangzhuanghua
2016-12-05 18:43:58 +08:00
parent d02a136e2f
commit c7ceb5cf82
105 changed files with 1794 additions and 8141 deletions

View File

@ -7,11 +7,8 @@ import android.view.KeyEvent;
import android.view.View;
import android.widget.RelativeLayout;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.gh.base.AppController;
import com.gh.base.BaseDetailActivity;
import com.gh.common.constant.Config;
import com.gh.common.util.DataUtils;
import com.gh.common.util.DialogUtils;
import com.gh.gamecenter.changeskin.ChangeSkinUtils;
@ -19,16 +16,18 @@ import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.eventbus.EBConcernChanged;
import com.gh.gamecenter.gamedetail.GameDetailAdapter;
import com.gh.gamecenter.manager.DataCollectionManager;
import com.gh.gamecenter.volley.extended.JsonObjectExtendedRequest;
import com.google.gson.Gson;
import org.json.JSONObject;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import java.util.HashMap;
import java.util.Map;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
/**
* Created by khy on 2016/8/12.
*
*/
public class GameDetailActivity extends BaseDetailActivity implements View.OnClickListener{
@ -157,29 +156,25 @@ public class GameDetailActivity extends BaseDetailActivity implements View.OnCli
// 获取游戏摘要
private void getGameDigest() {
JsonObjectExtendedRequest request = new JsonObjectExtendedRequest(
Config.HOST + "game/" + gameId + "/digest",
new Response.Listener<JSONObject>() {
RetrofitManager.getApi().getGameDigest(gameId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<GameEntity>() {
@Override
public void onResponse(JSONObject response) {
if (response.length() != 0) {
Gson gson = new Gson();
gameEntity = gson.fromJson(response.toString(), GameEntity.class);
title = gameEntity.getName();
actionbar_tv_title.setText(gameEntity.getName());
adapter.setGameEntity(gameEntity);
adapter.getGameDetail();
} else {
reuse_no_connection.setVisibility(View.VISIBLE);
}
public void onResponse(GameEntity response) {
gameEntity = response;
title = gameEntity.getName();
actionbar_tv_title.setText(gameEntity.getName());
adapter.setGameEntity(gameEntity);
adapter.getGameDetail();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
public void onFailure(Throwable e) {
reuse_no_connection.setVisibility(View.VISIBLE);
}
});
AppController.addToRequestQueue(request);
}
// 关注事件