diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f0303a75a5..d321934f55 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -233,10 +233,6 @@
android:name = "com.gh.gamecenter.AskTabOrderActivity"
android:screenOrientation = "portrait" />
-
-
diff --git a/app/src/main/java/com/gh/gamecenter/AskQuestionsDetailActivity.java b/app/src/main/java/com/gh/gamecenter/AskQuestionsDetailActivity.java
index c14c4131f3..169dcbe7ad 100644
--- a/app/src/main/java/com/gh/gamecenter/AskQuestionsDetailActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/AskQuestionsDetailActivity.java
@@ -3,15 +3,32 @@ package com.gh.gamecenter;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
+import android.support.v4.app.FragmentManager;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.RelativeLayout;
import com.gh.base.BaseActivity;
-import com.gh.gamecenter.ask.QuestionsEditFragment;
+import com.gh.common.util.DisplayUtils;
+import com.gh.gamecenter.ask.questionsdetail.AnswerEditFragment;
+import com.gh.gamecenter.ask.questionsdetail.QuestionsDetailFragment;
+import com.gh.gamecenter.ask.questionsdetail.QuestionsInviteFragment;
/**
* Created by khy on 7/12/17.
*/
-public class AskQuestionsDetailActivity extends BaseActivity {
+public class AskQuestionsDetailActivity extends BaseActivity implements FragmentManager.OnBackStackChangedListener {
+
+ public static final String QUESTIONS_DETAIL_ANSWER = "answer";
+ public static final String QUESTIONS_DETAIL_INVITE = "invite";
+ public static final String QUESTIONS_DETAIL_FOLD = "fold";
+ public static final String QUESTIONS_DETAIL = "questions_detail";
+
+ private QuestionsDetailFragment mQuestionsDetailFragment;
+
+ private View mShareIv;
+ private View mAnswerPost;
public static Intent getIntent(Context context) {
return new Intent(context, AskQuestionsDetailActivity.class);
@@ -25,7 +42,122 @@ public class AskQuestionsDetailActivity extends BaseActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- getSupportFragmentManager().beginTransaction().replace(
- R.id.layout_fragment_content, new QuestionsEditFragment()).commitAllowingStateLoss();
+ getSupportFragmentManager().addOnBackStackChangedListener(this);
+ show(QUESTIONS_DETAIL);
+
+ findViewById(R.id.actionbar_rl_back)
+ .setOnClickListener(new View.OnClickListener() {
+
+ @Override
+ public void onClick(View view) {
+ if (mQuestionsDetailFragment.isVisible()) {
+ finish();
+ } else {
+ getSupportFragmentManager().popBackStack();
+ }
+ }
+ });
+ }
+
+ private void addShareView() {
+ RelativeLayout reuse_actionbar = mContentView.findViewById(R.id.reuse_actionbar);
+ mShareIv = LayoutInflater.from(this).inflate(R.layout.menu_action_share, reuse_actionbar, false);
+ RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) mShareIv.getLayoutParams();
+ params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+ params.addRule(RelativeLayout.CENTER_VERTICAL);
+ reuse_actionbar.addView(mShareIv, params);
+ }
+
+ private void addAnswerPostView() {
+ RelativeLayout reuse_actionbar = mContentView.findViewById(R.id.reuse_actionbar);
+ mAnswerPost = LayoutInflater.from(this).inflate(R.layout.menu_action_post, reuse_actionbar, false);
+ RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
+ DisplayUtils.dip2px(this, 48), DisplayUtils.dip2px(this, 24));
+ params.addRule(RelativeLayout.CENTER_VERTICAL);
+ params.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+ reuse_actionbar.addView(mAnswerPost, params);
+ }
+
+ public void show(String type) {
+ showMenu(type);
+ switch (type) {
+ case QUESTIONS_DETAIL_ANSWER:
+ showAnswerEdit(type);
+ break;
+ case QUESTIONS_DETAIL_INVITE:
+ showQuestionsInvite(type);
+ break;
+ case QUESTIONS_DETAIL_FOLD:
+ showDetailFold(type);
+ break;
+ case QUESTIONS_DETAIL:
+ showQuestionsDetail(type);
+ break;
+ }
+ }
+
+ private void showQuestionsDetail(String type) {
+ mQuestionsDetailFragment = new QuestionsDetailFragment();
+ getSupportFragmentManager()
+ .beginTransaction()
+ .replace(R.id.layout_fragment_content, mQuestionsDetailFragment)
+ .commitAllowingStateLoss();
+ }
+
+ private void showDetailFold(String type) {
+
+ }
+
+ private void showQuestionsInvite(String type) {
+ getSupportFragmentManager()
+ .beginTransaction()
+ .addToBackStack(type)
+ .replace(R.id.layout_fragment_content,
+ new QuestionsInviteFragment(), null).commit();
+ }
+
+ private void showAnswerEdit(String type) {
+ getSupportFragmentManager()
+ .beginTransaction()
+ .addToBackStack(type)
+ .replace(R.id.layout_fragment_content,
+ new AnswerEditFragment(), null).commit();
+ }
+
+ private void showMenu(String type) {
+ switch (type) {
+ case QUESTIONS_DETAIL_ANSWER:
+ if (mAnswerPost == null) {
+ addAnswerPostView();
+ } else {
+ mAnswerPost.setVisibility(View.VISIBLE);
+ }
+ if (mShareIv != null && mShareIv.getVisibility() == View.VISIBLE)
+ mShareIv.setVisibility(View.GONE);
+ break;
+ case QUESTIONS_DETAIL:
+ if (mShareIv == null) {
+ addShareView();
+ } else {
+ mShareIv.setVisibility(View.VISIBLE);
+ }
+ if (mAnswerPost != null && mAnswerPost.getVisibility() == View.VISIBLE)
+ mAnswerPost.setVisibility(View.GONE);
+ break;
+ case QUESTIONS_DETAIL_INVITE:
+ case QUESTIONS_DETAIL_FOLD:
+ if (mShareIv != null && mShareIv.getVisibility() == View.VISIBLE)
+ mShareIv.setVisibility(View.GONE);
+ if (mAnswerPost != null && mAnswerPost.getVisibility() == View.VISIBLE)
+ mAnswerPost.setVisibility(View.GONE);
+ break;
+ }
+ }
+
+ @Override
+ public void onBackStackChanged() {
+ if (mQuestionsDetailFragment.isVisible()) {
+ showMenu(QUESTIONS_DETAIL);
+ }
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/AskTabOrderActivity.java b/app/src/main/java/com/gh/gamecenter/AskTabOrderActivity.java
index c65a583fae..6857b8bc0a 100644
--- a/app/src/main/java/com/gh/gamecenter/AskTabOrderActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/AskTabOrderActivity.java
@@ -1,12 +1,19 @@
package com.gh.gamecenter;
+import android.app.Service;
import android.content.Context;
import android.content.Intent;
+import android.graphics.Color;
import android.os.Bundle;
+import android.os.Vibrator;
import android.support.annotation.NonNull;
+import android.support.v4.view.GestureDetectorCompat;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.helper.ItemTouchHelper;
+import android.view.GestureDetector;
+import android.view.MotionEvent;
+import android.view.View;
import android.widget.TextView;
import com.gh.base.BaseActivity;
@@ -52,10 +59,30 @@ public class AskTabOrderActivity extends BaseActivity {
mRvData = new ArrayList<>();
for (int i = 0; i < 50; i++) {
+
mRvData.add(i);
}
- ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new ItemTouchHelper.Callback() {
+ final ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new ItemTouchHelper.Callback() {
+ @Override
+ public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) {
+ if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
+ viewHolder.itemView.setBackgroundColor(Color.LTGRAY);
+ }
+ if (actionState == ItemTouchHelper.ACTION_STATE_DRAG) {
+ //获取系统震动服务
+ Vibrator vib = (Vibrator) getSystemService(Service.VIBRATOR_SERVICE);
+ if (vib != null) vib.vibrate(70);
+ }
+ super.onSelectedChanged(viewHolder, actionState);
+ }
+
+ @Override
+ public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
+ super.clearView(recyclerView, viewHolder);
+ viewHolder.itemView.setBackgroundColor(0);
+ }
+
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
@@ -89,6 +116,12 @@ public class AskTabOrderActivity extends BaseActivity {
return true;
}
+ @Override
+ public boolean isLongPressDragEnabled() {
+
+ return false;
+ }
+
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
@@ -101,5 +134,54 @@ public class AskTabOrderActivity extends BaseActivity {
mAdapter = new AskTabOrderAdapter(this, mRvData);
mAsktabOrderRv.setAdapter(mAdapter);
+ mAsktabOrderRv.addOnItemTouchListener(new OnRvLongClickListener(mAsktabOrderRv) {
+ @Override
+ public void onItemLongClick(RecyclerView.ViewHolder vh) {
+ if (vh.getLayoutPosition() != 0)
+ itemTouchHelper.startDrag(vh);
+ }
+ });
+
+ }
+
+ private abstract class OnRvLongClickListener implements RecyclerView.OnItemTouchListener {
+
+ private GestureDetectorCompat mGestureDetector;
+ private RecyclerView recyclerView;
+
+ public OnRvLongClickListener(RecyclerView recyclerView) {
+ this.recyclerView = recyclerView;
+ mGestureDetector = new GestureDetectorCompat(recyclerView.getContext(), new ItemTouchHelperGestureListener());
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
+ mGestureDetector.onTouchEvent(e);
+ return false;
+ }
+
+ @Override
+ public void onTouchEvent(RecyclerView rv, MotionEvent e) {
+ mGestureDetector.onTouchEvent(e);
+ }
+
+ @Override
+ public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {
+
+ }
+
+ private class ItemTouchHelperGestureListener extends GestureDetector.SimpleOnGestureListener {
+
+ @Override
+ public void onLongPress(MotionEvent e) {
+ View child = recyclerView.findChildViewUnder(e.getX(), e.getY());
+ if (child != null) {
+ RecyclerView.ViewHolder vh = recyclerView.getChildViewHolder(child);
+ onItemLongClick(vh);
+ }
+ }
+ }
+
+ public abstract void onItemLongClick(RecyclerView.ViewHolder vh);
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/UserInfoEditActivity.java b/app/src/main/java/com/gh/gamecenter/UserInfoEditActivity.java
index 72df9f54dc..56515c40fa 100644
--- a/app/src/main/java/com/gh/gamecenter/UserInfoEditActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/UserInfoEditActivity.java
@@ -88,7 +88,6 @@ public class UserInfoEditActivity extends BaseActivity {
super.onCreate(savedInstanceState);
mEditType = getIntent().getStringExtra(KEY_EDITTYPE);
- // 添加分享图标
mSaveTv = (TextView) LayoutInflater.from(this).inflate(R.layout.menu_action_save, null);
mSaveTv.setVisibility(View.GONE);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
diff --git a/app/src/main/java/com/gh/gamecenter/adapter/AskSelectGameAdapter.java b/app/src/main/java/com/gh/gamecenter/adapter/AskSelectGameAdapter.java
index 7cf580f488..eea81dbba7 100644
--- a/app/src/main/java/com/gh/gamecenter/adapter/AskSelectGameAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/adapter/AskSelectGameAdapter.java
@@ -8,6 +8,7 @@ import android.view.ViewGroup;
import com.gh.common.constant.ItemViewType;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.AskSelectGameItemViewHolder;
+import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder;
import com.lightgame.adapter.BaseRecyclerAdapter;
/**
@@ -15,6 +16,7 @@ import com.lightgame.adapter.BaseRecyclerAdapter;
*/
public class AskSelectGameAdapter extends BaseRecyclerAdapter {
+
private int mTitlePosition;
public AskSelectGameAdapter(Context context) {
@@ -33,13 +35,26 @@ public class AskSelectGameAdapter extends BaseRecyclerAdapter {
case ItemViewType.ITEM_BODY:
view = mLayoutInflater.inflate(R.layout.ask_selectgame_item, parent, false);
return new AskSelectGameItemViewHolder(view);
+ case ItemViewType.ITEM_FOOTER:
+ view = mLayoutInflater.inflate(R.layout.ask_selectgame_footer, parent, false);
+ return new ReuseViewHolder(view);
+ case ItemViewType.ITEM_TOP:
+ view = mLayoutInflater.inflate(R.layout.area_title_item, parent, false);
+ return new ReuseViewHolder(view);
}
return null;
}
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
-
+ switch (getItemViewType(position)) {
+ case ItemViewType.ITEM_BODY:
+ break;
+ case ItemViewType.ITEM_FOOTER:
+ break;
+ case ItemViewType.ITEM_TOP:
+ break;
+ }
}
@Override
diff --git a/app/src/main/java/com/gh/gamecenter/ask/AskFragment.java b/app/src/main/java/com/gh/gamecenter/ask/AskFragment.java
index 57ba7b184b..b12d95f4e7 100644
--- a/app/src/main/java/com/gh/gamecenter/ask/AskFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/AskFragment.java
@@ -12,7 +12,7 @@ import android.widget.TextView;
import com.gh.base.adapter.FragmentAdapter;
import com.gh.base.fragment.BaseFragment;
import com.gh.gamecenter.AskSearchActivity;
-import com.gh.gamecenter.AskSelectGameActivity;
+import com.gh.gamecenter.NormalActivity;
import com.gh.gamecenter.R;
import com.lightgame.view.NoScrollableViewPager;
@@ -59,7 +59,7 @@ public class AskFragment extends BaseFragment {
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.ask_selectgame:
- startActivityForResult(AskSelectGameActivity.getIntent(getContext()), 0x111);//todo
+ NormalActivity.startFragment(getContext(), SelectGameFragment.class);
break;
case R.id.ask_search:
startActivity(AskSearchActivity.getIntent(getContext()));
diff --git a/app/src/main/java/com/gh/gamecenter/ask/AskHotAdapter.java b/app/src/main/java/com/gh/gamecenter/ask/AskHotAdapter.java
index cf5e4260e9..d314bbfe7a 100644
--- a/app/src/main/java/com/gh/gamecenter/ask/AskHotAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/AskHotAdapter.java
@@ -10,7 +10,7 @@ import com.gh.base.OnListClickListener;
import com.gh.common.constant.ItemViewType;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
-import com.gh.gamecenter.baselist.BaseListAdapter;
+import com.gh.gamecenter.baselist.ListAdapter;
import com.gh.gamecenter.baselist.LoadStatus;
import com.gh.gamecenter.entity.NewsEntity;
@@ -20,7 +20,7 @@ import java.util.List;
* Created by khy on 2/12/17.
*/
-public class AskHotAdapter extends BaseListAdapter {
+public class AskHotAdapter extends ListAdapter {
private OnListClickListener mListClickListener;
diff --git a/app/src/main/java/com/gh/gamecenter/ask/AskHotFragment.java b/app/src/main/java/com/gh/gamecenter/ask/AskHotFragment.java
index 8c04ec0e5d..033d176faa 100644
--- a/app/src/main/java/com/gh/gamecenter/ask/AskHotFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/AskHotFragment.java
@@ -4,7 +4,7 @@ import android.view.View;
import com.gh.gamecenter.AskQuestionsDetailActivity;
import com.gh.gamecenter.R;
-import com.gh.gamecenter.baselist.BaseListAdapter;
+import com.gh.gamecenter.baselist.ListAdapter;
import com.gh.gamecenter.baselist.ListFragment;
import com.gh.gamecenter.baselist.LoadStatus;
import com.gh.gamecenter.baselist.LoadType;
@@ -30,7 +30,7 @@ public class AskHotFragment extends ListFragment {
}
@Override
- protected BaseListAdapter provideListAdapter() {
+ protected ListAdapter provideListAdapter() {
return mAdapter == null ? mAdapter = new AskHotAdapter(getContext(), this) : mAdapter;
}
diff --git a/app/src/main/java/com/gh/gamecenter/ask/AskQuestionsBodyAdapter.java b/app/src/main/java/com/gh/gamecenter/ask/AskQuestionsBodyAdapter.java
index 353a85e198..a0fc901835 100644
--- a/app/src/main/java/com/gh/gamecenter/ask/AskQuestionsBodyAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/AskQuestionsBodyAdapter.java
@@ -9,7 +9,7 @@ import com.gh.base.OnListClickListener;
import com.gh.common.constant.ItemViewType;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
-import com.gh.gamecenter.baselist.BaseListAdapter;
+import com.gh.gamecenter.baselist.ListAdapter;
import com.gh.gamecenter.baselist.LoadStatus;
import com.gh.gamecenter.entity.NewsEntity;
@@ -19,7 +19,7 @@ import java.util.List;
* Created by khy on 5/12/17.
*/
-public class AskQuestionsBodyAdapter extends BaseListAdapter {
+public class AskQuestionsBodyAdapter extends ListAdapter {
private OnListClickListener mListClickListener;
private List mEntityList;
diff --git a/app/src/main/java/com/gh/gamecenter/ask/AskQuestionsBodyFragment.java b/app/src/main/java/com/gh/gamecenter/ask/AskQuestionsBodyFragment.java
index c3c08ac95f..75954986c1 100644
--- a/app/src/main/java/com/gh/gamecenter/ask/AskQuestionsBodyFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/AskQuestionsBodyFragment.java
@@ -3,7 +3,7 @@ package com.gh.gamecenter.ask;
import android.view.View;
import com.gh.gamecenter.R;
-import com.gh.gamecenter.baselist.BaseListAdapter;
+import com.gh.gamecenter.baselist.ListAdapter;
import com.gh.gamecenter.baselist.ListFragment;
import com.gh.gamecenter.baselist.LoadStatus;
import com.gh.gamecenter.baselist.LoadType;
@@ -24,7 +24,7 @@ public class AskQuestionsBodyFragment extends ListFragment {
private AskQuestionsBodyAdapter mAdapter;
@Override
- protected BaseListAdapter provideListAdapter() {
+ protected ListAdapter provideListAdapter() {
return mAdapter == null ? mAdapter = new AskQuestionsBodyAdapter(getContext(), this) : mAdapter;
}
diff --git a/app/src/main/java/com/gh/gamecenter/AskSelectGameActivity.java b/app/src/main/java/com/gh/gamecenter/ask/SelectGameFragment.java
similarity index 73%
rename from app/src/main/java/com/gh/gamecenter/AskSelectGameActivity.java
rename to app/src/main/java/com/gh/gamecenter/ask/SelectGameFragment.java
index 5e52546579..408aab1729 100644
--- a/app/src/main/java/com/gh/gamecenter/AskSelectGameActivity.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/SelectGameFragment.java
@@ -1,51 +1,51 @@
-package com.gh.gamecenter;
+package com.gh.gamecenter.ask;
-import android.content.Context;
-import android.content.Intent;
import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
+import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
-import com.gh.base.BaseActivity;
+import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.AskSelectGameAdapter;
+import com.gh.gamecenter.normal.NormalFragment;
import butterknife.BindView;
/**
- * Created by khy on 6/12/17.
+ * Created by khy on 11/12/17.
*/
-public class AskSelectGameActivity extends BaseActivity {
+public class SelectGameFragment extends NormalFragment {
+
@BindView(R.id.ask_selectgame_rv)
RecyclerView mRecyclerView;
@BindView(R.id.ask_selectgame_rv_title)
TextView mRvTitle;
-
private AskSelectGameAdapter mAdapter;
-
private LinearLayoutManager mLayoutManager;
private RelativeLayout.LayoutParams mParams;
- public static Intent getIntent(Context context) {
- return new Intent(context, AskSelectGameActivity.class);
- }
-
@Override
protected int getLayoutId() {
- return R.layout.activity_ask_selectgame;
+ return R.layout.fragment_ask_selectgame;
}
@Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- initTitle(getString(R.string.ask_selectgame_title));
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ initTitle(getString(R.string.title_select_game));
+
+ mAdapter = new AskSelectGameAdapter(getContext());
mParams = (RelativeLayout.LayoutParams) mRvTitle.getLayoutParams();
- mLayoutManager = new LinearLayoutManager(this);
+ mLayoutManager = new LinearLayoutManager(getContext());
mRecyclerView.setLayoutManager(mLayoutManager);
+ mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
@@ -74,4 +74,5 @@ public class AskSelectGameActivity extends BaseActivity {
}
});
}
+
}
diff --git a/app/src/main/java/com/gh/gamecenter/ask/entity/CommunitiesEntity.kt b/app/src/main/java/com/gh/gamecenter/ask/entity/CommunitiesEntity.kt
new file mode 100644
index 0000000000..fc8be8b4a0
--- /dev/null
+++ b/app/src/main/java/com/gh/gamecenter/ask/entity/CommunitiesEntity.kt
@@ -0,0 +1,22 @@
+package com.gh.gamecenter.ask.entity
+
+import com.google.gson.annotations.SerializedName
+
+/**
+ * Created by khy on 11/12/17.
+ */
+class CommunitiesEntity {
+
+ @SerializedName("_id")
+ var id: String? = null
+
+ var name: String? = null
+
+ var status: String? = null
+
+ var vote: Int = 0
+
+ var game: CommunitiesGameEntity? = null
+
+ var me: MeEntity? = null
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/gh/gamecenter/ask/entity/CommunitiesGameEntity.kt b/app/src/main/java/com/gh/gamecenter/ask/entity/CommunitiesGameEntity.kt
new file mode 100644
index 0000000000..b16e5681d6
--- /dev/null
+++ b/app/src/main/java/com/gh/gamecenter/ask/entity/CommunitiesGameEntity.kt
@@ -0,0 +1,17 @@
+package com.gh.gamecenter.ask.entity
+
+import com.google.gson.annotations.SerializedName
+
+/**
+ * Created by khy on 11/12/17.
+ */
+class CommunitiesGameEntity {
+
+ @SerializedName("_id")
+ var id: String? = null
+
+ var name: String? = null
+
+ var icon: String? = null
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/gh/gamecenter/ask/entity/MeEntity.kt b/app/src/main/java/com/gh/gamecenter/ask/entity/MeEntity.kt
new file mode 100644
index 0000000000..40307acdf9
--- /dev/null
+++ b/app/src/main/java/com/gh/gamecenter/ask/entity/MeEntity.kt
@@ -0,0 +1,11 @@
+package com.gh.gamecenter.ask.entity
+
+import com.google.gson.annotations.SerializedName
+
+/**
+ * Created by khy on 11/12/17.
+ */
+class MeEntity {
+ @SerializedName("is_community_voted")
+ var isCommunityVoted: String? = null
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/gh/gamecenter/questionsdetail/AnswerEditFragment.java b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/AnswerEditFragment.java
similarity index 99%
rename from app/src/main/java/com/gh/gamecenter/questionsdetail/AnswerEditFragment.java
rename to app/src/main/java/com/gh/gamecenter/ask/questionsdetail/AnswerEditFragment.java
index 9166978aad..1fdfd049fd 100644
--- a/app/src/main/java/com/gh/gamecenter/questionsdetail/AnswerEditFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/AnswerEditFragment.java
@@ -1,4 +1,4 @@
-package com.gh.gamecenter.questionsdetail;
+package com.gh.gamecenter.ask.questionsdetail;
import android.content.Intent;
import android.database.Cursor;
diff --git a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsDetailAdapter.java b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsDetailAdapter.java
similarity index 89%
rename from app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsDetailAdapter.java
rename to app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsDetailAdapter.java
index d82d4cfb22..633e3cbb00 100644
--- a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsDetailAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsDetailAdapter.java
@@ -1,4 +1,4 @@
-package com.gh.gamecenter.questionsdetail;
+package com.gh.gamecenter.ask.questionsdetail;
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
@@ -12,13 +12,16 @@ import com.gh.common.constant.ItemViewType;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.ReuseViewHolder;
import com.gh.gamecenter.ask.AskItemViewHolder;
-import com.lightgame.adapter.BaseRecyclerAdapter;
+import com.gh.gamecenter.baselist.ListAdapter;
+import com.gh.gamecenter.baselist.LoadStatus;
+
+import java.util.List;
/**
* Created by khy on 7/12/17.
*/
-public class QuestionsDetailAdapter extends BaseRecyclerAdapter {
+public class QuestionsDetailAdapter extends ListAdapter {
private OnListClickListener mListClickListener;
@@ -27,6 +30,16 @@ public class QuestionsDetailAdapter extends BaseRecyclerAdapter {
mListClickListener = listClickListener;
}
+ @Override
+ protected void provideListData(List listData) {
+
+ }
+
+ @Override
+ protected void loadChange(LoadStatus status) {
+
+ }
+
@Override
public int getItemViewType(int position) {
if (position == 0) {
diff --git a/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsDetailFragment.java b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsDetailFragment.java
new file mode 100644
index 0000000000..227040bd69
--- /dev/null
+++ b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsDetailFragment.java
@@ -0,0 +1,69 @@
+package com.gh.gamecenter.ask.questionsdetail;
+
+import android.arch.lifecycle.Lifecycle;
+import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.view.View;
+import android.widget.RelativeLayout;
+
+import com.gh.gamecenter.AskQuestionsDetailActivity;
+import com.gh.gamecenter.R;
+import com.gh.gamecenter.baselist.ListAdapter;
+import com.gh.gamecenter.baselist.ListFragment;
+import com.gh.gamecenter.entity.NewsEntity;
+
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.OnClick;
+import rx.Observable;
+
+/**
+ * Created by khy on 7/12/17.
+ */
+
+public class QuestionsDetailFragment extends ListFragment {
+
+ @BindView(R.id.questionsdetail_answer)
+ RelativeLayout mAnswer;
+ @BindView(R.id.questionsdetail_invite)
+ RelativeLayout mInvite;
+
+ QuestionsDetailAdapter mAdapter;
+
+
+ @Override
+ protected ListAdapter provideListAdapter() {
+ return mAdapter == null ? mAdapter = new QuestionsDetailAdapter(getContext(), this) : mAdapter;
+ }
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.fragment_questionsdetail;
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ }
+
+ @OnClick({R.id.questionsdetail_answer, R.id.questionsdetail_invite})
+ public void onClick(View v) {
+ switch (v.getId()) {
+ case R.id.questionsdetail_answer:
+ if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
+ ((AskQuestionsDetailActivity) getActivity()).show(AskQuestionsDetailActivity.QUESTIONS_DETAIL_ANSWER);
+ break;
+ case R.id.questionsdetail_invite:
+ if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
+ ((AskQuestionsDetailActivity) getActivity()).show(AskQuestionsDetailActivity.QUESTIONS_DETAIL_INVITE);
+ break;
+ }
+ }
+
+ @Override
+ public Observable> provideDataObservable() {
+ return null;
+ }
+}
diff --git a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsDetailItemViewHolder.java b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsDetailItemViewHolder.java
similarity index 96%
rename from app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsDetailItemViewHolder.java
rename to app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsDetailItemViewHolder.java
index b075425620..2c7ffce37d 100644
--- a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsDetailItemViewHolder.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsDetailItemViewHolder.java
@@ -1,4 +1,4 @@
-package com.gh.gamecenter.questionsdetail;
+package com.gh.gamecenter.ask.questionsdetail;
import android.support.v7.widget.RecyclerView;
import android.view.View;
diff --git a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteAdapter.java b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteAdapter.java
similarity index 93%
rename from app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteAdapter.java
rename to app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteAdapter.java
index c0e5af4754..76d0ce5772 100644
--- a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteAdapter.java
@@ -1,4 +1,4 @@
-package com.gh.gamecenter.questionsdetail;
+package com.gh.gamecenter.ask.questionsdetail;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
@@ -9,7 +9,7 @@ import com.gh.base.OnListClickListener;
import com.gh.common.constant.ItemViewType;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
-import com.gh.gamecenter.baselist.BaseListAdapter;
+import com.gh.gamecenter.baselist.ListAdapter;
import com.gh.gamecenter.baselist.LoadStatus;
import java.util.List;
@@ -18,7 +18,7 @@ import java.util.List;
* Created by khy on 7/12/17.
*/
-public class QuestionsInviteAdapter extends BaseListAdapter {
+public class QuestionsInviteAdapter extends ListAdapter {
private OnListClickListener mListClickListener;
diff --git a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteFragment.java b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteFragment.java
similarity index 77%
rename from app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteFragment.java
rename to app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteFragment.java
index a61ea91a5e..81df876770 100644
--- a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteFragment.java
@@ -1,6 +1,6 @@
-package com.gh.gamecenter.questionsdetail;
+package com.gh.gamecenter.ask.questionsdetail;
-import com.gh.gamecenter.baselist.BaseListAdapter;
+import com.gh.gamecenter.baselist.ListAdapter;
import com.gh.gamecenter.baselist.ListFragment;
import com.gh.gamecenter.entity.NewsEntity;
@@ -22,7 +22,7 @@ public class QuestionsInviteFragment extends ListFragment {
}
@Override
- protected BaseListAdapter provideListAdapter() {
+ protected ListAdapter provideListAdapter() {
return mAdapter == null ? mAdapter = new QuestionsInviteAdapter(getContext(), this) : mAdapter;
}
}
diff --git a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteItemViewHolder.java b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteItemViewHolder.java
similarity index 95%
rename from app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteItemViewHolder.java
rename to app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteItemViewHolder.java
index d455088c49..7dc0f975d7 100644
--- a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteItemViewHolder.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteItemViewHolder.java
@@ -1,4 +1,4 @@
-package com.gh.gamecenter.questionsdetail;
+package com.gh.gamecenter.ask.questionsdetail;
import android.view.View;
import android.widget.TextView;
diff --git a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteTopItemViewHolder.java b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteTopItemViewHolder.java
similarity index 92%
rename from app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteTopItemViewHolder.java
rename to app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteTopItemViewHolder.java
index 7b044932de..99c7f71f09 100644
--- a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsInviteTopItemViewHolder.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/questionsdetail/QuestionsInviteTopItemViewHolder.java
@@ -1,4 +1,4 @@
-package com.gh.gamecenter.questionsdetail;
+package com.gh.gamecenter.ask.questionsdetail;
import android.view.View;
import android.widget.TextView;
diff --git a/app/src/main/java/com/gh/gamecenter/ask/search/AskSearchAdapter.java b/app/src/main/java/com/gh/gamecenter/ask/search/AskSearchAdapter.java
index a3f3159308..94c874b765 100644
--- a/app/src/main/java/com/gh/gamecenter/ask/search/AskSearchAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/search/AskSearchAdapter.java
@@ -9,7 +9,7 @@ import com.gh.base.OnListClickListener;
import com.gh.common.constant.ItemViewType;
import com.gh.gamecenter.R;
import com.gh.gamecenter.adapter.viewholder.FooterViewHolder;
-import com.gh.gamecenter.baselist.BaseListAdapter;
+import com.gh.gamecenter.baselist.ListAdapter;
import com.gh.gamecenter.baselist.LoadStatus;
import com.gh.gamecenter.entity.NewsEntity;
@@ -19,7 +19,7 @@ import java.util.List;
* Created by khy on 8/12/17.
*/
-public class AskSearchAdapter extends BaseListAdapter {
+public class AskSearchAdapter extends ListAdapter {
private OnListClickListener mListClickListener;
diff --git a/app/src/main/java/com/gh/gamecenter/ask/search/AskSearchFragment.java b/app/src/main/java/com/gh/gamecenter/ask/search/AskSearchFragment.java
index 3f55575dbd..b5a6a2d8ea 100644
--- a/app/src/main/java/com/gh/gamecenter/ask/search/AskSearchFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/ask/search/AskSearchFragment.java
@@ -3,7 +3,7 @@ package com.gh.gamecenter.ask.search;
import android.view.View;
import com.gh.gamecenter.R;
-import com.gh.gamecenter.baselist.BaseListAdapter;
+import com.gh.gamecenter.baselist.ListAdapter;
import com.gh.gamecenter.baselist.ListFragment;
import com.gh.gamecenter.baselist.LoadStatus;
import com.gh.gamecenter.baselist.LoadType;
@@ -26,14 +26,14 @@ public class AskSearchFragment extends ListFragment {
protected int getLayoutId() {
return R.layout.fragment_ask_search;
}
-
+// android:windowSoftInputMode = "stateVisible|adjustResize|adjustPan"
@Override
public Observable> provideDataObservable() {
return RetrofitManager.getInstance(getContext()).getApi().getZiXun(getListOffset());
}
@Override
- protected BaseListAdapter provideListAdapter() {
+ protected ListAdapter provideListAdapter() {
return mAdapter == null ? mAdapter = new AskSearchAdapter(getContext(), this) : mAdapter;
}
diff --git a/app/src/main/java/com/gh/gamecenter/baselist/BaseListAdapter.java b/app/src/main/java/com/gh/gamecenter/baselist/ListAdapter.java
similarity index 82%
rename from app/src/main/java/com/gh/gamecenter/baselist/BaseListAdapter.java
rename to app/src/main/java/com/gh/gamecenter/baselist/ListAdapter.java
index b7d495daf4..39001ad837 100644
--- a/app/src/main/java/com/gh/gamecenter/baselist/BaseListAdapter.java
+++ b/app/src/main/java/com/gh/gamecenter/baselist/ListAdapter.java
@@ -10,7 +10,7 @@ import java.util.List;
* Created by khy on 10/11/17.
*/
-public abstract class BaseListAdapter extends BaseRecyclerAdapter {
+public abstract class ListAdapter extends BaseRecyclerAdapter {
protected static final int FOOTER_ITEM_COUNT = 1;
@@ -18,7 +18,7 @@ public abstract class BaseListAdapter extends BaseRecyclerAdapter {
protected boolean mIsNetworkError;
- public BaseListAdapter(Context context) {
+ public ListAdapter(Context context) {
super(context);
}
diff --git a/app/src/main/java/com/gh/gamecenter/baselist/ListFragment.java b/app/src/main/java/com/gh/gamecenter/baselist/ListFragment.java
index d08bd99729..8eb4a1ef0b 100644
--- a/app/src/main/java/com/gh/gamecenter/baselist/ListFragment.java
+++ b/app/src/main/java/com/gh/gamecenter/baselist/ListFragment.java
@@ -45,7 +45,7 @@ public abstract class ListFragment extends BaseFragment implements
protected ListViewModel mListViewModel;
- protected abstract BaseListAdapter provideListAdapter();
+ protected abstract ListAdapter provideListAdapter();
@Override
diff --git a/app/src/main/java/com/gh/gamecenter/login/UserRepository.java b/app/src/main/java/com/gh/gamecenter/login/UserRepository.java
index cec4a59a14..c8efc482eb 100644
--- a/app/src/main/java/com/gh/gamecenter/login/UserRepository.java
+++ b/app/src/main/java/com/gh/gamecenter/login/UserRepository.java
@@ -84,7 +84,7 @@ class UserRepository {
mApiService = RetrofitManager.getInstance(context).getApi();
mAppDatabase = database;
mCachedId = PreferenceManager.getDefaultSharedPreferences(context).getString(Constants.LOGIN_TOKEN_ID, null);
- checkLogin();
+ if (!TextUtils.isEmpty(mCachedId)) checkLogin();
}
protected void checkLogin() {
diff --git a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsDetailFragment.java b/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsDetailFragment.java
deleted file mode 100644
index 9b1d24fbdd..0000000000
--- a/app/src/main/java/com/gh/gamecenter/questionsdetail/QuestionsDetailFragment.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package com.gh.gamecenter.questionsdetail;
-
-import android.os.Bundle;
-import android.support.annotation.NonNull;
-import android.support.annotation.Nullable;
-import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
-import android.view.View;
-import android.widget.RelativeLayout;
-
-import com.gh.base.fragment.BaseFragment;
-import com.gh.gamecenter.R;
-
-import butterknife.BindView;
-import butterknife.OnClick;
-
-/**
- * Created by khy on 7/12/17.
- */
-
-public class QuestionsDetailFragment extends BaseFragment {
-
- @BindView(R.id.questionsdetail_rv)
- RecyclerView mRecyclerView;
- @BindView(R.id.questionsdetail_answer)
- RelativeLayout mAnswer;
- @BindView(R.id.questionsdetail_invite)
- RelativeLayout mInvite;
-
- QuestionsDetailAdapter mAdapter;
-
- @Override
- protected int getLayoutId() {
- return R.layout.fragment_questionsdetail;
- }
-
- @Override
- public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
- mAdapter = new QuestionsDetailAdapter(getContext(), this);
- mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
- mRecyclerView.setAdapter(mAdapter);
- }
-
- @OnClick({R.id.questionsdetail_answer, R.id.questionsdetail_invite})
- public void onClick(View v) {
- switch (v.getId()) {
- case R.id.questionsdetail_answer:
- break;
- case R.id.questionsdetail_invite:
- break;
- }
- }
-}
diff --git a/app/src/main/res/layout/activity_normal.xml b/app/src/main/res/layout/activity_normal.xml
index 9e0450c054..4a580c34d4 100644
--- a/app/src/main/res/layout/activity_normal.xml
+++ b/app/src/main/res/layout/activity_normal.xml
@@ -6,7 +6,8 @@
+ android:layout_height = "?actionBarSize"
+ android:background = "@android:color/white" >
diff --git a/app/src/main/res/layout/ask_selectgame_footer.xml b/app/src/main/res/layout/ask_selectgame_footer.xml
new file mode 100644
index 0000000000..0add1eb87e
--- /dev/null
+++ b/app/src/main/res/layout/ask_selectgame_footer.xml
@@ -0,0 +1,8 @@
+
+
diff --git a/app/src/main/res/layout/ask_tab_item.xml b/app/src/main/res/layout/ask_tab_item.xml
index 7f07917e27..2bec10eb4a 100644
--- a/app/src/main/res/layout/ask_tab_item.xml
+++ b/app/src/main/res/layout/ask_tab_item.xml
@@ -2,9 +2,11 @@
+ android:layout_marginBottom = "10dp"
+ android:layout_marginTop = "10dp"
+ android:gravity = "center"
+ android:paddingBottom = "5dp"
+ android:paddingTop = "5dp" >
-
-
diff --git a/app/src/main/res/layout/fragment_questionsdetail.xml b/app/src/main/res/layout/fragment_questionsdetail.xml
index c6a156ff31..18eeb6edc9 100644
--- a/app/src/main/res/layout/fragment_questionsdetail.xml
+++ b/app/src/main/res/layout/fragment_questionsdetail.xml
@@ -5,12 +5,32 @@
android:layout_width = "match_parent"
android:layout_height = "match_parent" >
-
+ app:layout_constraintTop_toTopOf = "@+id/questionsdetail_constraintlayout" >
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout/menu_action_save.xml b/app/src/main/res/layout/menu_action_save.xml
index 9dcb42de4f..dd1ce1b4ba 100644
--- a/app/src/main/res/layout/menu_action_save.xml
+++ b/app/src/main/res/layout/menu_action_save.xml
@@ -7,6 +7,4 @@
android:orientation = "vertical"
android:text = "@string/text_save"
android:textColor = "@color/title"
- android:textSize = "13sp" >
-
-
\ No newline at end of file
+ android:textSize = "13sp" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/questionsdetail_footer_item.xml b/app/src/main/res/layout/questionsdetail_footer_item.xml
index d7018568a2..29b4abeef3 100644
--- a/app/src/main/res/layout/questionsdetail_footer_item.xml
+++ b/app/src/main/res/layout/questionsdetail_footer_item.xml
@@ -7,4 +7,4 @@
android:paddingBottom = "15dp"
android:paddingTop = "15dp"
android:paddingLeft="20dp"
- android:text = "查看折叠答案" />
+ android:text = "@string/quesionsdetail_fold_hint" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 857393b33d..4905822863 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -448,5 +448,7 @@
最多选择3个标签
没有你想要的?
点我提问
+ 查看折叠答案
+ 没有我的游戏?点击提交