1:羽声新版本
This commit is contained in:
@@ -8,7 +8,7 @@ apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.3"
|
||||
// buildToolsVersion "30.0.3"
|
||||
namespace "com.tencent.qcloud.tuikit.tuichat"
|
||||
defaultConfig {
|
||||
minSdkVersion 19
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
android:maxSdkVersion="32" />
|
||||
@@ -93,7 +94,12 @@
|
||||
<activity android:name="com.tencent.qcloud.tuikit.tuichat.minimalistui.page.GroupNoticeMinimalistActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<!-- **************** Minimalist UI End **************** -->
|
||||
|
||||
<service
|
||||
android:name=".TUIChatService"
|
||||
android:authorities="${applicationId}.TUIChat.Init"
|
||||
android:enabled="true"
|
||||
android:exported="false"
|
||||
tools:ignore="Instantiatable" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -96,11 +96,11 @@ public class TUIC2CChatFragment extends TUIBaseChatFragment {
|
||||
}
|
||||
|
||||
private void openFriendProfile(String userId) {
|
||||
Intent intent = new Intent(getContext(), FriendProfileActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, userId);
|
||||
intent.putExtra(TUIChatConstants.CHAT_BACKGROUND_URI, mChatBackgroundThumbnailUrl);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
startActivity(intent);
|
||||
// Intent intent = new Intent(getContext(), FriendProfileActivity.class);
|
||||
// intent.putExtra(TUIConstants.TUIChat.CHAT_ID, userId);
|
||||
// intent.putExtra(TUIChatConstants.CHAT_BACKGROUND_URI, mChatBackgroundThumbnailUrl);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.tencent.qcloud.tuikit.tuichat.classicui.widget.input;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.Uri;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
@@ -19,10 +20,13 @@ import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonSyntaxException;
|
||||
import com.tencent.imsdk.v2.V2TIMManager;
|
||||
@@ -50,6 +54,7 @@ import com.tencent.qcloud.tuikit.tuichat.bean.InputMoreItem;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.ReplyPreviewBean;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.message.FileMessageBean;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.interfaces.IChatLayout;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.page.TUIBaseChatFragment;
|
||||
import com.tencent.qcloud.tuikit.tuichat.classicui.widget.input.inputmore.InputMoreFragment;
|
||||
import com.tencent.qcloud.tuikit.tuichat.component.album.AlbumPicker;
|
||||
import com.tencent.qcloud.tuikit.tuichat.component.album.VideoRecorder;
|
||||
@@ -219,6 +224,52 @@ public class InputView extends LinearLayout implements View.OnClickListener, Tex
|
||||
init();
|
||||
}
|
||||
|
||||
public class userInd{
|
||||
private int is_can_chat;//是否可以私聊,1:可以,0:不可以
|
||||
private int can_chat_money;//需要充值的金额
|
||||
|
||||
public int getIs_can_chat() {
|
||||
return is_can_chat;
|
||||
}
|
||||
|
||||
public void setIs_can_chat(int is_can_chat) {
|
||||
this.is_can_chat = is_can_chat;
|
||||
}
|
||||
|
||||
public int getCan_chat_money() {
|
||||
return can_chat_money;
|
||||
}
|
||||
|
||||
public void setCan_chat_money(int can_chat_money) {
|
||||
this.can_chat_money = can_chat_money;
|
||||
}
|
||||
}
|
||||
private userInd getUserInfo(){
|
||||
SharedPreferences sp = getContext().getSharedPreferences("Vespa", Context.MODE_PRIVATE);
|
||||
String s= sp.getString("userInfo","");
|
||||
if (TextUtils.isEmpty(s)){
|
||||
return null;
|
||||
}
|
||||
Gson Gson = new Gson();
|
||||
userInd userInd =Gson.fromJson(s, userInd.class);
|
||||
return userInd;
|
||||
|
||||
}
|
||||
|
||||
private boolean isChock(){
|
||||
userInd userInfo = getUserInfo();
|
||||
|
||||
if (userInfo != null) {
|
||||
if (userInfo.getIs_can_chat() == 0 && userInfo.getCan_chat_money() > 0) {
|
||||
Toast.makeText(getContext(), "充值不足"+userInfo.getCan_chat_money()+"元,您无法发送消息", Toast.LENGTH_LONG).show();
|
||||
ARouter.getInstance().build("/modulevocal/RechargeActivity").navigation();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
mAudioInputSwitchButton.setOnClickListener(this);
|
||||
mEmojiInputButton.setOnClickListener(this);
|
||||
@@ -229,10 +280,13 @@ public class InputView extends LinearLayout implements View.OnClickListener, Tex
|
||||
@Override
|
||||
public boolean onTouch(View view, MotionEvent motionEvent) {
|
||||
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
if (presenter != null) {
|
||||
presenter.scrollToNewestMessage();
|
||||
|
||||
if (isChock()) {
|
||||
if (presenter != null) {
|
||||
presenter.scrollToNewestMessage();
|
||||
}
|
||||
showSoftInput();
|
||||
}
|
||||
showSoftInput();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -647,65 +701,73 @@ public class InputView extends LinearLayout implements View.OnClickListener, Tex
|
||||
"onClick id:" + view.getId() + "|voice_input_switch:" + R.id.voice_input_switch + "|face_btn:" + R.id.face_btn + "|more_btn:" + R.id.more_btn
|
||||
+ "|send_btn:" + R.id.send_btn + "|mCurrentState:" + mCurrentState + "|mSendEnable:" + mSendEnable + "|mMoreInputEvent:" + mMoreInputEvent);
|
||||
if (view.getId() == R.id.voice_input_switch) {
|
||||
if (mCurrentState == STATE_FACE_INPUT || mCurrentState == STATE_ACTION_INPUT) {
|
||||
mCurrentState = STATE_VOICE_INPUT;
|
||||
mInputMoreView.setVisibility(View.GONE);
|
||||
mEmojiInputButton.setImageResource(R.drawable.action_face_selector);
|
||||
} else if (mCurrentState == STATE_SOFT_INPUT) {
|
||||
mCurrentState = STATE_VOICE_INPUT;
|
||||
} else {
|
||||
mCurrentState = STATE_SOFT_INPUT;
|
||||
}
|
||||
if (mCurrentState == STATE_VOICE_INPUT) {
|
||||
mSendAudioButton.setVisibility(VISIBLE);
|
||||
mTextInput.setVisibility(GONE);
|
||||
mAudioInputSwitchButton.setImageResource(R.drawable.chat_input_keyboard);
|
||||
hideInputMoreLayout();
|
||||
hideSoftInput();
|
||||
} else {
|
||||
mAudioInputSwitchButton.setImageResource(R.drawable.action_audio_selector);
|
||||
mSendAudioButton.setVisibility(GONE);
|
||||
mTextInput.setVisibility(VISIBLE);
|
||||
showSoftInput();
|
||||
if (isChock()) {
|
||||
if (mCurrentState == STATE_FACE_INPUT || mCurrentState == STATE_ACTION_INPUT) {
|
||||
mCurrentState = STATE_VOICE_INPUT;
|
||||
mInputMoreView.setVisibility(View.GONE);
|
||||
mEmojiInputButton.setImageResource(R.drawable.action_face_selector);
|
||||
} else if (mCurrentState == STATE_SOFT_INPUT) {
|
||||
mCurrentState = STATE_VOICE_INPUT;
|
||||
} else {
|
||||
mCurrentState = STATE_SOFT_INPUT;
|
||||
}
|
||||
if (mCurrentState == STATE_VOICE_INPUT) {
|
||||
mSendAudioButton.setVisibility(VISIBLE);
|
||||
mTextInput.setVisibility(GONE);
|
||||
mAudioInputSwitchButton.setImageResource(R.drawable.chat_input_keyboard);
|
||||
hideInputMoreLayout();
|
||||
hideSoftInput();
|
||||
} else {
|
||||
mAudioInputSwitchButton.setImageResource(R.drawable.action_audio_selector);
|
||||
mSendAudioButton.setVisibility(GONE);
|
||||
mTextInput.setVisibility(VISIBLE);
|
||||
showSoftInput();
|
||||
}
|
||||
}
|
||||
} else if (view.getId() == R.id.face_btn) {
|
||||
mAudioInputSwitchButton.setImageResource(R.drawable.action_audio_selector);
|
||||
if (mCurrentState == STATE_VOICE_INPUT) {
|
||||
mCurrentState = STATE_NONE_INPUT;
|
||||
mSendAudioButton.setVisibility(GONE);
|
||||
mTextInput.setVisibility(VISIBLE);
|
||||
}
|
||||
if (mCurrentState == STATE_FACE_INPUT) {
|
||||
mCurrentState = STATE_SOFT_INPUT;
|
||||
mEmojiInputButton.setImageResource(R.drawable.action_face_selector);
|
||||
mTextInput.setVisibility(VISIBLE);
|
||||
showSoftInput();
|
||||
} else {
|
||||
mCurrentState = STATE_FACE_INPUT;
|
||||
mEmojiInputButton.setImageResource(R.drawable.chat_input_keyboard);
|
||||
showFaceViewGroup();
|
||||
}
|
||||
} else if (view.getId() == R.id.more_btn) {
|
||||
hideSoftInput();
|
||||
if (mMoreInputEvent instanceof View.OnClickListener) {
|
||||
((View.OnClickListener) mMoreInputEvent).onClick(view);
|
||||
} else if (mMoreInputEvent instanceof BaseInputFragment) {
|
||||
showCustomInputMoreFragment();
|
||||
} else {
|
||||
if (mCurrentState == STATE_ACTION_INPUT) {
|
||||
if (isChock()) {
|
||||
mAudioInputSwitchButton.setImageResource(R.drawable.action_audio_selector);
|
||||
if (mCurrentState == STATE_VOICE_INPUT) {
|
||||
mCurrentState = STATE_NONE_INPUT;
|
||||
mInputMoreView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
showInputMoreLayout();
|
||||
mCurrentState = STATE_ACTION_INPUT;
|
||||
mAudioInputSwitchButton.setImageResource(R.drawable.action_audio_selector);
|
||||
mEmojiInputButton.setImageResource(R.drawable.action_face_selector);
|
||||
mSendAudioButton.setVisibility(GONE);
|
||||
mTextInput.setVisibility(VISIBLE);
|
||||
}
|
||||
if (mCurrentState == STATE_FACE_INPUT) {
|
||||
mCurrentState = STATE_SOFT_INPUT;
|
||||
mEmojiInputButton.setImageResource(R.drawable.action_face_selector);
|
||||
mTextInput.setVisibility(VISIBLE);
|
||||
showSoftInput();
|
||||
} else {
|
||||
mCurrentState = STATE_FACE_INPUT;
|
||||
mEmojiInputButton.setImageResource(R.drawable.chat_input_keyboard);
|
||||
showFaceViewGroup();
|
||||
}
|
||||
}
|
||||
} else if (view.getId() == R.id.more_btn) {
|
||||
if (isChock()) {
|
||||
hideSoftInput();
|
||||
if (mMoreInputEvent instanceof View.OnClickListener) {
|
||||
((View.OnClickListener) mMoreInputEvent).onClick(view);
|
||||
} else if (mMoreInputEvent instanceof BaseInputFragment) {
|
||||
showCustomInputMoreFragment();
|
||||
} else {
|
||||
if (mCurrentState == STATE_ACTION_INPUT) {
|
||||
mCurrentState = STATE_NONE_INPUT;
|
||||
mInputMoreView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
showInputMoreLayout();
|
||||
mCurrentState = STATE_ACTION_INPUT;
|
||||
mAudioInputSwitchButton.setImageResource(R.drawable.action_audio_selector);
|
||||
mEmojiInputButton.setImageResource(R.drawable.action_face_selector);
|
||||
mSendAudioButton.setVisibility(GONE);
|
||||
mTextInput.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (view.getId() == R.id.send_btn) {
|
||||
sendTextMessage();
|
||||
if (isChock()) {
|
||||
sendTextMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -152,9 +152,9 @@ public class TipsMessageHolder extends MessageBaseHolder {
|
||||
}
|
||||
|
||||
private void onUserClick(String userID) {
|
||||
Intent intent = new Intent(itemView.getContext(), FriendProfileActivity.class);
|
||||
intent.putExtra(TUIConstants.TUIChat.CHAT_ID, userID);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
itemView.getContext().startActivity(intent);
|
||||
// Intent intent = new Intent(itemView.getContext(), FriendProfileActivity.class);
|
||||
// intent.putExtra(TUIConstants.TUIChat.CHAT_ID, userID);
|
||||
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
// itemView.getContext().startActivity(intent);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user