fix entity

This commit is contained in:
CsHeng
2017-06-29 15:59:36 +08:00
parent 1d1c9666dc
commit 2b23665cb5
11 changed files with 86 additions and 49 deletions

View File

@ -13,16 +13,16 @@ import android.widget.Toast;
import com.gh.common.constant.Config;
import com.gh.common.view.DownloadDialog;
import com.lightgame.download.DownloadConfig;
import com.lightgame.download.DownloadEntity;
import com.gh.download.DownloadManager;
import com.lightgame.download.DownloadStatus;
import com.lightgame.download.FileUtils;
import com.gh.gamecenter.DownloadManagerActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.GameViewHolder;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.manager.PackageManager;
import com.lightgame.download.DownloadConfig;
import com.lightgame.download.DownloadEntity;
import com.lightgame.download.DownloadStatus;
import com.lightgame.download.FileUtils;
import java.util.concurrent.LinkedBlockingQueue;

View File

@ -20,6 +20,7 @@ import com.facebook.drawee.view.SimpleDraweeView;
import com.gh.base.BaseActivity;
import com.gh.base.adapter.FragmentAdapter;
import com.gh.common.util.ApkActiveUtils;
import com.gh.common.util.AppDebugConfig;
import com.gh.common.util.CheckLoginUtils;
import com.gh.common.util.ConcernUtils;
import com.gh.common.util.DataCollectionUtils;
@ -29,9 +30,6 @@ import com.gh.common.util.DialogUtils;
import com.gh.common.util.EntranceUtils;
import com.gh.common.util.ImageUtils;
import com.gh.common.util.ShareUtils;
import com.lightgame.utils.Utils;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadEntity;
import com.gh.download.DownloadManager;
import com.gh.gamecenter.adapter.viewholder.DetailViewHolder;
import com.gh.gamecenter.entity.ApkEntity;
@ -47,6 +45,9 @@ import com.gh.gamecenter.manager.ConcernManager;
import com.gh.gamecenter.retrofit.Response;
import com.gh.gamecenter.retrofit.RetrofitManager;
import com.jakewharton.rxbinding.view.RxView;
import com.lightgame.download.DataWatcher;
import com.lightgame.download.DownloadEntity;
import com.lightgame.utils.Utils;
import com.lightgame.view.NoScrollableViewPager;
import com.tencent.tauth.Tencent;
@ -183,7 +184,7 @@ public class GameDetailActivity extends BaseActivity {
mViewPager.setScrollable(true);
mConcernManager = new ConcernManager(GameDetailActivity.this);
mConcernManager = new ConcernManager(this);
name = "游戏详情";
@ -195,12 +196,18 @@ public class GameDetailActivity extends BaseActivity {
if (mGameId == null) {
mGameEntity = getIntent().getParcelableExtra(GameEntity.class.getSimpleName());
// mGameEntity = getIntent().getExtras().getParcelable(GameEntity.class.getSimpleName());
if (mGameEntity != null) {
mGameId = mGameEntity.getId();
mTitle.setText(mGameEntity.getName());
title = mGameEntity.getName();
}
}
if (AppDebugConfig.IS_DEBUG) {
AppDebugConfig.logMethodWithParams(this, getIntent().toUri(Intent.URI_INTENT_SCHEME), mGameId, mGameEntity);
}
if (mGameEntity != null) {
getGameDetail();
} else if (mGameId != null) {
@ -241,7 +248,7 @@ public class GameDetailActivity extends BaseActivity {
@Override
public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
int total = appBarLayout.getTotalScrollRange();
if (Math.abs(verticalOffset) > total/2) {
if (Math.abs(verticalOffset) > total / 2) {
mTitle.setVisibility(View.VISIBLE);
} else {
mTitle.setVisibility(View.GONE);

View File

@ -48,7 +48,7 @@ public class GameDetailContact implements Parcelable {
this.player = in.readParcelable(GameDetailPlayer.class.getClassLoader());
}
public static final Parcelable.Creator<GameDetailContact> CREATOR = new Parcelable.Creator<GameDetailContact>() {
public static final Creator<GameDetailContact> CREATOR = new Creator<GameDetailContact>() {
@Override
public GameDetailContact createFromParcel(Parcel source) {
return new GameDetailContact(source);

View File

@ -195,10 +195,10 @@ public class GameDetailEntity implements Parcelable {
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeList(this.serverInfo);
dest.writeList(this.tag);
dest.writeTypedList(this.serverInfo);
dest.writeTypedList(this.tag);
dest.writeParcelable(this.tips, flags);
dest.writeList(this.news);
dest.writeTypedList(this.news);
dest.writeStringList(this.gallery);
dest.writeString(this.des);
dest.writeString(this.downloadAddWord);
@ -207,10 +207,10 @@ public class GameDetailEntity implements Parcelable {
dest.writeString(this.downloadOffText);
dest.writeByte(this.isSkinTest ? (byte) 1 : (byte) 0);
dest.writeParcelable(this.contact, flags);
dest.writeList(this.notice);
dest.writeTypedList(this.notice);
dest.writeStringList(this.gameTag);
dest.writeParcelable(this.serverEntity, flags);
dest.writeList(this.relatedGames);
dest.writeTypedList(this.relatedGames);
dest.writeString(this.fulishuoming);
}
@ -218,13 +218,10 @@ public class GameDetailEntity implements Parcelable {
}
protected GameDetailEntity(Parcel in) {
this.serverInfo = new ArrayList<ServerEntity>();
in.readList(this.serverInfo, ServerEntity.class.getClassLoader());
this.tag = new ArrayList<TagEntity>();
in.readList(this.tag, TagEntity.class.getClassLoader());
this.serverInfo = in.createTypedArrayList(ServerEntity.CREATOR);
this.tag = in.createTypedArrayList(TagEntity.CREATOR);
this.tips = in.readParcelable(TipsEntity.class.getClassLoader());
this.news = new ArrayList<NewsEntity>();
in.readList(this.news, NewsEntity.class.getClassLoader());
this.news = in.createTypedArrayList(NewsEntity.CREATOR);
this.gallery = in.createStringArrayList();
this.des = in.readString();
this.downloadAddWord = in.readString();
@ -233,16 +230,14 @@ public class GameDetailEntity implements Parcelable {
this.downloadOffText = in.readString();
this.isSkinTest = in.readByte() != 0;
this.contact = in.readParcelable(GameDetailContact.class.getClassLoader());
this.notice = new ArrayList<NewsEntity>();
in.readList(this.notice, NewsEntity.class.getClassLoader());
this.notice = in.createTypedArrayList(NewsEntity.CREATOR);
this.gameTag = in.createStringArrayList();
this.serverEntity = in.readParcelable(ServerEntity.class.getClassLoader());
this.relatedGames = new ArrayList<GameDetailRelatedGame>();
in.readList(this.relatedGames, GameDetailRelatedGame.class.getClassLoader());
this.serverEntity = in.readParcelable(GameDetailServer.class.getClassLoader());
this.relatedGames = in.createTypedArrayList(GameDetailRelatedGame.CREATOR);
this.fulishuoming = in.readString();
}
public static final Parcelable.Creator<GameDetailEntity> CREATOR = new Parcelable.Creator<GameDetailEntity>() {
public static final Creator<GameDetailEntity> CREATOR = new Creator<GameDetailEntity>() {
@Override
public GameDetailEntity createFromParcel(Parcel source) {
return new GameDetailEntity(source);

View File

@ -50,7 +50,7 @@ public class GameDetailServer implements Parcelable {
this.calendar = in.createTypedArrayList(KaiFuServerEntity.CREATOR);
}
public static final Parcelable.Creator<GameDetailServer> CREATOR = new Parcelable.Creator<GameDetailServer>() {
public static final Creator<GameDetailServer> CREATOR = new Creator<GameDetailServer>() {
@Override
public GameDetailServer createFromParcel(Parcel source) {
return new GameDetailServer(source);

View File

@ -4,8 +4,8 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.support.v4.util.ArrayMap;
import com.lightgame.download.DownloadEntity;
import com.google.gson.annotations.SerializedName;
import com.lightgame.download.DownloadEntity;
import java.util.ArrayList;
import java.util.Map;
@ -306,7 +306,6 @@ public class GameEntity implements Parcelable {
dest.writeSerializable(entry.getValue());
}
}
dest.writeString(this.image);
dest.writeString(this.type);
dest.writeByte(this.isPluggable ? (byte) 1 : (byte) 0);
@ -335,14 +334,12 @@ public class GameEntity implements Parcelable {
this.slide = in.readString();
this.test = in.readParcelable(TestEntity.class.getClassLoader());
this.downloadAddWord = in.readString();
if (this.entryMap != null) {
int entryMapSize = in.readInt();
this.entryMap = new ArrayMap<>(entryMapSize);
for (int i = 0; i < entryMapSize; i++) {
String key = in.readString();
DownloadEntity value = (DownloadEntity) in.readSerializable();
this.entryMap.put(key, value);
}
int entryMapSize = in.readInt();
this.entryMap = new ArrayMap<String, DownloadEntity>(entryMapSize);
for (int i = 0; i < entryMapSize; i++) {
String key = in.readString();
DownloadEntity value = (DownloadEntity) in.readSerializable();
this.entryMap.put(key, value);
}
this.image = in.readString();
this.type = in.readString();
@ -358,7 +355,7 @@ public class GameEntity implements Parcelable {
this.isShowTop = in.readByte() != 0;
}
public static final Parcelable.Creator<GameEntity> CREATOR = new Parcelable.Creator<GameEntity>() {
public static final Creator<GameEntity> CREATOR = new Creator<GameEntity>() {
@Override
public GameEntity createFromParcel(Parcel source) {
return new GameEntity(source);

View File

@ -1,6 +1,9 @@
package com.gh.gamecenter.entity;
public class ServerEntity {
import android.os.Parcel;
import android.os.Parcelable;
public class ServerEntity implements Parcelable {
private String server;
private long time;
@ -30,4 +33,36 @@ public class ServerEntity {
this.time = time;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(this.server);
dest.writeLong(this.time);
dest.writeString(this.tag);
}
public ServerEntity() {
}
protected ServerEntity(Parcel in) {
this.server = in.readString();
this.time = in.readLong();
this.tag = in.readString();
}
public static final Creator<ServerEntity> CREATOR = new Creator<ServerEntity>() {
@Override
public ServerEntity createFromParcel(Parcel source) {
return new ServerEntity(source);
}
@Override
public ServerEntity[] newArray(int size) {
return new ServerEntity[size];
}
};
}

View File

@ -54,7 +54,7 @@ public class TestEntity implements Parcelable {
this.end = in.readLong();
}
public static final Parcelable.Creator<TestEntity> CREATOR = new Parcelable.Creator<TestEntity>() {
public static final Creator<TestEntity> CREATOR = new Creator<TestEntity>() {
@Override
public TestEntity createFromParcel(Parcel source) {
return new TestEntity(source);

View File

@ -34,7 +34,6 @@ public class TipsEntity implements Parcelable {
this.content = content;
}
@Override
public int describeContents() {
return 0;
@ -56,7 +55,7 @@ public class TipsEntity implements Parcelable {
this.content = in.readString();
}
public static final Parcelable.Creator<TipsEntity> CREATOR = new Parcelable.Creator<TipsEntity>() {
public static final Creator<TipsEntity> CREATOR = new Creator<TipsEntity>() {
@Override
public TipsEntity createFromParcel(Parcel source) {
return new TipsEntity(source);

View File

@ -318,9 +318,10 @@ public class KeFuFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
switch (keFuEntity.getLink().getType()) {
case "游戏":
if (!TextUtils.isEmpty(keFuEntity.getLink().getId())) {
Intent intent = new Intent(mContext, GameDetailActivity.class);
intent.putExtra("gameId", keFuEntity.getLink().getId());
mContext.startActivity(intent);
// Intent intent = new Intent(mContext, GameDetailActivity.class);
// intent.putExtra("gameId", keFuEntity.getLink().getId());
// mContext.startActivity(intent);
GameDetailActivity.startGameDetailActivity(mContext, keFuEntity.getLink().getId(), "");
}
break;
case "QQ号":

View File

@ -269,9 +269,12 @@ public class NoticeFragmentAdapter extends BaseRecyclerAdapter<ViewHolder> {
}
switch (noticeEntity.getLink().getType()) {
case "游戏":
Intent intent = new Intent(mContext, GameDetailActivity.class);
intent.putExtra("gameId", noticeEntity.getLink().getId());
mContext.startActivity(intent);
// Intent intent = new Intent(mContext, GameDetailActivity.class);
// intent.putExtra("gameId", noticeEntity.getLink().getId());
// mContext.startActivity(intent);
GameDetailActivity.startGameDetailActivity(mContext, noticeEntity.getLink().getId(), "");
break;
case "QQ号":
QQUtils.startQQSession(mContext, noticeEntity.getLink().getQq());