小编Sab*_*tiG的帖子

在 Kotlin Compose 项目中自动化 UI 测试 - Expresso Recorder 的等效版本

有没有一个框架可以用来在 Kotlin Compose 项目中自动化 UI 回归测试?单击 Android StudioRun -> Record Expresso Test会出现警告:Espresso Testing Framework does not support Compose projects.

android ui-automation kotlin expresso android-jetpack-compose

9
推荐指数
1
解决办法
570
查看次数

Cloud firestore:使用点表示法更新嵌套数组对象中的字段值

请帮我解决这个问题,我想使用点表示法、使用 set() 来更新字段,但每次我运行以下实现时。我将字段添加到 firestore 中,例如,studentInfo.0.course.0.courseId而不是更新已经存在的字段。

Json 样本位于 firestore 中

    "schoolId": "school123",
    "studentInfo": [
        {
            "studentId": "studentI23",
            "regDate": "2020-04-18",
            "course": [
                {
                    "courseId": "cs123",
                    "regDate": "2020-05-28",
                    "status": "COMPLETED"
                }
            ]
        
        }
    ],
    "registered":"yes"
}
Run Code Online (Sandbox Code Playgroud)

代码逻辑

const query = firestore.collection('users').where('registered', '==', 'yes')
const students = await query.get()
 students.forEach(student => {
    firestore.doc(student.ref.path).set({
        'studentInfo.0.studentId': '345','studentInfo.0.course.0.courseId': '555'
      }, { merge: true })
 }) 
Run Code Online (Sandbox Code Playgroud)

在文档https://firebase.google.com/docs/firestore/manage-data/add-data#update_fields_in_nested_objects上,我只能找到更新嵌套对象,但不能找到嵌套数组对象。

javascript firebase google-cloud-platform google-cloud-firestore

6
推荐指数
1
解决办法
2371
查看次数

根据 ExoPlayer 播放音频位置更新 Jetpack Compose 滑块进度

我已经为音频文件播放器创建了一个自定义 UI,并且我正在使用 Exoplayer 来获取文件并播放它。我没有使用 exoplayer 的自定义控制器,并且我的 UI 有一个滑块需要根据当前音频位置进行更新。我怎样才能实现这个目标?请帮忙。

  var currentValue by remember { mutableStateOf(0f) }
  currentValue = mediaPlayer.getCurrentPosition()
  Slider(
            modifier = Modifier.weight(1f),
            value = currentValue ,
            onValueChange = {currentValue = it },
            valueRange = 0f.. mediaPlayer.contentDuration()
        )
               
Run Code Online (Sandbox Code Playgroud)

kotlin exoplayer exoplayer2.x android-jetpack-compose

5
推荐指数
1
解决办法
3897
查看次数