issues测试以及整理

This commit is contained in:
kehaoyuan
2018-04-02 17:51:29 +08:00
parent 414b5b3861
commit c39ba2e17e
16 changed files with 120 additions and 16 deletions

View File

@ -32,6 +32,15 @@ public class BindingAdapters {
}
}
@BindingAdapter("messageUnread")
public static void setMessageUnread(TextView view, int unreadCount) {
if (unreadCount < 100) {
view.setText(String.valueOf(unreadCount));
} else {
view.setText("99+");
}
}
@BindingAdapter("messageCommand")
public static void setMessageCommand(TextView view, String command) {
switch (command) {

View File

@ -0,0 +1,53 @@
package com.gh.common.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;
import com.gh.common.util.DisplayUtils;
/**
* Created by khy on 2/04/18.
*/
public class LimitHeightScrollView extends ScrollView {
private int mLimitHeight;
public LimitHeightScrollView(Context context) {
super(context);
}
public LimitHeightScrollView(Context context, AttributeSet attrs) {
super(context, attrs);
mLimitHeight = DisplayUtils.dip2px(getContext(), 240);
}
public LimitHeightScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int heightMode = MeasureSpec.getMode(heightMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
if (heightMode == MeasureSpec.EXACTLY) {
heightSize = heightSize <= mLimitHeight ? heightSize
: mLimitHeight;
}
if (heightMode == MeasureSpec.UNSPECIFIED) {
heightSize = heightSize <= mLimitHeight ? heightSize
: mLimitHeight;
}
if (heightMode == MeasureSpec.AT_MOST) {
heightSize = heightSize <= mLimitHeight ? heightSize
: mLimitHeight;
}
int maxHeightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize,
heightMode);
super.onMeasure(widthMeasureSpec, maxHeightMeasureSpec);
}
}

View File

@ -273,6 +273,12 @@ public class SuggestionActivity extends BaseActivity implements SuggestTypeAdapt
showHintDialog(service);
}
break;
case "report" :
List<String> report = typeEntity.getReport();
if (report != null && report.size() > 0) {
showHintDialog(report);
}
break;
}
}
}

View File

@ -13,12 +13,15 @@ import com.gh.common.util.EntranceUtils;
import com.gh.gamecenter.NormalActivity;
import com.gh.gamecenter.R;
import com.gh.gamecenter.ask.entity.AnswerEntity;
import com.gh.gamecenter.ask.entity.AskSubjectEntity;
import com.gh.gamecenter.ask.entity.Questions;
import com.gh.gamecenter.ask.questionsdetail.QuestionsDetailFragment;
import com.gh.gamecenter.baselist.ListFragment;
import com.gh.gamecenter.baselist.LoadStatus;
import com.gh.gamecenter.baselist.LoadType;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
@ -175,6 +178,8 @@ public class AskQuestionsRecommendsFragment extends ListFragment<AnswerEntity, A
@Override
public void onStartProgress() {
List<AskSubjectEntity> value = mListViewModel.getSubjectLiveData().getValue();
if (value == null || value.size() <= 1) return;
mBaseHandler.removeMessages(0);
Message message = new Message();
message.what = 0;

View File

@ -28,6 +28,11 @@ public class QuestionsEditIndexAdapter extends ListAdapter<QuestionsIndexEntity>
mListClickListener = listClickListener;
}
@Override
protected boolean areItemsTheSame(QuestionsIndexEntity oldItem, QuestionsIndexEntity newItem) {
return oldItem != null && oldItem.getId().equals(newItem.getId());
}
private String replayKeyword(String title) {
if (TextUtils.isEmpty(mSearchKey)) return title;
return title.replaceAll(mSearchKey, getHtmlKeyword());

View File

@ -16,6 +16,7 @@ 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;
import com.gh.gamecenter.baselist.LoadStatus;
import com.gh.gamecenter.baselist.LoadType;
import com.gh.gamecenter.baselist.NormalListViewModel;
import com.gh.gamecenter.manager.UserManager;
@ -102,6 +103,7 @@ public class QuestionsEditIndexFragment extends ListFragment<QuestionsIndexEntit
}
public void search(String key) {
mAdapter.loadChange(LoadStatus.REFRESH);
mSearchKey = key;
mAdapter.setSearchKey(key);
if (mListViewModel != null) mListViewModel.load(LoadType.REFRESH);

View File

@ -124,7 +124,7 @@ public class QuestionsDetailFragment extends ListFragment<AnswerEntity, NormalLi
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setNavigationTitle("问题详情");
setNavigationTitle("光环助手 - 问题详情");
initMenu(R.menu.menu_questions_detail);
mQuestionConcern = getItemMenu(R.id.menu_question_concern);
}

View File

@ -1,5 +1,7 @@
package com.gh.gamecenter.ask.questionsdetail.invite;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.AppBarLayout;
@ -8,6 +10,7 @@ import android.support.v4.app.FragmentTransaction;
import android.text.TextUtils;
import android.view.MenuItem;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.TextView;
@ -50,6 +53,15 @@ public class QuestionsInviteWrapperFragment extends NormalFragment {
return R.layout.fragment_invite;
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
if (context instanceof Activity) {
((Activity) context).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
}
}
@Override
public void onMenuItemClick(MenuItem menuItem) {
if (menuItem.getItemId() == R.id.menu_answer_post) {

View File

@ -12,4 +12,6 @@ class SuggestionTypeEntity {
var plugin: List<String>? = null
var service: List<String>? = null
var report: List<String>? = null
}

View File

@ -872,7 +872,7 @@ public interface ApiService {
/**
* 取消关注问题
*/
@POST("users/{user_id}/follows/questions/{question_id}")
@DELETE("users/{user_id}/follows/questions/{question_id}")
Observable<ResponseBody> deleteConcernQuestions(@Path("user_id") String user_id, @Path("question_id") String questionsId);