fix context related
This commit is contained in:
@ -67,8 +67,6 @@ import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.functions.Action1;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
/**
|
||||
* Created by khy on 2017/3/24.
|
||||
* 游戏详情适配器
|
||||
@ -328,7 +326,7 @@ public class GameDetailActivity extends BaseActivity {
|
||||
|
||||
// 获取游戏摘要
|
||||
private void getGameDigest() {
|
||||
RetrofitManager.getInstance(mContext).getApi().getGameDigest(mGameId)
|
||||
RetrofitManager.getInstance(this).getApi().getGameDigest(mGameId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<GameEntity>() {
|
||||
@ -354,7 +352,7 @@ public class GameDetailActivity extends BaseActivity {
|
||||
// 获取游戏详情
|
||||
public void getGameDetail() {
|
||||
|
||||
RetrofitManager.getInstance(mContext).getApi().getGameDetail(mGameId)
|
||||
RetrofitManager.getInstance(this).getApi().getGameDetail(mGameId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<GameDetailEntity>() {
|
||||
|
||||
@ -37,8 +37,6 @@ import retrofit2.HttpException;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
/**
|
||||
* Created by LGT on 2016/8/29.
|
||||
* 游戏新闻界面
|
||||
@ -165,7 +163,7 @@ public class GameNewsActivity extends BaseActivity implements View.OnClickListen
|
||||
}
|
||||
|
||||
private void getGameArticleType() {
|
||||
RetrofitManager.getInstance(mContext).getApi()
|
||||
RetrofitManager.getInstance(this).getApi()
|
||||
.getGameArticleType(gameId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
||||
@ -89,7 +89,6 @@ import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.gh.common.util.EntranceUtils.KEY_DATA;
|
||||
import static com.gh.common.util.EntranceUtils.KEY_TO;
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
/**
|
||||
* 项目的主Activity,3个Fragment都嵌入在这里。
|
||||
@ -219,7 +218,7 @@ public class MainActivity extends BaseActivity {
|
||||
params.put("platform", platform);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
|
||||
new JSONObject(params).toString());
|
||||
RetrofitManager.getInstance(mContext).getApi().postDownload(body)
|
||||
RetrofitManager.getInstance(this).getApi().postDownload(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<ResponseBody>());
|
||||
@ -387,7 +386,7 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
for (int i = 0, size = localList.size(); i < size; i++) {
|
||||
final String packageName = localList.get(i);
|
||||
RetrofitManager.getInstance(mContext).getApi().getGameDigestByPackageName(packageName)
|
||||
RetrofitManager.getInstance(this).getApi().getGameDigestByPackageName(packageName)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<GameDigestEntity>>() {
|
||||
@ -430,7 +429,7 @@ public class MainActivity extends BaseActivity {
|
||||
} else {
|
||||
List<Observable<GameEntity>> sequences = new ArrayList<>();
|
||||
for (String id : concernIdList) {
|
||||
sequences.add(RetrofitManager.getInstance(mContext).getApi().getGameDigest(id));
|
||||
sequences.add(RetrofitManager.getInstance(this).getApi().getGameDigest(id));
|
||||
}
|
||||
Observable.merge(sequences)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -519,7 +518,7 @@ public class MainActivity extends BaseActivity {
|
||||
// 更新用户已安装游戏
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"),
|
||||
new JSONArray(installed).toString());
|
||||
RetrofitManager.getInstance(mContext).getApi().putPackage(body)
|
||||
RetrofitManager.getInstance(MainActivity.this).getApi().putPackage(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
.subscribe(new Response<ResponseBody>());
|
||||
@ -556,7 +555,7 @@ public class MainActivity extends BaseActivity {
|
||||
final List<GameEntity> list = new ArrayList<>();
|
||||
List<Observable<GameEntity>> sequences = new ArrayList<>();
|
||||
for (ConcernInfo info : concernManager.getInstalledGame()) {
|
||||
sequences.add(RetrofitManager.getInstance(mContext).getApi().getGameDigest(info.getId()));
|
||||
sequences.add(RetrofitManager.getInstance(this).getApi().getGameDigest(info.getId()));
|
||||
}
|
||||
Observable.merge(sequences)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -578,9 +577,9 @@ public class MainActivity extends BaseActivity {
|
||||
Object gh_id = PackageUtils.getMetaData(this, packageName, "gh_id");
|
||||
Observable<GameUpdateEntity> observable;
|
||||
if (gh_id == null) {
|
||||
observable = RetrofitManager.getInstance(mContext).getApi().getGameUpdate(packageName);
|
||||
observable = RetrofitManager.getInstance(this).getApi().getGameUpdate(packageName);
|
||||
} else {
|
||||
observable = RetrofitManager.getInstance(mContext).getApi().getGameUpdate((String) gh_id, packageName);
|
||||
observable = RetrofitManager.getInstance(this).getApi().getGameUpdate((String) gh_id, packageName);
|
||||
}
|
||||
observable.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -730,7 +729,7 @@ public class MainActivity extends BaseActivity {
|
||||
if (true) {
|
||||
String content = DeviceUtils.getUserDevice(MainActivity.this).toString();
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), content);
|
||||
RetrofitManager.getInstance(mContext).getApi().checkDevice(body)
|
||||
RetrofitManager.getInstance(this).getApi().checkDevice(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<ResponseBody>() {
|
||||
@ -768,7 +767,7 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void getSuggestionType() {
|
||||
RetrofitManager.getInstance(mContext).getApi()
|
||||
RetrofitManager.getInstance(this).getApi()
|
||||
.getSuggestionType()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -804,7 +803,7 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
List<Observable<GameEntity>> list = new ArrayList<>();
|
||||
for (String gameId : arrGameId) {
|
||||
list.add(RetrofitManager.getInstance(mContext).getApi().getGameDigest(gameId));
|
||||
list.add(RetrofitManager.getInstance(this).getApi().getGameDigest(gameId));
|
||||
}
|
||||
Observable.merge(list)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@ -941,7 +940,7 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
if ("安装".equals(busFour.getType()) && sp.getBoolean("concerngame", true)) {//设置页面控制是否安装后自动关注
|
||||
// 安装后关注游戏
|
||||
RetrofitManager.getInstance(mContext).getApi().getGameDigestByPackageName(packageName)
|
||||
RetrofitManager.getInstance(this).getApi().getGameDigestByPackageName(packageName)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<GameDigestEntity>>() {
|
||||
@ -964,7 +963,7 @@ public class MainActivity extends BaseActivity {
|
||||
params.put(packageName);
|
||||
RequestBody body = RequestBody.create(
|
||||
MediaType.parse("application/json"), params.toString());
|
||||
RetrofitManager.getInstance(mContext).getApi()
|
||||
RetrofitManager.getInstance(MainActivity.this).getApi()
|
||||
.postPackage(body)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
@ -975,7 +974,7 @@ public class MainActivity extends BaseActivity {
|
||||
|
||||
if ("卸载".equals(busFour.getType())) {
|
||||
// 更新已安装游戏
|
||||
RetrofitManager.getInstance(mContext).getApi()
|
||||
RetrofitManager.getInstance(this).getApi()
|
||||
.deletePackage(packageName)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(Schedulers.io())
|
||||
@ -986,7 +985,7 @@ public class MainActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void concernGame(final String id, final String packageName) {
|
||||
RetrofitManager.getInstance(mContext).getApi().getGameDigest(id)
|
||||
RetrofitManager.getInstance(this).getApi().getGameDigest(id)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<GameEntity>() {
|
||||
|
||||
@ -62,7 +62,6 @@ import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.gh.gamecenter.personal.PersonalFragment.LOGIN_TAG;
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/11/8.
|
||||
@ -218,7 +217,7 @@ public class MessageDetailActivity extends BaseActivity implements OnCommentCall
|
||||
}
|
||||
|
||||
public void getCommentNum() {
|
||||
RetrofitManager.getInstance(mContext).getApi()
|
||||
RetrofitManager.getInstance(this).getApi()
|
||||
.getNewsCommentnum(newsId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -239,7 +238,7 @@ public class MessageDetailActivity extends BaseActivity implements OnCommentCall
|
||||
}
|
||||
|
||||
private void getConcernDigest() {
|
||||
RetrofitManager.getInstance(mContext).getApi().getNewsRichDigest(newsId)
|
||||
RetrofitManager.getInstance(this).getApi().getNewsRichDigest(newsId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<ConcernEntity>() {
|
||||
@ -270,7 +269,7 @@ public class MessageDetailActivity extends BaseActivity implements OnCommentCall
|
||||
}
|
||||
|
||||
private void getNewsViews() {
|
||||
RetrofitManager.getInstance(mContext).getData()
|
||||
RetrofitManager.getInstance(this).getData()
|
||||
.getNewsViews(newsId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
|
||||
@ -68,8 +68,6 @@ import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.functions.Action1;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
|
||||
/**
|
||||
* 文章详情页面 要启动该页面 需要传入一下参数 放入 EssayEntity中传过来 文章 id 文章标题 title 文章发表时间 time
|
||||
@ -428,7 +426,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener,
|
||||
}
|
||||
|
||||
private void getNewsDigest(final String newsId) {
|
||||
RetrofitManager.getInstance(mContext).getApi().getNewsDigest(newsId)
|
||||
RetrofitManager.getInstance(this).getApi().getNewsDigest(newsId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<NewsEntity>() {
|
||||
@ -626,7 +624,7 @@ public class NewsDetailActivity extends BaseActivity implements OnClickListener,
|
||||
mDetailBottomLl.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
RetrofitManager.getInstance(mContext).getApi().getGameNewsDigest(gameId)
|
||||
RetrofitManager.getInstance(this).getApi().getGameNewsDigest(gameId)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<GameEntity>() {
|
||||
|
||||
@ -41,8 +41,6 @@ import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.functions.Func1;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/8/22.
|
||||
* 新闻搜索界面
|
||||
@ -185,7 +183,7 @@ public class NewsSearchActivity extends BaseActivity {
|
||||
// DataUtils.onEvent(this, "游戏新闻搜索", searchKey);
|
||||
// DataCollectionUtils.uploadSearch(this, searchKey, "游戏新闻搜索");
|
||||
|
||||
RetrofitManager.getInstance(mContext).getApi().getSearchNews(gameId, searchKey, page, 20)
|
||||
RetrofitManager.getInstance(this).getApi().getSearchNews(gameId, searchKey, page, 20)
|
||||
.map(new Func1<List<NewsEntity>, List<NewsEntity>>() {
|
||||
@Override
|
||||
public List<NewsEntity> call(List<NewsEntity> list) {
|
||||
@ -268,7 +266,7 @@ public class NewsSearchActivity extends BaseActivity {
|
||||
"列表", "游戏新闻搜索", newsEntity.getTitle());
|
||||
|
||||
// 统计阅读量
|
||||
NewsUtils.statNewsViews(mContext, newsEntity.getId());
|
||||
NewsUtils.statNewsViews(NewsSearchActivity.this, newsEntity.getId());
|
||||
NewsDetailActivity.startNewsDetailActivity(NewsSearchActivity.this, newsEntity,
|
||||
mEntrance + "+(游戏新闻搜索[" + searchKey + "])");
|
||||
}
|
||||
|
||||
@ -55,7 +55,6 @@ import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.gh.common.util.EntranceUtils.KEY_DATA;
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
/**
|
||||
* 引导页面
|
||||
@ -321,7 +320,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
// 获取下载按钮显示状态
|
||||
private void getDownloadStatus() {
|
||||
String channel = HaloApp.getInstance().getChannel();
|
||||
RetrofitManager.getInstance(mContext).getApi().getDownloadStatus(
|
||||
RetrofitManager.getInstance(this).getApi().getDownloadStatus(
|
||||
PackageUtils.getVersionName(getApplicationContext()), channel)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
@ -350,7 +349,7 @@ public class SplashScreenActivity extends BaseActivity {
|
||||
|
||||
// 获取界面设置
|
||||
private void getUISetting() {
|
||||
RetrofitManager.getInstance(mContext).getApi().getUISetting()
|
||||
RetrofitManager.getInstance(this).getApi().getUISetting()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new JSONObjectResponse() {
|
||||
|
||||
@ -43,7 +43,6 @@ import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.gh.gamecenter.MainActivity.EB_MAINACTIVITY_TAG;
|
||||
import static com.gh.gamecenter.MainActivity.EB_SKIP_GAMEFRAGMENT;
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
/**
|
||||
* @author CsHeng
|
||||
@ -135,7 +134,7 @@ public class MainFragment extends BaseFragment_ViewPager_Checkable {
|
||||
}
|
||||
|
||||
private void getSearchHints() {
|
||||
RetrofitManager.getInstance(mContext).getApi().getSearchHints()
|
||||
RetrofitManager.getInstance(getContext()).getApi().getSearchHints()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<ArrayList<String>>() {
|
||||
|
||||
@ -35,8 +35,6 @@ import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.functions.Func1;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static anet.channel.util.Utils.context;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/12/12.
|
||||
*/
|
||||
@ -80,7 +78,7 @@ class Libao2FragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
|
||||
}
|
||||
|
||||
isLoading = true;
|
||||
RetrofitManager.getInstance(context).getApi().getConcernLibao(offset)
|
||||
RetrofitManager.getInstance(mContext).getApi().getConcernLibao(offset)
|
||||
.map(new Func1<List<LibaoEntity>, List<LibaoEntity>>() {
|
||||
@Override
|
||||
public List<LibaoEntity> call(List<LibaoEntity> list) {
|
||||
|
||||
@ -57,8 +57,6 @@ import rx.functions.Action1;
|
||||
import rx.functions.Func1;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
/**
|
||||
* Created by khy on 2016/8/15.
|
||||
* 资讯-关注界面
|
||||
@ -205,9 +203,9 @@ public class News2Fragment extends BaseFragment implements SwipeRefreshLayout.On
|
||||
List<Observable<GameEntity>> sequences = new ArrayList<>();
|
||||
for (int i = 0, size = installedList.size() + 1; i < size; i++) {
|
||||
if (i == size - 1) {
|
||||
sequences.add(RetrofitManager.getInstance(mContext).getApi().getGameDigest("5618b86e8ab49e17088b4575"));// 光环助手ID
|
||||
sequences.add(RetrofitManager.getInstance(getContext()).getApi().getGameDigest("5618b86e8ab49e17088b4575"));// 光环助手ID
|
||||
} else {
|
||||
sequences.add(RetrofitManager.getInstance(mContext).getApi().getGameDigest(installedList.get(i).getId()));
|
||||
sequences.add(RetrofitManager.getInstance(getContext()).getApi().getGameDigest(installedList.get(i).getId()));
|
||||
}
|
||||
}
|
||||
Observable.merge(sequences)
|
||||
@ -243,7 +241,7 @@ public class News2Fragment extends BaseFragment implements SwipeRefreshLayout.On
|
||||
}
|
||||
}
|
||||
|
||||
RetrofitManager.getInstance(mContext).getApi()
|
||||
RetrofitManager.getInstance(getContext()).getApi()
|
||||
.getRemenkapai()
|
||||
.map(new Func1<List<GameEntity>, String>() {
|
||||
@Override
|
||||
|
||||
@ -55,8 +55,6 @@ import retrofit2.HttpException;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
/**
|
||||
* @author 温冠超
|
||||
* 294299195@qq.com
|
||||
@ -307,7 +305,7 @@ public class PersonalFragment extends BaseFragment implements GetLoginDataUtils.
|
||||
|
||||
private void checkUpdate() {
|
||||
String channel = HaloApp.getInstance().getChannel();
|
||||
RetrofitManager.getInstance(mContext)
|
||||
RetrofitManager.getInstance(getContext())
|
||||
.getApi()
|
||||
.getUpdate(PackageUtils.getVersionName(getContext()), channel)
|
||||
.subscribeOn(Schedulers.io())
|
||||
|
||||
@ -28,8 +28,6 @@ import butterknife.OnClick;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
import static com.taobao.accs.ACCSManager.mContext;
|
||||
|
||||
public class SearchHistoryFragment extends BaseFragment {
|
||||
|
||||
@BindView(R.id.search_hot_tv)
|
||||
@ -105,7 +103,7 @@ public class SearchHistoryFragment extends BaseFragment {
|
||||
|
||||
private void loadSearchHotData() {
|
||||
|
||||
RetrofitManager.getInstance(mContext).getApi()
|
||||
RetrofitManager.getInstance(getContext()).getApi()
|
||||
.getHotSearch().subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new JSONArrayResponse() {
|
||||
|
||||
Reference in New Issue
Block a user