房间私聊输入体验优化
This commit is contained in:
@@ -10,7 +10,7 @@ apply plugin: 'android-junk-code'
|
||||
def onlyArm64 = Boolean.parseBoolean(only_arm64)
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
compileSdkVersion 31
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.voice.magic"
|
||||
|
@@ -945,11 +945,11 @@
|
||||
<activity
|
||||
android:name=".room_chat.activity.NimRoomP2PMessageActivity"
|
||||
android:theme="@style/room_message_activity"
|
||||
android:windowSoftInputMode="stateHidden|adjustResize" />
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustResize" />
|
||||
<activity
|
||||
android:name=".room_chat.activity.RoomMsgActivity"
|
||||
android:theme="@style/room_message_activity"
|
||||
android:windowSoftInputMode="stateHidden|adjustNothing" />
|
||||
android:windowSoftInputMode="stateAlwaysHidden|adjustNothing" />
|
||||
<activity
|
||||
android:name=".room_chat.activity.RoomNewbieActivity"
|
||||
android:theme="@style/room_message_activity" />
|
||||
|
@@ -28,12 +28,14 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chad.library.adapter.base.BaseQuickAdapter;
|
||||
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.listener.OnPanelChangeListener;
|
||||
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 final List<PhotoInfo> selectPhotos = new ArrayList<>();
|
||||
private final boolean inRoom;
|
||||
private int unfilledHeight = 0;
|
||||
protected Container container;
|
||||
protected View view;
|
||||
protected Handler uiHandler;
|
||||
@@ -130,7 +134,6 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
private boolean cancelled = false;
|
||||
private boolean touched = false; // 是否按着
|
||||
private boolean isKeyboardShowed = false; // 是否显示键盘
|
||||
private boolean isTextAudioSwitchShow; // 是否展示左侧语音按钮
|
||||
// adapter
|
||||
private List<BaseAction> actions;
|
||||
// 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.view = view;
|
||||
this.actions = actions;
|
||||
this.uiHandler = new Handler();
|
||||
this.isTextAudioSwitchShow = isTextAudioSwitchShow;
|
||||
this.inRoom = inRoom;
|
||||
init();
|
||||
}
|
||||
|
||||
public InputPanel(Container container, View view, List<BaseAction> actions) {
|
||||
this(container, view, actions, true);
|
||||
}
|
||||
|
||||
// 上滑取消录音判断
|
||||
private static boolean isCancelled(View view, MotionEvent event) {
|
||||
int[] location = new int[2];
|
||||
@@ -348,9 +347,39 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
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
|
||||
.build();
|
||||
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);
|
||||
if (isTextAudioSwitchShow) {
|
||||
textAudioSwitchLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
textAudioSwitchLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
textAudioSwitchLayout.setVisibility(View.GONE);
|
||||
messageListView = view.findViewById(R.id.messageListView);
|
||||
ivImage = view.findViewById(R.id.iv_image);
|
||||
ivCamera = view.findViewById(R.id.iv_camera);
|
||||
@@ -537,15 +561,12 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
|
||||
});
|
||||
|
||||
// 不展示右侧按钮时需要添加edit间距
|
||||
if (!isTextAudioSwitchShow) {
|
||||
try {
|
||||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) messageEditText.getLayoutParams();
|
||||
layoutParams.setMarginStart(SizeUtils.dp2px(view.getContext(), 12));
|
||||
messageEditText.requestLayout();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) messageEditText.getLayoutParams();
|
||||
layoutParams.setMarginStart(SizeUtils.dp2px(view.getContext(), 12));
|
||||
messageEditText.requestLayout();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -18,6 +18,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
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
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
@@ -219,7 +228,7 @@ public class MessageFragment extends TFragment implements ModuleProxy, MessageLi
|
||||
}
|
||||
|
||||
if (inputPanel == null) {
|
||||
inputPanel = new InputPanel(container, rootView, getActionList());
|
||||
inputPanel = new InputPanel(container, rootView, getActionList(),inRoom);
|
||||
inputPanel.setCustomization(customization);
|
||||
inputPanel.setLimitLevel(isChat, hintText);
|
||||
} else {
|
||||
|
@@ -548,6 +548,7 @@ public class JSInterface {
|
||||
//拉起小程序页面的可带参路径,不填默认拉起小程序首页,对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。
|
||||
req.path = "pages/index/index?pub_ticket=" + AuthModel.get().getTicket() +
|
||||
"&tarotChargeProdId=" + jsonObject.getString("tarotChargeProdId") +
|
||||
"&luckyTarotRecordId=" + jsonObject.getString("luckyTarotRecordId") +
|
||||
"&cardList=" + jsonObject.getString("cardList") +
|
||||
"&payType=" + jsonObject.getString("payType") +
|
||||
"&pub_uid=" + AuthModel.get().getCurrentUid() +
|
||||
@@ -558,7 +559,7 @@ public class JSInterface {
|
||||
"&app=" + XChatConstants.APP_MARK;
|
||||
req.miniprogramType = BuildConfig.DEBUG ? WXLaunchMiniProgram.Req.MINIPROGRAM_TYPE_TEST : WXLaunchMiniProgram.Req.MINIPTOGRAM_TYPE_RELEASE;// 可选打开 开发版,体验版和正式版
|
||||
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 static void start(Context context, String url ) {
|
||||
public static void start(Context context, String url) {
|
||||
Intent intent = new Intent(context, TarotPayWebViewActivity.class);
|
||||
intent.putExtra("url", url);
|
||||
context.startActivity(intent);
|
||||
@@ -26,7 +26,7 @@ public class TarotPayWebViewActivity extends CommonWebViewActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setFinishOnTouchOutside(false);
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT,ScreenUtil.dip2px(150));
|
||||
getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, ScreenUtil.dip2px(150));
|
||||
getWindow().setGravity(Gravity.CENTER);
|
||||
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]));
|
||||
}
|
||||
viewpager.setOffscreenPageLimit(2);
|
||||
viewpager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), getFragment(), titles));
|
||||
//viewpager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager(), getFragment(), titles));
|
||||
viewIndicator.setViewPager(viewpager, titles, this, getFragment());
|
||||
|
||||
IMNetEaseManager.get().getChatRoomEventObservable()
|
||||
|
Reference in New Issue
Block a user