2020-10-20 21:17:28 +02:00
|
|
|
package info.nightscout.androidaps.skins
|
|
|
|
|
2020-11-22 20:48:36 +01:00
|
|
|
import android.util.DisplayMetrics
|
2022-03-11 14:48:48 +01:00
|
|
|
import android.view.View.GONE
|
2022-04-20 10:24:36 +02:00
|
|
|
import android.view.ViewGroup
|
|
|
|
import androidx.core.view.marginStart
|
2021-04-14 18:42:12 +02:00
|
|
|
import info.nightscout.androidaps.interfaces.Config
|
2020-10-20 21:17:28 +02:00
|
|
|
import info.nightscout.androidaps.R
|
2022-03-11 14:48:48 +01:00
|
|
|
import info.nightscout.androidaps.databinding.ActionsFragmentBinding
|
|
|
|
import info.nightscout.androidaps.databinding.OverviewFragmentBinding
|
2020-10-20 21:17:28 +02:00
|
|
|
import javax.inject.Inject
|
|
|
|
import javax.inject.Singleton
|
|
|
|
|
|
|
|
@Singleton
|
2020-11-22 20:48:36 +01:00
|
|
|
class SkinLowRes @Inject constructor(private val config: Config) : SkinInterface {
|
2020-10-20 21:17:28 +02:00
|
|
|
|
|
|
|
override val description: Int get() = R.string.lowres_description
|
|
|
|
override val mainGraphHeight: Int get() = 200
|
|
|
|
override val secondaryGraphHeight: Int get() = 100
|
|
|
|
|
2022-03-11 14:48:48 +01:00
|
|
|
override fun preProcessLandscapeActionsLayout(dm: DisplayMetrics, binding: ActionsFragmentBinding) {
|
|
|
|
val screenWidth = dm.widthPixels
|
|
|
|
val screenHeight = dm.heightPixels
|
|
|
|
val isLandscape = screenHeight < screenWidth
|
|
|
|
|
|
|
|
if (!isLandscape) {
|
2022-03-13 13:36:55 +01:00
|
|
|
binding.status.apply {
|
2022-03-11 14:48:48 +01:00
|
|
|
sensorAgeLabel.visibility = GONE
|
|
|
|
sensorAgeLabel.visibility = GONE
|
|
|
|
sensorLevelLabel.visibility = GONE
|
|
|
|
insulinAgeLabel.visibility = GONE
|
|
|
|
insulinLevelLabel.visibility = GONE
|
|
|
|
cannulaAgeLabel.visibility = GONE
|
|
|
|
cannulaPlaceholder.visibility = GONE
|
|
|
|
pbAgeLabel.visibility = GONE
|
|
|
|
pbLevelLabel.visibility = GONE
|
|
|
|
}
|
2020-10-26 22:55:22 +01:00
|
|
|
}
|
2022-03-11 14:48:48 +01:00
|
|
|
}
|
2020-11-22 20:48:36 +01:00
|
|
|
|
2022-03-11 14:48:48 +01:00
|
|
|
override fun preProcessLandscapeOverviewLayout(dm: DisplayMetrics, binding: OverviewFragmentBinding, isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean) {
|
|
|
|
if (!config.NSCLIENT && isLandscape) moveButtonsLayout(binding.root)
|
2022-04-20 10:24:36 +02:00
|
|
|
|
|
|
|
binding.apply {
|
|
|
|
infoCard.elevation = 0F
|
|
|
|
infoCard.radius = 0F
|
|
|
|
val paramInfo = (infoCard.layoutParams as ViewGroup.MarginLayoutParams).apply {
|
|
|
|
setMargins(0,0,0,0)
|
|
|
|
}
|
|
|
|
infoCard.layoutParams = paramInfo
|
|
|
|
|
|
|
|
statusCard.elevation = 0F
|
|
|
|
statusCard.radius = 0F
|
|
|
|
statusCard.strokeWidth = 1
|
|
|
|
val paramStatus = (statusCard.layoutParams as ViewGroup.MarginLayoutParams).apply {
|
|
|
|
setMargins(0,0,0,0)
|
|
|
|
}
|
|
|
|
statusCard.layoutParams = paramStatus
|
|
|
|
|
|
|
|
nsclientCard.elevation = 0F
|
|
|
|
nsclientCard.radius = 0F
|
|
|
|
val paramNsClient = (nsclientCard.layoutParams as ViewGroup.MarginLayoutParams).apply {
|
|
|
|
setMargins(0,0,0,0)
|
|
|
|
}
|
|
|
|
nsclientCard.layoutParams = paramNsClient
|
|
|
|
|
|
|
|
graphCard.elevation = 0F
|
|
|
|
graphCard.radius = 0F
|
|
|
|
val paramGraph = (graphCard.layoutParams as ViewGroup.MarginLayoutParams).apply {
|
|
|
|
setMargins(0,0,0,0)
|
|
|
|
}
|
|
|
|
graphCard.layoutParams = paramGraph
|
|
|
|
}
|
|
|
|
|
2021-01-26 15:44:56 +01:00
|
|
|
}
|
2022-03-11 14:48:48 +01:00
|
|
|
|
2020-11-29 15:31:45 +01:00
|
|
|
}
|