Skip to content

Commit

Permalink
Merge pull request #39 from ldirry/MOS-022
Browse files Browse the repository at this point in the history
Mos 022 added deletetion confirmation
  • Loading branch information
amomic authored May 5, 2021
2 parents 6c58236 + 4af0aa6 commit db8ea32
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app/src/main/java/com/team12/myopensecret/ViewEntryActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.TextView
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup
Expand Down Expand Up @@ -35,9 +36,18 @@ class ViewEntryActivity: AppCompatActivity() {
override fun onOptionsItemSelected(item: MenuItem): Boolean {

if (item.itemId == R.id.delete_entry) {
MainActivity.dataBase.deleteEmployee(model)
setResult(1)
finish()
val builder = AlertDialog.Builder(this)
builder.setTitle(resources.getString(R.string.title_delete))
builder.setMessage(resources.getString(R.string.description_delete))
builder.setPositiveButton(android.R.string.yes) { dialog, which ->
MainActivity.dataBase.deleteEmployee(model)
setResult(1)
finish()
}
builder.setNegativeButton(android.R.string.no) { dialog, which ->
}

builder.show()
}

return super.onOptionsItemSelected(item)
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values-ru-rRU/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
<string name="toomany200">Слишком много символов (макс. 200)</string>
<string name="choosecategory">выберите категорию!</string>
<string name="language_support">Language2</string>
<string name="title_delete">Удалить подтверждение</string>
<string name="description_delete">Вы действительно хотите удалить эту запись?</string>
<string name="settings">настройки</string>
<string-array name="languages_array">
<item>English</item>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<string name="toomany50">Too many Characters (max. 50)</string>
<string name="toomany200">Too many Characters (max. 200)</string>
<string name="choosecategory">Please choose a category!</string>
<string name="title_delete">Delete Confirmation</string>
<string name="description_delete">Do you really want to delete this entry?</string>
<string name="language_support">Language</string>
<string name="settings">Settings</string>
<string-array name="languages_array">
Expand Down

0 comments on commit db8ea32

Please sign in to comment.