提问问题/修改问题(完成)
This commit is contained in:
@ -67,6 +67,7 @@ public class EntranceUtils {
|
||||
public static final String KEY_QUESTIONS_PATCH = "questionsPatch";
|
||||
public static final String KEY_INVITE_SEARCH_KEY = "inviteSearchKey";
|
||||
public static final String KEY_MESSAGE_TYPE = "messageType";
|
||||
public static final String KEY_QUESTIONS_SEARCH_KEY = "questionsSearchKey";
|
||||
|
||||
public static void jumpActivity(Context context, Bundle bundle) {
|
||||
|
||||
|
||||
@ -188,7 +188,7 @@ public class CropImageActivity extends BaseActivity {
|
||||
sp.edit().putString("updateIconCount", jsonObject.toString()).apply();
|
||||
|
||||
Intent data = new Intent();
|
||||
data.putExtra(EntranceUtils.KEY_URL, result.getString("icon"));
|
||||
data.putExtra(EntranceUtils.KEY_URL, result.getString("url"));
|
||||
setResult(RESULT_OK, data);
|
||||
finish();
|
||||
|
||||
|
||||
@ -500,7 +500,7 @@ public class SuggestionActivity extends BaseActivity implements SuggestTypeAdapt
|
||||
try {
|
||||
int statusCode = result.getInt("statusCode");
|
||||
if (statusCode == HttpURLConnection.HTTP_OK) {
|
||||
picArray.put(result.getString("icon"));
|
||||
picArray.put(result.getString("url"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.gh.gamecenter.ask;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
@ -63,6 +64,7 @@ import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.ResponseBody;
|
||||
import retrofit2.HttpException;
|
||||
import rx.Observable;
|
||||
import rx.android.schedulers.AndroidSchedulers;
|
||||
import rx.schedulers.Schedulers;
|
||||
|
||||
@ -88,13 +90,17 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
private static final int QUESTION_TITLE_MAX_LENGTH = 50;
|
||||
private static final int QUESTION_TAG_MAX_COUNT = 5;
|
||||
|
||||
private List<String> mTagList = new ArrayList<>(); // 已选择的标签
|
||||
private List<String> mAllTagList = new ArrayList<>(); // 全部标签(网络标签/新增标签)
|
||||
private List<String> mTagByTitle = new ArrayList<>(); // 根据标题匹配的变迁
|
||||
|
||||
private QuestionsEditPicAdapter mAdapter;
|
||||
|
||||
private WaitingDialogFragment mPostDialog;
|
||||
|
||||
private List<String> mNetWordTagList = new ArrayList<>();
|
||||
private List<String> mTagList = new ArrayList<>();
|
||||
private List<String> mAllTagList = new ArrayList<>();
|
||||
private Dialog mTagDialog;
|
||||
|
||||
private QuestionsDetailEntity mQuestionsEntity;
|
||||
|
||||
private String mSearchKey;
|
||||
private Boolean mAgreePostPic;
|
||||
@ -155,7 +161,7 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
toast("标题至少6个字");
|
||||
return;
|
||||
}
|
||||
CheckLoginUtils.checkLogin(getContext(), this::showTagDialog);
|
||||
CheckLoginUtils.checkLogin(getContext(), this::addTagByTitle);
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,6 +177,7 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
Bundle arguments = getArguments();
|
||||
if (arguments != null) {
|
||||
mSearchKey = arguments.getString(EntranceUtils.KEY_SEARCHKEY);
|
||||
mQuestionsEntity = arguments.getParcelable(QuestionsDetailEntity.TAG);
|
||||
}
|
||||
getCommunitiesTags();
|
||||
mAgreePostPic = null;
|
||||
@ -179,7 +186,6 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
setNavigationTitle(UserManager.getInstance().getCommunityName(getContext()));
|
||||
mPicRv.setLayoutManager(new LinearLayoutManager(getContext(), RecyclerView.HORIZONTAL, false));
|
||||
if (!TextUtils.isEmpty(mSearchKey)) {
|
||||
if (mSearchKey.length() > QUESTION_TITLE_MAX_LENGTH) {
|
||||
@ -209,9 +215,9 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
if (s.toString().length() == 0) {
|
||||
addQuestionsIndexFragment(false, null);
|
||||
addQuestionsIndexFragment(null);
|
||||
} else {
|
||||
addQuestionsIndexFragment(true, s.toString());
|
||||
addQuestionsIndexFragment(s.toString());
|
||||
}
|
||||
|
||||
if (s.length() > QUESTION_TITLE_MAX_LENGTH) {
|
||||
@ -229,24 +235,43 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
}
|
||||
});
|
||||
|
||||
if (mQuestionsEntity != null) {
|
||||
initEditQuestion();
|
||||
setNavigationTitle("编辑问题");
|
||||
} else {
|
||||
setNavigationTitle(UserManager.getInstance().getCommunityName(getContext()));
|
||||
}
|
||||
}
|
||||
|
||||
private void addQuestionsIndexFragment(boolean isShow, String searchKey) {
|
||||
|
||||
// 编辑问题
|
||||
void initEditQuestion() {
|
||||
List<String> images = mQuestionsEntity.getImages();
|
||||
mTitle.setText(mQuestionsEntity.getTitle());
|
||||
mContent.setText(mQuestionsEntity.getDescription());
|
||||
for (String image : images) {
|
||||
mAdapter.addFileList(image);
|
||||
}
|
||||
}
|
||||
|
||||
public void showSearchIndexLayout(boolean isShow) {
|
||||
if (isShow) {
|
||||
mIndexView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
mIndexView.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void addQuestionsIndexFragment(String searchKey) {
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
Fragment fragment = getChildFragmentManager().findFragmentByTag(QuestionsEditIndexFragment.class.getSimpleName());
|
||||
if (fragment != null && fragment instanceof QuestionsEditIndexFragment) {
|
||||
((QuestionsEditIndexFragment) fragment).search(""); // TODO: 23/03/18
|
||||
((QuestionsEditIndexFragment) fragment).search(searchKey);
|
||||
} else {
|
||||
QuestionsEditIndexFragment indexFragment = new QuestionsEditIndexFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(EntranceUtils.KEY_ENTRANCE, mEntrance);
|
||||
args.putString(EntranceUtils.KEY_QUESTIONS_SEARCH_KEY, searchKey);
|
||||
indexFragment.setArguments(args);
|
||||
transaction.add(R.id.questionsedit_index, indexFragment, QuestionsEditIndexFragment.class.getSimpleName());
|
||||
}
|
||||
@ -268,7 +293,7 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
try {
|
||||
int statusCode = response.getInt("statusCode");
|
||||
if (statusCode == HttpURLConnection.HTTP_OK) {
|
||||
mAdapter.addFileList(response.getString("icon"));
|
||||
mAdapter.addFileList(response.getString("url"));
|
||||
} else if (statusCode == 403) {
|
||||
toast("图片违规");
|
||||
} else {
|
||||
@ -297,7 +322,7 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
.subscribe(new Response<List<String>>() {
|
||||
@Override
|
||||
public void onResponse(List<String> response) {
|
||||
mNetWordTagList = response;
|
||||
mAllTagList.addAll(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -328,8 +353,20 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
String jsonBody = GsonUtils.Companion.getInstance().toJson(entity);
|
||||
Utils.log("postQuestions->Body:" + jsonBody);
|
||||
RequestBody body = RequestBody.create(MediaType.parse("application/json"), jsonBody);
|
||||
RetrofitManager.getInstance(getContext()).getApi()
|
||||
.postQuestions(body, UserManager.getInstance().getCommunityId(getContext()))
|
||||
Observable<ResponseBody> responseBodyObservable;
|
||||
|
||||
if (mQuestionsEntity != null) {
|
||||
responseBodyObservable = RetrofitManager.getInstance(getContext()).getApi()
|
||||
.patchQuestions(body, mQuestionsEntity.getId());
|
||||
mQuestionsEntity.setTags(mTagList);
|
||||
mQuestionsEntity.setImages(imgs);
|
||||
mQuestionsEntity.setTitle(title);
|
||||
mQuestionsEntity.setDescription(content);
|
||||
} else {
|
||||
responseBodyObservable = RetrofitManager.getInstance(getContext()).getApi()
|
||||
.postQuestions(body, UserManager.getInstance().getCommunityId(getContext()));
|
||||
}
|
||||
responseBodyObservable
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<ResponseBody>() {
|
||||
@ -339,12 +376,19 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
mPostDialog.dismissAllowingStateLoss();
|
||||
toast("提交成功");
|
||||
try {
|
||||
JSONObject object = new JSONObject(response.string());
|
||||
if (getActivity() != null) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceUtils.KEY_QUESTIONS_ID, object.getString("_id"));
|
||||
bundle.putString(EntranceUtils.KEY_ENTRANCE, "(回答编辑)");
|
||||
NormalActivity.startFragment(getContext(), QuestionsDetailFragment.class, bundle);
|
||||
if (mQuestionsEntity != null) {
|
||||
Intent data = new Intent();
|
||||
data.putExtra(QuestionsDetailEntity.TAG, mQuestionsEntity);
|
||||
getActivity().setResult(Activity.RESULT_OK, data);
|
||||
} else {
|
||||
JSONObject object = new JSONObject(response.string());
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceUtils.KEY_QUESTIONS_ID, object.getString("_id"));
|
||||
bundle.putString(EntranceUtils.KEY_ENTRANCE, "(回答编辑)");
|
||||
NormalActivity.startFragment(getContext(), QuestionsDetailFragment.class, bundle);
|
||||
}
|
||||
if (mTagDialog != null) mTagDialog.dismiss();
|
||||
getActivity().finish();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -412,13 +456,40 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
});
|
||||
}
|
||||
|
||||
private void addTagByTitle() {
|
||||
RetrofitManager.getInstance(getContext())
|
||||
.getApi()
|
||||
.getQuestionTagsByTitle(UserManager.getInstance().getCommunityId(getContext()), mTitle.getText().toString())
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Response<List<String>>() {
|
||||
@Override
|
||||
public void onResponse(List<String> response) {
|
||||
mTagByTitle.clear();
|
||||
if (response.size() <= 5) {
|
||||
mTagByTitle.addAll(response);
|
||||
} else {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
mTagByTitle.add(response.get(i));
|
||||
}
|
||||
}
|
||||
showTagDialog();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(HttpException e) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showTagDialog() {
|
||||
View view = LayoutInflater.from(getContext()).inflate(R.layout.questions_edit_tag, null);
|
||||
Dialog dialog = new Dialog(getActivity());
|
||||
dialog.setContentView(view);
|
||||
dialog.setCanceledOnTouchOutside(false);
|
||||
dialog.setCancelable(false);
|
||||
Window window = dialog.getWindow();
|
||||
mTagDialog = new Dialog(getActivity());
|
||||
mTagDialog.setContentView(view);
|
||||
mTagDialog.setCanceledOnTouchOutside(false);
|
||||
mTagDialog.setCancelable(false);
|
||||
Window window = mTagDialog.getWindow();
|
||||
if (window != null) {
|
||||
window.setGravity(Gravity.BOTTOM);
|
||||
window.setBackgroundDrawable(new ColorDrawable(0));
|
||||
@ -430,8 +501,7 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
mTagFl = view.findViewById(R.id.questions_edit_tag);
|
||||
View add = view.findViewById(R.id.questions_edit_tag_add);
|
||||
view.findViewById(R.id.questions_edit_tag_cancel).setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
mAllTagList.clear();
|
||||
mTagDialog.dismiss();
|
||||
mTagList.clear();
|
||||
});
|
||||
view.findViewById(R.id.questions_edit_tag_positive).setOnClickListener(v -> postQuestions(mAdapter.getFileList()));
|
||||
@ -443,12 +513,20 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
}
|
||||
});
|
||||
|
||||
// init default tag
|
||||
for (int i = mNetWordTagList.size() - 1; i >= 0; i--) {
|
||||
addTag(mNetWordTagList.get(i), false);
|
||||
if (mQuestionsEntity == null || mQuestionsEntity.getTags().size() == 0) {
|
||||
// init default tag
|
||||
for (int i = mAllTagList.size() - 1; i >= 0; i--) {
|
||||
String tag = mAllTagList.get(i);
|
||||
addTag(tag, mTagByTitle.contains(tag));
|
||||
}
|
||||
} else {
|
||||
List<String> tags = mQuestionsEntity.getTags();
|
||||
for (int i = tags.size() - 1; i >= 0; i--) {
|
||||
addTag(tags.get(i), true);
|
||||
}
|
||||
}
|
||||
mTagDialog.show();
|
||||
}
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
||||
@ -466,12 +544,16 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
|
||||
input.setOnEditorActionListener((v, actionId, event) -> {
|
||||
if (actionId == EditorInfo.IME_ACTION_DONE) {
|
||||
String nickname = input.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(nickname)) {
|
||||
String tag = input.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(tag)) {
|
||||
toast(R.string.vote_empty_hint);
|
||||
return true;
|
||||
}
|
||||
addTag(nickname, true);
|
||||
if (mAllTagList.contains(tag)) {
|
||||
toast("标签已存在");
|
||||
} else {
|
||||
addTag(tag, true);
|
||||
}
|
||||
dialog.dismiss();
|
||||
return true;
|
||||
}
|
||||
@ -485,12 +567,16 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
// 确定按钮
|
||||
TextView confirm = view.findViewById(R.id.dialog_nickname_confirm);
|
||||
confirm.setOnClickListener(v -> {
|
||||
String nickname = input.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(nickname)) {
|
||||
String tag = input.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(tag)) {
|
||||
toast(R.string.vote_empty_hint);
|
||||
return;
|
||||
}
|
||||
addTag(nickname, true);
|
||||
if (mAllTagList.contains(tag)) {
|
||||
toast("标签已存在");
|
||||
} else {
|
||||
addTag(tag, true);
|
||||
}
|
||||
dialog.dismiss();
|
||||
});
|
||||
|
||||
@ -504,12 +590,6 @@ public class QuestionsEditFragment extends NormalFragment {
|
||||
}
|
||||
|
||||
private void addTag(String tag, boolean isAdd) {
|
||||
if (mAllTagList.contains(tag)) {
|
||||
toast("标签已经存在");
|
||||
return;
|
||||
}
|
||||
mAllTagList.add(tag);
|
||||
|
||||
View view = LayoutInflater.from(getContext()).inflate(R.layout.questionsdedit_tag_item, null);
|
||||
TextView tagTv = (TextView) view;
|
||||
tagTv.setText(tag);
|
||||
|
||||
@ -11,17 +11,14 @@ 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.ask.entity.AskSearchEntity;
|
||||
import com.gh.gamecenter.ask.entity.Questions;
|
||||
import com.gh.gamecenter.ask.entity.QuestionsIndexEntity;
|
||||
import com.gh.gamecenter.baselist.ListAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by khy on 22/03/18.
|
||||
*/
|
||||
|
||||
public class QuestionsEditIndexAdapter extends ListAdapter<AskSearchEntity> {
|
||||
public class QuestionsEditIndexAdapter extends ListAdapter<QuestionsIndexEntity> {
|
||||
|
||||
private OnListClickListener mListClickListener;
|
||||
private String mSearchKey;
|
||||
@ -30,37 +27,10 @@ public class QuestionsEditIndexAdapter extends ListAdapter<AskSearchEntity> {
|
||||
super(context);
|
||||
mListClickListener = listClickListener;
|
||||
}
|
||||
// @Override
|
||||
// protected void setListData(List<AskSearchEntity> listData) {
|
||||
// if (listData == null) {
|
||||
// if (mEntityList != null) mEntityList.clear();
|
||||
// } else {
|
||||
// mEntityList = new ArrayList<>(replayKeyword(listData));
|
||||
// }
|
||||
// notifyDataSetChanged();
|
||||
// }
|
||||
|
||||
private List<AskSearchEntity> replayKeyword(List<AskSearchEntity> listData) {
|
||||
for (int i = 0; i < listData.size(); i++) {
|
||||
if (!TextUtils.isEmpty(mSearchKey)) {
|
||||
AskSearchEntity entity = listData.get(i);
|
||||
String brief = entity.getBrief();
|
||||
if (!TextUtils.isEmpty(brief)) {
|
||||
brief = brief.replace("<em>", "").replace("</em>", "")
|
||||
.replace(mSearchKey, getHtmlKeyword());
|
||||
entity.setBrief(brief);
|
||||
}
|
||||
String title = entity.getQuestions().getTitle();
|
||||
if (!TextUtils.isEmpty(title)) {
|
||||
title = title.replace("<em>", "").replace("</em>", "")
|
||||
.replace(mSearchKey, getHtmlKeyword());
|
||||
Questions questions = entity.getQuestions();
|
||||
questions.setTitle(title);
|
||||
entity.setQuestions(questions);
|
||||
}
|
||||
}
|
||||
}
|
||||
return listData;
|
||||
private String replayKeyword(String title) {
|
||||
if (TextUtils.isEmpty(mSearchKey)) return title;
|
||||
return title.replaceAll(mSearchKey, getHtmlKeyword());
|
||||
}
|
||||
|
||||
private String getHtmlKeyword() {
|
||||
@ -93,12 +63,11 @@ public class QuestionsEditIndexAdapter extends ListAdapter<AskSearchEntity> {
|
||||
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
|
||||
switch (getItemViewType(position)) {
|
||||
case ItemViewType.ITEM_BODY:
|
||||
AskSearchEntity searchEntity = mEntityList.get(position);
|
||||
Questions questions = searchEntity.getQuestions();
|
||||
QuestionsIndexEntity searchEntity = mEntityList.get(position);
|
||||
QuestionsEditIndexViewHolder viewHolder = (QuestionsEditIndexViewHolder) holder;
|
||||
viewHolder.mIndexTitle.setText(Html.fromHtml(questions.getTitle()));
|
||||
viewHolder.mIndexTitle.setText(Html.fromHtml(replayKeyword(searchEntity.getTitle())));
|
||||
viewHolder.setClickData(searchEntity);
|
||||
viewHolder.mIndexAnswerCount.setText(mContext.getString(R.string.ask_answer_count, questions.getAnswerCount()));
|
||||
viewHolder.mIndexAnswerCount.setText(mContext.getString(R.string.ask_answer_count, searchEntity.getAnswerCount()));
|
||||
break;
|
||||
case ItemViewType.ITEM_FOOTER:
|
||||
FooterViewHolder footerViewHolder = (FooterViewHolder) holder;
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
package com.gh.gamecenter.ask;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.UrlFilterUtils;
|
||||
import com.gh.common.view.VerticalItemDecoration;
|
||||
import com.gh.gamecenter.NormalActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.ask.entity.AskSearchEntity;
|
||||
import com.gh.gamecenter.ask.entity.Questions;
|
||||
import com.gh.gamecenter.ask.entity.QuestionsIndexEntity;
|
||||
import com.gh.gamecenter.ask.questionsdetail.QuestionsDetailFragment;
|
||||
import com.gh.gamecenter.baselist.ListAdapter;
|
||||
import com.gh.gamecenter.baselist.ListFragment;
|
||||
@ -26,9 +29,11 @@ import rx.Observable;
|
||||
* Created by khy on 22/03/18.
|
||||
*/
|
||||
|
||||
public class QuestionsEditIndexFragment extends ListFragment<AskSearchEntity, NormalListViewModel> {
|
||||
public class QuestionsEditIndexFragment extends ListFragment<QuestionsIndexEntity, NormalListViewModel> {
|
||||
private QuestionsEditIndexAdapter mAdapter;
|
||||
|
||||
private String mSearchKey;
|
||||
|
||||
protected RecyclerView.ItemDecoration getItemDecoration() {
|
||||
return new VerticalItemDecoration(getContext(), 1, false);
|
||||
}
|
||||
@ -39,9 +44,42 @@ public class QuestionsEditIndexFragment extends ListFragment<AskSearchEntity, No
|
||||
}
|
||||
|
||||
@Override
|
||||
public Observable<List<AskSearchEntity>> provideDataObservable(int offset) {
|
||||
return RetrofitManager.getInstance(getContext()).getApi().getAskSearch(UserManager.getInstance().getCommunityId(getContext()), "一", offset);
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
if (getArguments() != null)
|
||||
mSearchKey = getArguments().getString(EntranceUtils.KEY_QUESTIONS_SEARCH_KEY, null);
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Observable<List<QuestionsIndexEntity>> provideDataObservable(int offset) {
|
||||
if (TextUtils.isEmpty(mSearchKey)) {
|
||||
Fragment parentFragment = getParentFragment();
|
||||
if (parentFragment instanceof QuestionsEditFragment) {
|
||||
((QuestionsEditFragment) parentFragment).showSearchIndexLayout(false);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return RetrofitManager.getInstance(getContext()).getApi().getAskSearchByTitle(
|
||||
UserManager.getInstance().getCommunityId(getContext()),
|
||||
UrlFilterUtils.getFilterQuery("keyword", mSearchKey), offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadEmpty() {
|
||||
super.onLoadEmpty();
|
||||
Fragment parentFragment = getParentFragment();
|
||||
if (parentFragment instanceof QuestionsEditFragment) {
|
||||
((QuestionsEditFragment) parentFragment).showSearchIndexLayout(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadDone() {
|
||||
super.onLoadDone();
|
||||
Fragment parentFragment = getParentFragment();
|
||||
if (parentFragment instanceof QuestionsEditFragment) {
|
||||
((QuestionsEditFragment) parentFragment).showSearchIndexLayout(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,10 +92,9 @@ public class QuestionsEditIndexFragment extends ListFragment<AskSearchEntity, No
|
||||
break;
|
||||
case R.id.questions_edit_index_title:
|
||||
String tracers = mEntrance + "+(标题自动搜索)";
|
||||
AskSearchEntity entity = (AskSearchEntity) data;
|
||||
Questions questions = entity.getQuestions();
|
||||
QuestionsIndexEntity entity = (QuestionsIndexEntity) data;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(EntranceUtils.KEY_QUESTIONS_ID, questions.getId());
|
||||
bundle.putString(EntranceUtils.KEY_QUESTIONS_ID, entity.getId());
|
||||
bundle.putString(EntranceUtils.KEY_ENTRANCE, tracers);
|
||||
NormalActivity.startFragment(getContext(), QuestionsDetailFragment.class, bundle);
|
||||
break;
|
||||
@ -65,6 +102,8 @@ public class QuestionsEditIndexFragment extends ListFragment<AskSearchEntity, No
|
||||
}
|
||||
|
||||
public void search(String key) {
|
||||
mSearchKey = key;
|
||||
mAdapter.setSearchKey(key);
|
||||
if (mListViewModel != null) mListViewModel.load(LoadType.REFRESH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ import android.widget.TextView;
|
||||
import com.gh.base.BaseRecyclerViewHolder;
|
||||
import com.gh.base.OnListClickListener;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.ask.entity.AskSearchEntity;
|
||||
import com.gh.gamecenter.ask.entity.QuestionsIndexEntity;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
@ -14,7 +14,7 @@ import butterknife.BindView;
|
||||
* Created by khy on 23/03/18.
|
||||
*/
|
||||
|
||||
public class QuestionsEditIndexViewHolder extends BaseRecyclerViewHolder<AskSearchEntity> {
|
||||
public class QuestionsEditIndexViewHolder extends BaseRecyclerViewHolder<QuestionsIndexEntity> {
|
||||
@BindView(R.id.questions_edit_index_title)
|
||||
TextView mIndexTitle;
|
||||
@BindView(R.id.questions_edit_index_answer_count)
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.gh.gamecenter.ask.entity
|
||||
|
||||
import com.gh.gamecenter.entity.UserEntity
|
||||
import com.google.gson.annotations.SerializedName
|
||||
|
||||
/**
|
||||
@ -11,7 +10,9 @@ class InviteEntity {
|
||||
@SerializedName("_id")
|
||||
var id: String? = null
|
||||
|
||||
var user: UserEntity? = null
|
||||
var icon: String? = null
|
||||
|
||||
var name: String? = null
|
||||
|
||||
@SerializedName("answer_count")
|
||||
var answerCount: Int = 0
|
||||
|
||||
@ -12,8 +12,8 @@ class MeEntity() : Parcelable {
|
||||
@SerializedName("is_community_voted")
|
||||
var isCommunityVoted: Boolean = false
|
||||
|
||||
@SerializedName("is_expert_invited")
|
||||
var isExpertInvited: Boolean = false
|
||||
@SerializedName("is_user_invite")
|
||||
var isUserInvite: Boolean = false
|
||||
|
||||
@SerializedName("is_answer_voted")
|
||||
var isAnswerVoted: Boolean = false
|
||||
@ -35,21 +35,23 @@ class MeEntity() : Parcelable {
|
||||
|
||||
constructor(parcel: Parcel) : this() {
|
||||
isCommunityVoted = parcel.readByte() != 0.toByte()
|
||||
isExpertInvited = parcel.readByte() != 0.toByte()
|
||||
isUserInvite = parcel.readByte() != 0.toByte()
|
||||
isAnswerVoted = parcel.readByte() != 0.toByte()
|
||||
isAnswerOwn = parcel.readByte() != 0.toByte()
|
||||
isAnswerFavorite = parcel.readByte() != 0.toByte()
|
||||
isQuestionFollowed = parcel.readByte() != 0.toByte()
|
||||
isQuestionOwn = parcel.readByte() != 0.toByte()
|
||||
myAnswerId = parcel.readString()
|
||||
}
|
||||
|
||||
override fun writeToParcel(parcel: Parcel, flags: Int) {
|
||||
parcel.writeByte(if (isCommunityVoted) 1 else 0)
|
||||
parcel.writeByte(if (isExpertInvited) 1 else 0)
|
||||
parcel.writeByte(if (isUserInvite) 1 else 0)
|
||||
parcel.writeByte(if (isAnswerVoted) 1 else 0)
|
||||
parcel.writeByte(if (isAnswerOwn) 1 else 0)
|
||||
parcel.writeByte(if (isAnswerFavorite) 1 else 0)
|
||||
parcel.writeByte(if (isQuestionFollowed) 1 else 0)
|
||||
parcel.writeByte(if (isQuestionOwn) 1 else 0)
|
||||
parcel.writeString(myAnswerId)
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,42 @@
|
||||
package com.gh.gamecenter.ask.entity;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by khy on 28/03/18.
|
||||
*/
|
||||
|
||||
public class QuestionsIndexEntity {
|
||||
|
||||
@SerializedName("_id")
|
||||
private String id;
|
||||
|
||||
private String title;
|
||||
|
||||
@SerializedName("answer_count")
|
||||
private int answerCount;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getAnswerCount() {
|
||||
return answerCount;
|
||||
}
|
||||
|
||||
public void setAnswerCount(int answerCount) {
|
||||
this.answerCount = answerCount;
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ public class AnswerEditFragment extends NormalFragment {
|
||||
try {
|
||||
int statusCode = response.getInt("statusCode");
|
||||
if (statusCode == HttpURLConnection.HTTP_OK) {
|
||||
mMapImg.put(picturePath, response.getString("icon"));
|
||||
mMapImg.put(picturePath, response.getString("url"));
|
||||
mEditContent.insertImage(FILE_HOST + picturePath);
|
||||
} else if (statusCode == 403) {
|
||||
toast("图片违规");
|
||||
|
||||
@ -200,18 +200,9 @@ public class QuestionsDetailAdapter extends ListAdapter<AnswerEntity> {
|
||||
|
||||
List<String> tags = mQuestionsDetailEntity.getTags();
|
||||
holder.mTagRl.removeAllViews();
|
||||
addTag(holder.mTagRl, mQuestionsDetailEntity.getCommunityName());
|
||||
for (String tag : tags) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.questionsdedit_tag_item, null);
|
||||
TextView tagTv = (TextView) view;
|
||||
tagTv.setText(tag);
|
||||
tagTv.setBackgroundResource(R.drawable.questions_detail_tag_bg);
|
||||
tagTv.setTextColor(ContextCompat.getColor(mContext, R.color.hint));
|
||||
FlexboxLayout.LayoutParams params = new FlexboxLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(0, DisplayUtils.dip2px(mContext, 5), DisplayUtils.dip2px(mContext, 15),
|
||||
DisplayUtils.dip2px(mContext, 5));
|
||||
tagTv.setLayoutParams(params);
|
||||
holder.mTagRl.addView(view);
|
||||
addTag(holder.mTagRl, tag);
|
||||
}
|
||||
|
||||
String description = mQuestionsDetailEntity.getDescription();
|
||||
@ -279,6 +270,20 @@ public class QuestionsDetailAdapter extends ListAdapter<AnswerEntity> {
|
||||
});
|
||||
}
|
||||
|
||||
private void addTag(FlexboxLayout mTagRl, String tag) {
|
||||
View view = LayoutInflater.from(mContext).inflate(R.layout.questionsdedit_tag_item, null);
|
||||
TextView tagTv = (TextView) view;
|
||||
tagTv.setText(tag);
|
||||
tagTv.setBackgroundResource(R.drawable.questions_detail_tag_bg);
|
||||
tagTv.setTextColor(ContextCompat.getColor(mContext, R.color.hint));
|
||||
FlexboxLayout.LayoutParams params = new FlexboxLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(0, DisplayUtils.dip2px(mContext, 5), DisplayUtils.dip2px(mContext, 15),
|
||||
DisplayUtils.dip2px(mContext, 5));
|
||||
tagTv.setLayoutParams(params);
|
||||
mTagRl.addView(view);
|
||||
}
|
||||
|
||||
private void setAnswerTv(TextView answerTv, @StringRes int answerTvId) {
|
||||
String answerText = mContext.getString(answerTvId);
|
||||
answerTv.setText(answerText);
|
||||
|
||||
@ -32,6 +32,7 @@ import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.SuggestionActivity;
|
||||
import com.gh.gamecenter.ViewImageActivity;
|
||||
import com.gh.gamecenter.ask.AnswerDetailFragment;
|
||||
import com.gh.gamecenter.ask.QuestionsEditFragment;
|
||||
import com.gh.gamecenter.ask.entity.AnswerEntity;
|
||||
import com.gh.gamecenter.ask.entity.QuestionsDetailEntity;
|
||||
import com.gh.gamecenter.ask.questionsdetail.invite.QuestionsInviteWrapperFragment;
|
||||
@ -67,6 +68,7 @@ public class QuestionsDetailFragment extends ListFragment<AnswerEntity, NormalLi
|
||||
public static final String TAG = "ask.questionsdetail.QuestionsDetailFragment";
|
||||
|
||||
public static final int QUESTIONS_DETAIL_ANSWER_REQUEST = 110;
|
||||
public static final int QUESTIONS_EDIT_REQUEST = 111;
|
||||
|
||||
@BindView(R.id.reuse_tv_none_data)
|
||||
TextView mNoDataTv;
|
||||
@ -111,6 +113,11 @@ public class QuestionsDetailFragment extends ListFragment<AnswerEntity, NormalLi
|
||||
if (data != null)
|
||||
postAnswerSuccess(data.getStringExtra(EntranceUtils.KEY_ANSWER_ID));
|
||||
}
|
||||
} else if (requestCode == QUESTIONS_EDIT_REQUEST && resultCode == Activity.RESULT_OK) {
|
||||
if (data != null && data.getParcelableExtra(QuestionsDetailEntity.TAG) != null) {
|
||||
mQuestionsDetailEntity = data.getParcelableExtra(QuestionsDetailEntity.TAG);
|
||||
mAdapter.setQuestionsEntity(mQuestionsDetailEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -307,7 +314,9 @@ public class QuestionsDetailFragment extends ListFragment<AnswerEntity, NormalLi
|
||||
item1.setOnClickListener(v -> {
|
||||
dialog.dismiss();
|
||||
if ("编辑".equals(title.getText().toString())) {
|
||||
// 跳转编辑问题页面
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable(QuestionsDetailEntity.TAG, mQuestionsDetailEntity);
|
||||
NormalActivity.startFragmentForResult(getContext(), QuestionsEditFragment.class, bundle, QUESTIONS_EDIT_REQUEST);
|
||||
} else {
|
||||
// 跳转意见反馈
|
||||
SuggestionActivity.startSuggestionActivity(getContext(), 1, "report", "问题举报:");
|
||||
@ -369,8 +378,6 @@ public class QuestionsDetailFragment extends ListFragment<AnswerEntity, NormalLi
|
||||
mQuestionConcern.setIcon(R.drawable.menu_ic_question_concern_unselect);
|
||||
}
|
||||
response.setId(mQuestionsId);
|
||||
List<String> tags = response.getTags();
|
||||
tags.add(0, response.getCommunityName()); // 原来的[社区名字]移到问题标题的顶部,标签的左侧
|
||||
mQuestionsDetailEntity = response;
|
||||
mAdapter.setQuestionsEntity(response);
|
||||
mListViewModel.load(LoadType.REFRESH);
|
||||
|
||||
@ -55,7 +55,7 @@ public class QuestionsInviteAdapter extends ListAdapter<InviteEntity> {
|
||||
return new FooterViewHolder(view, null, mListClickListener);
|
||||
case ItemViewType.ITEM_BODY:
|
||||
view = mLayoutInflater.inflate(R.layout.questionsinvite_item, parent, false);
|
||||
return new QuestionsInviteViewHolder(view, mEntityList, mListClickListener);
|
||||
return new QuestionsInviteViewHolder(view, mListClickListener);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@ -85,7 +85,7 @@ public class QuestionsInviteAdapter extends ListAdapter<InviteEntity> {
|
||||
if (id.equals(inviteEntity.getId())) {
|
||||
MeEntity me = inviteEntity.getMe();
|
||||
if (me == null) me = new MeEntity();
|
||||
me.setExpertInvited(true);
|
||||
me.setUserInvite(true);
|
||||
inviteEntity.setMe(me);
|
||||
notifyDataSetChanged();
|
||||
break;
|
||||
|
||||
@ -10,6 +10,7 @@ import android.view.View;
|
||||
import com.gh.common.util.AskErrorResponseUtils;
|
||||
import com.gh.common.util.CheckLoginUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.UrlFilterUtils;
|
||||
import com.gh.common.view.VerticalItemDecoration;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.ask.entity.InviteEntity;
|
||||
@ -78,8 +79,14 @@ public class QuestionsInviteFragment extends ListFragment<InviteEntity, NormalLi
|
||||
|
||||
@Override
|
||||
public Observable<List<InviteEntity>> provideDataObservable(int offset) {
|
||||
return RetrofitManager.getInstance(getContext()).getApi().getInviteExperts(mQuestionsDetailEntity.getId()
|
||||
, TextUtils.isEmpty(mSearchKey) ? offset : offset + 10);
|
||||
if (TextUtils.isEmpty(mSearchKey)) {
|
||||
return RetrofitManager.getInstance(getContext()).getApi().getInviteExperts(mQuestionsDetailEntity.getId(), offset);
|
||||
} else {
|
||||
return RetrofitManager.getInstance(getContext()).getApi().getSearchInviteExperts(mQuestionsDetailEntity.getId()
|
||||
, UrlFilterUtils.getFilterQuery("keyword", mSearchKey), offset);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -91,10 +98,9 @@ public class QuestionsInviteFragment extends ListFragment<InviteEntity, NormalLi
|
||||
public void onListClick(View view, int position, Object data) {
|
||||
switch (view.getId()) {
|
||||
case R.id.questionsinvite_item_invite:
|
||||
List<InviteEntity> mEntityList = (List<InviteEntity>) data;
|
||||
InviteEntity inviteEntity = mEntityList.get(position - ListAdapter.TOP_ITEM_COUNT);
|
||||
InviteEntity inviteEntity = (InviteEntity) data;
|
||||
MeEntity me = inviteEntity.getMe();
|
||||
if (me == null || !me.isExpertInvited())
|
||||
if (me == null || !me.isUserInvite())
|
||||
CheckLoginUtils.checkLogin(getContext(), () -> {
|
||||
postInvite(inviteEntity.getId());
|
||||
});
|
||||
@ -110,10 +116,10 @@ public class QuestionsInviteFragment extends ListFragment<InviteEntity, NormalLi
|
||||
}
|
||||
}
|
||||
|
||||
private void postInvite(String expertId) {
|
||||
private void postInvite(String userId) {
|
||||
JSONObject object = new JSONObject();
|
||||
try {
|
||||
object.put("expert_id", expertId);
|
||||
object.put("user_id", userId);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -126,7 +132,7 @@ public class QuestionsInviteFragment extends ListFragment<InviteEntity, NormalLi
|
||||
@Override
|
||||
public void onResponse(ResponseBody response) {
|
||||
super.onResponse(response);
|
||||
mAdapter.inviteSuccess(expertId);
|
||||
mAdapter.inviteSuccess(userId);
|
||||
toast(R.string.invite_success);
|
||||
}
|
||||
|
||||
|
||||
@ -13,7 +13,6 @@ import com.gh.common.util.ImageUtils;
|
||||
import com.gh.gamecenter.R;
|
||||
import com.gh.gamecenter.ask.entity.InviteEntity;
|
||||
import com.gh.gamecenter.ask.entity.MeEntity;
|
||||
import com.gh.gamecenter.entity.UserEntity;
|
||||
|
||||
import butterknife.BindView;
|
||||
|
||||
@ -21,7 +20,7 @@ import butterknife.BindView;
|
||||
* Created by khy on 7/12/17.
|
||||
*/
|
||||
|
||||
public class QuestionsInviteViewHolder extends BaseRecyclerViewHolder {
|
||||
public class QuestionsInviteViewHolder extends BaseRecyclerViewHolder<InviteEntity> {
|
||||
@BindView(R.id.questionsinvite_item_icon)
|
||||
public SimpleDraweeView mIcon;
|
||||
@BindView(R.id.questionsinvite_item_name)
|
||||
@ -33,21 +32,18 @@ public class QuestionsInviteViewHolder extends BaseRecyclerViewHolder {
|
||||
@BindView(R.id.questionsinvite_item_invite)
|
||||
public TextView mInvite;
|
||||
|
||||
public QuestionsInviteViewHolder(View itemView, Object data, OnListClickListener listClickListener) {
|
||||
super(itemView, data, listClickListener);
|
||||
public QuestionsInviteViewHolder(View itemView, OnListClickListener listClickListener) {
|
||||
super(itemView, listClickListener);
|
||||
mInvite.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public void initQuestionsInviteViewHolder(Context context, InviteEntity entity) {
|
||||
|
||||
UserEntity user = entity.getUser();
|
||||
if (user != null) {
|
||||
ImageUtils.Companion.display(mIcon, user.getIcon());
|
||||
mName.setText(user.getName());
|
||||
}
|
||||
setClickData(entity);
|
||||
ImageUtils.Companion.display(mIcon, entity.getIcon());
|
||||
mName.setText(entity.getName());
|
||||
|
||||
MeEntity me = entity.getMe();
|
||||
if (me != null && me.isExpertInvited()) {
|
||||
if (me != null && me.isUserInvite()) {
|
||||
mInvite.setTextColor(ContextCompat.getColor(context, R.color.content));
|
||||
mInvite.setText(R.string.invited);
|
||||
mInvite.setBackgroundResource(R.drawable.border_suggest_bg);
|
||||
|
||||
@ -11,6 +11,7 @@ import android.view.View;
|
||||
import com.gh.common.util.AskLogUtils;
|
||||
import com.gh.common.util.CheckLoginUtils;
|
||||
import com.gh.common.util.EntranceUtils;
|
||||
import com.gh.common.util.UrlFilterUtils;
|
||||
import com.gh.common.view.VerticalItemDecoration;
|
||||
import com.gh.gamecenter.NormalActivity;
|
||||
import com.gh.gamecenter.R;
|
||||
@ -86,7 +87,8 @@ public class AskSearchFragment extends ListFragment<AskSearchEntity, NormalListV
|
||||
@Override
|
||||
public Observable<List<AskSearchEntity>> provideDataObservable(int offset) {
|
||||
if (TextUtils.isEmpty(mSearchKey)) return null;
|
||||
return RetrofitManager.getInstance(getContext()).getApi().getAskSearch(UserManager.getInstance().getCommunityId(getContext()), mSearchKey, offset);
|
||||
return RetrofitManager.getInstance(getContext()).getApi().getAskSearch(UserManager.getInstance().getCommunityId(getContext())
|
||||
, UrlFilterUtils.getFilterQuery("keyword", mSearchKey), offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -44,9 +44,7 @@ public class KaiFuWrapperFragment extends NormalFragment {
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
setNavigationTitle(R.string.title_kaifu);
|
||||
initMenu(R.menu.menu_button);
|
||||
mResetMenuItem = getItemMenu(R.id.menu_button);
|
||||
createMenu();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -54,12 +52,11 @@ public class KaiFuWrapperFragment extends NormalFragment {
|
||||
super.onCreate(savedInstanceState);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
if (mResetMenuItem != null) {
|
||||
mResetMenuItem.setTitle(R.string.menu_text_reset);
|
||||
mResetMenuItem.setVisible(false);
|
||||
final TextView textView = mResetMenuItem.getActionView().findViewById(R.id.tv_menu_button);
|
||||
textView.setText(R.string.menu_text_reset);
|
||||
}
|
||||
if (mResetMenuItem == null) createMenu();
|
||||
mResetMenuItem.setTitle(R.string.menu_text_reset);
|
||||
mResetMenuItem.setVisible(false);
|
||||
final TextView textView = mResetMenuItem.getActionView().findViewById(R.id.tv_menu_button);
|
||||
textView.setText(R.string.menu_text_reset);
|
||||
|
||||
|
||||
FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
|
||||
@ -68,7 +65,15 @@ public class KaiFuWrapperFragment extends NormalFragment {
|
||||
fragmentTransaction.commit();
|
||||
}
|
||||
|
||||
private void createMenu() {
|
||||
if (mResetMenuItem != null) return;
|
||||
setNavigationTitle(R.string.title_kaifu);
|
||||
initMenu(R.menu.menu_button);
|
||||
mResetMenuItem = getItemMenu(R.id.menu_button);
|
||||
}
|
||||
|
||||
private void resetFragment() {
|
||||
if (mGameKaiFuFragment == null) return;
|
||||
mKaiFuFragment.setCurPage(mGameKaiFuFragment.getCurPage());
|
||||
|
||||
mResetMenuItem.setVisible(false);
|
||||
|
||||
@ -8,6 +8,7 @@ import com.gh.gamecenter.ask.entity.AskTagGroupsEntity;
|
||||
import com.gh.gamecenter.ask.entity.InviteEntity;
|
||||
import com.gh.gamecenter.ask.entity.Questions;
|
||||
import com.gh.gamecenter.ask.entity.QuestionsDetailEntity;
|
||||
import com.gh.gamecenter.ask.entity.QuestionsIndexEntity;
|
||||
import com.gh.gamecenter.entity.AppEntity;
|
||||
import com.gh.gamecenter.entity.CommentEntity;
|
||||
import com.gh.gamecenter.entity.CommentnumEntity;
|
||||
@ -302,7 +303,7 @@ public interface ApiService {
|
||||
/**
|
||||
* 获取开服表数据
|
||||
*/
|
||||
@GET("/games/servers")
|
||||
@GET("games/servers")
|
||||
Observable<List<GameEntity>> getKaiFuData(@Query("type") String type, @Query("day") String day,
|
||||
@Query("offset") int offset, @Query("limit") int limit);
|
||||
|
||||
@ -742,17 +743,30 @@ public interface ApiService {
|
||||
@GET("questions/{question_id}/experts")
|
||||
Observable<List<InviteEntity>> getInviteExperts(@Path("question_id") String questionsId, @Query("offset") int offset);
|
||||
|
||||
/**
|
||||
* 搜索社区达人列表
|
||||
*/
|
||||
@GET("questions/{question_id}/experts:search")
|
||||
Observable<List<InviteEntity>> getSearchInviteExperts(@Path("question_id") String questionId,
|
||||
@Query("filter") String filter, @Query("offset") int offset);
|
||||
|
||||
/**
|
||||
* 邀请达人回答社区问题
|
||||
*/
|
||||
@POST("questions/{question_id}:invite")
|
||||
Observable<ResponseBody> postInvite(@Body RequestBody body, @Path("questions_id") String questionsId);
|
||||
Observable<ResponseBody> postInvite(@Body RequestBody body, @Path("question_id") String questionId);
|
||||
|
||||
/**
|
||||
* 搜索社区问题
|
||||
*/
|
||||
@GET("communities/{community_id}/questions:search")
|
||||
Observable<List<AskSearchEntity>> getAskSearch(@Path("community_id") String communityId, @Query("keyword") String keyword, @Query("offset") int offset);
|
||||
@GET("communities/{community_id}:search")
|
||||
Observable<List<AskSearchEntity>> getAskSearch(@Path("community_id") String communityId, @Query("filter") String filter, @Query("offset") int offset);
|
||||
|
||||
/**
|
||||
* 搜索社区问题(编辑问题索引)
|
||||
*/
|
||||
@GET("communities/{community_id}/questions:search?view=digest")
|
||||
Observable<List<QuestionsIndexEntity>> getAskSearchByTitle(@Path("community_id") String communityId, @Query("filter") String filter, @Query("offset") int offset);
|
||||
|
||||
/**
|
||||
* 用户对社区进行投票
|
||||
@ -784,12 +798,24 @@ public interface ApiService {
|
||||
@GET("communities/{community_id}/tags")
|
||||
Observable<List<String>> getCommunitiesTags(@Path("community_id") String communityId);
|
||||
|
||||
/**
|
||||
* 根据问题标题匹配标签问题标签
|
||||
*/
|
||||
@GET("communities/{community_id}/tags")
|
||||
Observable<List<String>> getQuestionTagsByTitle(@Path("community_id") String communityId, @Query("filter") String filter);
|
||||
|
||||
/**
|
||||
* 添加社区问题
|
||||
*/
|
||||
@POST("communities/{community_id}/questions")
|
||||
Observable<ResponseBody> postQuestions(@Body RequestBody body, @Path("community_id") String communityId);
|
||||
|
||||
/**
|
||||
* 添加社区问题
|
||||
*/
|
||||
@POST("questions/{question_id}")
|
||||
Observable<ResponseBody> patchQuestions(@Body RequestBody body, @Path("question_id") String questionId);
|
||||
|
||||
/**
|
||||
* 对社区回答点赞
|
||||
*/
|
||||
|
||||
@ -9,11 +9,13 @@
|
||||
|
||||
<com.google.android.flexbox.FlexboxLayout
|
||||
android:id = "@+id/questionsdetail_item_tag"
|
||||
android:layout_width = "match_parent"
|
||||
android:layout_width = "wrap_content"
|
||||
android:layout_height = "wrap_content"
|
||||
android:layout_marginLeft = "20dp"
|
||||
android:layout_marginRight = "20dp"
|
||||
android:orientation = "horizontal" />
|
||||
android:orientation = "horizontal"
|
||||
android:paddingLeft = "20dp"
|
||||
android:paddingRight = "20dp" >
|
||||
|
||||
</com.google.android.flexbox.FlexboxLayout >
|
||||
|
||||
<TextView
|
||||
android:id = "@+id/questionsdetail_item_title"
|
||||
|
||||
@ -21,7 +21,7 @@ org.gradle.parallel=true
|
||||
channel_file=channel.txt
|
||||
|
||||
# tinker patch version_name
|
||||
PATCH_VERSION_NAME=3.1.1
|
||||
PATCH_VERSION_NAME=3.2
|
||||
|
||||
# Third-party keys
|
||||
DEBUG_UMENG_APPKEY=58e5b0b9c62dca35a00005e6
|
||||
@ -50,19 +50,19 @@ USERSEA_APP_ID=2017101012
|
||||
USERSEA_APP_SECRET=597aa2b463f5770013146675
|
||||
|
||||
# hosts
|
||||
DEV_API_HOST=https\://dev.api.ghzs666.com/v3d1/
|
||||
DEV_LIBAO_HOST=https\://dev.api.ghzs666.com/v3d1/
|
||||
DEV_MESSAGE_HOST=https\://dev.api.ghzs666.com/v3d1/
|
||||
DEV_USER_HOST=https\://dev.api.ghzs666.com/v3d1/
|
||||
DEV_COMMENT_HOST=https\://dev.api.ghzs666.com/v3d1/
|
||||
DEV_API_HOST=https\://dev.api.ghzs666.com/v3d2/
|
||||
DEV_LIBAO_HOST=https\://dev.api.ghzs666.com/v3d2/
|
||||
DEV_MESSAGE_HOST=https\://dev.api.ghzs666.com/v3d2/
|
||||
DEV_USER_HOST=https\://dev.api.ghzs666.com/v3d2/
|
||||
DEV_COMMENT_HOST=https\://dev.api.ghzs666.com/v3d2/
|
||||
DEV_DATA_HOST=http\://data.ghzs666.com/
|
||||
DEV_USERSEA_HOST=https\://dev.usersea.ghzs666.com/v1d1/
|
||||
|
||||
API_HOST=https\://api.ghzs.com/v3d1/
|
||||
LIBAO_HOST=https\://api.ghzs.com/v3d1/
|
||||
MESSAGE_HOST=https\://api.ghzs.com/v3d1/
|
||||
USER_HOST=https\://api.ghzs.com/v3d1/
|
||||
COMMENT_HOST=https\://api.ghzs.com/v3d1/
|
||||
API_HOST=https\://api.ghzs.com/v3d2/
|
||||
LIBAO_HOST=https\://api.ghzs.com/v3d2/
|
||||
MESSAGE_HOST=https\://api.ghzs.com/v3d2/
|
||||
USER_HOST=https\://api.ghzs.com/v3d2/
|
||||
COMMENT_HOST=https\://api.ghzs.com/v3d2/
|
||||
DATA_HOST=http\://data.ghzs666.com/
|
||||
USERSEA_HOST=https\://usersea.ghzs.com/v1d1/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user