forked from microsoft/fluentui-android
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathProgressActivity.kt
More file actions
40 lines (33 loc) · 1.19 KB
/
Copy pathProgressActivity.kt
File metadata and controls
40 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
package com.microsoft.fluentuidemo.demos
import android.os.Bundle
import android.os.Handler
import android.view.LayoutInflater
import com.microsoft.fluentuidemo.DemoActivity
import com.microsoft.fluentuidemo.R
import com.microsoft.fluentuidemo.databinding.ActivityProgressBinding
class ProgressActivity : DemoActivity() {
private lateinit var progressBinding: ActivityProgressBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
progressBinding =
ActivityProgressBinding.inflate(LayoutInflater.from(container.context), container, true)
var progressStatus = 0
val handler = Handler()
// Updates linear determinate progress
Thread {
while (progressStatus < 100) {
progressStatus++
handler.post {
progressBinding.progressBarLinearDeterminate.progress = progressStatus
}
Thread.sleep(20)
if (progressStatus == 100)
progressStatus = 0
}
}.start()
}
}