diff --git a/app/build.gradle b/app/build.gradle
index 9d0652b2..14f2723a 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -64,7 +64,7 @@ android {
}
dependencies {
- implementation 'com.github.SimpleMobileTools:Simple-Commons:1db5d21d3e'
+ implementation 'com.github.SimpleMobileTools:Simple-Commons:8921e5c41c'
kapt 'androidx.room:room-compiler:2.3.0'
implementation 'androidx.room:room-runtime:2.3.0'
diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/activities/ManageClipboardItemsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/activities/ManageClipboardItemsActivity.kt
index f71eecc8..98daeed4 100644
--- a/app/src/main/kotlin/com/simplemobiletools/keyboard/activities/ManageClipboardItemsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/activities/ManageClipboardItemsActivity.kt
@@ -3,10 +3,14 @@ package com.simplemobiletools.keyboard.activities
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
+import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
import com.simplemobiletools.commons.extensions.underlineText
import com.simplemobiletools.commons.extensions.updateTextColors
+import com.simplemobiletools.commons.helpers.ensureBackgroundThread
import com.simplemobiletools.keyboard.R
+import com.simplemobiletools.keyboard.dialogs.AddClipDialog
+import com.simplemobiletools.keyboard.extensions.clipsDB
import kotlinx.android.synthetic.main.activity_manage_clipboard_items.*
class ManageClipboardItemsActivity : SimpleActivity() {
@@ -15,7 +19,9 @@ class ManageClipboardItemsActivity : SimpleActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_manage_clipboard_items)
updateTextColors(clipboard_items_wrapper)
+ updateClips()
+ clipboard_items_placeholder.text = "${getText(R.string.manage_clipboard_empty)}\n\n${getText(R.string.manage_clips)}"
clipboard_items_placeholder_2.apply {
underlineText()
setTextColor(getAdjustedPrimaryColor())
@@ -40,7 +46,20 @@ class ManageClipboardItemsActivity : SimpleActivity() {
return true
}
- private fun addNewClip() {
+ private fun updateClips() {
+ ensureBackgroundThread {
+ val clips = clipsDB.getClips()
+ runOnUiThread {
+ clipboard_items_list.beVisibleIf(clips.isNotEmpty())
+ clipboard_items_placeholder.beVisibleIf(clips.isEmpty())
+ clipboard_items_placeholder_2.beVisibleIf(clips.isEmpty())
+ }
+ }
+ }
+ private fun addNewClip() {
+ AddClipDialog(this) {
+ updateClips()
+ }
}
}
diff --git a/app/src/main/kotlin/com/simplemobiletools/keyboard/dialogs/AddClipDialog.kt b/app/src/main/kotlin/com/simplemobiletools/keyboard/dialogs/AddClipDialog.kt
new file mode 100644
index 00000000..6f2c4aab
--- /dev/null
+++ b/app/src/main/kotlin/com/simplemobiletools/keyboard/dialogs/AddClipDialog.kt
@@ -0,0 +1,44 @@
+package com.simplemobiletools.keyboard.dialogs
+
+import androidx.appcompat.app.AlertDialog
+import com.simplemobiletools.commons.activities.BaseSimpleActivity
+import com.simplemobiletools.commons.extensions.setupDialogStuff
+import com.simplemobiletools.commons.extensions.showKeyboard
+import com.simplemobiletools.commons.extensions.toast
+import com.simplemobiletools.commons.extensions.value
+import com.simplemobiletools.commons.helpers.ensureBackgroundThread
+import com.simplemobiletools.keyboard.R
+import com.simplemobiletools.keyboard.extensions.clipsDB
+import com.simplemobiletools.keyboard.models.Clip
+import kotlinx.android.synthetic.main.dialog_add_clip.view.*
+
+class AddClipDialog(val activity: BaseSimpleActivity, val callback: () -> Unit) {
+ init {
+ val view = activity.layoutInflater.inflate(R.layout.dialog_add_clip, null)
+
+ AlertDialog.Builder(activity)
+ .setPositiveButton(R.string.ok, null)
+ .setNegativeButton(R.string.cancel, null)
+ .create().apply {
+ activity.setupDialogStuff(view, this) {
+ showKeyboard(view.add_clip_value)
+ getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener {
+ val clipValue = view.add_clip_value.value
+ if (clipValue.isEmpty()) {
+ activity.toast(R.string.value_cannot_be_empty)
+ return@setOnClickListener
+ }
+
+ val clip = Clip(null, clipValue)
+ ensureBackgroundThread {
+ activity.clipsDB.insertOrUpdate(clip)
+ activity.runOnUiThread {
+ callback()
+ dismiss()
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/app/src/main/res/layout/dialog_add_clip.xml b/app/src/main/res/layout/dialog_add_clip.xml
new file mode 100644
index 00000000..3e0bf87f
--- /dev/null
+++ b/app/src/main/res/layout/dialog_add_clip.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml
index 8cc80707..94f1fdad 100644
--- a/app/src/main/res/values-ca/strings.xml
+++ b/app/src/main/res/values-ca/strings.xml
@@ -6,7 +6,7 @@
Canvia el teclat
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Neteja les dades del porta-retalls
Esteu segur que voleu netejar les dades del porta-retalls\?
@@ -15,6 +15,7 @@
Fixat
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Suprimeix
Canvia el tipus de teclat
@@ -34,4 +35,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
-
\ No newline at end of file
+
diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml
index a964d06a..dd818a87 100644
--- a/app/src/main/res/values-da/strings.xml
+++ b/app/src/main/res/values-da/strings.xml
@@ -6,7 +6,7 @@
Skift tastatur
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Ryd data i udklipsholder
Er du sikker på, at du vil slette data i udklipsholderen\?
@@ -15,6 +15,7 @@
Pinned
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Slet
Skift tastaturtype
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index b088df6c..58a42264 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -6,7 +6,7 @@
Tastatur wechseln
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Daten in der Zwischenablage löschen
Sind Sie sicher, dass Sie die Daten in der Zwischenablage löschen wollen\?
@@ -15,6 +15,7 @@
Pinned
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Löschen
Tastaturtyp ändern
diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml
index 3cf7fa55..fdb62b56 100644
--- a/app/src/main/res/values-el/strings.xml
+++ b/app/src/main/res/values-el/strings.xml
@@ -6,7 +6,7 @@
Αλλαγή πληκτρολογίου
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Καθαρισμός δεδομένων πρόχειρου
Είστε σίγουροι ότι θέλετε να διαγράψετε τα δεδομένα του πρόχειρου;
@@ -15,6 +15,7 @@
Καρφιτσωμένα
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Διαγραφή
Αλλαγή τύπου πληκτρολογίου
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index 18646707..88c6f818 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -6,7 +6,7 @@
Changer de clavier
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Effacer les données du presse-papiers
Voulez-vous vraiment effacer les données du presse-papiers \?
@@ -15,6 +15,7 @@
Épinglé
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Supprimer
Changer de type de clavier
@@ -34,4 +35,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
-
\ No newline at end of file
+
diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml
index 231da8f8..324d8454 100644
--- a/app/src/main/res/values-hr/strings.xml
+++ b/app/src/main/res/values-hr/strings.xml
@@ -6,7 +6,7 @@
Promijeni tipkovnicu
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Izbriši podatke međuspremnika
Stvarno želiš izbrisati podatke međuspremnika\?
@@ -15,6 +15,7 @@
Pinned
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Izbriži
Promijeni vrstu tipkovnice
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 9501470e..7470e9c9 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -6,7 +6,7 @@
Cambia la tastiera
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Elimina i dati degli appunti
Vuoi davvero eliminare i dati degli appunti\?
@@ -15,6 +15,7 @@
Pinned
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Elimina
Cambia il tipo di tastiera
diff --git a/app/src/main/res/values-lt/strings.xml b/app/src/main/res/values-lt/strings.xml
index 49f82ce8..2333ea13 100644
--- a/app/src/main/res/values-lt/strings.xml
+++ b/app/src/main/res/values-lt/strings.xml
@@ -6,7 +6,7 @@
Keisti klaviatūrą
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Išvalyti iškarpinės duomenis
Ar tikrai norite išvalyti iškarpinės duomenis\?
@@ -15,6 +15,7 @@
Pinned
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Delete
Keisti klaviatūros tipą
diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
index 15bf86f2..ae41d014 100644
--- a/app/src/main/res/values-pl/strings.xml
+++ b/app/src/main/res/values-pl/strings.xml
@@ -6,7 +6,7 @@
Zmień klawiaturę
Zarządzaj elementami schowka
- Twój schowek jest pusty
+ Twój schowek jest pusty.
Gdy skopiujesz jakiś tekst, pojawi się on tutaj. Możesz także przypinać wpisy, aby później nie zniknęły.
Wyczyść dane schowka
Czy wyczyścić dane schowka\?
@@ -15,6 +15,7 @@
Przypięte
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Usuń
Zmień typ klawiatury
@@ -34,4 +35,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
-
\ No newline at end of file
+
diff --git a/app/src/main/res/values-sk/strings.xml b/app/src/main/res/values-sk/strings.xml
index 5bcca62d..e857f253 100644
--- a/app/src/main/res/values-sk/strings.xml
+++ b/app/src/main/res/values-sk/strings.xml
@@ -6,7 +6,7 @@
Zmeniť klávesnicu
Spravovať položky v schránke
- Schránka je prázdna
+ Vaša schránka je prázdna.
Akonáhle skopírujete nejaký text, objaví sa tu. Budete ho aj môcť pripnúť, aby sa časom nestratil.
Vyčistič schránku
Ste si istý, že chcete vyčistiť schránku?
@@ -15,6 +15,7 @@
Pripnuté
Pridať novú položku
Na tomto mieste viete spravovať a pridávať nové pripnutia do schránky pre rýchly prístup.
+ Text položky
Odstrániť
Zmeniť typ klávesnice
diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml
index 65850aa4..abc9d8cf 100644
--- a/app/src/main/res/values-tr/strings.xml
+++ b/app/src/main/res/values-tr/strings.xml
@@ -6,7 +6,7 @@
Klavye Değiştir
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Pano verilerini temizle
Pano verilerini silmek istediğinizden emin misiniz\?
@@ -15,6 +15,7 @@
Sabitlendi
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Sil
Klavye türünü değiştir
@@ -34,4 +35,4 @@
Haven't found some strings? There's more at
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
-->
-
\ No newline at end of file
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8b3ecf5f..02ff0448 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -6,7 +6,7 @@
Change Keyboard
Manage clipboard items
- Your clipboard is empty
+ Your clipboard is empty.
Once you copy some text, it will show up here. You can also pin clips so they won\'t disappear later.
Clear clipboard data
Are you sure you want to clear the clipboard data?
@@ -15,6 +15,7 @@
Pinned
Add a new item
You can manage or add clips here for quick access.
+ Clip text
Delete
Change keyboard type