diff --git a/app/src/main/java/com/gh/gamecenter/VoteActivity.java b/app/src/main/java/com/gh/gamecenter/VoteActivity.java index 28670bd0f2..cb3f092c93 100644 --- a/app/src/main/java/com/gh/gamecenter/VoteActivity.java +++ b/app/src/main/java/com/gh/gamecenter/VoteActivity.java @@ -74,7 +74,7 @@ public class VoteActivity extends BaseActivity implements SwipeRefreshLayout.OnR Runnable runnable = new Runnable() { @Override public void run() { - mAdapter = new VoteAdapter(VoteActivity.this, mGameId, mVoteDao); + mAdapter = new VoteAdapter(VoteActivity.this,VoteActivity.this, mGameId, mVoteDao); mVoteRv.setAdapter(mAdapter); } }; @@ -117,7 +117,7 @@ public class VoteActivity extends BaseActivity implements SwipeRefreshLayout.OnR layoutManager = new LinearLayoutManager(this); mVoteRv.setLayoutManager(layoutManager); - mAdapter = new VoteAdapter(this, mGameId, mVoteDao); + mAdapter = new VoteAdapter(this, this, mGameId, mVoteDao); mVoteRv.setAdapter(mAdapter); mVoteRefresh.setColorSchemeResources(R.color.theme); diff --git a/app/src/main/java/com/gh/gamecenter/adapter/VoteAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/VoteAdapter.java index 3897815ce3..4842686e1e 100644 --- a/app/src/main/java/com/gh/gamecenter/adapter/VoteAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/adapter/VoteAdapter.java @@ -2,12 +2,12 @@ package com.gh.gamecenter.adapter; import android.content.Context; import android.support.v7.widget.RecyclerView; +import android.support.v7.widget.RecyclerView.ViewHolder; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.gh.gamecenter.R; -import com.gh.gamecenter.VoteActivity; import com.gh.gamecenter.adapter.viewholder.FooterViewHolder; import com.gh.gamecenter.adapter.viewholder.VoteViewHolder; import com.gh.gamecenter.db.VersionVoteDao; @@ -27,9 +27,7 @@ import rx.schedulers.Schedulers; * Created by khy on 2017/4/11. * 求版本投票页面适配器 */ -public class VoteAdapter extends RecyclerView.Adapter { - - private Context mContext; +public class VoteAdapter extends BaseRecyclerAdapter { private OnCallBackListener mCallBackListener; @@ -45,11 +43,13 @@ public class VoteAdapter extends RecyclerView.Adapter { private String mGameId; - public VoteAdapter(VoteActivity activity, String gameId, VersionVoteDao voteDao) { - this.mContext = activity; - this.mCallBackListener = activity; + public VoteAdapter(Context context,OnCallBackListener onCallBackListener , String gameId, VersionVoteDao voteDao) { + super(context); + + this.mCallBackListener = onCallBackListener; this.mGameId = gameId; - mPbwidth = (float) (activity.getResources().getDisplayMetrics().widthPixels * 0.65); + + mPbwidth = (float) (mContext.getResources().getDisplayMetrics().widthPixels * 0.65); mVoteList = new ArrayList<>(); mVoteDao = voteDao; diff --git a/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java b/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java index ef8c6de949..044143a8a1 100644 --- a/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java +++ b/app/src/main/java/com/gh/gamecenter/newsdetail/NewsDetailAdapter.java @@ -1,39 +1,75 @@ package com.gh.gamecenter.newsdetail; import android.app.Activity; -import android.content.*; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; import android.graphics.Color; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.RecyclerView.ViewHolder; import android.text.TextUtils; -import android.view.*; -import android.webkit.*; -import android.widget.*; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.webkit.JavascriptInterface; +import android.webkit.WebSettings; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; +import android.widget.Toast; + import com.facebook.drawee.view.SimpleDraweeView; import com.gh.common.constant.Config; -import com.gh.common.util.*; -import com.gh.gamecenter.*; +import com.gh.common.util.CommentUtils; +import com.gh.common.util.ConcernUtils; +import com.gh.common.util.DataCollectionUtils; +import com.gh.common.util.DataUtils; +import com.gh.common.util.DialogUtils; +import com.gh.common.util.DisplayUtils; +import com.gh.common.util.GameUtils; +import com.gh.common.util.ImageUtils; +import com.gh.common.util.NewsUtils; +import com.gh.common.util.PostCommentUtils; +import com.gh.common.util.RandomUtils; +import com.gh.common.util.Utils; +import com.gh.gamecenter.MessageDetailActivity; +import com.gh.gamecenter.NewsDetailActivity; +import com.gh.gamecenter.R; +import com.gh.gamecenter.ViewImageActivity; import com.gh.gamecenter.adapter.BaseRecyclerAdapter; import com.gh.gamecenter.adapter.viewholder.NewsDetailCommentListViewHolder; import com.gh.gamecenter.db.VoteDao; import com.gh.gamecenter.db.info.VoteInfo; -import com.gh.gamecenter.entity.*; +import com.gh.gamecenter.entity.ApkEntity; +import com.gh.gamecenter.entity.CommentEntity; +import com.gh.gamecenter.entity.GameEntity; +import com.gh.gamecenter.entity.NewsDetailEntity; +import com.gh.gamecenter.entity.NewsEntity; import com.gh.gamecenter.gamedetail.GameDetailTopViewHolder; import com.gh.gamecenter.listener.OnCallBackListener; import com.gh.gamecenter.manager.ConcernManager; import com.gh.gamecenter.retrofit.Response; import com.gh.gamecenter.retrofit.RetrofitManager; + import org.json.JSONObject; -import retrofit2.adapter.rxjava.HttpException; -import rx.android.schedulers.AndroidSchedulers; -import rx.schedulers.Schedulers; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import retrofit2.adapter.rxjava.HttpException; +import rx.android.schedulers.AndroidSchedulers; +import rx.schedulers.Schedulers; + /** * Created by LGT on 2016/9/13. * 新闻详情数据适配器 @@ -195,8 +231,8 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter { if (mGameEntity != null) { count++; } - if (mGameEntity != null && mGameEntity.getId() != null && - !mGameEntity.getId().isEmpty() && mCommentEntityList.size() != 0) { + if (mGameEntity != null && mGameEntity.getId() != null && !mGameEntity.getId().isEmpty() + && mCommentEntityList != null &&mCommentEntityList.size() != 0) { count++; } if (mNewsDetailEntity.getMore() != null && mNewsDetailEntity.getMore().size() != 0) { @@ -208,7 +244,7 @@ public class NewsDetailAdapter extends BaseRecyclerAdapter { @Override public int getItemViewType(int position) { if (position == getItemCount() -1 && mGameEntity != null && mGameEntity.getId() != null - && !mGameEntity.getId().isEmpty() && mCommentEntityList.size() != 0) { + && !mGameEntity.getId().isEmpty() && mCommentEntityList != null && mCommentEntityList.size() != 0) { return 100; } if (mGameEntity != null && position == 1) { diff --git a/app/src/main/res/layout/vote_item.xml b/app/src/main/res/layout/vote_item.xml index a31094f22f..9b5d1a51a1 100644 --- a/app/src/main/res/layout/vote_item.xml +++ b/app/src/main/res/layout/vote_item.xml @@ -37,6 +37,7 @@ android:paddingRight="12dp" android:paddingTop="5dp" android:paddingBottom="6dp" + android:text="投票" android:layout_alignParentRight="true" />