Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/bitfireAT/ical4android.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Lang <72232737+patrickunterwegs@users.noreply.github.com>2022-04-05 00:20:11 +0300
committerGitHub <noreply@github.com>2022-04-05 00:20:11 +0300
commit93c510c72834244284ee9ba5806d9db039694f4a (patch)
treea80261ffbdfe87c10eef8c9f0232d5f30de9398a
parent6c2cb6dd380fe897ce42ca173180f8970f2eea26 (diff)
New function to query a jtxIcalObject by UID (#23)
* New function to query a jtxIalObject by UID https://gitlab.com/techbeeat1/jtx/-/issues/47 * Update test-dev.yml
-rw-r--r--.github/workflows/test-dev.yml2
-rw-r--r--src/main/java/at/bitfire/ical4android/JtxCollection.kt14
2 files changed, 15 insertions, 1 deletions
diff --git a/.github/workflows/test-dev.yml b/.github/workflows/test-dev.yml
index e8a62bc..2c616bc 100644
--- a/.github/workflows/test-dev.yml
+++ b/.github/workflows/test-dev.yml
@@ -55,7 +55,7 @@ jobs:
mkdir apk && cd apk
wget -q -O org.dmfs.tasks.apk https://f-droid.org/archive/org.dmfs.tasks_80800.apk && adb install org.dmfs.tasks.apk
wget -q -O org.tasks.apk https://f-droid.org/archive/org.tasks_110701.apk && adb install org.tasks.apk
- wget -q -O at.techbee.jtx.apk https://f-droid.org/repo/at.techbee.jtx_100040011.apk && adb install at.techbee.jtx.apk
+ wget -q -O at.techbee.jtx.apk https://f-droid.org/repo/at.techbee.jtx_100090001.apk && adb install at.techbee.jtx.apk
cd ..
- name: Run connected tests
run: ./gradlew connectedCheck
diff --git a/src/main/java/at/bitfire/ical4android/JtxCollection.kt b/src/main/java/at/bitfire/ical4android/JtxCollection.kt
index fe7515d..5b75f7b 100644
--- a/src/main/java/at/bitfire/ical4android/JtxCollection.kt
+++ b/src/main/java/at/bitfire/ical4android/JtxCollection.kt
@@ -125,6 +125,20 @@ open class JtxCollection<out T: JtxICalObject>(val account: Account,
}
/**
+ * @param [UID] of the entry that should be retrieved as content values
+ * @return Content Values of the found item with the given UID or null if the result was empty or more than 1
+ */
+ fun queryByUID(uid: String): ContentValues? {
+ client.query(JtxContract.JtxICalObject.CONTENT_URI.asSyncAdapter(account), null, "${JtxContract.JtxICalObject.ICALOBJECT_COLLECTIONID} = ? AND ${JtxContract.JtxICalObject.UID} = ?", arrayOf(id.toString(), uid), null).use { cursor ->
+ Ical4Android.log.fine("queryByUID: found ${cursor?.count} records in ${account.name}")
+ if (cursor?.count != 1)
+ return null
+ cursor.moveToFirst()
+ return cursor.toValues()
+ }
+ }
+
+ /**
* updates the flags of all entries in the collection with the given flag
* @param [flags] to be set
* @return the number of records that were updated