@@ -34,18 +34,22 @@ import androidx.glance.layout.Column
34
34
import androidx.glance.layout.fillMaxWidth
35
35
import androidx.glance.layout.height
36
36
import androidx.glance.layout.padding
37
+ import androidx.glance.preview.ExperimentalGlancePreviewApi
38
+ import androidx.glance.preview.Preview
37
39
import androidx.glance.semantics.semantics
38
40
import androidx.glance.semantics.testTag
39
41
import androidx.glance.text.FontWeight
40
42
import androidx.glance.text.Text
41
43
import androidx.glance.text.TextStyle
42
44
import dagger.hilt.android.AndroidEntryPoint
43
45
import dev.aungkyawpaing.ccdroidx.R
46
+ import dev.aungkyawpaing.ccdroidx.common.BuildState
44
47
import dev.aungkyawpaing.ccdroidx.common.BuildStatus
45
48
import dev.aungkyawpaing.ccdroidx.common.Project
46
49
import dev.aungkyawpaing.ccdroidx.data.ProjectRepo
47
50
import dev.aungkyawpaing.ccdroidx.feature.MainActivity
48
51
import dev.aungkyawpaing.ccdroidx.feature.sync.SyncWorkerScheduler
52
+ import java.time.ZonedDateTime
49
53
import javax.inject.Inject
50
54
51
55
class DashboardWidget (
@@ -146,3 +150,29 @@ class DashboardWidgetReceiver : GlanceAppWidgetReceiver() {
146
150
override val glanceAppWidget: GlanceAppWidget
147
151
get() = DashboardWidget (projectRepo)
148
152
}
153
+
154
+ @OptIn(ExperimentalGlancePreviewApi ::class )
155
+ @Preview(widthDp = 150 , heightDp = 200 )
156
+ @Composable
157
+ fun DashboardWidgetContentPreview () {
158
+ val projects = listOf (
159
+ " failing/project" ,
160
+ " shown/here" ,
161
+ " just/glance"
162
+ ).mapIndexed { index, name ->
163
+ Project (
164
+ id = index.toLong(),
165
+ name = name,
166
+ activity = BuildState .SLEEPING ,
167
+ lastBuildStatus = BuildStatus .FAILURE ,
168
+ lastBuildTime = ZonedDateTime .now(),
169
+ nextBuildTime = null ,
170
+ webUrl = " https://example.com/$name " ,
171
+ feedUrl = " https://www.example.com/cc.xml" ,
172
+ isMuted = false ,
173
+ mutedUntil = null ,
174
+ lastBuildLabel = null
175
+ )
176
+ }
177
+ DashboardWidgetContent (projects)
178
+ }
0 commit comments