Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ class ClipboardTool(
highlightBox()
pasteBoxContent()
}

override fun clearClicked() {
clearClipboardContent()
}
}
clipboardToolOptionsView.setCallback(callback)
toolOptionsViewController.showDelayed()
Expand Down Expand Up @@ -139,6 +143,13 @@ class ClipboardTool(
commandManager.addCommand(command)
}

private fun clearClipboardContent() {
drawingBitmap?.recycle()
drawingBitmap = null
readyForPaste = false
clipboardToolOptionsView.enablePaste(false)
}

override fun onClickOnButton() {
if (!readyForPaste || drawingBitmap == null) {
contextCallback.showNotification(R.string.clipboard_tool_copy_hint)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,7 @@ interface ClipboardToolOptionsView {
fun cutClicked()

fun pasteClicked()

fun clearClicked()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class DefaultClipboardToolOptionsView(rootView: ViewGroup) : ClipboardToolOption
private val pasteChip: Chip
private val copyChip: Chip
private val cutChip: Chip
private val clearChip: Chip
private val shapeSizeChip: Chip
private val changeSizeShapeSizeChip: Chip
private val clipboardToolOptionsView: View
Expand All @@ -49,6 +50,10 @@ class DefaultClipboardToolOptionsView(rootView: ViewGroup) : ClipboardToolOption
pasteChip.setOnClickListener {
callback?.pasteClicked()
}

clearChip.setOnClickListener {
callback?.clearClicked()
}
}

override fun setCallback(callback: ClipboardToolOptionsView.Callback) {
Expand Down Expand Up @@ -81,8 +86,9 @@ class DefaultClipboardToolOptionsView(rootView: ViewGroup) : ClipboardToolOption
val stampToolOptionsView: View =
inflater.inflate(R.layout.dialog_pocketpaint_clipboard_tool, rootView)
copyChip = stampToolOptionsView.findViewById(R.id.action_copy)
pasteChip = stampToolOptionsView.findViewById(R.id.action_paste)
cutChip = stampToolOptionsView.findViewById(R.id.action_cut)
pasteChip = stampToolOptionsView.findViewById(R.id.action_paste)
clearChip = stampToolOptionsView.findViewById(R.id.action_clear)
enablePaste(false)
initializeListeners()
stampToolOptionsView.run {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,23 @@
app:chipIcon="@drawable/ic_pocketpaint_paste_chip_icon_selector"
app:chipStartPadding="8dp" />

<Space
android:id="@+id/space_three"
style="@style/PocketPaintToolHorizontalSpace"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/action_paste" />

<com.google.android.material.chip.Chip
android:id="@+id/action_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toEndOf="@+id/space_three"
android:text="@string/clipboard_tool_clear"
android:theme="@style/Theme.MaterialComponents.Light"
app:chipIcon="@drawable/ic_pocketpaint_layers_delete"
app:chipStartPadding="8dp" />

</RelativeLayout>

<RelativeLayout
Expand Down
1 change: 1 addition & 0 deletions Paintroid/src/main/res/values/string.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<string name="clipboard_tool_paste">Paste</string>
<string name="clipboard_tool_copy">Copy</string>
<string name="clipboard_tool_cut">Cut</string>
<string name="clipboard_tool_clear">Clear</string>

<string name="stickers">Stickers</string>
<string name="dialog_import_image_title" translatable="false">@string/button_import_image</string>
Expand Down