From 6f97fd5f7c528594899e66d2d8b502a20ade6f53 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 13 Jun 2019 13:29:07 -0700 Subject: Revert iconics updates for now --- sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt | 2 +- sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sample/src') diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt index a851c1d..a11a672 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/AdapterActivity.kt @@ -22,7 +22,7 @@ import ca.allanwang.kau.ui.activities.ElasticRecyclerActivity import ca.allanwang.kau.utils.toast import com.mikepenz.fastadapter.IItem import com.mikepenz.fastadapter.adapters.ItemAdapter -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial /** * Created by Allan Wang on 2017-07-17. diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt index 73d6eab..9ce3f42 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/MainActivity.kt @@ -39,7 +39,7 @@ import ca.allanwang.kau.utils.toast import ca.allanwang.kau.utils.withSceneTransitionAnimation import ca.allanwang.kau.xml.showChangelog import com.afollestad.materialdialogs.input.input -import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial +import com.mikepenz.google_material_typeface_library.GoogleMaterial class MainActivity : KPrefActivity() { -- cgit v1.2.3 From e1849c9c633047979d8017262041e925ec3bd219 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 13 Jun 2019 13:51:52 -0700 Subject: Update to sdk 29 and update changelog --- buildSrc/src/main/kotlin/kau/Versions.kt | 4 ++-- core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefTransaction.kt | 2 +- core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt | 2 +- docs/Changelog.md | 3 +++ sample/src/main/res/xml/kau_changelog.xml | 5 +++-- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'sample/src') diff --git a/buildSrc/src/main/kotlin/kau/Versions.kt b/buildSrc/src/main/kotlin/kau/Versions.kt index 7133ed5..515f702 100644 --- a/buildSrc/src/main/kotlin/kau/Versions.kt +++ b/buildSrc/src/main/kotlin/kau/Versions.kt @@ -3,10 +3,10 @@ package kau object Versions { const val coreMinSdk = 19 const val minSdk = 21 - const val targetSdk = 28 + const val targetSdk = 29 // https://developer.android.com/studio/releases/build-tools - const val buildTools = "28.0.3" + const val buildTools = "29.0.0" // https://mvnrepository.com/artifact/androidx.appcompat/appcompat?repo=google const val appcompat = "1.0.2" diff --git a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefTransaction.kt b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefTransaction.kt index 1070e11..3f8fe28 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefTransaction.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/kpref/KPrefTransaction.kt @@ -60,7 +60,7 @@ internal object KPrefFloatTransaction : KPrefTransaction { internal object KPrefStringTransaction : KPrefTransaction { override fun get(prefs: SharedPreferences, key: String, fallback: String) = - prefs.getString(key, fallback) + prefs.getString(key, fallback) ?: "" override fun set(editor: SharedPreferences.Editor, key: String, data: String) { editor.putString(key, data) diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt index e8680dc..d002fb8 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/ContextUtils.kt @@ -239,7 +239,7 @@ fun Context.hasPermission(permissions: String) = !buildIsMarshmallowAndUp || Con fun Context.copyToClipboard(text: String?, label: String = "Copied Text", showToast: Boolean = true) { val clipboard = getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager - clipboard.primaryClip = ClipData.newPlainText(label, text ?: "") + clipboard.setPrimaryClip(ClipData.newPlainText(label, text ?: "")) if (showToast) toast(R.string.kau_text_copied) } diff --git a/docs/Changelog.md b/docs/Changelog.md index 61e5fb7..689fbd9 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,8 +1,11 @@ # Changelog ## v5.0.0 +* Update Android SDK to 29 and Kotlin to 1.3.31 * :core: Update Material Dialogs to 3.x +* :core: Change ProgressAnimator API * :colorpicker: Strip down to just the interface; unless you require the accent palette, it may be fine to just use MD's color extension +* :gradle-plugin: Convert to kotlin, rework dependencies, and remove extension hooks ## v4.1.0 * :core: Deprecate NetworkUtils, as the underlying functions are deprecated diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index 53265d0..b5ec47c 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -7,10 +7,11 @@ --> + + - - + -- cgit v1.2.3 From c84edb5a6656cf3fcd10dfb05727b0f3bad5a37d Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 13 Jun 2019 20:28:37 -0700 Subject: Update changelog --- docs/Changelog.md | 1 + sample/src/main/res/xml/kau_changelog.xml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'sample/src') diff --git a/docs/Changelog.md b/docs/Changelog.md index 689fbd9..795b860 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -4,6 +4,7 @@ * Update Android SDK to 29 and Kotlin to 1.3.31 * :core: Update Material Dialogs to 3.x * :core: Change ProgressAnimator API +* :core: Remove cursor tinting in EditText as it used reflection * :colorpicker: Strip down to just the interface; unless you require the accent palette, it may be fine to just use MD's color extension * :gradle-plugin: Convert to kotlin, rework dependencies, and remove extension hooks diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index b5ec47c..d6e3d99 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -10,10 +10,10 @@ + - -- cgit v1.2.3 From 8725ae5647e15a38281ca6778b33413490dff91b Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 13 Jun 2019 21:36:04 -0700 Subject: Translations (#207) * New translations strings_about.xml (Arabic) * New translations strings_colorpicker.xml (Arabic) * New translations strings_commons.xml (Arabic) * New translations strings_mediapicker.xml (Arabic) * New translations strings_about.xml (Afrikaans) * New translations strings_colorpicker.xml (Russian) * New translations strings_about.xml (Russian) * New translations strings_mediapicker.xml (Romanian) * New translations strings_commons.xml (Romanian) * New translations strings_colorpicker.xml (Romanian) * New translations strings_about.xml (Romanian) * New translations strings_mediapicker.xml (Russian) * New translations strings_mediapicker.xml (Japanese) * New translations strings_commons.xml (Japanese) * New translations strings_colorpicker.xml (Japanese) * New translations strings_commons.xml (Russian) * New translations strings_mediapicker.xml (Tagalog) * New translations strings_commons.xml (Tagalog) * New translations strings_colorpicker.xml (Tagalog) * New translations strings_about.xml (Tagalog) * New translations strings_about.xml (Japanese) * New translations strings_colorpicker.xml (Afrikaans) * New translations strings_mediapicker.xml (Czech) * New translations strings_commons.xml (Czech) * New translations strings_colorpicker.xml (Czech) * New translations strings_about.xml (Czech) * New translations strings_about.xml (Finnish) * New translations strings_mediapicker.xml (Catalan) * New translations strings_commons.xml (Catalan) * New translations strings_colorpicker.xml (Catalan) * New translations strings_about.xml (Catalan) * New translations strings_mediapicker.xml (Afrikaans) * New translations strings_commons.xml (Afrikaans) * New translations strings_colorpicker.xml (Finnish) * New translations strings_commons.xml (Greek) * New translations strings_mediapicker.xml (Hebrew) * New translations strings_commons.xml (Hebrew) * New translations strings_colorpicker.xml (Hebrew) * New translations strings_about.xml (Hebrew) * New translations strings_mediapicker.xml (Greek) * New translations strings_colorpicker.xml (Greek) * New translations strings_commons.xml (Finnish) * New translations strings_about.xml (Greek) * New translations strings_mediapicker.xml (Finnish) * New translations strings_about.xml (Tamil) * New translations strings_colorpicker.xml (Tamil) * New translations strings_commons.xml (Tamil) * New translations strings_mediapicker.xml (Tamil) * New translations strings_mediapicker.xml (Arabic) * New translations strings_commons.xml (Arabic) * New translations strings_about.xml (Arabic) * Add credits * Delete blank translations * Update changelog --- README.md | 1 + about/src/main/res/values-ar-rSA/strings_about.xml | 6 +++ .../res-public/values-ar-rSA/strings_commons.xml | 55 ++++++++++++++++++++++ docs/Changelog.md | 1 + files/translation_migration.sh | 0 .../main/res/values-ar-rSA/strings_mediapicker.xml | 11 +++++ sample/src/main/res/xml/kau_changelog.xml | 1 + 7 files changed, 75 insertions(+) create mode 100644 about/src/main/res/values-ar-rSA/strings_about.xml create mode 100644 core/src/main/res-public/values-ar-rSA/strings_commons.xml mode change 100644 => 100755 files/translation_migration.sh create mode 100644 mediapicker/src/main/res/values-ar-rSA/strings_mediapicker.xml (limited to 'sample/src') diff --git a/README.md b/README.md index 0059e47..2c72eb1 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ Special thanks to the following awesome people for translating significant porti | Language | Contributors | |----------|--------------| +| Arabic | [Mohammed Qubati](https://crowdin.com/profile/Mrkqubati) | | Chinese (Simplified) | [Alcatelia](https://crowdin.com/profile/Alcatelia) | | Chinese (Traditional) | [yipinghuang](https://crowdin.com/profile/yipinghuang) • [Su, Jun-Ming](https://crowdin.com/profile/sujunmin) • [Wei](https://crowdin.com/profile/wei4green) | | Danish | [mhtorp](https://crowdin.com/profile/mhtorp) | diff --git a/about/src/main/res/values-ar-rSA/strings_about.xml b/about/src/main/res/values-ar-rSA/strings_about.xml new file mode 100644 index 0000000..f80ee4d --- /dev/null +++ b/about/src/main/res/values-ar-rSA/strings_about.xml @@ -0,0 +1,6 @@ + + + + لن يتم تمكين هذا التطبيق بدون المكتبات الكبيرة التالية. + الأسئلة الشائعة + diff --git a/core/src/main/res-public/values-ar-rSA/strings_commons.xml b/core/src/main/res-public/values-ar-rSA/strings_commons.xml new file mode 100644 index 0000000..efaa623 --- /dev/null +++ b/core/src/main/res-public/values-ar-rSA/strings_commons.xml @@ -0,0 +1,55 @@ + + + + + عن التطبيق + حول %s + إضافة حساب + العودة + إلغاء + سجل التغييرات + إغلاق + التواصل معنا + نسخ + مخصص + مظلم + الافتراضي + لا تظهر مجدداً + تم + خطأ + خروج + هل أنت متأكد بأنك تريد الخروج؟ + هل أنت متأكد بأنك تريد الخروج %s؟ + زجاجي + فهمت + رائع + إخفاء + فاتح + تسجيل الدخول + تسجيل الخروج + هل أنت متأكد بأنك تريد تسجيل الخروج %s؟ + إدارة الحساب + ربما + القائمة + لا + لم يتم العثور على نتائج + لا يوجد + حسناً + Google play + تقييم + الإبلاغ عن خطأ + البحث + إرسال ملاحظات + الإرسال عبر + الاعدادات + المشاركة + تم نسخ النص إلى الحافظة. + شكراً + أوبس + تحذير + نعم + الإذن مرفوض + diff --git a/docs/Changelog.md b/docs/Changelog.md index 795b860..c68629f 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -2,6 +2,7 @@ ## v5.0.0 * Update Android SDK to 29 and Kotlin to 1.3.31 +* Update translations * :core: Update Material Dialogs to 3.x * :core: Change ProgressAnimator API * :core: Remove cursor tinting in EditText as it used reflection diff --git a/files/translation_migration.sh b/files/translation_migration.sh old mode 100644 new mode 100755 diff --git a/mediapicker/src/main/res/values-ar-rSA/strings_mediapicker.xml b/mediapicker/src/main/res/values-ar-rSA/strings_mediapicker.xml new file mode 100644 index 0000000..c05d161 --- /dev/null +++ b/mediapicker/src/main/res/values-ar-rSA/strings_mediapicker.xml @@ -0,0 +1,11 @@ + + + + لم يتم العثور على أي عنصر + لم يتم إختيار أي عنصر + لم يتم تحميل أي عنصر + لا توجد كاميرا + يرجى تثبيت تطبيق كاميرا والمحاولة مجدداً. + فشل في حفظ صورة مؤقتة. + اختيار وسائط + diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index d6e3d99..d59ce53 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -8,6 +8,7 @@ + -- cgit v1.2.3 From b360c95e93afc39f2c8043d6087035e1c661e478 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 17 Jun 2019 23:45:13 -0700 Subject: Update triple t contents --- docs/Changelog.md | 3 +++ sample/src/main/play/contact-email.txt | 1 + sample/src/main/play/contactEmail | 1 - sample/src/main/play/default-language.txt | 1 + sample/src/main/play/defaultLanguage | 1 - sample/src/main/play/en-CA/listing/fulldescription | 3 --- sample/src/main/play/en-CA/listing/shortdescription | 1 - sample/src/main/play/en-CA/listing/title | 1 - sample/src/main/play/en-CA/whatsnew | 1 - sample/src/main/play/listings/en-CA/listing/full-description.txt | 3 +++ sample/src/main/play/listings/en-CA/listing/short-description.txt | 1 + sample/src/main/play/listings/en-CA/listing/title-txt | 1 + sample/src/main/play/release-notes/en-CA/default.txt | 1 + sample/src/main/res/xml/kau_changelog.xml | 7 +++++++ 14 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 sample/src/main/play/contact-email.txt delete mode 100644 sample/src/main/play/contactEmail create mode 100644 sample/src/main/play/default-language.txt delete mode 100644 sample/src/main/play/defaultLanguage delete mode 100644 sample/src/main/play/en-CA/listing/fulldescription delete mode 100644 sample/src/main/play/en-CA/listing/shortdescription delete mode 100644 sample/src/main/play/en-CA/listing/title delete mode 100644 sample/src/main/play/en-CA/whatsnew create mode 100644 sample/src/main/play/listings/en-CA/listing/full-description.txt create mode 100644 sample/src/main/play/listings/en-CA/listing/short-description.txt create mode 100644 sample/src/main/play/listings/en-CA/listing/title-txt create mode 100644 sample/src/main/play/release-notes/en-CA/default.txt (limited to 'sample/src') diff --git a/docs/Changelog.md b/docs/Changelog.md index c68629f..2c653e0 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,5 +1,8 @@ # Changelog +## v5.0.1 +* :adapter: Moved fastadapter elements to new module, :fastadapter:. To migrate, simply rename the dependency. If you don't use fast adapter, no changes are necessary + ## v5.0.0 * Update Android SDK to 29 and Kotlin to 1.3.31 * Update translations diff --git a/sample/src/main/play/contact-email.txt b/sample/src/main/play/contact-email.txt new file mode 100644 index 0000000..3e03392 --- /dev/null +++ b/sample/src/main/play/contact-email.txt @@ -0,0 +1 @@ +pitchedapps@gmail.com \ No newline at end of file diff --git a/sample/src/main/play/contactEmail b/sample/src/main/play/contactEmail deleted file mode 100644 index 3e03392..0000000 --- a/sample/src/main/play/contactEmail +++ /dev/null @@ -1 +0,0 @@ -pitchedapps@gmail.com \ No newline at end of file diff --git a/sample/src/main/play/default-language.txt b/sample/src/main/play/default-language.txt new file mode 100644 index 0000000..ffdd217 --- /dev/null +++ b/sample/src/main/play/default-language.txt @@ -0,0 +1 @@ +en-CA \ No newline at end of file diff --git a/sample/src/main/play/defaultLanguage b/sample/src/main/play/defaultLanguage deleted file mode 100644 index ffdd217..0000000 --- a/sample/src/main/play/defaultLanguage +++ /dev/null @@ -1 +0,0 @@ -en-CA \ No newline at end of file diff --git a/sample/src/main/play/en-CA/listing/fulldescription b/sample/src/main/play/en-CA/listing/fulldescription deleted file mode 100644 index 2d9fe89..0000000 --- a/sample/src/main/play/en-CA/listing/fulldescription +++ /dev/null @@ -1,3 +0,0 @@ -This app aims to demonstrate the features available in KAU, or Kotlin Android Utils. - -The project is open sourced on github \ No newline at end of file diff --git a/sample/src/main/play/en-CA/listing/shortdescription b/sample/src/main/play/en-CA/listing/shortdescription deleted file mode 100644 index 9424ee8..0000000 --- a/sample/src/main/play/en-CA/listing/shortdescription +++ /dev/null @@ -1 +0,0 @@ -A simple showcase for Kotlin Android Utils \ No newline at end of file diff --git a/sample/src/main/play/en-CA/listing/title b/sample/src/main/play/en-CA/listing/title deleted file mode 100644 index c3c5422..0000000 --- a/sample/src/main/play/en-CA/listing/title +++ /dev/null @@ -1 +0,0 @@ -KAU - Library Showcase \ No newline at end of file diff --git a/sample/src/main/play/en-CA/whatsnew b/sample/src/main/play/en-CA/whatsnew deleted file mode 100644 index 1d15ce2..0000000 --- a/sample/src/main/play/en-CA/whatsnew +++ /dev/null @@ -1 +0,0 @@ -A full changelog is available in the app \ No newline at end of file diff --git a/sample/src/main/play/listings/en-CA/listing/full-description.txt b/sample/src/main/play/listings/en-CA/listing/full-description.txt new file mode 100644 index 0000000..2d9fe89 --- /dev/null +++ b/sample/src/main/play/listings/en-CA/listing/full-description.txt @@ -0,0 +1,3 @@ +This app aims to demonstrate the features available in KAU, or Kotlin Android Utils. + +The project is open sourced on github \ No newline at end of file diff --git a/sample/src/main/play/listings/en-CA/listing/short-description.txt b/sample/src/main/play/listings/en-CA/listing/short-description.txt new file mode 100644 index 0000000..9424ee8 --- /dev/null +++ b/sample/src/main/play/listings/en-CA/listing/short-description.txt @@ -0,0 +1 @@ +A simple showcase for Kotlin Android Utils \ No newline at end of file diff --git a/sample/src/main/play/listings/en-CA/listing/title-txt b/sample/src/main/play/listings/en-CA/listing/title-txt new file mode 100644 index 0000000..c3c5422 --- /dev/null +++ b/sample/src/main/play/listings/en-CA/listing/title-txt @@ -0,0 +1 @@ +KAU - Library Showcase \ No newline at end of file diff --git a/sample/src/main/play/release-notes/en-CA/default.txt b/sample/src/main/play/release-notes/en-CA/default.txt new file mode 100644 index 0000000..1d15ce2 --- /dev/null +++ b/sample/src/main/play/release-notes/en-CA/default.txt @@ -0,0 +1 @@ +A full changelog is available in the app \ No newline at end of file diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index d59ce53..301193a 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -6,6 +6,13 @@ --> + + + + + + + -- cgit v1.2.3 From 273430e0fb1b884826382349b46a917ce42ebe0b Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 1 Jul 2019 13:50:27 -0700 Subject: Remove extra dpToPx conversion, resolves #210 --- .../kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt | 2 +- sample/src/main/res/xml/kau_changelog.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sample/src') diff --git a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt index f4578f2..2cf005a 100644 --- a/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt +++ b/core-ui/src/main/kotlin/ca/allanwang/kau/ui/widgets/ElasticDragDismissFrameLayout.kt @@ -50,7 +50,7 @@ class ElasticDragDismissFrameLayout @JvmOverloads constructor( ) : FrameLayout(context, attrs, defStyleAttr, defStyleRes) { // configurable attribs - var dragDismissDistance = context.dimen(R.dimen.kau_drag_dismiss_distance).dpToPx + var dragDismissDistance = context.dimen(R.dimen.kau_drag_dismiss_distance) var dragDismissFraction = -1f var dragDismissScale = 1f set(value) { diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index 301193a..0e38015 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -8,7 +8,7 @@ - + -- cgit v1.2.3 From 39bda3064e75a8a4be100afa4f5e7adee33c2f17 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 1 Jul 2019 14:44:34 -0700 Subject: Update changelog and add post setter test --- .../androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt | 12 +++++++++++- docs/Changelog.md | 2 ++ sample/src/main/res/xml/kau_changelog.xml | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'sample/src') diff --git a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt index 735302c..143b83f 100644 --- a/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt +++ b/core/src/androidTest/kotlin/ca/allanwang/kau/kpref/KPrefTest.kt @@ -41,11 +41,15 @@ class KPrefTest { initialize(ApplicationProvider.getApplicationContext(), "kpref_test_${System.currentTimeMillis()}") } + var postSetterCount: Int = 0 + var one by kpref("one", 1) var two by kpref("two", 2f) - var `true` by kpref("true", true) + var `true` by kpref("true", true, postSetter = { + postSetterCount++ + }) var hello by kpref("hello", "hello") @@ -113,4 +117,10 @@ class KPrefTest { assertPrefEquals(true, { oneShot }) assertPrefEquals(false, { androidPref.oneShot }) } + + @Test + fun postSetter() { + pref { `true` = true } + assertPrefEquals(1, { postSetterCount }, "Post setter was not called") + } } diff --git a/docs/Changelog.md b/docs/Changelog.md index 0ccf69c..b282830 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -3,6 +3,8 @@ ## v5.0.1 * :adapter: Moved fastadapter elements to new module, :fastadapter:. To migrate, simply rename the dependency. If you don't use fast adapter, no changes are necessary * :adapter: Make NoAnimatorChange an object; previously a class +* :core: KPref now supports in memory only variants for testing; pass KPrefBuilderInMemory to KPref constructor +* :core: KPref initializer takes in SharedPreferences so user can configure it ## v5.0.0 * Update Android SDK to 29 and Kotlin to 1.3.31 diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index 0e38015..6144685 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -9,8 +9,8 @@ - - + + -- cgit v1.2.3 From 6154ad0708be6b09acf8a3ff81b822fbf985e8d9 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 1 Jul 2019 14:52:52 -0700 Subject: Run release tests only --- .travis.yml | 2 +- docs/Changelog.md | 2 +- sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt | 1 - sample/src/main/res/xml/kau_changelog.xml | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) (limited to 'sample/src') diff --git a/.travis.yml b/.travis.yml index 7f4d045..69dabb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,7 +23,7 @@ script: - chmod +x gradlew - "./gradlew --quiet androidGitVersion" - if [[ "$TRAVIS_BRANCH" == "master" ]]; then ./gradlew lintRelease publishRelease; - else ./gradlew lintRelease test; fi + else ./gradlew lintRelease testReleaseUnitTest; fi branches: except: - gh-pages diff --git a/docs/Changelog.md b/docs/Changelog.md index b282830..f8287ca 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,6 +1,6 @@ # Changelog -## v5.0.1 +## v5.1.0 * :adapter: Moved fastadapter elements to new module, :fastadapter:. To migrate, simply rename the dependency. If you don't use fast adapter, no changes are necessary * :adapter: Make NoAnimatorChange an object; previously a class * :core: KPref now supports in memory only variants for testing; pass KPrefBuilderInMemory to KPref constructor diff --git a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt index 0f20880..80a75bf 100644 --- a/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt +++ b/sample/src/main/kotlin/ca/allanwang/kau/sample/KPrefSample.kt @@ -17,7 +17,6 @@ package ca.allanwang.kau.sample import android.graphics.Color import ca.allanwang.kau.kpref.KPref -import ca.allanwang.kau.kpref.kpref /** * Created by Allan Wang on 2017-06-07. diff --git a/sample/src/main/res/xml/kau_changelog.xml b/sample/src/main/res/xml/kau_changelog.xml index 6144685..62614ed 100644 --- a/sample/src/main/res/xml/kau_changelog.xml +++ b/sample/src/main/res/xml/kau_changelog.xml @@ -6,7 +6,7 @@ --> - + -- cgit v1.2.3 From 4b40be65fd4854c1772ae60ecf784b14e489734c Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 1 Jul 2019 15:09:56 -0700 Subject: Delete old color picker test --- .../ca/allanwang/kau/sample/ColorPickerTest.kt | 79 ---------------------- 1 file changed, 79 deletions(-) delete mode 100644 sample/src/androidTest/kotlin/ca/allanwang/kau/sample/ColorPickerTest.kt (limited to 'sample/src') diff --git a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/ColorPickerTest.kt b/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/ColorPickerTest.kt deleted file mode 100644 index ef53817..0000000 --- a/sample/src/androidTest/kotlin/ca/allanwang/kau/sample/ColorPickerTest.kt +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2018 Allan Wang - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ca.allanwang.kau.sample - -import android.view.View -import androidx.test.espresso.DataInteraction -import androidx.test.espresso.Espresso.onData -import androidx.test.espresso.Espresso.onView -import androidx.test.espresso.ViewAssertion -import androidx.test.espresso.action.ViewActions.click -import androidx.test.espresso.matcher.ViewMatchers.withId -import androidx.test.espresso.matcher.ViewMatchers.withText -import androidx.test.ext.junit.runners.AndroidJUnit4 -import androidx.test.filters.MediumTest -import androidx.test.rule.ActivityTestRule -import ca.allanwang.kau.colorpicker.CircleView -import org.hamcrest.Matchers.anything -import org.junit.Rule -import org.junit.Test -import org.junit.runner.RunWith -import kotlin.test.assertEquals -import kotlin.test.fail - -/** - * Created by Allan Wang on 22/02/2018. - * - * Tests related to the :colorpicker module - */ -@RunWith(AndroidJUnit4::class) -@MediumTest -class ColorPickerTest { - - @get:Rule - val activity: ActivityTestRule = ActivityTestRule(MainActivity::class.java) - - private fun DataInteraction.click(position: Int) = - atPosition(position).perform(click()) - - private fun View.colorSelected(selected: Boolean) { - val circle = this as? CircleView ?: fail("View is not a CircleView") - assertEquals( - selected, - circle.colorSelected, - "CircleView ${circle.tag} ${if (selected) "is not" else "is"} actually selected" - ) - } - - private val colorSelected = ViewAssertion { view, _ -> view.colorSelected(true) } - - private val colorNotSelected = ViewAssertion { view, _ -> view.colorSelected(false) } - - @Test - fun colorClick() { - onView(withText(R.string.accent_color)).perform(click()) - val colors = onData(anything()).inAdapterView(withId(R.id.md_grid)) - - colors.click(0).check(colorNotSelected) // enter sub grid - colors.click(0).check(colorSelected) // click first grid item - colors.atPosition(1).check(colorNotSelected) - colors.atPosition(2).check(colorNotSelected) - .perform(click()).check(colorSelected) - colors.atPosition(0).check(colorNotSelected) - .perform(click()).check(colorSelected) - // first item is now selected - } -} -- cgit v1.2.3