Skip to content

Commit

Permalink
After 'Delete' is tapped in the bottom sheet, instead of getting a di…
Browse files Browse the repository at this point in the history
…alog verifying whether or not the user wants to delete their creation, the creation will get deleted and they will then see a snackbar with an 'Undo' button.
  • Loading branch information
therealbluepandabear committed Jul 11, 2022
1 parent cfb6c26 commit 20462be
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ package com.therealbluepandabear.pixapencil.activities.main.bottomsheet
import com.therealbluepandabear.pixapencil.R
import com.therealbluepandabear.pixapencil.activities.main.BottomSheetDialog
import com.therealbluepandabear.pixapencil.activities.main.MainActivity
import com.therealbluepandabear.pixapencil.extensions.showDialog
import com.therealbluepandabear.pixapencil.enums.SnackbarDuration
import com.therealbluepandabear.pixapencil.extensions.showSnackbarWithAction
import com.therealbluepandabear.pixapencil.models.PixelArt

fun MainActivity.extendedOnDeleteTapped(pixelArt: PixelArt, bottomSheetDialog: BottomSheetDialog) {
showDialog(
getString(R.string.dialog_delete_pixel_art_project_title_in_code_str, pixelArt.title),
getString(R.string.dialog_delete_pixel_art_project_text_in_code_str, title),
getString(R.string.generic_ok_in_code_str), { _, _ ->
bottomSheetDialog.dismiss()
pixelArtViewModel.delete(pixelArt)
}, getString(R.string.generic_cancel_in_code_str), null, dimBackground = false
)
bottomSheetDialog.dismiss()
pixelArtViewModel.delete(pixelArt)

binding.clayout.showSnackbarWithAction(
getString(R.string.dialog_delete_pixel_art_project_deleted_text_in_code_str, pixelArt.title),
SnackbarDuration.Long,
getString(R.string.activityCanvasTopAppMenu_undo_str)) {
pixelArtViewModel.insert(pixelArt)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ class MidpointCircleAlgorithm(private val algorithmInfo: AlgorithmInfoParameter,
}

fun compute(p1: Coordinates, radius: Int) {
Log.d("CIRCLE", "CIRCLE STARTED")
Log.d("FLOODFILL", "CIRCLE STARTED")
Log.d("MIRR", "CIRCLE STARTED")

val xc = p1.x
val yc = p1.y

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ enum class SnackbarDuration(val timeValue: Int) {
Short(800),
Default(1500),
Medium(3000),
Long(5000)
}
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
<string name="dialog_image_exception_when_saving_title_in_code_str">Error saving %1$s as %2$s</string>
<string name="dialog_delete_pixel_art_project_title_in_code_str">Delete %1$s?"</string>
<string name="dialog_delete_pixel_art_project_text_in_code_str">Are you sure you want to delete %1$s? - this cannot be undone."</string>
<string name="dialog_delete_pixel_art_project_deleted_text_in_code_str">Deleted %1$s</string>
<string name="dialog_project_details_title_in_code_str">Details</string>
<string name="dialog_rename_title_in_code_str">Rename</string>
<string name="dialog_welcome_title_in_code_str">Welcome</string>
Expand Down

0 comments on commit 20462be

Please sign in to comment.