diff --git a/app/src/main/java/it/danieleverducci/lunatracker/MainActivity.kt b/app/src/main/java/it/danieleverducci/lunatracker/MainActivity.kt index ec65d8a..07ed707 100644 --- a/app/src/main/java/it/danieleverducci/lunatracker/MainActivity.kt +++ b/app/src/main/java/it/danieleverducci/lunatracker/MainActivity.kt @@ -83,6 +83,7 @@ class MainActivity : AppCompatActivity() { recyclerView.adapter = adapter // Set listeners + findViewById(R.id.logbooks_add_button).setOnClickListener { showAddLogbookDialog() } findViewById(R.id.button_bottle).setOnClickListener { askBabyBottleContent() } findViewById(R.id.button_scale).setOnClickListener { askWeightValue() } findViewById(R.id.button_nipple_left).setOnClickListener { logEvent( @@ -330,7 +331,12 @@ class MainActivity : AppCompatActivity() { // Show logbooks dropdown val spinner = findViewById(R.id.logbooks_spinner) val sAdapter = ArrayAdapter(this@MainActivity, android.R.layout.simple_spinner_item) - sAdapter.addAll(logbooksNames) + sAdapter.setDropDownViewResource(R.layout.row_logbook_spinner) + for (ln in logbooksNames) { + sAdapter.add( + if (ln.isEmpty()) getString(R.string.default_logbook_name) else ln + ) + } spinner.adapter = sAdapter spinner.onItemSelectedListener = object: AdapterView.OnItemSelectedListener { override fun onItemSelected( diff --git a/app/src/main/res/drawable/dropdown_list_item_background.xml b/app/src/main/res/drawable/dropdown_list_item_background.xml new file mode 100644 index 0000000..f246fbe --- /dev/null +++ b/app/src/main/res/drawable/dropdown_list_item_background.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/dropdown_list_item_background_pressed.xml b/app/src/main/res/drawable/dropdown_list_item_background_pressed.xml new file mode 100644 index 0000000..3c655cc --- /dev/null +++ b/app/src/main/res/drawable/dropdown_list_item_background_pressed.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/app/src/main/res/drawable/dropdown_list_item_background_released.xml b/app/src/main/res/drawable/dropdown_list_item_background_released.xml new file mode 100644 index 0000000..bcae055 --- /dev/null +++ b/app/src/main/res/drawable/dropdown_list_item_background_released.xml @@ -0,0 +1,14 @@ + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 72028fe..cbcb678 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -65,7 +65,7 @@ @@ -25,7 +25,7 @@ android:layout_height="match_parent" android:layout_marginTop="10dp" android:padding="20dp" - android:background="@drawable/button_background" + android:background="@drawable/dropdown_list_item_background" style="@style/OverflowMenuText" android:text="@string/overflow_event_enema"/> @@ -35,7 +35,7 @@ android:layout_height="match_parent" android:layout_marginTop="10dp" android:padding="20dp" - android:background="@drawable/button_background" + android:background="@drawable/dropdown_list_item_background" style="@style/OverflowMenuText" android:text="@string/overflow_event_note"/> @@ -45,7 +45,7 @@ android:layout_height="match_parent" android:layout_marginTop="10dp" android:padding="20dp" - android:background="@drawable/button_background" + android:background="@drawable/dropdown_list_item_background" style="@style/OverflowMenuText" android:text="@string/overflow_event_temperature"/> @@ -55,7 +55,7 @@ android:layout_height="match_parent" android:layout_marginTop="10dp" android:padding="20dp" - android:background="@drawable/button_background" + android:background="@drawable/dropdown_list_item_background" style="@style/OverflowMenuText" android:text="@string/overflow_event_colic"/> diff --git a/app/src/main/res/layout/row_logbook_spinner.xml b/app/src/main/res/layout/row_logbook_spinner.xml new file mode 100644 index 0000000..6e955e9 --- /dev/null +++ b/app/src/main/res/layout/row_logbook_spinner.xml @@ -0,0 +1,11 @@ + + diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index e540ab1..848aa0d 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -84,6 +84,6 @@ Nome del diario Scrivi un nome per identificare questo diario. Comparirà in cima allo schermo, e se usi WebDAV sarà incluso anche nel nome del file di salvataggio. - Senza nome + 👶 Il mio primo diario \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 87594b8..fa31134 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -107,6 +107,6 @@ Logbook name Write a name to identify this logbook. This name will appear on top of the screen and, if you use WebDAV, will be in the save file name as well. - Unnamed + 👶 My first logbook \ No newline at end of file