From 1ce5ac2c5f003f5aa3b0f66a30f79fe86e3aa561 Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 25 Oct 2022 15:29:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=AD=E9=9F=B3=E8=BD=AC=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunbao/common/dialog/HintDialog.java | 52 ++++++++++++++++--- .../yunbao/common/manager/IMLoginManager.java | 9 ++++ .../common/views/weight/LiveFloatView.java | 11 +++- common/src/main/res/layout/view_hint.xml | 1 + common/src/main/res/values-en/strings.xml | 1 + common/src/main/res/values/strings.xml | 1 + .../yunbao/main/activity/MainActivity.java | 19 ++++--- main/src/main/res/layout/view_homemain.xml | 18 +++---- 8 files changed, 83 insertions(+), 29 deletions(-) diff --git a/common/src/main/java/com/yunbao/common/dialog/HintDialog.java b/common/src/main/java/com/yunbao/common/dialog/HintDialog.java index 23b06f659..4df56490e 100644 --- a/common/src/main/java/com/yunbao/common/dialog/HintDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/HintDialog.java @@ -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,14 +45,46 @@ 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(); - ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.to_set_up), new ViewClicksAntiShake.ViewClicksCallBack() { - @Override - public void onViewClicks() { - RouteUtil.forwardSettingActivity(); - dismiss(); - } - }); - ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.know_the), () -> dismiss()); + 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() { + 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(); + } + }); + } + } } diff --git a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java index f171828cd..f3b00750f 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -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); } diff --git a/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java b/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java index d687228bb..830d1e5f4 100644 --- a/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java +++ b/common/src/main/java/com/yunbao/common/views/weight/LiveFloatView.java @@ -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 { 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 { 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"); } } diff --git a/common/src/main/res/layout/view_hint.xml b/common/src/main/res/layout/view_hint.xml index f1e67461e..1877f79f0 100644 --- a/common/src/main/res/layout/view_hint.xml +++ b/common/src/main/res/layout/view_hint.xml @@ -15,6 +15,7 @@ android:layout_height="match_parent"> Message Settings Blocking gift effects Blocking seat effects + If you want to Minimize Play,\nYou can go to set the license. diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index b788dc390..f3f0ccd21 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -945,4 +945,5 @@ 屏蔽直播間座駕特效 換一批 聊聊天 + 想在其他APP上方也顯示小窗,\n可前往設置進行授權。 diff --git a/main/src/main/java/com/yunbao/main/activity/MainActivity.java b/main/src/main/java/com/yunbao/main/activity/MainActivity.java index b9205f6ec..eb04cdd73 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -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); } /** diff --git a/main/src/main/res/layout/view_homemain.xml b/main/src/main/res/layout/view_homemain.xml index 1d47d4685..e490effa3 100644 --- a/main/src/main/res/layout/view_homemain.xml +++ b/main/src/main/res/layout/view_homemain.xml @@ -92,12 +92,6 @@ - - - - + android:layout_marginRight="10dp" + android:layout_marginBottom="10dp" + android:clickable="true" + android:focusable="true" + android:visibility="gone" /> +