cleanup nsclient settings

This commit is contained in:
Milos Kozak 2020-07-24 13:30:19 +02:00
parent 7bf9b8d588
commit bad7a584c6
2 changed files with 20 additions and 2 deletions

View file

@ -190,7 +190,7 @@ abstract class PluginsModule {
abstract fun bindLocalProfilePlugin(plugin: LocalProfilePlugin): PluginBase
@Binds
@AllConfigs
@APS
@IntoMap
@IntKey(250)
abstract fun bindAutomationPlugin(plugin: AutomationPlugin): PluginBase

View file

@ -1,6 +1,9 @@
package info.nightscout.androidaps.plugins.general.overview
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.Config
import info.nightscout.androidaps.R
import info.nightscout.androidaps.events.EventRefreshOverview
import info.nightscout.androidaps.interfaces.PluginBase
@ -26,7 +29,8 @@ class OverviewPlugin @Inject constructor(
private val fabricPrivacy: FabricPrivacy,
private val rxBus: RxBusWrapper,
aapsLogger: AAPSLogger,
resourceHelper: ResourceHelper
resourceHelper: ResourceHelper,
private val config: Config
) : PluginBase(PluginDescription()
.mainType(PluginType.GENERAL)
.fragmentClass(OverviewFragment::class.qualifiedName)
@ -64,4 +68,18 @@ class OverviewPlugin @Inject constructor(
disposable.clear()
super.onStop()
}
override fun preprocessPreferences(preferenceFragment: PreferenceFragmentCompat) {
super.preprocessPreferences(preferenceFragment)
if (config.NSCLIENT) {
(preferenceFragment.findPreference(resourceHelper.gs(R.string.key_show_cgm_button)) as SwitchPreference?)?.let {
it.isVisible = false
it.isEnabled = false
}
(preferenceFragment.findPreference(resourceHelper.gs(R.string.key_show_calibration_button)) as SwitchPreference?)?.let {
it.isVisible = false
it.isEnabled = false
}
}
}
}