语音转文字
This commit is contained in:
parent
172b37ece2
commit
7e00a5e71e
@ -1,16 +1,15 @@
|
||||
package com.yunbao.main.dialog;
|
||||
package com.yunbao.common.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.views.weight.ViewClicksAntiShake;
|
||||
import com.yunbao.main.R;
|
||||
|
||||
public class HintDialog extends AbsDialogFragment {
|
||||
@Override
|
||||
@ -31,7 +30,7 @@ public class HintDialog extends AbsDialogFragment {
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
window.setWindowAnimations(com.yunbao.live.R.style.bottomToTopAnim);
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = DpUtil.dp2px(277);
|
||||
params.height = DpUtil.dp2px(134);
|
@ -5,6 +5,8 @@ import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.lzf.easyfloat.EasyFloat;
|
||||
import com.lzf.easyfloat.enums.ShowPattern;
|
||||
import com.lzf.easyfloat.interfaces.FloatCallbacks;
|
||||
@ -14,6 +16,8 @@ import com.tencent.live2.impl.V2TXLivePlayerImpl;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.bean.LiveBean;
|
||||
import com.yunbao.common.dialog.HintDialog;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.views.floatingview.APPEasyFloat;
|
||||
import com.yunbao.common.views.floatingview.FloatingMagnetView;
|
||||
@ -66,6 +70,10 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
||||
public void onViewClicks() {
|
||||
mPlayer.stopPlay();
|
||||
APPEasyFloat.getInstance().dismiss(mContext);
|
||||
if (IMLoginManager.get(mContext).isHint()) {
|
||||
HintDialog fragment = new HintDialog();
|
||||
fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog");
|
||||
}
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(videoView, () -> {
|
||||
@ -155,6 +163,10 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
|
||||
public void onViewClicks() {
|
||||
mPlayer.stopPlay();
|
||||
EasyFloat.dismiss("LiveFloatView", true);
|
||||
if (IMLoginManager.get(mContext).isHint()) {
|
||||
HintDialog fragment = new HintDialog();
|
||||
fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog");
|
||||
}
|
||||
}
|
||||
});
|
||||
ViewClicksAntiShake.clicksAntiShake(videoView, () -> {
|
||||
|
@ -20,8 +20,6 @@ import com.iflytek.cloud.SpeechConstant;
|
||||
import com.iflytek.cloud.SpeechError;
|
||||
import com.iflytek.cloud.SpeechRecognizer;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
|
||||
@ -107,20 +105,25 @@ public class VoiceDialog extends AbsDialogFragment {
|
||||
* 上划取消
|
||||
*/
|
||||
public void withdraw() {
|
||||
if (!isDetached()) {
|
||||
voiceFluctuations.setVisibility(View.GONE);
|
||||
gifView.setVisibility(View.GONE);
|
||||
iconWithdraw.setVisibility(View.VISIBLE);
|
||||
fingersSlide.setText(getString(R.string.release_cancel_send));
|
||||
isSend = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上划取消
|
||||
*/
|
||||
public void notWithdraw() {
|
||||
if (!isDetached()) {
|
||||
if (TextUtils.isEmpty(sendMessage())) {
|
||||
if (gifView.getVisibility() != View.VISIBLE)
|
||||
voiceFluctuations.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
if (voiceFluctuations.getVisibility() != View.VISIBLE)
|
||||
gifView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
iconWithdraw.setVisibility(View.GONE);
|
||||
@ -128,6 +131,8 @@ public class VoiceDialog extends AbsDialogFragment {
|
||||
isSend = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 科大讯飞内置录音机
|
||||
*/
|
||||
|
@ -290,11 +290,11 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
} else if (event.getAction() == MotionEvent.ACTION_MOVE) {
|
||||
float moveY = event.getY();
|
||||
if (downY - moveY > 120) {
|
||||
if (voiceDialog != null)
|
||||
if (voiceDialog != null && voiceDialog.isAdded())
|
||||
voiceDialog.withdraw();
|
||||
}
|
||||
if ((downY - moveY < 100) && (downY - moveY > 30)) {
|
||||
if (voiceDialog != null)
|
||||
if (voiceDialog != null&& voiceDialog.isAdded())
|
||||
voiceDialog.notWithdraw();
|
||||
}
|
||||
} else if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
@ -326,7 +326,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
public void run() {
|
||||
|
||||
Vibrator vibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
|
||||
vibrator.vibrate(30);//震动时间(ms)
|
||||
vibrator.vibrate(100);//震动时间(ms)
|
||||
if (voiceDialog == null) {
|
||||
voiceDialog = new VoiceDialog();
|
||||
}
|
||||
|
@ -93,7 +93,6 @@ import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
import com.yunbao.live.utils.LiveStorge;
|
||||
import com.yunbao.live.views.ChatListViewHolder;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.dialog.HintDialog;
|
||||
import com.yunbao.main.dialog.MainStartDialogFragment;
|
||||
import com.yunbao.main.dialog.ReturnUserDialog;
|
||||
import com.yunbao.main.dialog.SigninDialog;
|
||||
@ -476,16 +475,13 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
new Handler().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (IMLoginManager.get(mContext).isHint()) {
|
||||
HintDialog fragment = new HintDialog();
|
||||
fragment.show(getSupportFragmentManager(), "HintDialog");
|
||||
}
|
||||
|
||||
}
|
||||
}, 1000);
|
||||
// new Handler().postDelayed(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }, 1000);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user