统一投票样式,选择游戏入口显示小红点
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package com.gh.gamecenter.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
@ -143,8 +144,8 @@ public class AskSelectGameAdapter extends ListAdapter<AskGameSelectEntity> {
|
||||
bodyHolder.mVoteBtn.setTextColor(ContextCompat.getColor(mContext, R.color.content));
|
||||
bodyHolder.mVoteBtn.setText(R.string.voted);
|
||||
} else {
|
||||
bodyHolder.mVoteBtn.setBackgroundResource(R.drawable.comment_border_bg);
|
||||
bodyHolder.mVoteBtn.setTextColor(ContextCompat.getColor(mContext, R.color.theme));
|
||||
bodyHolder.mVoteBtn.setBackgroundResource(R.drawable.button_normal_style);
|
||||
bodyHolder.mVoteBtn.setTextColor(Color.WHITE);
|
||||
bodyHolder.mVoteBtn.setText(R.string.vote);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +64,8 @@ public class VoteAdapter extends ListAdapter<VersionVoteEntity> {
|
||||
VersionVoteEntity versionVoteEntity = mEntityList.get(position);
|
||||
UserDataEntity userData = versionVoteEntity.getUserData();
|
||||
if (userData != null && userData.isVersionRequested()) {
|
||||
viewHolder.voteBtn.setBackgroundResource(R.drawable.button_normal_border);
|
||||
viewHolder.voteBtn.setTextColor(ContextCompat.getColor(mContext, R.color.theme));
|
||||
viewHolder.voteBtn.setBackgroundResource(R.drawable.border_suggest_bg);
|
||||
viewHolder.voteBtn.setTextColor(ContextCompat.getColor(mContext, R.color.content));
|
||||
viewHolder.voteBtn.setText(R.string.voted);
|
||||
viewHolder.voteBtn.setEnabled(false);
|
||||
} else {
|
||||
|
||||
@ -110,6 +110,10 @@ public class AnswerDetailFragment extends NormalFragment {
|
||||
TextView mAnswerDetailLikeTv;
|
||||
@BindView(R.id.answer_detail_comment_like_iv)
|
||||
ImageView mAnswerDetailLiveIv;
|
||||
@BindView(R.id.answer_detail_line)
|
||||
View mDividerView;
|
||||
@BindView(R.id.answer_detail_comment_container)
|
||||
View mBottomContainer;
|
||||
|
||||
private static final int ANSWER_STATUS_UNKNOWN = 0;
|
||||
private static final int ANSWERED_MY_ANSWER = 1;
|
||||
@ -227,16 +231,19 @@ public class AnswerDetailFragment extends NormalFragment {
|
||||
HttpException e = apiResponse.getHttpException();
|
||||
try {
|
||||
if (e != null && e.code() == 404 && e.response().errorBody().string().length() > 0) {
|
||||
mBottomContainer.setVisibility(View.GONE);
|
||||
mNoDataTv.setText(R.string.content_delete_hint);
|
||||
mNoData.setVisibility(View.VISIBLE);
|
||||
mNoConn.setVisibility(View.GONE);
|
||||
mLoading.setVisibility(View.GONE);
|
||||
mContent.setVisibility(View.GONE);
|
||||
mDividerView.setVisibility(View.GONE);
|
||||
Utils.toast(getContext(), R.string.content_delete_toast);
|
||||
} else {
|
||||
mNoConn.setVisibility(View.VISIBLE);
|
||||
mLoading.setVisibility(View.GONE);
|
||||
mContent.setVisibility(View.GONE);
|
||||
mBottomContainer.setVisibility(View.GONE);
|
||||
}
|
||||
} catch (IOException e1) {
|
||||
e1.printStackTrace();
|
||||
|
||||
@ -2,7 +2,9 @@ package com.gh.gamecenter.ask;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
@ -58,13 +60,33 @@ public class AskFragment extends BaseFragment {
|
||||
View mAskTabBar;
|
||||
@BindView(R.id.ask_loading)
|
||||
View mLoading;
|
||||
@BindView(R.id.select_game_hint)
|
||||
View mSelectGameHint;
|
||||
|
||||
private SharedPreferences sp;
|
||||
private boolean mHasClickedSelectGame;
|
||||
private AskQuestionsRecommendsFragment mRecommendsFragment;
|
||||
|
||||
public static final int INDEX_HOT = 0;
|
||||
public static final int INDEX_QUESTIONS = 1; // communities
|
||||
public static final int COMMUNITIES_SELECT_REQUEST = 103;
|
||||
|
||||
private static final String SP_KEY_CLICKED_SELECT_GAME = "has_clicked_select_game";
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
sp = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
mHasClickedSelectGame = sp.getBoolean(SP_KEY_CLICKED_SELECT_GAME, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
mSelectGameHint.setVisibility(!mHasClickedSelectGame ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.fragment_ask;
|
||||
@ -91,19 +113,18 @@ public class AskFragment extends BaseFragment {
|
||||
mAskGamename.setText(UserManager.getInstance().getCommunityName(getContext()));
|
||||
initViewPager();
|
||||
setTabbarPosition(INDEX_HOT);
|
||||
mAskGamename.setOnTouchListener(new onDoubleTapListener(getContext()) {
|
||||
@Override
|
||||
public void onDoubleTap() {
|
||||
mRecommendsFragment.scrollToTop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@OnClick({R.id.ask_selectgame, R.id.ask_search, R.id.ask_hot, R.id.ask_questions, R.id.reuse_no_connection})
|
||||
public void onViewClicked(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.ask_selectgame:
|
||||
if (!mHasClickedSelectGame) {
|
||||
mHasClickedSelectGame = true;
|
||||
sp.edit().putBoolean(SP_KEY_CLICKED_SELECT_GAME, mHasClickedSelectGame).apply();
|
||||
}
|
||||
startActivityForResult(CommunitiesSelectActivity.getIntent(getContext()), COMMUNITIES_SELECT_REQUEST);
|
||||
break;
|
||||
case R.id.ask_search:
|
||||
@ -131,6 +152,13 @@ public class AskFragment extends BaseFragment {
|
||||
fragmentList.add(new AskQuestionsNewFragment());
|
||||
mAskViewpager.setAdapter(new FragmentAdapter(getChildFragmentManager(), fragmentList));
|
||||
mAskViewpager.setScrollable(false);
|
||||
|
||||
mAskGamename.setOnTouchListener(new onDoubleTapListener(getContext()) {
|
||||
@Override
|
||||
public void onDoubleTap() {
|
||||
mRecommendsFragment.scrollToTop();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void setTabbarPosition(int index) {
|
||||
|
||||
Reference in New Issue
Block a user