Skip to content

Commit

Permalink
Remove hardcoded ItemDetail string resource
Browse files Browse the repository at this point in the history
  • Loading branch information
PamCatten committed Apr 13, 2024
1 parent 35f084c commit 9e8a9ac
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package com.hotstuff.ui.learn

class LearnFragmentTest {

}
class LearnFragmentTest
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package com.hotstuff.utils

class OnboardAdapterTest {
}
class OnboardAdapterTest
15 changes: 4 additions & 11 deletions app/src/main/java/com/hotstuff/ui/items/ItemDetailFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,6 @@ class ItemDetailFragment : Fragment() {
image.setImageResource(R.drawable.image_default_item)
bundle.putString("image", null)
DatabaseHelper(requireContext()).removeInvalidImageURI(bundle.getInt("id"))
// val item = Item(id = bundle.get("id"))
// item.id =
// item.name = bundle.getString("name")
// category.text = bundle.getString("category")
// room.text = bundle.getString("room")

val quantityNumeral = bundle.getInt("quantity")
}

val editButton = view.findViewById<MaterialButton>(R.id.item_detail_edit_button)
Expand All @@ -89,15 +82,15 @@ class ItemDetailFragment : Fragment() {
val deleteButton = view.findViewById<MaterialButton>(R.id.item_detail_delete_button)
deleteButton.setOnClickListener{
val alertDialogBuilder = MaterialAlertDialogBuilder(requireContext(), R.style.dialog_alert)
alertDialogBuilder.setTitle("Delete item?")
alertDialogBuilder.setMessage("${name.text} will be permanently removed from your device")
alertDialogBuilder.setPositiveButton("Delete") { dialog, _ ->
alertDialogBuilder.setTitle(getString(R.string.dialog_delete_item_title))
alertDialogBuilder.setMessage(getString(R.string.dialog_delete_item_message, name.text))
alertDialogBuilder.setPositiveButton(getString(R.string.dialog_delete)) { dialog, _ ->
DatabaseHelper(requireContext()).deleteItem(bundle.getInt("id"))
bundle.putInt("delete", bundle.getInt("position"))
findNavController().navigate(R.id.action_item_detail_to_items, bundle)
dialog.dismiss()
}
alertDialogBuilder.setNegativeButton("Cancel") { dialog, _ ->
alertDialogBuilder.setNegativeButton(getString(R.string.dialog_negative)) { dialog, _ ->
dialog.dismiss()
}
val alertDialog = alertDialogBuilder.create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class CreateBuildingFragment : Fragment() {
}
createBuildingButton.setOnClickListener {
fun confirmForm() {
val newBuilding = com.hotstuff.models.Building()
val newBuilding = Building()
newBuilding.name = buildingNameText.text.toString().trim()
newBuilding.type = buildingTypeText.text.toString().trim()
newBuilding.description = buildingDescriptionText.text.toString().trim()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
val shareMessage = "$shareApp https://play.google.com/store/apps/details?id=$appPackageName"
textIntent.putExtra(Intent.EXTRA_TEXT, shareMessage)

startActivity(Intent.createChooser(textIntent, appName));
startActivity(Intent.createChooser(textIntent, appName))
}

/**
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
<!-- Dialogs -->
<string name="dialog_positive">OK</string>
<string name="dialog_negative">Cancel</string>
<string name="dialog_delete">Delete</string>
<string name="dialog_export_title">Export item data?</string>
<string name="dialog_export_message">Your records will be saved to your device\'s downloads folder</string>
<string name="dialog_create_item_title">Missing required value</string>
Expand All @@ -90,6 +91,8 @@
<string name="dialog_settings_building_name">Building Name</string>
<string name="dialog_settings_building_type">Building Type</string>
<string name="dialog_settings_building_desc">Building Description</string>
<string name="dialog_delete_item_title">Delete item?</string>
<string name="dialog_delete_item_message">%1$s will be permanently removed from your device</string>
<string name="desc_expand_dropdown">Expand dropdown</string>
<!-- Settings: Building Info -->
<string name="label_building_info">Building Details</string>
Expand Down

0 comments on commit 9e8a9ac

Please sign in to comment.