adding a Clipboard button at the top toolbar

This commit is contained in:
tibbi 2022-01-26 22:08:14 +01:00
parent 985c70e209
commit 247ed0607d
3 changed files with 33 additions and 6 deletions

View File

@ -278,6 +278,7 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
} }
settings_cog.applyColorFilter(mTextColor) settings_cog.applyColorFilter(mTextColor)
pinned_clipboard_items.applyColorFilter(mTextColor)
clipboard_clear.applyColorFilter(mTextColor) clipboard_clear.applyColorFilter(mTextColor)
} }
} }
@ -319,6 +320,17 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
context.startActivity(this) context.startActivity(this)
} }
} }
pinned_clipboard_items.setOnLongClickListener { context.toast(R.string.clipboard); true; }
pinned_clipboard_items.setOnClickListener {
}
clipboard_clear.setOnLongClickListener { context.toast(R.string.clear_clipboard_data); true; }
clipboard_clear.setOnClickListener {
clearClipboardContent()
toggleClipboardVisibility(false)
}
} }
val clipboardManager = (context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager) val clipboardManager = (context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager)
@ -552,11 +564,6 @@ class MyKeyboardView @JvmOverloads constructor(context: Context, attrs: Attribut
} }
} }
clipboard_clear.setOnLongClickListener { context.toast(R.string.clear_clipboard_data); true; }
clipboard_clear.setOnClickListener {
clearClipboardContent()
toggleClipboardVisibility(false)
}
toggleClipboardVisibility(true) toggleClipboardVisibility(true)
} }
} else { } else {

View File

@ -0,0 +1,4 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="24dp" android:height="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#FFFFFFFF" android:pathData="M19 2.935h-4.18c-0.42-1.16-1.52-2-2.82-2-1.3 0-2.4 0.84-2.82 2H5c-1.1 0-2 0.9-2 2v16c0 1.1 0.9 2 2 2h14c1.1 0 2-0.9 2-2v-16c0-1.1-0.9-2-2-2zm-7 0c0.55 0 1 0.45 1 1s-0.45 1-1 1-1-0.45-1-1 0.45-1 1-1zm6 18H6c-0.55 0-1-0.45-1-1v-14c0-0.55 0.45-1 1-1h1v1c0 1.1 0.9 2 2 2h6c1.1 0 2-0.9 2-2v-1h1c0.55 0 1 0.45 1 1v14c0 0.55-0.45 1-1 1z"/>
<path android:fillColor="#FFFFFFFF" android:pathData="M7.61 15.125h4.172c0.327 0 0.595-0.288 0.595-0.64 0-0.352-0.268-0.64-0.595-0.64H7.61c-0.328 0-0.596 0.288-0.596 0.64 0 0.352 0.268 0.64 0.596 0.64zm-0.595-3.562c0 0.352 0.268 0.64 0.596 0.64h8.397c0.327 0 0.595-0.288 0.595-0.64 0-0.352-0.268-0.64-0.595-0.64H7.61c-0.328 0-0.596 0.288-0.596 0.64zm0.564 6.423h6.983c0.328 0 0.596-0.288 0.596-0.64 0-0.352-0.268-0.64-0.596-0.64H7.579c-0.328 0-0.596 0.288-0.596 0.64 0 0.352 0.268 0.64 0.596 0.64z"/>
</vector>

View File

@ -26,13 +26,28 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/pinned_clipboard_items"
android:layout_width="@dimen/toolbar_icon_height"
android:layout_height="@dimen/toolbar_icon_height"
android:layout_marginStart="@dimen/medium_margin"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/settings"
android:padding="@dimen/small_margin"
android:src="@drawable/ic_clipboard_vector"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/settings_cog"
app:layout_constraintTop_toTopOf="parent" />
<RelativeLayout <RelativeLayout
android:id="@+id/clipboard_value_holder" android:id="@+id/clipboard_value_holder"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/normal_margin"
android:layout_marginEnd="@dimen/normal_margin"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/clipboard_clear" app:layout_constraintEnd_toStartOf="@+id/clipboard_clear"
app:layout_constraintStart_toEndOf="@+id/settings_cog" app:layout_constraintStart_toEndOf="@+id/pinned_clipboard_items"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<TextView <TextView
@ -51,6 +66,7 @@
android:paddingBottom="@dimen/small_margin" android:paddingBottom="@dimen/small_margin"
android:textSize="@dimen/label_text_size" android:textSize="@dimen/label_text_size"
tools:text="Clipboard content" /> tools:text="Clipboard content" />
</RelativeLayout> </RelativeLayout>
<ImageView <ImageView