1.进房飘屏文案修改

2.删除AppBarLayoutBehavior日志代码
This commit is contained in:
huangjian
2020-12-03 16:16:15 +08:00
parent bdcc992886
commit 91aefefa27
3 changed files with 22 additions and 24 deletions

View File

@@ -25,6 +25,7 @@ import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.AppCompatImageView;
import androidx.databinding.DataBindingUtil; import androidx.databinding.DataBindingUtil;
@@ -51,6 +52,7 @@ import com.yizhuan.erban.avroom.presenter.HomePartyPresenter;
import com.yizhuan.erban.avroom.widget.GiftV2View; import com.yizhuan.erban.avroom.widget.GiftV2View;
import com.yizhuan.erban.avroom.widget.MessageView; import com.yizhuan.erban.avroom.widget.MessageView;
import com.yizhuan.erban.base.BaseMvpActivity; import com.yizhuan.erban.base.BaseMvpActivity;
import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
import com.yizhuan.erban.common.widget.dialog.DialogManager; import com.yizhuan.erban.common.widget.dialog.DialogManager;
import com.yizhuan.erban.databinding.FragmentChatroomGameMainBinding; import com.yizhuan.erban.databinding.FragmentChatroomGameMainBinding;
import com.yizhuan.erban.friend.view.SelectFriendActivity; import com.yizhuan.erban.friend.view.SelectFriendActivity;
@@ -104,11 +106,13 @@ import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import cn.sharesdk.framework.Platform; import cn.sharesdk.framework.Platform;
import io.reactivex.Observable; import io.reactivex.Observable;
import io.reactivex.Single;
import io.reactivex.SingleObserver; import io.reactivex.SingleObserver;
import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposable;
@@ -1071,19 +1075,29 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
private void showMemberInNotify(ChatRoomMessage chatRoomMessage) { private void showMemberInNotify(ChatRoomMessage chatRoomMessage) {
ChatRoomNotificationAttachment attachment = (ChatRoomNotificationAttachment) chatRoomMessage.getAttachment(); ChatRoomNotificationAttachment attachment = (ChatRoomNotificationAttachment) chatRoomMessage.getAttachment();
Map<String, Object> remoteExtension = chatRoomMessage.getRemoteExtension();
int experLevelSeq = (int) chatRoomMessage.getRemoteExtension().get("experLevelSeq"); int experLevelSeq = (int) remoteExtension.get("experLevelSeq");
List<String> targetNicks = attachment.getTargetNicks(); List<String> targetNicks = attachment.getTargetNicks();
if (ListUtils.isListEmpty(targetNicks)) { if (ListUtils.isListEmpty(targetNicks)) {
return; return;
} }
int fromType = (int) remoteExtension.get("fromType");
String fromNick = (String) remoteExtension.get("fromNick");
SuperTextView textView = (SuperTextView) LayoutInflater.from(mContext).inflate(R.layout.layout_member_in_notify, null); SuperTextView textView = (SuperTextView) LayoutInflater.from(mContext).inflate(R.layout.layout_member_in_notify, null);
// 内容 // 内容
MessageView.SpannableBuilder text = new MessageView.SpannableBuilder(textView) MessageView.SpannableBuilder text = new MessageView.SpannableBuilder(textView)
.append(targetNicks.get(0), new ForegroundColorSpan(Color.WHITE)) .append(targetNicks.get(0), new ForegroundColorSpan(Color.WHITE));
.append("进入了房间", new ForegroundColorSpan(Color.WHITE)); String enterText = " 进入了房间 ";
if (fromType == AVRoomActivity.FROM_TYPE_RECOMMEND) {
enterText = " 根据首页推荐进房";
}
if (fromType == AVRoomActivity.FROM_TYPE_USER) {
enterText = " 跟随 " + fromNick + "进房";
}
text.append(enterText, new ForegroundColorSpan(Color.WHITE));
textView.setText(text.build()); textView.setText(text.build());
playMemberInAnim("" + targetNicks.get(0) + "进入了房间", memberInSvgaPath(experLevelSeq)); playMemberInAnim("" + targetNicks.get(0) + "" + enterText, memberInSvgaPath(experLevelSeq));
} }
private String memberInSvgaPath(int level) { private String memberInSvgaPath(int level) {
@@ -1100,7 +1114,7 @@ public class HomePartyFragment extends AbsRoomFragment implements View.OnClickLi
path = "svga/svga_member_in_lv70.svga"; path = "svga/svga_member_in_lv70.svga";
} else if (level >= 80 && level <= 89) { } else if (level >= 80 && level <= 89) {
path = "svga/svga_member_in_lv80.svga"; path = "svga/svga_member_in_lv80.svga";
} else if (level >= 90 && level <= 100) { } else if (level >= 90) {
path = "svga/svga_member_in_lv90.svga"; path = "svga/svga_member_in_lv90.svga";
} }
return path; return path;

View File

@@ -2,7 +2,6 @@ package com.yizhuan.erban.ui.widget;
import android.content.Context; import android.content.Context;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.OverScroller; import android.widget.OverScroller;
@@ -28,7 +27,6 @@ public class AppBarLayoutBehavior extends AppBarLayout.Behavior {
@Override @Override
public boolean onInterceptTouchEvent(@NotNull CoordinatorLayout parent, AppBarLayout child, MotionEvent ev) { public boolean onInterceptTouchEvent(@NotNull CoordinatorLayout parent, AppBarLayout child, MotionEvent ev) {
LogUtil.d(TAG, "onInterceptTouchEvent:" + child.getTotalScrollRange());
shouldBlockNestedScroll = isFlinging; shouldBlockNestedScroll = isFlinging;
switch (ev.getActionMasked()) { switch (ev.getActionMasked()) {
case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_DOWN:
@@ -60,7 +58,6 @@ public class AppBarLayoutBehavior extends AppBarLayout.Behavior {
return null; return null;
} }
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
e.printStackTrace();
// 可能是28及以上版本 // 可能是28及以上版本
Class<?> headerBehaviorType = superclass.getSuperclass().getSuperclass(); Class<?> headerBehaviorType = superclass.getSuperclass().getSuperclass();
if (headerBehaviorType != null) { if (headerBehaviorType != null) {
@@ -90,7 +87,6 @@ public class AppBarLayoutBehavior extends AppBarLayout.Behavior {
return null; return null;
} }
} catch (NoSuchFieldException e) { } catch (NoSuchFieldException e) {
e.printStackTrace();
// 可能是28及以上版本 // 可能是28及以上版本
Class<?> headerBehaviorType = superclass.getSuperclass().getSuperclass(); Class<?> headerBehaviorType = superclass.getSuperclass().getSuperclass();
if (headerBehaviorType != null) { if (headerBehaviorType != null) {
@@ -122,7 +118,6 @@ public class AppBarLayoutBehavior extends AppBarLayout.Behavior {
} }
OverScroller overScroller = (OverScroller) scrollerField.get(this); OverScroller overScroller = (OverScroller) scrollerField.get(this);
if (flingRunnable != null) { if (flingRunnable != null) {
LogUtil.d(TAG, "存在flingRunnable");
appBarLayout.removeCallbacks(flingRunnable); appBarLayout.removeCallbacks(flingRunnable);
flingRunnableField.set(this, null); flingRunnableField.set(this, null);
} }
@@ -138,7 +133,6 @@ public class AppBarLayoutBehavior extends AppBarLayout.Behavior {
public boolean onStartNestedScroll(@NotNull CoordinatorLayout parent, @NotNull AppBarLayout child, public boolean onStartNestedScroll(@NotNull CoordinatorLayout parent, @NotNull AppBarLayout child,
@NotNull View directTargetChild, View target, @NotNull View directTargetChild, View target,
int nestedScrollAxes, int type) { int nestedScrollAxes, int type) {
LogUtil.d(TAG, "onStartNestedScroll");
stopAppbarLayoutFling(child); stopAppbarLayoutFling(child);
return super.onStartNestedScroll(parent, child, directTargetChild, target, return super.onStartNestedScroll(parent, child, directTargetChild, target,
nestedScrollAxes, type); nestedScrollAxes, type);
@@ -148,8 +142,6 @@ public class AppBarLayoutBehavior extends AppBarLayout.Behavior {
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, public void onNestedPreScroll(CoordinatorLayout coordinatorLayout,
AppBarLayout child, View target, AppBarLayout child, View target,
int dx, int dy, int[] consumed, int type) { int dx, int dy, int[] consumed, int type) {
LogUtil.d(TAG, "onNestedPreScroll:" + child.getTotalScrollRange()
+ " ,dx:" + dx + " ,dy:" + dy + " ,type:" + type);
//type返回1时表示当前target处于非touch的滑动 //type返回1时表示当前target处于非touch的滑动
//该bug的引起是因为appbar在滑动时CoordinatorLayout内的实现NestedScrollingChild2接口的滑动 //该bug的引起是因为appbar在滑动时CoordinatorLayout内的实现NestedScrollingChild2接口的滑动
//子类还未结束其自身的fling //子类还未结束其自身的fling
@@ -166,9 +158,6 @@ public class AppBarLayoutBehavior extends AppBarLayout.Behavior {
public void onNestedScroll(@NotNull CoordinatorLayout coordinatorLayout, AppBarLayout child, public void onNestedScroll(@NotNull CoordinatorLayout coordinatorLayout, AppBarLayout child,
View target, int dxConsumed, int dyConsumed, int View target, int dxConsumed, int dyConsumed, int
dxUnconsumed, int dyUnconsumed, int type) { dxUnconsumed, int dyUnconsumed, int type) {
LogUtil.d(TAG, "onNestedScroll: target:" + target.getClass() + " ,"
+ child.getTotalScrollRange() + " ,dxConsumed:"
+ dxConsumed + " ,dyConsumed:" + dyConsumed + " " + ",type:" + type);
if (!shouldBlockNestedScroll) { if (!shouldBlockNestedScroll) {
super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, super.onNestedScroll(coordinatorLayout, child, target, dxConsumed,
dyConsumed, dxUnconsumed, dyUnconsumed, type); dyConsumed, dxUnconsumed, dyUnconsumed, type);
@@ -178,16 +167,10 @@ public class AppBarLayoutBehavior extends AppBarLayout.Behavior {
@Override @Override
public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, @NotNull AppBarLayout abl, public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, @NotNull AppBarLayout abl,
View target, int type) { View target, int type) {
LogUtil.d(TAG, "onStopNestedScroll");
super.onStopNestedScroll(coordinatorLayout, abl, target, type); super.onStopNestedScroll(coordinatorLayout, abl, target, type);
isFlinging = false; isFlinging = false;
shouldBlockNestedScroll = false; shouldBlockNestedScroll = false;
} }
private static class LogUtil{
static void d(String tag, String string){
Log.d(tag,string);
}
}
} }

View File

@@ -222,6 +222,7 @@
android:paddingTop="@dimen/dp_15" android:paddingTop="@dimen/dp_15"
android:paddingEnd="@dimen/dp_15" android:paddingEnd="@dimen/dp_15"
android:text="公会" android:text="公会"
android:drawableEnd="@drawable/arrow_right_2"
android:textColor="@color/color_333333" android:textColor="@color/color_333333"
android:textSize="@dimen/sp_13" /> android:textSize="@dimen/sp_13" />