Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTT功能开发 #76

Open
wants to merge 32 commits into
base: feature/2.8.120
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8a33c79
新增资源文件
Loren-Wang Jun 27, 2024
2327a42
弹窗以及吐司调整
Loren-Wang Jun 27, 2024
64609bd
新增rtt相关组件
Loren-Wang Jun 27, 2024
6df296f
添加rtt管理类以及入口修改
Loren-Wang Jun 27, 2024
2853c12
修改rtt的proto报错
Loren-Wang Jul 1, 2024
29caf84
widget新增
Loren-Wang Jul 1, 2024
b6e3552
rtt逻辑调整
Loren-Wang Jul 4, 2024
5fa522c
ui调整
Loren-Wang Jul 21, 2024
a09136c
接口请求调整
Loren-Wang Jul 22, 2024
2fbbbd3
调整弹窗
Loren-Wang Jul 22, 2024
20f3a05
初始化调整
Loren-Wang Jul 22, 2024
2024a1b
调整代码格式
Loren-Wang Aug 5, 2024
b899290
bug修复
Loren-Wang Aug 8, 2024
ffb575b
崩溃问题修复
Loren-Wang Aug 8, 2024
20929e3
显示UI
Loren-Wang Aug 8, 2024
8b98c00
显示UI
Loren-Wang Aug 8, 2024
dbdc9e5
双语显示问题调整
Loren-Wang Aug 8, 2024
30d8293
显示问题修复
Loren-Wang Aug 8, 2024
6d8258c
显示问题修复
Loren-Wang Aug 9, 2024
dd5167b
显示问题修复
Loren-Wang Aug 9, 2024
49fdec1
显示问题修复
Loren-Wang Aug 9, 2024
86ecdd4
转写开关调整
Loren-Wang Aug 11, 2024
907d52a
样式逻辑调整
Loren-Wang Aug 16, 2024
53bb221
分组逻辑处理rtt显示流程
Loren-Wang Aug 19, 2024
f588878
分组逻辑处理rtt显示流程
Loren-Wang Aug 19, 2024
310427b
调整分组判断
Loren-Wang Aug 20, 2024
83f1760
文案调整
Loren-Wang Aug 23, 2024
7e2da9f
样式微调
Loren-Wang Sep 12, 2024
dc39e52
样式微调
Loren-Wang Sep 14, 2024
a546663
样式微调
Loren-Wang Sep 19, 2024
25b4ca5
Rtt问题修复
Loren-Wang Dec 3, 2024
0f03b6c
修改编译环境
Loren-Wang Dec 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions AgoraCloudScene/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-parcelize'
id 'com.google.protobuf'
}

android {
Expand Down Expand Up @@ -49,6 +50,22 @@ android {
}
}


protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.21.12'
}
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option 'lite' // 生成精简版类
}
}
}
}
}

dependencies {
//implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "androidx.core:core-ktx:${rootProject.ext.dependencies.core_ktx}"
Expand Down Expand Up @@ -77,6 +94,8 @@ dependencies {
implementation 'com.pierfrancescosoffritti.androidyoutubeplayer:custom-ui:12.0.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"

implementation 'com.google.protobuf:protobuf-javalite:3.21.12'
}

if (readyPublishMaven.toBoolean()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package io.agora.online.component

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import io.agora.agoraeducore.core.internal.framework.impl.managers.AgoraWidgetActiveObserver
import io.agora.agoraeducore.core.internal.framework.impl.managers.AgoraWidgetRoomPropsUpdateReq
import io.agora.online.component.common.AbsAgoraEduComponent
import io.agora.online.component.common.IAgoraUIProvider
import io.agora.online.databinding.FcrOnlineEduRttComponentBinding
import io.agora.online.options.AgoraEduOptionsComponent
import io.agora.online.options.AgoraEduRttOptionsComponent
import io.agora.online.widget.FcrWidgetManager.WIDGETS_RTT_ID
import io.agora.online.widget.rtt.FcrRttToolBoxWidget

class FcrRttToolBoxComponent : AbsAgoraEduComponent {
constructor(context: Context) : super(context)
constructor(context: Context, attr: AttributeSet) : super(context, attr)
constructor(context: Context, attr: AttributeSet, defStyleAttr: Int) : super(context, attr, defStyleAttr)


private var binding: FcrOnlineEduRttComponentBinding = FcrOnlineEduRttComponentBinding.inflate(LayoutInflater.from(context), this, true)

/**
* widget插件
*/
private var widget: FcrRttToolBoxWidget? = null

/**
* 界面上设置好的布局
*/
private var conversionStatusView: ViewGroup? = null
private var subtitleView: AgoraEduRttOptionsComponent? = null
private var agoraEduOptionsComponent: AgoraEduOptionsComponent? = null

/**
* 插件注册监听
*/
private val widgetActiveObserver = object : AgoraWidgetActiveObserver {
override fun onWidgetActive(widgetId: String) {
if (widget == null) {
val widgetConfig = eduContext?.widgetContext()?.getWidgetConfig(widgetId)
widgetConfig?.let { config ->
widget = eduContext?.widgetContext()?.create(config) as FcrRttToolBoxWidget?
runOnUIThread{
widget?.init(binding.root, agoraUIProvider, agoraEduOptionsComponent!!, conversionStatusView!!, subtitleView!!)
}
}
}
}

override fun onWidgetInActive(widgetId: String) {
ContextCompat.getMainExecutor(binding.root.context).execute { widget?.release() }
}
}

/**
* 重置工具准提
*/
fun resetEduRttToolBoxStatus() {
widget?.resetEduRttToolBoxStatus()
}

fun initView(
agoraUIProvider: IAgoraUIProvider, agoraEduOptionsComponent: AgoraEduOptionsComponent, conversionStatusView: ViewGroup,
subtitleView: AgoraEduRttOptionsComponent,
) {
super.initView(agoraUIProvider)
this.agoraEduOptionsComponent = agoraEduOptionsComponent
this.conversionStatusView = conversionStatusView
this.subtitleView = subtitleView
eduContext?.widgetContext()?.addWidgetActiveObserver(widgetActiveObserver, WIDGETS_RTT_ID)
eduContext?.widgetContext()?.setWidgetActive(WIDGETS_RTT_ID, AgoraWidgetRoomPropsUpdateReq(state = 1))
}

/**
* 如果体验结束的话,那么则隐藏弹窗view
*/
fun resetShowDialogIfEnd() {
widget?.resetShowDialogIfEnd()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.text.SpannableString
import android.view.View
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
Expand Down Expand Up @@ -60,6 +61,13 @@ class AgoraUIDialog(context: Context) : Dialog(context, R.style.agora_full_scree
this.message.visibility = View.VISIBLE
this.message.text = message
}
fun setMessage(message: SpannableString) {
this.message.visibility = View.VISIBLE
this.message.text = message
}
fun setMessagePaddingHorizontal(messagePaddingHorizontal: Int) {
this.message.setPadding(messagePaddingHorizontal,this.message.paddingTop,messagePaddingHorizontal,this.message.paddingBottom)
}

fun setIconResource(iconResource: Int) {
this.icon.visibility = View.VISIBLE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package io.agora.online.component.dialog

import android.content.Context
import android.text.SpannableString
import android.view.View

class AgoraUIDialogBuilder(private val context: Context) {
private var title: String? = null
private var message: String? = null
private var messageSpan: SpannableString? = null
private var positiveText: String? = null
private var negativeText: String? = null
private var iconResource: Int? = null
private var messagePaddingHorizontal: Int? = null
private var positiveListener: View.OnClickListener? = null
private var negativeListener: View.OnClickListener? = null
private var mCancelable: Boolean? = null
Expand All @@ -28,6 +31,16 @@ class AgoraUIDialogBuilder(private val context: Context) {
return this
}

fun message(message: SpannableString): AgoraUIDialogBuilder {
this.messageSpan = message
return this
}

fun messagePaddingHorizontal(messagePaddingHorizontal: Int): AgoraUIDialogBuilder {
this.messagePaddingHorizontal = messagePaddingHorizontal
return this
}

fun positiveText(text: String): AgoraUIDialogBuilder {
this.positiveText = text
return this
Expand Down Expand Up @@ -57,6 +70,8 @@ class AgoraUIDialogBuilder(private val context: Context) {
val dialog = AgoraUIDialog(context)
title?.let { dialog.setTitle(it) }
message?.let { dialog.setMessage(it) }
messageSpan?.let { dialog.setMessage(it) }
messagePaddingHorizontal?.let { dialog.setMessagePaddingHorizontal(it) }
positiveText?.let { dialog.setPositiveButtonText(it) }
positiveListener?.let { dialog.setPositiveClick(it) }
negativeText?.let { dialog.setNegativeButtonText(it) }
Expand Down Expand Up @@ -138,4 +153,28 @@ class AgoraUICustomDialogBuilder(private val context: Context) {
}
return dialog
}
}
}

class AgoraUIRttSettingBuilder(private val context: Context) {
private var listener: AgoraUIRttSettingDialogListener? = null
fun build(): AgoraUIRttSettingDialog {
val dialog = AgoraUIRttSettingDialog(context)
listener?.let { dialog.setListener(it) }
return dialog
}

/**
* 设置监听
*/
fun setListener(listener: AgoraUIRttSettingDialogListener): AgoraUIRttSettingBuilder {
this.listener = listener
return this
}
}

class AgoraUIRttConversionDialogBuilder(private val context: Context) {
fun build(): AgoraUIRttConversionDialog {
val dialog = AgoraUIRttConversionDialog(context)
return dialog
}
}
Loading