光环助手V3.6 RELEASE(20181224-1145)测试问题汇总(前端)(7.8.16)https://gitlab.ghzhushou.com/pm/halo-app-issues/issues/419

This commit is contained in:
kehaoyuan
2018-12-25 15:02:10 +08:00
parent 974d4fcefa
commit 95acc64e42
6 changed files with 75 additions and 20 deletions

View File

@ -0,0 +1,28 @@
package com.gh.gamecenter.eventbus;
public class EBUserFollow {
private String userId;
private boolean follow;
public EBUserFollow(String userId, boolean isFollow) {
this.userId = userId;
this.follow = isFollow;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public boolean isFollow() {
return follow;
}
public void setFollow(boolean follow) {
this.follow = follow;
}
}

View File

@ -9,6 +9,7 @@ import com.gh.gamecenter.baselist.ListViewModel
import com.gh.gamecenter.baselist.LoadType
import com.gh.gamecenter.entity.PersonalEntity
import com.gh.gamecenter.entity.PersonalHistoryEntity
import com.gh.gamecenter.eventbus.EBUserFollow
import com.gh.gamecenter.retrofit.Response
import com.gh.gamecenter.retrofit.RetrofitManager
import com.halo.assistant.HaloApp
@ -17,6 +18,7 @@ import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import okhttp3.ResponseBody
import org.greenrobot.eventbus.EventBus
import retrofit2.HttpException
class PersonalHomeViewModel(application: Application,
@ -76,13 +78,10 @@ class PersonalHomeViewModel(application: Application,
override fun onResponse(response: ResponseBody?) {
super.onResponse(response)
if (isFollow) {
// 关注成功
callback(true)
Utils.toast(getApplication(), R.string.concern_success)
} else {
// 取消关注成功
callback(false)
Utils.toast(getApplication(), R.string.concern_success) // 关注成功
}
callback(isFollow)
EventBus.getDefault().post(EBUserFollow(userId, isFollow))
}
override fun onFailure(e: HttpException?) {

View File

@ -67,26 +67,13 @@ public class QuestionsDetailAdapter extends ListAdapter<AnswerEntity> {
@Override
protected void setListData(List<AnswerEntity> updateData) {
if (mQuestionsDetailEntity == null) {
notifyDataSetChanged();
return;
}
int oldSize = TOP_ITEM_COUNT;
if (updateData != null && updateData.size() == 0) {
mIsNoneData = true;
} else {
mIsNoneData = false;
}
if (mEntityList != null && mEntityList.size() > 0) {
oldSize += mEntityList.size();
}
mEntityList = new ArrayList<>(updateData);
if (oldSize == 0 || oldSize > updateData.size()) {
notifyDataSetChanged();
} else {
notifyItemRangeInserted(oldSize, updateData.size() + TOP_ITEM_COUNT - oldSize);
}
notifyDataSetChanged();
}
@Override

View File

@ -21,6 +21,7 @@ import com.gh.gamecenter.baselist.ListFragment;
import com.gh.gamecenter.baselist.LoadStatus;
import com.gh.gamecenter.baselist.LoadType;
import com.gh.gamecenter.eventbus.EBReuse;
import com.gh.gamecenter.eventbus.EBUserFollow;
import com.gh.gamecenter.fragment.MainWrapperFragment;
import com.gh.gamecenter.manager.UserManager;
import com.gh.gamecenter.qa.AskFragment;
@ -238,6 +239,13 @@ public class AskQuestionsRecommendsFragment extends ListFragment<RecommendItemDa
}
}
@Subscribe(threadMode = ThreadMode.MAIN)
public void onEventMainThread(EBUserFollow follow) {
if (follow != null && follow.isFollow()) {
mListViewModel.filterFollowedData(follow.getUserId());
}
}
@Override
protected RecyclerView.ItemDecoration getItemDecoration() {
return new VerticalItemDecoration(getContext(), 8, false);

View File

@ -231,6 +231,26 @@ public class AskQuestionsRecommendsViewModel extends BaseListViewModel<Recommend
});
}
void filterFollowedData(String userId) {
if (!TextUtils.isEmpty(userId)) {
List<RecommendItemData> value = mLiveData.getValue();
if (value != null) {
for (RecommendItemData data : value) {
List<SuggestedFollowEntity> followList = data.getFollowList();
if (followList != null) {
for (SuggestedFollowEntity followEntity : followList) {
if (userId.equals(followEntity.getId())) {
followList.remove(followEntity);
mLiveData.postValue(value);
return;
}
}
}
}
}
}
}
private void loadData(boolean isUp, String sequenceId, LoadType loadType) {
if (mIsLoading && !TextUtils.isEmpty(sequenceId) && !isUp) return;
if (!isUp && mLiveData.getValue() != null && mLiveData.getValue().size() > 0) {
@ -369,6 +389,7 @@ public class AskQuestionsRecommendsViewModel extends BaseListViewModel<Recommend
} else {
mLoadStatusLiveData.postValue(LoadStatus.INIT_LOADED);
}
if (isUp) mRefreshCount.postValue(size);
} else if (isUp) {
mRefreshCount.postValue(size);
} else {

View File

@ -5,6 +5,7 @@ import android.graphics.Color
import android.support.v4.content.ContextCompat
import android.view.ViewGroup
import com.gh.common.util.MtaHelper
import com.gh.gamecenter.PersonalHomeActivity
import com.gh.gamecenter.R
import com.gh.gamecenter.databinding.AskRecommendsConcernListItemBinding
import com.gh.gamecenter.manager.UserManager
@ -51,6 +52,17 @@ class RecommendConcernAdapter(context: Context,
})
}
}
holder.binding.concernUserIconContainer.setOnClickListener {
skipPersonalHome(entity)
}
holder.binding.concernUserName.setOnClickListener {
skipPersonalHome(entity)
}
}
private fun skipPersonalHome(entity: SuggestedFollowEntity) {
PersonalHomeActivity.startTargetActivity(mContext, entity.id, "", "问答-精选-推荐关注")
}
fun updateData(list: List<SuggestedFollowEntity>) {