stats layout

This commit is contained in:
Milos Kozak 2019-12-31 15:04:20 +01:00
parent f8b2b596c6
commit cc125986ac
4 changed files with 97 additions and 27 deletions

View file

@ -7,7 +7,7 @@ import info.nightscout.androidaps.utils.OKDialog
import info.nightscout.androidaps.utils.stats.TddCalculator
import info.nightscout.androidaps.utils.stats.TirCalculator
import info.nightscout.androidaps.utils.resources.ResourceHelper
import kotlinx.android.synthetic.main.stats_activity.*
import kotlinx.android.synthetic.main.activity_stats.*
import javax.inject.Inject
class StatsActivity : NoSplashAppCompatActivity() {
@ -18,7 +18,7 @@ class StatsActivity : NoSplashAppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.stats_activity)
setContentView(R.layout.activity_stats)
stats_tdds.text = tddCalculator.stats()
stats_tir.text = tirCalculator.stats()

View file

@ -22,6 +22,7 @@ class LogSettingActivity : NoSplashAppCompatActivity() {
L.resetToDefaults()
createViewsForSettings()
}
ok.setOnClickListener { finish() }
}
private fun createViewsForSettings() {
@ -34,7 +35,8 @@ class LogSettingActivity : NoSplashAppCompatActivity() {
}
internal inner class LogViewHolder(element: L.LogElement) {
var baseView: LinearLayout = layoutInflater.inflate(R.layout.logsettings_item, null) as LinearLayout
@Suppress("InflateParams")
var baseView = layoutInflater.inflate(R.layout.logsettings_item, null) as LinearLayout
init {
(baseView.findViewById<View>(R.id.logsettings_description) as TextView).text = element.name

View file

@ -1,21 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".plugins.general.maintenance.activities.LogSettingActivity">
<Button
android:id="@+id/logsettings_reset"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:text="@string/resettodefaults" />
android:orientation="vertical">
<ScrollView
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/activity_title_background"
android:orientation="horizontal"
android:padding="5dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/carbs"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/nav_logsettings"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<LinearLayout
android:id="@+id/spacer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" />
<LinearLayout
android:id="@+id/logsettings_placeholder"
@ -23,6 +52,34 @@
android:layout_height="wrap_content"
android:orientation="vertical" />
</ScrollView>
<LinearLayout
android:id="@+id/done_background"
android:layout_width="match_parent"
android:layout_height="56dp"
android:orientation="horizontal"
android:background="@android:color/transparent"
android:gravity="end"
android:layout_gravity="center_vertical"
android:paddingBottom="8dp">
</LinearLayout>
<Button
android:id="@+id/logsettings_reset"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginEnd="8dp"
style="@style/mdtp_ActionButton.Text"
android:text="@string/resettodefaults" />
<Button
android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
style="@style/mdtp_ActionButton.Text"
android:text="@string/mdtp_ok" />
</LinearLayout>
</LinearLayout>
</ScrollView>

View file

@ -12,27 +12,39 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/activity_title_background"
android:orientation="horizontal"
android:padding="5dp">
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:paddingStart="10dp"
android:contentDescription="@string/carbs"
app:srcCompat="@mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_centerInParent="true"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/statistics"
android:textAppearance="@style/TextAppearance.AppCompat.Display1" />
</LinearLayout>
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
</RelativeLayout>
<LinearLayout
android:id="@+id/spacer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp" />
<TextView
android:id="@+id/stats_tdds"
@ -55,13 +67,13 @@
android:layout_marginStart="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:id="@+id/done_background"
android:layout_width="match_parent"
android:layout_height="56dp"
android:orientation="horizontal"
android:background="@android:color/transparent"
android:gravity="end|right"
android:gravity="end"
android:layout_gravity="center_vertical"
android:paddingBottom="8dp">
@ -69,7 +81,6 @@
android:id="@+id/stats_reset"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginRight="8dp"
android:layout_marginEnd="8dp"
style="@style/mdtp_ActionButton.Text"
android:text="@string/reset" />
@ -78,10 +89,10 @@
android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
style="@style/mdtp_ActionButton.Text"
android:text="@string/mdtp_ok" />
</LinearLayout>
</LinearLayout>