房间私聊输入体验优化
This commit is contained in:
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
|
|||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
|
@@ -10,7 +10,7 @@ apply plugin: 'android-junk-code'
|
|||||||
def onlyArm64 = Boolean.parseBoolean(only_arm64)
|
def onlyArm64 = Boolean.parseBoolean(only_arm64)
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.voice.magic"
|
applicationId "com.voice.magic"
|
||||||
|
@@ -945,11 +945,11 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".room_chat.activity.NimRoomP2PMessageActivity"
|
android:name=".room_chat.activity.NimRoomP2PMessageActivity"
|
||||||
android:theme="@style/room_message_activity"
|
android:theme="@style/room_message_activity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".room_chat.activity.RoomMsgActivity"
|
android:name=".room_chat.activity.RoomMsgActivity"
|
||||||
android:theme="@style/room_message_activity"
|
android:theme="@style/room_message_activity"
|
||||||
android:windowSoftInputMode="stateHidden|adjustNothing" />
|
android:windowSoftInputMode="stateAlwaysHidden|adjustNothing" />
|
||||||
<activity
|
<activity
|
||||||
android:name=".room_chat.activity.RoomNewbieActivity"
|
android:name=".room_chat.activity.RoomNewbieActivity"
|
||||||
android:theme="@style/room_message_activity" />
|
android:theme="@style/room_message_activity" />
|
||||||
|
@@ -28,12 +28,14 @@ import android.widget.ImageView;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||||
import com.effective.android.panel.PanelSwitchHelper;
|
import com.effective.android.panel.PanelSwitchHelper;
|
||||||
|
import com.effective.android.panel.interfaces.ContentScrollMeasurer;
|
||||||
import com.effective.android.panel.interfaces.PanelHeightMeasurer;
|
import com.effective.android.panel.interfaces.PanelHeightMeasurer;
|
||||||
import com.effective.android.panel.interfaces.listener.OnPanelChangeListener;
|
import com.effective.android.panel.interfaces.listener.OnPanelChangeListener;
|
||||||
import com.effective.android.panel.view.panel.IPanelView;
|
import com.effective.android.panel.view.panel.IPanelView;
|
||||||
@@ -105,6 +107,8 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|||||||
|
|
||||||
private static final int SHOW_LAYOUT_DELAY = 0;
|
private static final int SHOW_LAYOUT_DELAY = 0;
|
||||||
private final List<PhotoInfo> selectPhotos = new ArrayList<>();
|
private final List<PhotoInfo> selectPhotos = new ArrayList<>();
|
||||||
|
private final boolean inRoom;
|
||||||
|
private int unfilledHeight = 0;
|
||||||
protected Container container;
|
protected Container container;
|
||||||
protected View view;
|
protected View view;
|
||||||
protected Handler uiHandler;
|
protected Handler uiHandler;
|
||||||
@@ -130,7 +134,6 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|||||||
private boolean cancelled = false;
|
private boolean cancelled = false;
|
||||||
private boolean touched = false; // 是否按着
|
private boolean touched = false; // 是否按着
|
||||||
private boolean isKeyboardShowed = false; // 是否显示键盘
|
private boolean isKeyboardShowed = false; // 是否显示键盘
|
||||||
private boolean isTextAudioSwitchShow; // 是否展示左侧语音按钮
|
|
||||||
// adapter
|
// adapter
|
||||||
private List<BaseAction> actions;
|
private List<BaseAction> actions;
|
||||||
// data
|
// data
|
||||||
@@ -220,19 +223,15 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public InputPanel(Container container, View view, List<BaseAction> actions, boolean isTextAudioSwitchShow) {
|
public InputPanel(Container container, View view, List<BaseAction> actions, boolean inRoom) {
|
||||||
this.container = container;
|
this.container = container;
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.actions = actions;
|
this.actions = actions;
|
||||||
this.uiHandler = new Handler();
|
this.uiHandler = new Handler();
|
||||||
this.isTextAudioSwitchShow = isTextAudioSwitchShow;
|
this.inRoom = inRoom;
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputPanel(Container container, View view, List<BaseAction> actions) {
|
|
||||||
this(container, view, actions, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 上滑取消录音判断
|
// 上滑取消录音判断
|
||||||
private static boolean isCancelled(View view, MotionEvent event) {
|
private static boolean isCancelled(View view, MotionEvent event) {
|
||||||
int[] location = new int[2];
|
int[] location = new int[2];
|
||||||
@@ -348,9 +347,39 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|||||||
return R.id.emoji_button;
|
return R.id.emoji_button;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.addContentScrollMeasurer(new ContentScrollMeasurer() {
|
||||||
|
@Override
|
||||||
|
public int getScrollDistance(int defaultDistance) {
|
||||||
|
return defaultDistance - unfilledHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getScrollViewId() {
|
||||||
|
return R.id.messageListView;
|
||||||
|
}
|
||||||
|
})
|
||||||
.logTrack(false)//output log
|
.logTrack(false)//output log
|
||||||
.build();
|
.build();
|
||||||
messageListView.setPanelSwitchHelper(mHelper);
|
messageListView.setPanelSwitchHelper(mHelper);
|
||||||
|
messageListView.addOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||||
|
@Override
|
||||||
|
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
|
||||||
|
super.onScrolled(recyclerView, dx, dy);
|
||||||
|
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
|
||||||
|
if (layoutManager instanceof LinearLayoutManager) {
|
||||||
|
int childCount = recyclerView.getChildCount();
|
||||||
|
if (childCount > 0) {
|
||||||
|
View lastChildView = recyclerView.getChildAt(childCount - 1);
|
||||||
|
int bottom = lastChildView.getBottom();
|
||||||
|
int listHeight = messageListView.getHeight() - messageListView.getPaddingBottom();
|
||||||
|
unfilledHeight = listHeight - bottom;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (inRoom) {
|
||||||
|
container.activity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -446,12 +475,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|||||||
|
|
||||||
// 文本录音按钮切换布局
|
// 文本录音按钮切换布局
|
||||||
textAudioSwitchLayout = view.findViewById(R.id.switchLayout);
|
textAudioSwitchLayout = view.findViewById(R.id.switchLayout);
|
||||||
if (isTextAudioSwitchShow) {
|
textAudioSwitchLayout.setVisibility(View.GONE);
|
||||||
textAudioSwitchLayout.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
textAudioSwitchLayout.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
messageListView = view.findViewById(R.id.messageListView);
|
messageListView = view.findViewById(R.id.messageListView);
|
||||||
ivImage = view.findViewById(R.id.iv_image);
|
ivImage = view.findViewById(R.id.iv_image);
|
||||||
ivCamera = view.findViewById(R.id.iv_camera);
|
ivCamera = view.findViewById(R.id.iv_camera);
|
||||||
@@ -537,15 +561,12 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 不展示右侧按钮时需要添加edit间距
|
// 不展示右侧按钮时需要添加edit间距
|
||||||
if (!isTextAudioSwitchShow) {
|
try {
|
||||||
try {
|
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) messageEditText.getLayoutParams();
|
||||||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) messageEditText.getLayoutParams();
|
layoutParams.setMarginStart(SizeUtils.dp2px(view.getContext(), 12));
|
||||||
layoutParams.setMarginStart(SizeUtils.dp2px(view.getContext(), 12));
|
messageEditText.requestLayout();
|
||||||
messageEditText.requestLayout();
|
} catch (Exception ex) {
|
||||||
} catch (Exception ex) {
|
ex.printStackTrace();
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import com.mango.core.UriProvider;
|
import com.mango.core.UriProvider;
|
||||||
@@ -131,6 +132,14 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
if (getArguments()!=null){
|
||||||
|
inRoom =getArguments().getBoolean(IN_ROOM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityCreated(Bundle savedInstanceState) {
|
public void onActivityCreated(Bundle savedInstanceState) {
|
||||||
super.onActivityCreated(savedInstanceState);
|
super.onActivityCreated(savedInstanceState);
|
||||||
@@ -219,7 +228,7 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (inputPanel == null) {
|
if (inputPanel == null) {
|
||||||
inputPanel = new InputPanel(container, rootView, getActionList());
|
inputPanel = new InputPanel(container, rootView, getActionList(),inRoom);
|
||||||
inputPanel.setCustomization(customization);
|
inputPanel.setCustomization(customization);
|
||||||
inputPanel.setLimitLevel(isChat, hintText);
|
inputPanel.setLimitLevel(isChat, hintText);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -548,6 +548,7 @@ public class JSInterface {
|
|||||||
//拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
//拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
||||||
req.path = "pages/index/index?pub_ticket=" + AuthModel.get().getTicket() +
|
req.path = "pages/index/index?pub_ticket=" + AuthModel.get().getTicket() +
|
||||||
"&tarotChargeProdId=" + jsonObject.getString("tarotChargeProdId") +
|
"&tarotChargeProdId=" + jsonObject.getString("tarotChargeProdId") +
|
||||||
|
"&luckyTarotRecordId=" + jsonObject.getString("luckyTarotRecordId") +
|
||||||
"&cardList=" + jsonObject.getString("cardList") +
|
"&cardList=" + jsonObject.getString("cardList") +
|
||||||
"&payType=" + jsonObject.getString("payType") +
|
"&payType=" + jsonObject.getString("payType") +
|
||||||
"&pub_uid=" + AuthModel.get().getCurrentUid() +
|
"&pub_uid=" + AuthModel.get().getCurrentUid() +
|
||||||
@@ -558,7 +559,7 @@ public class JSInterface {
|
|||||||
"&app=" + XChatConstants.APP_MARK;
|
"&app=" + XChatConstants.APP_MARK;
|
||||||
req.miniprogramType = BuildConfig.DEBUG ? WXLaunchMiniProgram.Req.MINIPROGRAM_TYPE_TEST : WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版,体验版和正式版
|
req.miniprogramType = BuildConfig.DEBUG ? WXLaunchMiniProgram.Req.MINIPROGRAM_TYPE_TEST : WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版,体验版和正式版
|
||||||
api.sendReq(req);
|
api.sendReq(req);
|
||||||
TarotPayWebViewActivity.start(mActivity, UriProvider.JAVA_WEB_URL + "yinyou/modules/tarot/payment_result.html?chargeRecordId=" + jsonObject.getString("chargeRecordId"));
|
TarotPayWebViewActivity.start(mActivity, UriProvider.JAVA_WEB_URL + "yinyou/modules/tarot/payment_result.html?luckyTarotRecordId=" + jsonObject.getString("luckyTarotRecordId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -16,7 +16,7 @@ import com.mango.moshen.R;
|
|||||||
*/
|
*/
|
||||||
public class TarotPayWebViewActivity extends CommonWebViewActivity {
|
public class TarotPayWebViewActivity extends CommonWebViewActivity {
|
||||||
|
|
||||||
public static void start(Context context, String url ) {
|
public static void start(Context context, String url) {
|
||||||
Intent intent = new Intent(context, TarotPayWebViewActivity.class);
|
Intent intent = new Intent(context, TarotPayWebViewActivity.class);
|
||||||
intent.putExtra("url", url);
|
intent.putExtra("url", url);
|
||||||
context.startActivity(intent);
|
context.startActivity(intent);
|
||||||
@@ -26,7 +26,7 @@ public class TarotPayWebViewActivity extends CommonWebViewActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setFinishOnTouchOutside(false);
|
setFinishOnTouchOutside(false);
|
||||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,ScreenUtil.dip2px(150));
|
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.dip2px(150));
|
||||||
getWindow().setGravity(Gravity.CENTER);
|
getWindow().setGravity(Gravity.CENTER);
|
||||||
layoutTitleBar.setVisibility(View.GONE);
|
layoutTitleBar.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
18
app/src/main/res/values-v31/styles.xml
Normal file
18
app/src/main/res/values-v31/styles.xml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
|
|
||||||
|
<!--<style name="SplashTheme" parent="MyMaterialTheme.Base">-->
|
||||||
|
<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="android:windowBackground">@drawable/bg_splash</item>
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<!--<item name="android:windowFullscreen">true</item>-->
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
<item name="android:windowTranslucentNavigation">false</item>
|
||||||
|
<item name="android:windowLayoutInDisplayCutoutMode" tools:targetApi="o_mr1">shortEdges
|
||||||
|
</item>
|
||||||
|
<item name="android:windowTranslucentStatus">true</item>
|
||||||
|
<item name="android:statusBarColor" tools:targetApi="lollipop">@color/transparent</item>
|
||||||
|
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_logo</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
</resources>
|
@@ -63,7 +63,7 @@ public class RoomMsgActivity extends BaseActivity implements CarMagicIndicator.O
|
|||||||
tabInfoList.add(new TabInfo(i, titles[i]));
|
tabInfoList.add(new TabInfo(i, titles[i]));
|
||||||
}
|
}
|
||||||
viewpager.setOffscreenPageLimit(2);
|
viewpager.setOffscreenPageLimit(2);
|
||||||
viewpager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), getFragment(), titles));
|
//viewpager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), getFragment(), titles));
|
||||||
viewIndicator.setViewPager(viewpager, titles, this, getFragment());
|
viewIndicator.setViewPager(viewpager, titles, this, getFragment());
|
||||||
|
|
||||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||||
|
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply from: '../mob.gradle'
|
apply from: '../mob.gradle'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
@@ -158,5 +158,7 @@ public class InitInfo implements Serializable {
|
|||||||
|
|
||||||
private List<String> officialMsgUids;
|
private List<String> officialMsgUids;
|
||||||
|
|
||||||
|
private List<String> officialAccountUids;
|
||||||
|
|
||||||
private boolean twelveStarSwitch;
|
private boolean twelveStarSwitch;
|
||||||
}
|
}
|
||||||
|
@@ -17,8 +17,12 @@ public class SystemUidUtil {
|
|||||||
initInfo.getOfficialMsgUids().contains(uid)) {
|
initInfo.getOfficialMsgUids().contains(uid)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return XChatConstants.SECRETARY_UID.equals(uid)
|
|
||||||
|| XChatConstants.SYSTEM_MESSAGE_UID.equals(uid)
|
if (initInfo != null &&
|
||||||
|| XChatConstants.MATCH_UID.equals(uid);
|
!ListUtils.isListEmpty(initInfo.getOfficialAccountUids()) &&
|
||||||
|
initInfo.getOfficialAccountUids().contains(uid)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
|
|||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 30
|
compileSdkVersion 31
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
|
Reference in New Issue
Block a user