AndroidAPS/app/src/main/java/info/nightscout/androidaps/skins/SkinLowRes.kt

78 lines
2.9 KiB
Kotlin
Raw Normal View History

package info.nightscout.androidaps.skins
import android.util.DisplayMetrics
2022-03-11 14:48:48 +01:00
import android.view.View.GONE
import android.view.ViewGroup
import androidx.core.view.marginStart
2021-04-14 18:42:12 +02:00
import info.nightscout.androidaps.interfaces.Config
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
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
class SkinLowRes @Inject constructor(private val config: Config) : SkinInterface {
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
}
}
2022-03-11 14:48:48 +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)
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
}