Add horizontal layout to alarm part
This commit is contained in:
parent
345f5eff92
commit
54007afd25
@ -8,6 +8,7 @@ import android.content.IntentFilter
|
|||||||
import android.provider.AlarmClock
|
import android.provider.AlarmClock
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.Alarm
|
import androidx.compose.material.icons.rounded.Alarm
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
@ -78,23 +79,57 @@ class AlarmPartProvider : PartProvider {
|
|||||||
val time by this.time.collectAsState(System.currentTimeMillis())
|
val time by this.time.collectAsState(System.currentTimeMillis())
|
||||||
|
|
||||||
alarmTime?.let {
|
alarmTime?.let {
|
||||||
TextButton(onClick = {
|
|
||||||
context.tryStartActivity(Intent(AlarmClock.ACTION_SHOW_ALARMS))
|
if (layout == ClockWidgetLayout.Vertical) {
|
||||||
},
|
|
||||||
colors = ButtonDefaults.textButtonColors(
|
TextButton(
|
||||||
contentColor = LocalContentColor.current
|
onClick = {
|
||||||
)
|
context.tryStartActivity(Intent(AlarmClock.ACTION_SHOW_ALARMS))
|
||||||
) {
|
},
|
||||||
Icon(
|
colors = ButtonDefaults.textButtonColors(
|
||||||
imageVector = Icons.Rounded.Alarm,
|
contentColor = LocalContentColor.current
|
||||||
contentDescription = null
|
)
|
||||||
)
|
) {
|
||||||
Text(
|
Icon(
|
||||||
modifier = Modifier.padding(start = 12.dp),
|
imageVector = Icons.Rounded.Alarm,
|
||||||
text = DateUtils.getRelativeTimeSpanString(it, time, DateUtils.MINUTE_IN_MILLIS)
|
contentDescription = null
|
||||||
.toString(),
|
)
|
||||||
style = MaterialTheme.typography.labelLarge
|
Text(
|
||||||
)
|
modifier = Modifier.padding(start = 12.dp),
|
||||||
|
text = DateUtils.getRelativeTimeSpanString(
|
||||||
|
it,
|
||||||
|
time,
|
||||||
|
DateUtils.MINUTE_IN_MILLIS
|
||||||
|
)
|
||||||
|
.toString(),
|
||||||
|
style = MaterialTheme.typography.labelLarge
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TextButton(
|
||||||
|
onClick = {
|
||||||
|
context.tryStartActivity(Intent(AlarmClock.ACTION_SHOW_ALARMS))
|
||||||
|
},
|
||||||
|
colors = ButtonDefaults.textButtonColors(
|
||||||
|
contentColor = LocalContentColor.current
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
modifier = Modifier.padding(end = 8.dp).size(32.dp),
|
||||||
|
imageVector = Icons.Rounded.Alarm,
|
||||||
|
contentDescription = null
|
||||||
|
)
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.padding(start = 12.dp),
|
||||||
|
text = DateUtils.getRelativeTimeSpanString(
|
||||||
|
it,
|
||||||
|
time,
|
||||||
|
DateUtils.MINUTE_IN_MILLIS
|
||||||
|
)
|
||||||
|
.toString(),
|
||||||
|
style = MaterialTheme.typography.titleMedium
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user