语音转文字

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; package com.yunbao.common.dialog;
import android.os.Bundle; import android.os.Bundle;
import android.text.TextUtils;
import android.view.Gravity; import android.view.Gravity;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; 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.R;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.utils.DpUtil; import com.yunbao.common.utils.DpUtil;
@ -41,14 +45,46 @@ public class HintDialog extends AbsDialogFragment {
@Override @Override
public void onActivityCreated(Bundle savedInstanceState) { public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(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(); IMLoginManager.get(mContext).initISHint();
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() { Bundle args = getArguments();
@Override if (args != null && !TextUtils.isEmpty(args.getString("close")) && TextUtils.equals(args.getString("close"), "1")) {
public void onViewClicks() { hint.setText(getString(R.string.do_you_like));
RouteUtil.forwardSettingActivity(); toSetUp.setText(getString(R.string.to_set_up));
dismiss(); knowThe.setText(getString(R.string.know_the));
} ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() {
}); @Override
ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.know_the), () -> dismiss()); public void onViewClicks() {
RouteUtil.forwardSettingActivity();
dismiss();
}
});
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_SLIDE = "isSlide";
private final static String IS_FLOAT = "is_float"; private final static String IS_FLOAT = "is_float";
private final static String IS_HINT = "is_hint"; private final static String IS_HINT = "is_hint";
private final static String IS_HINT2 = "is_hint2";
public boolean isHint() { public boolean isHint() {
@ -44,6 +45,14 @@ public class IMLoginManager extends BaseCacheManager {
int number = getInt(IS_HINT, 0) + 1; int number = getInt(IS_HINT, 0) + 1;
put(IS_HINT, number); 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; package com.yunbao.common.views.weight;
import android.app.Activity; import android.app.Activity;
import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.view.Gravity; import android.view.Gravity;
import android.view.View; import android.view.View;
@ -70,8 +71,11 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
public void onViewClicks() { public void onViewClicks() {
mPlayer.stopPlay(); mPlayer.stopPlay();
APPEasyFloat.getInstance().dismiss(mContext); APPEasyFloat.getInstance().dismiss(mContext);
if (IMLoginManager.get(mContext).isHint()) { if (IMLoginManager.get(mContext).isHint2()) {
HintDialog fragment = new HintDialog(); HintDialog fragment = new HintDialog();
Bundle args = new Bundle();
args.putString("close", "1");
fragment.setArguments(args);
fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog"); fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog");
} }
} }
@ -163,8 +167,11 @@ public class LiveFloatView implements Function1<FloatCallbacks.Builder, Unit> {
public void onViewClicks() { public void onViewClicks() {
mPlayer.stopPlay(); mPlayer.stopPlay();
EasyFloat.dismiss("LiveFloatView", true); EasyFloat.dismiss("LiveFloatView", true);
if (IMLoginManager.get(mContext).isHint()) { if (IMLoginManager.get(mContext).isHint2()) {
HintDialog fragment = new HintDialog(); HintDialog fragment = new HintDialog();
Bundle args = new Bundle();
args.putString("close", "1");
fragment.setArguments(args);
fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog"); fragment.show(((FragmentActivity) mContext).getSupportFragmentManager(), "HintDialog");
} }
} }

View File

@ -15,6 +15,7 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<TextView <TextView
android:id="@+id/hint"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="16.33dp" 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="alerts">Message Settings</string>
<string name="studio_gift_effects">Blocking gift effects</string> <string name="studio_gift_effects">Blocking gift effects</string>
<string name="studio_ride_effects">Blocking seat 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> </resources>

View File

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

View File

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

View File

@ -92,12 +92,6 @@
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="99dp"
android:layout_height="match_parent"
android:layout_weight="1">
</LinearLayout>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -144,7 +138,6 @@
</RelativeLayout> </RelativeLayout>
<com.yunbao.main.views.FloatBannerView <com.yunbao.main.views.FloatBannerView
android:id="@+id/float_banner_home" android:id="@+id/float_banner_home"
android:layout_width="wrap_content" android:layout_width="wrap_content"
@ -159,13 +152,14 @@
android:id="@+id/banner_click" android:id="@+id/banner_click"
android:layout_width="123dp" android:layout_width="123dp"
android:layout_height="35.33dp" 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_above="@id/rt_main_tab"
android:layout_alignParentRight="true" 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 <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"