Large display skin
This commit is contained in:
parent
09de329934
commit
55bccafef5
8 changed files with 44 additions and 5 deletions
|
@ -174,6 +174,7 @@ class MainActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
private fun processPreferenceChange(ev: EventPreferenceChange) {
|
||||
if (ev.isChanged(resourceHelper, R.string.key_keep_screen_on)) setWakeLock()
|
||||
if (ev.isChanged(resourceHelper, R.string.key_skin)) recreate()
|
||||
}
|
||||
|
||||
private fun setupViews() {
|
||||
|
|
|
@ -8,6 +8,7 @@ import dagger.multibindings.IntoMap
|
|||
import info.nightscout.androidaps.skins.SkinButtonsOn
|
||||
import info.nightscout.androidaps.skins.SkinClassic
|
||||
import info.nightscout.androidaps.skins.SkinInterface
|
||||
import info.nightscout.androidaps.skins.SkinLargeDisplay
|
||||
import javax.inject.Qualifier
|
||||
|
||||
@Module
|
||||
|
@ -25,6 +26,12 @@ open class SkinsModule {
|
|||
@IntKey(10)
|
||||
fun bindsSkinButtonsOn(skinButtonsOn: SkinButtonsOn): SkinInterface = skinButtonsOn
|
||||
|
||||
@Provides
|
||||
@Skin
|
||||
@IntoMap
|
||||
@IntKey(20)
|
||||
fun bindsSkinLargeDisplay(skinLargeDisplay: SkinLargeDisplay): SkinInterface = skinLargeDisplay
|
||||
|
||||
@Qualifier
|
||||
annotation class Skin
|
||||
}
|
|
@ -184,6 +184,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
overview_bggraph?.gridLabelRenderer?.gridColor = resourceHelper.gc(R.color.graphgrid)
|
||||
overview_bggraph?.gridLabelRenderer?.reloadStyles()
|
||||
overview_bggraph?.gridLabelRenderer?.labelVerticalWidth = axisWidth
|
||||
overview_bggraph?.layoutParams?.height = resourceHelper.dpToPx(skinProvider.activeSkin().mainGraphHeight)
|
||||
|
||||
rangeToDisplay = sp.getInt(R.string.key_rangetodisplay, 6)
|
||||
|
||||
|
@ -482,7 +483,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
|||
overview_iobgraph.addView(label)
|
||||
secondaryGraphsLabel.add(label)
|
||||
val graph = GraphView(context)
|
||||
graph.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, resourceHelper.dpToPx(100)).also { it.setMargins(0, resourceHelper.dpToPx(35), 0, resourceHelper.dpToPx(15)) }
|
||||
graph.layoutParams = LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, resourceHelper.dpToPx(skinProvider.activeSkin().secondaryGraphHeight)).also { it.setMargins(0, resourceHelper.dpToPx(35), 0, resourceHelper.dpToPx(15)) }
|
||||
graph.gridLabelRenderer?.gridColor = resourceHelper.gc(R.color.graphgrid)
|
||||
graph.gridLabelRenderer?.reloadStyles()
|
||||
graph.gridLabelRenderer?.isHorizontalLabelsVisible = false
|
||||
|
|
|
@ -8,7 +8,9 @@ import javax.inject.Singleton
|
|||
@Singleton
|
||||
class SkinButtonsOn @Inject constructor(private val config: Config) : SkinInterface {
|
||||
|
||||
override val description: Int get() = R.string.buttonson_desrciption
|
||||
override val description: Int get() = R.string.buttonson_description
|
||||
override val mainGraphHeight: Int get() = 200
|
||||
override val secondaryGraphHeight: Int get() = 100
|
||||
|
||||
override fun overviewLayout(isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean): Int =
|
||||
when {
|
||||
|
|
|
@ -8,7 +8,9 @@ import javax.inject.Singleton
|
|||
@Singleton
|
||||
class SkinClassic @Inject constructor(private val config: Config): SkinInterface {
|
||||
|
||||
override val description: Int get() = R.string.classic_desrciption
|
||||
override val description: Int get() = R.string.classic_description
|
||||
override val mainGraphHeight: Int get() = 200
|
||||
override val secondaryGraphHeight: Int get() = 100
|
||||
|
||||
override fun overviewLayout(isLandscape: Boolean, isTablet: Boolean, isSmallHeight: Boolean): Int =
|
||||
when {
|
||||
|
|
|
@ -6,5 +6,7 @@ import androidx.annotation.StringRes
|
|||
interface SkinInterface {
|
||||
@get:StringRes val description : Int
|
||||
|
||||
val mainGraphHeight : Int // in dp
|
||||
val secondaryGraphHeight : Int // in dp
|
||||
@LayoutRes fun overviewLayout(isLandscape : Boolean, isTablet : Boolean, isSmallHeight : Boolean): Int
|
||||
}
|
|
@ -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 SkinLargeDisplay @Inject constructor(private val config: Config): SkinInterface {
|
||||
|
||||
override val description: Int get() = R.string.largedisplay_description
|
||||
override val mainGraphHeight: Int get() = 400
|
||||
override val secondaryGraphHeight: Int get() = 150
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
}
|
|
@ -1548,8 +1548,9 @@
|
|||
<string name="key_statuslights_copy_ns" translatable="false">statuslights_copy_ns</string>
|
||||
<string name="copyexistingvalues">Copy NS settings (if exists)?</string>
|
||||
<string name="key_statuslights_overview_advanced" translatable="false">statuslights_overview_advanced</string>
|
||||
<string name="classic_desrciption">Original skin</string>
|
||||
<string name="buttonson_desrciption">Buttons are always displayed on bottom of screen</string>
|
||||
<string name="classic_description">Original skin</string>
|
||||
<string name="buttonson_description">Buttons are always displayed on bottom of screen</string>
|
||||
<string name="largedisplay_description">Large display</string>
|
||||
<string name="key_skin" translatable="false">skin</string>
|
||||
<string name="skin">Skin</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue