Replace dedicated setting by Low Res Skin

Just a copy of Classic skin for initialization
This commit is contained in:
Philoul 2020-10-20 21:17:28 +02:00
parent ee79588449
commit 85c2c9bb50
5 changed files with 35 additions and 8 deletions

View file

@ -9,6 +9,7 @@ import info.nightscout.androidaps.skins.SkinButtonsOn
import info.nightscout.androidaps.skins.SkinClassic import info.nightscout.androidaps.skins.SkinClassic
import info.nightscout.androidaps.skins.SkinInterface import info.nightscout.androidaps.skins.SkinInterface
import info.nightscout.androidaps.skins.SkinLargeDisplay import info.nightscout.androidaps.skins.SkinLargeDisplay
import info.nightscout.androidaps.skins.SkinLowRes
import javax.inject.Qualifier import javax.inject.Qualifier
@Module @Module
@ -32,6 +33,12 @@ open class SkinsModule {
@IntKey(20) @IntKey(20)
fun bindsSkinLargeDisplay(skinLargeDisplay: SkinLargeDisplay): SkinInterface = skinLargeDisplay fun bindsSkinLargeDisplay(skinLargeDisplay: SkinLargeDisplay): SkinInterface = skinLargeDisplay
@Provides
@Skin
@IntoMap
@IntKey(30)
fun bindsSkinLowRes(skinLowRes: SkinLowRes): SkinInterface = skinLowRes
@Qualifier @Qualifier
annotation class Skin annotation class Skin
} }

View file

@ -24,6 +24,7 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper
import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction import info.nightscout.androidaps.plugins.general.actions.defs.CustomAction
import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler import info.nightscout.androidaps.plugins.general.overview.StatusLightHandler
import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.skins.SkinProvider
import info.nightscout.androidaps.utils.FabricPrivacy import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.alertDialogs.OKDialog import info.nightscout.androidaps.utils.alertDialogs.OKDialog
import info.nightscout.androidaps.utils.buildHelper.BuildHelper import info.nightscout.androidaps.utils.buildHelper.BuildHelper
@ -54,6 +55,7 @@ class ActionsFragment : DaggerFragment() {
@Inject lateinit var commandQueue: CommandQueueProvider @Inject lateinit var commandQueue: CommandQueueProvider
@Inject lateinit var buildHelper: BuildHelper @Inject lateinit var buildHelper: BuildHelper
@Inject lateinit var protectionCheck: ProtectionCheck @Inject lateinit var protectionCheck: ProtectionCheck
@Inject lateinit var skinProvider: SkinProvider
@Inject lateinit var config: Config @Inject lateinit var config: Config
private var disposable: CompositeDisposable = CompositeDisposable() private var disposable: CompositeDisposable = CompositeDisposable()
@ -239,7 +241,8 @@ class ActionsFragment : DaggerFragment() {
actions_pumpbatterychange?.visibility = pump.pumpDescription.isBatteryReplaceable.toVisibility() actions_pumpbatterychange?.visibility = pump.pumpDescription.isBatteryReplaceable.toVisibility()
actions_temptarget?.visibility = (profile != null && config.APS).toVisibility() actions_temptarget?.visibility = (profile != null && config.APS).toVisibility()
actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility() actions_tddstats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility()
val shortlabel = sp.getBoolean(R.string.key_short_cp_label,false)
val shortlabel = skinProvider.activeSkin().description == R.string.lowres_description
if (shortlabel) { if (shortlabel) {
careportal_pblabel?.text = resourceHelper.gs(R.string.pump) careportal_pblabel?.text = resourceHelper.gs(R.string.pump)
careportal_sensoragelabel?.text = "" careportal_sensoragelabel?.text = ""

View file

@ -0,0 +1,23 @@
package info.nightscout.androidaps.skins
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.R
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
override fun overviewLayout(isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean): Int =
when {
config.NSCLIENT && isTablet -> R.layout.overview_fragment_nsclient_tablet
config.NSCLIENT -> R.layout.overview_fragment_nsclient
isSmallHeight || isLandscape -> R.layout.overview_fragment_landscape
else -> R.layout.overview_fragment
}
}

View file

@ -403,7 +403,6 @@
<string name="wear_shortname">WEAR</string> <string name="wear_shortname">WEAR</string>
<string name="smscommunicator_shortname">SMS</string> <string name="smscommunicator_shortname">SMS</string>
<string name="short_tabtitles">Shorten tab titles</string> <string name="short_tabtitles">Shorten tab titles</string>
<string name="short_cp_label">Shorten Careportal labels in Actions tab</string>
<string name="always_use_shortavg">Always use short average delta instead of simple delta</string> <string name="always_use_shortavg">Always use short average delta instead of simple delta</string>
<string name="always_use_shortavg_summary">Useful when data from unfiltered sources like xDrip gets noisy.</string> <string name="always_use_shortavg_summary">Useful when data from unfiltered sources like xDrip gets noisy.</string>
<string name="key_advancedsettings" translatable="false">key_advancedsettings</string> <string name="key_advancedsettings" translatable="false">key_advancedsettings</string>
@ -1032,7 +1031,6 @@
<string name="loop_openmode_min_change">Minimal request change [%]</string> <string name="loop_openmode_min_change">Minimal request change [%]</string>
<string name="loop_openmode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</string> <string name="loop_openmode_min_change_summary" formatted="false">Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20%</string>
<string name="key_short_tabtitles" translatable="false">short_tabtitles</string> <string name="key_short_tabtitles" translatable="false">short_tabtitles</string>
<string name="key_short_cp_label" translatable="false">short_cplabel</string>
<string name="searching_for_devices">Searching for devices…</string> <string name="searching_for_devices">Searching for devices…</string>
<string name="pairing_completed">Pairing completed</string> <string name="pairing_completed">Pairing completed</string>
<string name="code_compare">Do the codes displayed on this device and on your pump match?</string> <string name="code_compare">Do the codes displayed on this device and on your pump match?</string>
@ -1410,6 +1408,7 @@
<string name="copyexistingvalues">Copy NS settings (if exists)?</string> <string name="copyexistingvalues">Copy NS settings (if exists)?</string>
<string name="key_statuslights_overview_advanced" translatable="false">statuslights_overview_advanced</string> <string name="key_statuslights_overview_advanced" translatable="false">statuslights_overview_advanced</string>
<string name="classic_description">Original skin</string> <string name="classic_description">Original skin</string>
<string name="lowres_description">Low Resolution skin</string>
<string name="buttonson_description">Buttons are always displayed on bottom of screen</string> <string name="buttonson_description">Buttons are always displayed on bottom of screen</string>
<string name="largedisplay_description">Large display</string> <string name="largedisplay_description">Large display</string>
<string name="key_skin" translatable="false">skin</string> <string name="key_skin" translatable="false">skin</string>

View file

@ -282,11 +282,6 @@
android:key="@string/key_show_statuslights" android:key="@string/key_show_statuslights"
android:title="@string/show_statuslights" /> android:title="@string/show_statuslights" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_short_cp_label"
android:title="@string/short_cp_label" />
<info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference <info.nightscout.androidaps.utils.textValidator.ValidatingEditTextPreference
android:defaultValue="48" android:defaultValue="48"
android:dependency="@string/key_show_statuslights" android:dependency="@string/key_show_statuslights"