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 995bcc223..3cbf73f24 100644 --- a/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java +++ b/common/src/main/java/com/yunbao/common/manager/IMLoginManager.java @@ -32,6 +32,15 @@ public class IMLoginManager extends BaseCacheManager { private final static String IS_CHAT = "isChat"; private final static String IS_SLIDE = "isSlide"; private final static String IS_FLOAT = "is_float"; + private final static String IS_HINT = "is_hint"; + + public boolean isHint() { + return TextUtils.equals("1", getString(IS_HINT)) || TextUtils.isEmpty(getString(IS_HINT)); + } + + public void initISHint(String isHint) { + put(IS_HINT, isHint); + } /** * 存储是否打开悬浮窗权限提示 @@ -43,7 +52,6 @@ public class IMLoginManager extends BaseCacheManager { } /** - * * @return */ public boolean isFloat() { diff --git a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java index cd00ba2e7..0cb37ef5b 100644 --- a/common/src/main/java/com/yunbao/common/utils/RouteUtil.java +++ b/common/src/main/java/com/yunbao/common/utils/RouteUtil.java @@ -28,6 +28,7 @@ public class RouteUtil { public static final String PATH_MAIN = "/main/MainActivity"; public static final String PATH_ENTRY = "/main/EntryActivity"; public static final String PATH_LIVE_AUDIENCE = "/live/LiveAudienceActivity"; + public static final String PATH_SETTING = "/main/SettingActivity"; /** * 启动页 @@ -113,7 +114,13 @@ public class RouteUtil { ARouter.getInstance().build(PATH_EDITPROFILE) .navigation(); } - + /** + * 修改个人资料 + */ + public static void forwardSettingActivity() { + ARouter.getInstance().build(PATH_SETTING) + .navigation(); + } /** * 打开直播页面 */ diff --git a/common/src/main/res/layout/view_effects_settings.xml b/common/src/main/res/layout/view_effects_settings.xml index dc2fbea48..65f0f092e 100644 --- a/common/src/main/res/layout/view_effects_settings.xml +++ b/common/src/main/res/layout/view_effects_settings.xml @@ -57,7 +57,7 @@ diff --git a/common/src/main/res/values-en/strings.xml b/common/src/main/res/values-en/strings.xml index 4a969262e..5da7c1017 100644 --- a/common/src/main/res/values-en/strings.xml +++ b/common/src/main/res/values-en/strings.xml @@ -921,4 +921,7 @@ Limited ride And limited avatar frame ALL Minimize Play Show on other apps and pages \n Need to open the display Go to open + Don\'t like the small window play?\n You can turn it off in [Personal Center] - [Settings] + Go to Settings + Got it diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index c8c008666..305f3c76c 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -933,4 +933,14 @@ APP全應用小窗播放 在其他應用上及所有界面显示小窗\n需打開懸浮窗權限。 前往打開 + 不喜歡小窗播放吗?\n 可以在「個人中心」-「設定」中關閉 + 去設置 + 知道了 + 個人設定 + 獎勵 + 修改密碼 + 黑名单 + 消息通知 + 屏蔽直播間禮物特效 + 屏蔽直播間座駕特效 diff --git a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java index 511a96ca6..0ee8b5eee 100644 --- a/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java +++ b/live/src/main/java/com/yunbao/live/activity/LiveAudienceActivity.java @@ -183,7 +183,7 @@ public class LiveAudienceActivity extends LiveActivity { if (EasyFloat.isShow("LiveFloatView")) { EasyFloat.dismiss("LiveFloatView", true); } - + IMLoginManager.get(mContext).initISHint("1"); } public void setBackIndex(int backIndex) { 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 2cb3996dd..0e59f28cc 100644 --- a/main/src/main/java/com/yunbao/main/activity/MainActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/MainActivity.java @@ -93,6 +93,7 @@ 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; @@ -470,12 +471,22 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene //获取指导员账号 ConversationIMListManager.get(this).getUserInstructor(this); checkVersion(); -// new Handler().postDelayed(new Runnable() { -// @Override -// public void run() { -// startActivity(new Intent(MainActivity.this,TestActivity.class)); -// } -// },1000); + + } + + @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); } /** diff --git a/main/src/main/java/com/yunbao/main/activity/SettingActivity.java b/main/src/main/java/com/yunbao/main/activity/SettingActivity.java index 575a5cab6..a022b7afa 100644 --- a/main/src/main/java/com/yunbao/main/activity/SettingActivity.java +++ b/main/src/main/java/com/yunbao/main/activity/SettingActivity.java @@ -1,18 +1,31 @@ package com.yunbao.main.activity; +import static com.yunbao.common.Constants.SETTING_CLEAR_CACHE; + import android.app.Dialog; import android.content.Intent; +import android.graphics.Color; import android.os.Handler; +import android.text.Spannable; +import android.text.SpannableStringBuilder; +import android.text.TextUtils; +import android.text.style.ForegroundColorSpan; +import android.widget.ImageView; +import android.widget.TextView; + import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; -import android.text.TextUtils; +import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.fastjson.JSON; +import com.lzf.easyfloat.interfaces.OnPermissionResult; +import com.lzf.easyfloat.permission.PermissionUtils; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.Constants; import com.yunbao.common.activity.AbsActivity; import com.yunbao.common.activity.WebViewActivity; import com.yunbao.common.bean.ConfigBean; +import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.HttpCallback; @@ -21,9 +34,11 @@ import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.GlideCatchUtil; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.VersionUtil; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import com.yunbao.main.R; import com.yunbao.main.adapter.SettingAdapter; import com.yunbao.main.bean.SettingBean; @@ -37,17 +52,18 @@ import java.util.List; import cn.rongcloud.rtc.api.RCRTCEngine; import io.rong.imlib.RongIMClient; -import static com.yunbao.common.Constants.SETTING_CLEAR_CACHE; - /** * Created by cxf on 2018/9/30. */ - +@Route(path = RouteUtil.PATH_SETTING) public class SettingActivity extends AbsActivity implements OnItemClickListener { private RecyclerView mRecyclerView; private Handler mHandler; private SettingAdapter mAdapter; + private ImageView studioGiftEffects, studioRideEffects, upSlideSettings, appWindow, systemWindow; + private boolean giftEffect, mountEffect, slide, isFloat; + private TextView systemHit; @Override protected int getLayoutId() { @@ -56,10 +72,18 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< @Override protected void main() { - setTitle(WordUtil.getString(R.string.setting)); + setTitle(WordUtil.getString(R.string.set_up)); mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView); + studioGiftEffects = findViewById(R.id.studio_gift_effects); + studioRideEffects = findViewById(R.id.studio_ride_effects); + upSlideSettings = findViewById(R.id.up_slide_settings); + appWindow = findViewById(R.id.app_window); + systemHit = findViewById(R.id.system_hit); + systemWindow = findViewById(R.id.system_window); mRecyclerView.setHasFixedSize(true); mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); + giftEffect = IMLoginManager.get(mContext).isGiftEffect(); + mountEffect = IMLoginManager.get(mContext).isMountEffect(); MainHttpUtil.getSettingList(new HttpCallback() { @Override public void onSuccess(int code, String msg, String[] info) { @@ -79,6 +103,149 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< mRecyclerView.setAdapter(mAdapter); } }); + //黑名单 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.blacklist), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 1); + } + }); + //修改密码 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.change_the_password), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + forwardModifyPwd(); + } + }); + //消息通知 + ViewClicksAntiShake.clicksAntiShake(findViewById(R.id.alerts), new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + startActivity(new Intent(SettingActivity.this, MsgSettActivity.class)); + } + }); + //屏蔽坐骑特效 + ViewClicksAntiShake.clicksAntiShake(studioGiftEffects, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + mountEffect = !mountEffect; + if (mountEffect) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, studioGiftEffects); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, studioGiftEffects); + } + //更新特效开关 + IMLoginManager.get(mContext).setMountEffect(mountEffect); + } + + }); + //屏蔽礼物特效 + ViewClicksAntiShake.clicksAntiShake(studioGiftEffects, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + giftEffect = !giftEffect; + if (giftEffect) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, studioRideEffects); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, studioRideEffects); + } + //更新特效开关 + IMLoginManager.get(mContext).setGiftEffect(giftEffect); + } + }); + //直播间滚动 + ViewClicksAntiShake.clicksAntiShake(upSlideSettings, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + slide = !slide; + if (slide) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, upSlideSettings); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, upSlideSettings); + } + //滑动设置 + IMLoginManager.get(mContext).initSlide(slide); + } + }); + //APP内小窗 + ViewClicksAntiShake.clicksAntiShake(appWindow, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + isFloat = !isFloat; + if (!isFloat) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, appWindow); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, appWindow); + } + //更新特效开关 + IMLoginManager.get(mContext).initFloat(isFloat); + } + }); + //系统悬浮窗 + ViewClicksAntiShake.clicksAntiShake(systemWindow, () -> { + PermissionUtils.requestPermission(mContext, new OnPermissionResult() { + @Override + public void permissionResult(boolean isFloat) { + if (!isFloat) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, systemWindow); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, systemWindow); + } + } + }); + } + ); + //系统悬浮窗 + ViewClicksAntiShake.clicksAntiShake(systemHit, () -> { + PermissionUtils.requestPermission(mContext, new OnPermissionResult() { + @Override + public void permissionResult(boolean isFloat) { + if (!isFloat) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, systemWindow); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, systemWindow); + } + } + }); + } + ); + SpannableStringBuilder builder = new SpannableStringBuilder(getString(com.yunbao.common.R.string.system_window_hint)); + String goTo = getString(com.yunbao.common.R.string.to_open_the); + int star = builder.length(); + int end = star + goTo.length(); + builder.append(goTo); + builder.setSpan(new ForegroundColorSpan(Color.parseColor("#ffaf08")), + star, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + + systemHit.setText(builder); + boolean floatPermission = PermissionUtils.checkPermission(mContext); + if (!floatPermission) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, systemWindow); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, systemWindow); + } + isFloat = IMLoginManager.get(mContext).isFloat(); + if (!isFloat) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, appWindow); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, appWindow); + } + slide = IMLoginManager.get(mContext).isSlide(); + if (slide) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, upSlideSettings); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, upSlideSettings); + } + if (giftEffect) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, studioGiftEffects); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, studioGiftEffects); + } + if (mountEffect) { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_off, studioRideEffects); + } else { + ImgLoader.display(mContext, com.yunbao.common.R.mipmap.special_icon_on, studioRideEffects); + } } @@ -93,11 +260,11 @@ public class SettingActivity extends AbsActivity implements OnItemClickListener< } else if (bean.getId() == Constants.SETTING_UPDATE_ID) {//检查更新 checkVersion(); } else if (bean.getId() == Constants.SETTING_ISBLACK) {//拉黑列表 - FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(),1); + FollowActivity.forward(mContext, CommonAppConfig.getInstance().getUid(), 1); } else if (bean.getId() == SETTING_CLEAR_CACHE) {//清除缓存 - clearCache(position); - }else if (bean.getId() == 21) {//清除缓存 - startActivity(new Intent(SettingActivity.this,MsgSettActivity.class)); + clearCache(position); + } else if (bean.getId() == 21) {//清除缓存 + startActivity(new Intent(SettingActivity.this, MsgSettActivity.class)); } } else { if (bean.getId() == 17) {//意见反馈要在url上加版本号和设备号 diff --git a/main/src/main/java/com/yunbao/main/dialog/HintDialog.java b/main/src/main/java/com/yunbao/main/dialog/HintDialog.java new file mode 100644 index 000000000..b38b53742 --- /dev/null +++ b/main/src/main/java/com/yunbao/main/dialog/HintDialog.java @@ -0,0 +1,55 @@ +package com.yunbao.main.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.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 + protected int getLayoutId() { + return R.layout.view_hint; + } + + @Override + protected int getDialogStyle() { + return R.style.dialog; + + } + + @Override + protected boolean canCancel() { + return false; + } + + @Override + protected void setWindowAttributes(Window window) { + window.setWindowAnimations(com.yunbao.live.R.style.bottomToTopAnim); + WindowManager.LayoutParams params = window.getAttributes(); + params.width = DpUtil.dp2px(277); + params.height = DpUtil.dp2px(134); + params.gravity = Gravity.CENTER; + window.setAttributes(params); + } + + @Override + public void onActivityCreated(Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + IMLoginManager.get(mContext).initISHint("3"); + 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()); + } +} diff --git a/main/src/main/res/drawable/bc_reward.xml b/main/src/main/res/drawable/bc_reward.xml new file mode 100644 index 000000000..0ad03fe1d --- /dev/null +++ b/main/src/main/res/drawable/bc_reward.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/activity_setting.xml b/main/src/main/res/layout/activity_setting.xml index ebf7b38ac..be37c111c 100644 --- a/main/src/main/res/layout/activity_setting.xml +++ b/main/src/main/res/layout/activity_setting.xml @@ -1,19 +1,350 @@ + android:layout_width="match_parent" + android:layout_height="match_parent" + android:background="#F5F6F7" + android:orientation="vertical"> - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/layout/view_hint.xml b/main/src/main/res/layout/view_hint.xml new file mode 100644 index 000000000..f1e67461e --- /dev/null +++ b/main/src/main/res/layout/view_hint.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/main/src/main/res/mipmap-xxxhdpi/special_icon_off.png b/main/src/main/res/mipmap-xxxhdpi/special_icon_off.png new file mode 100644 index 000000000..57e24b1e5 Binary files /dev/null and b/main/src/main/res/mipmap-xxxhdpi/special_icon_off.png differ diff --git a/main/src/main/res/mipmap-xxxhdpi/special_icon_on.png b/main/src/main/res/mipmap-xxxhdpi/special_icon_on.png new file mode 100644 index 000000000..b172aa267 Binary files /dev/null and b/main/src/main/res/mipmap-xxxhdpi/special_icon_on.png differ