接口limit改为page_size,修复游戏列表下载与详情下载安装判断不一致问题,安装游戏删除addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)

This commit is contained in:
kehaoyuan
2018-04-26 17:09:16 +08:00
parent 29faea14c6
commit 684fa318ec
9 changed files with 26 additions and 43 deletions

View File

@ -156,15 +156,19 @@ public class DownloadItemUtils {
holder.gameDownloadBtn.setText(R.string.update);
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
} else {
Object gh_id = PackageUtils.getMetaData(context, packageName, "gh_id");
if (gameEntity.getTag() != null && gameEntity.getTag().size() != 0
&& !TextUtils.isEmpty(apkEntity.getGhVersion())
&& !PackageUtils.isSignature(context, packageName)) {
holder.gameDownloadBtn.setText(R.string.pluggable);
setwhat(context, holder, apkEntity, packageName);
} else {
} else if (gh_id == null || gh_id.equals(gameEntity.getId())) {
holder.gameDownloadBtn.setText(R.string.launch);
holder.gameDownloadBtn.setTextColor(ContextCompat.getColor(context, R.color.theme));
holder.gameDownloadBtn.setBackgroundResource(R.drawable.detail_downloading_normal_style);
} else {
holder.gameDownloadBtn.setText(R.string.download);
holder.gameDownloadBtn.setBackgroundResource(R.drawable.game_item_btn_download_style);
}
}
} else {

View File

@ -167,7 +167,7 @@ public class PackageUtils {
public static Intent getInstallIntent(Context context, String path) {
Uri uri = Uri.fromFile(new File(path));
Intent installIntent = new Intent(Intent.ACTION_VIEW);
installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
installIntent.setDataAndType(uri, "application/vnd.android.package-archive");
InstallUtils.getInstance(context).addInstall(getPackageNameByPath(context, path));
return installIntent;

View File

@ -64,7 +64,7 @@ public class CommentDetailAdapter extends BaseRecyclerAdapter<ViewHolder> {
if (mIsLoading) return;
mIsLoading = true;
RetrofitManager.getInstance(mContext).getApi()
.getCommentTrace(mCommentId, 20, mPage)
.getCommentTrace(mCommentId, mPage)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<CommentEntity>>() {

View File

@ -15,7 +15,6 @@ import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
import com.gh.gamecenter.ask.entity.AnswerEntity;
import com.gh.gamecenter.ask.entity.AskSubjectEntity;
import com.gh.gamecenter.baselist.ListAdapter;
import com.gh.gamecenter.manager.UserManager;
import java.util.ArrayList;
import java.util.HashMap;
@ -98,14 +97,7 @@ public class AskQuestionsRecommendsAdapter extends ListAdapter<AnswerEntity> {
AskSubjectViewHolder subjectViewHolder = (AskSubjectViewHolder) holder;
subjectViewHolder.mSubjectRG.removeAllViews();
mSubjectViewPager = subjectViewHolder.mSubjectViewPager;
AskSubjectPageAdapter adapter = mCachePageAdapter.get(UserManager.getInstance().getCommunityId(mContext));
if (adapter == null || adapter.getDataSize() != mSubjectEntity.size()) {
adapter = new AskSubjectPageAdapter(mContext, mSubjectEntity);
mCachePageAdapter.put(UserManager.getInstance().getCommunityId(mContext), adapter);
subjectViewHolder.mSubjectViewPager.setAdapter(adapter);
} else if (adapter != subjectViewHolder.mSubjectViewPager.getAdapter()) {
subjectViewHolder.mSubjectViewPager.setAdapter(adapter);
}
subjectViewHolder.mSubjectViewPager.setAdapter(new AskSubjectPageAdapter(mContext, mSubjectEntity));
int size = mSubjectEntity.size();
if (size > 1) {
for (int i = 0; i < size; i++) {

View File

@ -40,9 +40,9 @@ public class AnswerCommentViewModel extends ListViewModel<CommentEntity, Comment
@Override
public Observable<List<CommentEntity>> provideDataObservable(int page) {
if (TextUtils.isEmpty(mCommentId)) {
return RetrofitManager.getInstance(getApplication()).getApi().getAnswerCommentList(mAnswerId, 20, page);
return RetrofitManager.getInstance(getApplication()).getApi().getAnswerCommentList(mAnswerId, page);
} else {
return RetrofitManager.getInstance(getApplication()).getApi().getAnswerCommentConversationList(mAnswerId, mCommentId, 20, page);
return RetrofitManager.getInstance(getApplication()).getApi().getAnswerCommentConversationList(mAnswerId, mCommentId, page);
}
// return RetrofitManager.getInstance(getApplication()).getApi().getComment("59c0b965e9a64abe2a423544", 0, offset);
}

View File

@ -83,7 +83,7 @@ public class KaiFuVpAdapter extends BaseRecyclerAdapter {
public void addList() {
mIsLoaded = false;
RetrofitManager.getInstance(mContext).getApi()
.getKaiFuData(UrlFilterUtils.getFilterQuery("game_id", mGameId, "day", mDay), mPage, 20)
.getKaiFuData(UrlFilterUtils.getFilterQuery("game_id", mGameId, "day", mDay), mPage)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Response<List<GameEntity>>() {

View File

@ -13,6 +13,7 @@ import com.gh.base.OnRequestCallBackListener;
import com.gh.common.constant.ItemViewType;
import com.gh.common.util.DisplayUtils;
import com.gh.common.util.LibaoUtils;
import com.gh.common.util.UrlFilterUtils;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
import com.gh.gamecenter.adapter.viewholder.LibaoNormalViewHolder;
@ -58,7 +59,7 @@ public class LibaoHistoryAdapter extends BaseRecyclerAdapter<ViewHolder> {
if (isLoading) return;
isLoading = true;
RetrofitManager.getInstance(mContext).getApi()
.getHistoryLibao("true", mPage)
.getHistoryLibao(UrlFilterUtils.getFilterQuery("history", "true"), mPage)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.map(new Func1<List<LibaoEntity>, List<LibaoEntity>>() {

View File

@ -174,22 +174,9 @@ public interface ApiService {
* 获取游戏新闻
*/
@GET("articles")
Observable<List<NewsEntity>> getGameNews(@Query("filter") String filter, @Query("limit") int limit,
Observable<List<NewsEntity>> getGameNews(@Query("filter") String filter, @Query("page_size") int pageSize,
@Query("page") int page);
// /**
// * 获取游戏新闻
// */
// @GET("game/{game_id}/article")
// Observable<List<NewsEntity>> getGameNews(@Path("game_id") String game_id, @Query("limit") int limit,
// @Query("page") int page);
/**
* 获取游戏开服信息
*/
@GET("game/{game_id}/serverInfo")
Observable<ResponseBody> getGameServer(@Path("game_id") String game_id);
/**
* 获取游戏平台信息
*/
@ -299,7 +286,7 @@ public interface ApiService {
* 获取开服表数据
*/
@GET("games/servers")
Observable<List<GameEntity>> getKaiFuData(@Query("filter") String type, @Query("page") int page, @Query("limit") int limit);
Observable<List<GameEntity>> getKaiFuData(@Query("filter") String type, @Query("page") int page);
/**
* 获取游戏新闻类型
@ -311,8 +298,7 @@ public interface ApiService {
* 获取投票 游戏求版本列表
*/
@GET("games/{game_id}/platform_requests")
Observable<List<VersionVoteEntity>> getVersionVote(@Path("game_id") String gameId, @Query("page") int page,
@Query("limit") int limit);
Observable<List<VersionVoteEntity>> getVersionVote(@Path("game_id") String gameId, @Query("page") int page);
/**
* 提交投票
@ -487,14 +473,14 @@ public interface ApiService {
* 获取新闻评论
*/
@GET("articles/{article_id}/comments?filter=order:hot")
Observable<List<CommentEntity>> getHotComment(@Path("article_id") String articleId, @Query("limit") int limit,
Observable<List<CommentEntity>> getHotComment(@Path("article_id") String articleId, @Query("page_size") int pageSize,
@Query("page") int page);
/**
* 获取新闻评论
*/
@GET("articles/{article_id}/comments")
Observable<List<CommentEntity>> getComment(@Path("article_id") String articleId, @Query("limit") int limit,
Observable<List<CommentEntity>> getComment(@Path("article_id") String articleId, @Query("page_size") int pageSize,
@Query("page") int page);
/**
@ -509,7 +495,7 @@ public interface ApiService {
* 获取评论对话
*/
@GET("articles/comments/{comment_id}/traces")
Observable<List<CommentEntity>> getCommentTrace(@Path("comment_id") String news_id, @Query("limit") int limit,
Observable<List<CommentEntity>> getCommentTrace(@Path("comment_id") String news_id,
@Query("page") int page);
/********* LibaoService ********/
@ -517,13 +503,13 @@ public interface ApiService {
/**
* 获取礼包列表数据
*/
@GET("libao?limit=20")
@GET("libao")
Observable<List<LibaoEntity>> getLibao(@Query("page") int page);
/**
* 搜索礼包列表数据
*/
@GET("libao?limit=20")
@GET("libao")
Observable<List<LibaoEntity>> getLibaoBySearch(@Query("filter") String filter, @Query("page") int page);
/**
@ -537,7 +523,7 @@ public interface ApiService {
*/
@GET("libao")
Observable<List<LibaoEntity>> getLibaoByGame(@Query("filter") String filter,
@Query("page") int page, @Query("limit") int limit);
@Query("page") int page, @Query("page_size") int pageSize);
/**
* 获取礼包详情数据
@ -598,7 +584,7 @@ public interface ApiService {
* 获取历史礼包数据
*/
@GET("libao")
Observable<List<LibaoEntity>> getHistoryLibao(@Query("history") String history, @Query("page") int page);
Observable<List<LibaoEntity>> getHistoryLibao(@Query("filter") String filter, @Query("page") int page);
/***************8 MessageService *******/
@ -924,13 +910,13 @@ public interface ApiService {
* 获取评论列表.可以分页
*/
@GET("answers/{answer_id}/comments")
Observable<List<CommentEntity>> getAnswerCommentList(@Path("answer_id") String answerId, @Query("limit") int limit, @Query("page") int page);
Observable<List<CommentEntity>> getAnswerCommentList(@Path("answer_id") String answerId, @Query("page") int page);
/**
* 获取评论的对话列表.
*/
@GET("answers/{answer_id}/comments/{comment_id}/trace")
Observable<List<CommentEntity>> getAnswerCommentConversationList(@Path("answer_id") String answerId, @Path("comment_id") String commentId, @Query("limit") int limit, @Query("page") int page);
Observable<List<CommentEntity>> getAnswerCommentConversationList(@Path("answer_id") String answerId, @Path("comment_id") String commentId, @Query("page") int page);
/**
* 签到

View File

@ -69,7 +69,7 @@ public class VoteFragment extends ListFragment<VersionVoteEntity, NormalListView
@Override
public Observable<List<VersionVoteEntity>> provideDataObservable(int page) {
return RetrofitManager.getInstance(getContext()).getApi().getVersionVote(mGameId, page, 20);
return RetrofitManager.getInstance(getContext()).getApi().getVersionVote(mGameId, page);
}
protected int getLayoutId() {