From 96f21643b4f0eb7a969d4153b568fa58eae787cc Mon Sep 17 00:00:00 2001 From: zlzw <583819556@qq.com> Date: Tue, 8 Nov 2022 13:53:24 +0800 Subject: [PATCH] update --- .../com/yunbao/common/utils/DialogUitl.java | 14 +++- .../drawable/bg_dialog_unfollow_cancel.xml | 9 +++ .../main/res/layout/dialog_live_unfollow.xml | 71 +++++++++++++++++++ common/src/main/res/values/strings.xml | 2 + .../live/dialog/LiveUserDialogFragment.java | 28 +++++++- 5 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 common/src/main/res/drawable/bg_dialog_unfollow_cancel.xml create mode 100644 common/src/main/res/layout/dialog_live_unfollow.xml diff --git a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java index a72d6cac7..b8b2583f7 100644 --- a/common/src/main/java/com/yunbao/common/utils/DialogUitl.java +++ b/common/src/main/java/com/yunbao/common/utils/DialogUitl.java @@ -19,6 +19,8 @@ import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.LayoutRes; + import com.yunbao.common.R; import java.util.ArrayList; @@ -320,6 +322,7 @@ public class DialogUitl { private int mLength; private SimpleCallback mClickCallback; private SimpleCallback3 mClickCallback3; + private int mView = 0; public Builder(Context context) { mContext = context; @@ -385,9 +388,18 @@ public class DialogUitl { return this; } + public Builder setView(@LayoutRes int layoutRes) { + mView = layoutRes; + return this; + } + public Dialog build() { final Dialog dialog = new Dialog(mContext, mBackgroundDimEnabled ? R.style.dialog : R.style.dialog2); - dialog.setContentView(mInput ? R.layout.dialog_input : R.layout.dialog_simple); + if (mView != 0) { + dialog.setContentView(mView); + } else { + dialog.setContentView(mInput ? R.layout.dialog_input : R.layout.dialog_simple); + } dialog.setCancelable(mCancelable); dialog.setCanceledOnTouchOutside(mCancelable); TextView titleView = (TextView) dialog.findViewById(R.id.title); diff --git a/common/src/main/res/drawable/bg_dialog_unfollow_cancel.xml b/common/src/main/res/drawable/bg_dialog_unfollow_cancel.xml new file mode 100644 index 000000000..4edc8b6fc --- /dev/null +++ b/common/src/main/res/drawable/bg_dialog_unfollow_cancel.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/layout/dialog_live_unfollow.xml b/common/src/main/res/layout/dialog_live_unfollow.xml new file mode 100644 index 000000000..9121dcf67 --- /dev/null +++ b/common/src/main/res/layout/dialog_live_unfollow.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 9816117cc..f3a2d6462 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -94,6 +94,8 @@ 溫馨提示:可以免費修改昵稱一次,之後修改需要鑽石1800一次 關注 主播哪裡做的不好~\n哥哥確定要取消關注嗎? + 繼續關注 + 不再關注 已關注 我的關注 我的黑名單 diff --git a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java index bccc68faa..ae38a32c2 100644 --- a/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java +++ b/live/src/main/java/com/yunbao/live/dialog/LiveUserDialogFragment.java @@ -47,6 +47,7 @@ import com.yunbao.common.utils.WordUtil; import com.yunbao.live.R; import com.yunbao.live.activity.LiveActivity; import com.yunbao.live.activity.LiveReportActivity; +import com.yunbao.live.activity.LiveRyAnchorActivity; import com.yunbao.live.bean.GuardUserBean; import com.yunbao.live.bean.ImpressBean; import com.yunbao.common.bean.LiveBean; @@ -382,13 +383,32 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On * 关注 */ private void setAttention() { - if(mFollowing) { - //DialogUitl.showSimpleDialog(mContext,WordUtil.getString(R.string.unfollow)); + if (mFollowing) { + DialogUitl.Builder builder = new DialogUitl.Builder(mContext) + .setContent(WordUtil.getString(R.string.unfollow)) + .setConfrimString(WordUtil.getString(R.string.unfollow_confrim)) + .setCancelString(WordUtil.getString(R.string.unfollow_cancel)) + .setView(R.layout.dialog_live_unfollow) + .setClickCallback3(new DialogUitl.SimpleCallback3() { + + + @Override + public void onConfirmClick(Dialog dialog) { + dialog.dismiss(); + } + + @Override + public void onCancel() { + attention(); + } + }); + builder.build().show(); return; } attention(); } - private void attention(){ + + private void attention() { CommonHttpUtil.setAttention(mToUid, new CommonCallback() { @Override @@ -442,6 +462,8 @@ public class LiveUserDialogFragment extends AbsDialogFragment implements View.On report(); } else if (i == R.id.avatar) { forwardHomePage(); + } else if (i == R.id.btn_guard) { + ((LiveActivity) mContext).openNewGuardListWindow(mContext instanceof LiveRyAnchorActivity); } } }