去除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

@ -9,11 +9,9 @@ import android.provider.Settings;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.android.volley.Request;
import com.android.volley.Response;
import com.gh.base.AppController;
import com.gh.common.constant.Config;
import com.gh.gamecenter.volley.extended.StringExtendedRequest;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.gh.gamecenter.retrofit.StringResponse;
import com.tencent.stat.StatConfig;
import org.json.JSONException;
@ -32,6 +30,9 @@ import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
public class TokenUtils {
// 注册设备
@ -185,9 +186,10 @@ public class TokenUtils {
// 获取服务器时间
public static synchronized void getTime(Context context) {
final SharedPreferences sp = context.getSharedPreferences(Config.PREFERENCE, Context.MODE_PRIVATE);
StringExtendedRequest request = new StringExtendedRequest(
Request.Method.GET, Config.HOST + "support/time/current",
new Response.Listener<String>() {
RetrofitManager.getApi().getTime()
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new StringResponse() {
@Override
public void onResponse(String response) {
if (response.matches("^[0-9]{10}$")) {
@ -201,9 +203,7 @@ public class TokenUtils {
}
}
}
}, null);
request.setShouldCache(false);
AppController.addToRequestQueue(request);
});
}
public static synchronized void saveDeviceId(Context context, String device_id){