Kaynağa Gözat

feat: 开播限制

tongmengxiao 5 ay önce
ebeveyn
işleme
54cc71fed8

+ 4 - 0
baseswago/src/main/res/values-ar/strings.xml

@@ -288,4 +288,8 @@
     <string name="today_audio_duration">مدة الصوت اليوم</string>
     <string name="total_voice_time_this_week">إجمالي وقت الصوت هذا الأسبوع</string>
     <string name="voice_valid_days_this_week">أيام صالحة صوت هذا الأسبوع</string>
+    <string name="live_streaming_restrictions">قيود البث المباشر</string>
+    <string name="conditions_to_start_live_broadcasting">يجب عليك استيفاء أي من الشروط التالية لبدء البث المباشر</string>
+    <string name="already_be_a_host_or_agency">أن تكون مضيفًا أو وكالة بالفعل</string>
+    <string name="cumulative_recharge">إعادة الشحن التراكمي >=10$</string>
 </resources>

+ 4 - 0
baseswago/src/main/res/values-in/strings.xml

@@ -292,4 +292,8 @@
     <string name="today_audio_duration">Total durasi audio hari ini</string>
     <string name="total_voice_time_this_week">Total durasi audio minggu ini</string>
     <string name="voice_valid_days_this_week">valid hari audio Minggu Ini</string>
+    <string name="live_streaming_restrictions">Pembatasan streaming live</string>
+    <string name="conditions_to_start_live_broadcasting">Anda harus memenuhi salah satu ketentuan berikut untuk mulai siaran live</string>
+    <string name="already_be_a_host_or_agency">Sudah menjadi host atau agensi</string>
+    <string name="cumulative_recharge">Top up kumulatif>=10$</string>
 </resources>

+ 4 - 0
baseswago/src/main/res/values-ms/strings.xml

@@ -289,4 +289,8 @@
     <string name="today_audio_duration">Total durasi audio hari ini</string>
     <string name="total_voice_time_this_week">Total durasi audio minggu ini</string>
     <string name="voice_valid_days_this_week">valid hari audio Minggu Ini</string>
+    <string name="live_streaming_restrictions">Pembatasan streaming live</string>
+    <string name="conditions_to_start_live_broadcasting">Anda harus memenuhi salah satu ketentuan berikut untuk mulai siaran live</string>
+    <string name="already_be_a_host_or_agency">Sudah menjadi host atau agensi</string>
+    <string name="cumulative_recharge">Top up kumulatif>=10$</string>
 </resources>

+ 4 - 0
baseswago/src/main/res/values-zh/strings.xml

@@ -288,4 +288,8 @@
     <string name="today_audio_duration">本日语音时长</string>
     <string name="total_voice_time_this_week">本周语音总时长</string>
     <string name="voice_valid_days_this_week">本周语音有效天</string>
+    <string name="live_streaming_restrictions">直播限制</string>
+    <string name="conditions_to_start_live_broadcasting">需要满足以下任一条件可以开始直播</string>
+    <string name="already_be_a_host_or_agency">已经是主播或者家族长身份</string>
+    <string name="cumulative_recharge">累计充值>=10$</string>
 </resources>

+ 4 - 0
baseswago/src/main/res/values/strings.xml

@@ -310,4 +310,8 @@
     <string name="today_audio_duration">Today’s audio duration</string>
     <string name="total_voice_time_this_week">Total voice time this week</string>
     <string name="voice_valid_days_this_week">Voice valid days this week</string>
+    <string name="live_streaming_restrictions">Live streaming restrictions</string>
+    <string name="conditions_to_start_live_broadcasting">You need to meet any of the following conditions to start live broadcasting</string>
+    <string name="already_be_a_host_or_agency">Already be a host or agency</string>
+    <string name="cumulative_recharge">Cumulative recharge>=10$</string>
 </resources>

+ 5 - 0
room/src/main/java/com/swago/room/anchor/AnchorRoomActivity.kt

@@ -46,6 +46,7 @@ import com.swago.room.databinding.ActivityAnchorRoomBinding
 import com.swago.room.dialog.AnchorCloseDialog
 import com.swago.room.dialog.CanStartLiveDialog
 import com.swago.room.dialog.ForceCloseRoomDialog
+import com.swago.room.dialog.LiveRestrictionsDialog
 import com.swago.room.enum.RoomType
 import com.swago.room.lianmai.LianMaiManager
 import com.swago.room.lianmai.LianMaiVm
@@ -296,6 +297,10 @@ class AnchorRoomActivity : AbsAnchorActivity<ActivityAnchorRoomBinding, IRoomInf
             CanStartLiveDialog.newInstance(it).show(supportFragmentManager, "CanStartLiveDialog")
         }
 
+        roomVm.showLiveStreaming = {
+            LiveRestrictionsDialog.newInstance().show(supportFragmentManager , "LiveRestrictionsDialog")
+        }
+
         roomVm.anchorCloseLiveData.observe(this) {
             anchorCloseDialog = AnchorCloseDialog.newInstance(it)
             anchorCloseDialog?.show(supportFragmentManager, "AnchorCloseDialog")

+ 61 - 0
room/src/main/java/com/swago/room/dialog/LiveRestrictionsDialog.kt

@@ -0,0 +1,61 @@
+package com.swago.room.dialog
+
+import android.content.ClipData
+import android.content.ClipboardManager
+import android.content.Context
+import android.os.Bundle
+import android.view.Gravity
+import android.widget.Toast
+import androidx.fragment.app.viewModels
+import com.alibaba.android.arouter.launcher.ARouter
+import com.swago.baseswago.constant.ARouteConstant
+import com.swago.baseswago.constant.UrlConstant
+import com.swago.baseswago.dialog.BaseXDFragment
+import com.swago.baseswago.util.AppContext
+import com.swago.baseswago.util.NoDoubleClickListener
+import com.swago.baseswago.util.SwagoInfo
+import com.swago.baseswago.util.SwagoShareUtils
+import com.swago.room.R
+import com.swago.room.databinding.DialogLiveRestrictionsBinding
+import com.swago.room.databinding.DialogShareBinding
+import com.swago.room.vm.RoomOtherVm
+
+/**
+ *@date 2022/3/29 21:00
+ *description:
+ */
+class LiveRestrictionsDialog : BaseXDFragment<DialogLiveRestrictionsBinding>() {
+
+    init {
+        setGravity(Gravity.BOTTOM)
+        setCanCancel(true)
+        setDimAmount(0f)
+    }
+
+    companion object{
+        fun newInstance(): LiveRestrictionsDialog {
+            val args = Bundle()
+            val fragment = LiveRestrictionsDialog()
+            fragment.arguments = args
+            return fragment
+        }
+    }
+
+    override fun initOther() {
+        binding.tvRecharge.setOnClickListener {
+            if (SwagoInfo.isGooglePackage()){
+                ARouter.getInstance().build(ARouteConstant.User.recharge).navigation()
+            }else{
+                ARouter.getInstance().build(ARouteConstant.Base.webView)
+                    .withString("url", UrlConstant.TOP_UP)
+                    .navigation()
+            }
+            dismissAllowingStateLoss()
+        }
+    }
+
+    override fun initLiveData() {
+
+    }
+
+}

+ 6 - 0
room/src/main/java/com/swago/room/vm/RoomVm.kt

@@ -44,6 +44,9 @@ class RoomVm(application: Application) : AbsRoomVm(application) {
     //显示禁播时长弹窗
     var showBannerTime:((time:Long)->Unit)? = null
 
+    //开播限制
+    var showLiveStreaming:(()->Unit)? = null
+
     override fun afterRoomChange(
         roleType: Int,
         iRoomInfo: IRoomInfo,
@@ -152,6 +155,9 @@ class RoomVm(application: Application) : AbsRoomVm(application) {
                         545 -> {
                             showBannerTime?.invoke((it.message?:"0").toLong())
                         }
+                        601 -> {
+                            showLiveStreaming?.invoke()
+                        }
                         else -> {
                             Toast.makeText(AppContext.getContext(), it.message, Toast.LENGTH_SHORT).show()
                             SwagoRoomManager.closeRoom()

+ 103 - 0
room/src/main/res/layout/dialog_live_restrictions.xml

@@ -0,0 +1,103 @@
+<?xml version="1.0" encoding="utf-8"?>
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
+
+    <androidx.constraintlayout.widget.ConstraintLayout
+        android:background="@drawable/shape_white_top_20"
+        app:layout_constraintTop_toTopOf="parent"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:paddingBottom="24dp">
+
+        <com.swago.baseswago.cusview.BoldTextView
+            android:id="@+id/tvTitle"
+            android:textColor="#131B23"
+            android:textSize="17dp"
+            android:layout_marginTop="14dp"
+            app:layout_constraintTop_toTopOf="parent"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            android:text="@string/live_streaming_restrictions"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"/>
+
+
+        <com.swago.baseswago.cusview.MediumTextView
+            android:id="@+id/tv_hint"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/tvTitle"
+            android:layout_marginTop="20dp"
+            android:textSize="14sp"
+            android:textColor="#0F172A"
+            android:paddingStart="16dp"
+            android:paddingEnd="16dp"
+            android:gravity="center"
+            android:text="@string/conditions_to_start_live_broadcasting"/>
+
+        <androidx.constraintlayout.widget.ConstraintLayout
+            android:id="@+id/content"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@drawable/shape_f1f4f8_16"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="16dp"
+            android:layout_marginTop="23dp"
+            android:paddingBottom="@dimen/dp_10"
+            app:layout_constraintTop_toBottomOf="@+id/tv_hint">
+
+            <com.swago.baseswago.cusview.MediumTextView
+                android:id="@+id/textview1"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="@dimen/sp_14"
+                android:textColor="#0F172A"
+                android:layout_marginTop="@dimen/dp_10"
+                android:drawableStart="@mipmap/ic_user_type"
+                android:layout_marginStart="12dp"
+                android:drawablePadding="12dp"
+                android:text="@string/already_be_a_host_or_agency"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toTopOf="parent"/>
+
+            <com.swago.baseswago.cusview.MediumTextView
+                android:id="@+id/textview2"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:textSize="@dimen/sp_14"
+                android:textColor="#0F172A"
+                android:layout_marginTop="@dimen/dp_10"
+                android:drawableStart="@mipmap/ic_wallet"
+                android:layout_marginStart="12dp"
+                android:drawablePadding="12dp"
+                android:text="@string/cumulative_recharge"
+                app:layout_constraintStart_toStartOf="parent"
+                app:layout_constraintTop_toBottomOf="@+id/textview1"/>
+        </androidx.constraintlayout.widget.ConstraintLayout>
+
+        <com.swago.baseswago.cusview.BoldTextView
+            android:id="@+id/tvRecharge"
+            android:layout_width="match_parent"
+            android:layout_height="44dp"
+            app:layout_constraintStart_toStartOf="parent"
+            app:layout_constraintEnd_toEndOf="parent"
+            app:layout_constraintTop_toBottomOf="@+id/content"
+            android:layout_marginTop="23dp"
+            android:layout_marginStart="16dp"
+            android:layout_marginEnd="16dp"
+            android:text="@string/recharge"
+            android:textColor="@color/_ffffff"
+            android:gravity="center"
+            android:textSize="16sp"
+            android:layout_marginBottom="24dp"
+            android:background="@drawable/shape_ff56b7_37"/>
+
+    </androidx.constraintlayout.widget.ConstraintLayout>
+
+</androidx.constraintlayout.widget.ConstraintLayout>

BIN
room/src/main/res/mipmap-xxhdpi/ic_user_type.png


BIN
room/src/main/res/mipmap-xxhdpi/ic_wallet.png