语音转文字

This commit is contained in:
18401019693 2022-10-25 15:29:21 +08:00
parent 003f6622b9
commit 1ce5ac2c5f
8 changed files with 83 additions and 29 deletions

View File

@ -1,10 +1,14 @@
package com.yunbao.common.dialog;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;
import com.lzf.easyfloat.interfaces.OnPermissionResult;
import com.lzf.easyfloat.permission.PermissionUtils;
import com.yunbao.common.R;
import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.DpUtil;
@ -41,7 +45,15 @@ public class HintDialog extends AbsDialogFragment {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
TextView hint = (TextView) findViewById(R.id.hint);
TextView toSetUp = (TextView) findViewById(R.id.to_set_up);
TextView knowThe = (TextView) findViewById(R.id.know_the);
IMLoginManager.get(mContext).initISHint();
Bundle args = getArguments();
if (args != null && !TextUtils.isEmpty(args.getString("close")) && TextUtils.equals(args.getString("close"), "1")) {
hint.setText(getString(R.string.do_you_like));
toSetUp.setText(getString(R.string.to_set_up));
knowThe.setText(getString(R.string.know_the));
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
@ -50,5 +62,29 @@ public class HintDialog extends AbsDialogFragment {
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.know_the), () -> dismiss());
} else {
hint.setText(getString(R.string.want_pre));
toSetUp.setText(getString(R.string.know_the));
knowThe.setText(getString(R.string.to_set_up));
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
PermissionUtils.requestPermission(getActivity(), new OnPermissionResult() {
@Override
public void permissionResult(boolean b) {
}
});
dismiss();
}
});
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() {
@Override
public void onViewClicks() {
dismiss();
}
});
}
}
}

View File

@ -33,6 +33,7 @@ public class IMLoginManager extends BaseCacheManager {
private final static String IS_SLIDE = "isSlide";
private final static String IS_FLOAT = "is_float";
private final static String IS_HINT = "is_hint";
private final static String IS_HINT2 = "is_hint2";
public boolean isHint() {
@ -44,6 +45,14 @@ public class IMLoginManager extends BaseCacheManager {
int number = getInt(IS_HINT, 0) + 1;
put(IS_HINT, number);
}
}
public boolean isHint2() {
return getBoolean(IS_HINT2, true);
}
public void initISHint2() {
put(IS_HINT, false);
}

View File

@ -1,6 +1,7 @@
package com.yunbao.common.views.weight;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
@ -70,8 +71,11 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
public void onViewClicks() {
mPlayer.stopPlay();
APPEasyFloat.getInstance().dismiss(mContext);
if (IMLoginManager.get(mContext).isHint()) {
if (IMLoginManager.get(mContext).isHint2()) {
HintDialog fragment = new HintDialog();
Bundle args = new Bundle();
args.putString("close", "1");
fragment.setArguments(args);
fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog");
}
}
@ -163,8 +167,11 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
public void onViewClicks() {
mPlayer.stopPlay();
EasyFloat.dismiss("LiveFloatView", true);
if (IMLoginManager.get(mContext).isHint()) {
if (IMLoginManager.get(mContext).isHint2()) {
HintDialog fragment = new HintDialog();
Bundle args = new Bundle();
args.putString("close", "1");
fragment.setArguments(args);
fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog");
}
}

View File

@ -15,6 +15,7 @@
android:layout_height="match_parent">
<TextView
android:id="@+id/hint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16.33dp"

View File

@ -931,4 +931,5 @@ Limited ride And limited avatar frame</string>
<string name="alerts">Message Settings</string>
<string name="studio_gift_effects">Blocking gift effects</string>
<string name="studio_ride_effects">Blocking seat effects</string>
<string name="want_pre">If you want to Minimize Play,\nYou can go to set the license.</string>
</resources>

View File

@ -945,4 +945,5 @@
<string name="studio_ride_effects">屏蔽直播間座駕特效</string>
<string name="in_batch">換一批</string>
<string name="chat_chat">聊聊天</string>
<string name="want_pre">想在其他APP上方也顯示小窗\n可前往設置進行授權。</string>
</resources>

View File

@ -29,6 +29,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager.widget.ViewPager;
import com.alibaba.android.arouter.facade.annotation.Route;
@ -58,6 +59,7 @@ import com.yunbao.common.bean.LiveBean;
import com.yunbao.common.bean.LiveSvgGiftBean;
import com.yunbao.common.bean.UpdataListBean;
import com.yunbao.common.custom.TabButtonGroup;
import com.yunbao.common.dialog.HintDialog;
import com.yunbao.common.dialog.InstructorOperationDialog;
import com.yunbao.common.event.InstructorOperationEvent;
import com.yunbao.common.event.LiveFloatEvent;
@ -475,13 +477,16 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
@Override
protected void onRestart() {
super.onRestart();
// new Handler().postDelayed(new Runnable() {
// @Override
// public void run() {
//
//
// }
// }, 1000);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
if (IMLoginManager.get(mContext).isHint()) {
HintDialog fragment = new HintDialog();
fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog");
}
}
}, 1000);
}
/**

View File

@ -92,12 +92,6 @@
</LinearLayout>
<LinearLayout
android:layout_width="99dp"
android:layout_height="match_parent"
android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
@ -144,7 +138,6 @@
</RelativeLayout>
<com.yunbao.main.views.FloatBannerView
android:id="@+id/float_banner_home"
android:layout_width="wrap_content"
@ -159,13 +152,14 @@
android:id="@+id/banner_click"
android:layout_width="123dp"
android:layout_height="35.33dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
android:layout_marginRight="10dp"
android:layout_above="@id/rt_main_tab"
android:layout_alignParentRight="true"
android:layout_marginBottom="10dp" />
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:clickable="true"
android:focusable="true"
android:visibility="gone" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"