diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 771dddf..0000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: android -jdk: oraclejdk8 - -env: - matrix: - - ANDROID_TARGET=android-21 ANDROID_ABI=armeabi-v7a - -android: - components: - - tools # to get the new `repository-11.xml` - - tools # see https://github.com/travis-ci/travis-ci/issues/6040#issuecomment-219367943) - - platform-tools - - build-tools-28.0.3 - - android-28 - - licenses: - - '.+' - -before_install: - - yes | sdkmanager "platforms;android-28" -script: - - ./gradlew build connectedCheck diff --git a/README.md b/README.md index 156123f..84ee16c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ ## Nock Nock -[![Build Status](https://travis-ci.org/afollestad/nock-nock.svg)](https://travis-ci.org/afollestad/nock-nock) [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg?style=flat-square)](https://www.apache.org/licenses/LICENSE-2.0.html) ![Showcase](https://raw.githubusercontent.com/afollestad/nock-nock/master/art/showcase5.png) diff --git a/app/build.gradle b/app/build.gradle index 4b02af4..d6b315e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,6 +20,10 @@ android { sourceCompatibility 1.8 targetCompatibility 1.8 } + + packagingOptions { + exclude 'META-INF/atomicfu.kotlin_module' + } } dependencies { diff --git a/app/src/main/java/com/afollestad/nocknock/ui/DarkModeSwitchActivity.kt b/app/src/main/java/com/afollestad/nocknock/ui/DarkModeSwitchActivity.kt index bf5422d..3220567 100644 --- a/app/src/main/java/com/afollestad/nocknock/ui/DarkModeSwitchActivity.kt +++ b/app/src/main/java/com/afollestad/nocknock/ui/DarkModeSwitchActivity.kt @@ -55,8 +55,7 @@ abstract class DarkModeSwitchActivity : AppCompatActivity() { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) { return UNKNOWN } - val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK - return when (currentNightMode) { + return when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) { Configuration.UI_MODE_NIGHT_YES -> return ENABLED Configuration.UI_MODE_NIGHT_NO -> return DISABLED else -> UNKNOWN diff --git a/app/src/main/java/com/afollestad/nocknock/ui/main/MainActivity.kt b/app/src/main/java/com/afollestad/nocknock/ui/main/MainActivity.kt index 7b59bf1..aec76d8 100644 --- a/app/src/main/java/com/afollestad/nocknock/ui/main/MainActivity.kt +++ b/app/src/main/java/com/afollestad/nocknock/ui/main/MainActivity.kt @@ -24,7 +24,6 @@ import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.list.listItems -import com.afollestad.materialdialogs.list.listItemsSingleChoice import com.afollestad.nocknock.R import com.afollestad.nocknock.adapter.SiteAdapter import com.afollestad.nocknock.adapter.TagAdapter @@ -35,9 +34,6 @@ import com.afollestad.nocknock.notifications.NockNotificationManager import com.afollestad.nocknock.ui.DarkModeSwitchActivity import com.afollestad.nocknock.ui.NightMode.UNKNOWN import com.afollestad.nocknock.utilities.providers.IntentProvider -import com.afollestad.nocknock.utilities.ui.toast -import com.afollestad.nocknock.viewUrl -import com.afollestad.nocknock.viewUrlWithApp import com.afollestad.nocknock.viewcomponents.livedata.toViewVisibility import kotlinx.android.synthetic.main.activity_main.fab import kotlinx.android.synthetic.main.activity_main.list @@ -105,7 +101,6 @@ class MainActivity : DarkModeSwitchActivity() { when (item.itemId) { R.id.about -> AboutDialog.show(this@MainActivity) R.id.dark_mode -> toggleDarkMode() - R.id.support_me -> supportMe() } return@setOnMenuItemClickListener true } @@ -151,20 +146,4 @@ class MainActivity : DarkModeSwitchActivity() { viewSite(model) } } - - private fun supportMe() { - MaterialDialog(this).show { - title(R.string.support_me) - message(R.string.support_me_message, html = true, lineHeightMultiplier = 1.4f) - listItemsSingleChoice(R.array.donation_options) { _, index, _ -> - when (index) { - 0 -> viewUrl("https://paypal.me/AidanFollestad") - 1 -> viewUrlWithApp("https://cash.me/\$afollestad", pkg = "com.squareup.cash") - 2 -> viewUrlWithApp("https://venmo.com/afollestad", pkg = "com.venmo") - } - toast(R.string.thank_you) - } - positiveButton(R.string.next) - } - } } diff --git a/app/src/main/res/menu/menu_main.xml b/app/src/main/res/menu/menu_main.xml index b3b1727..5f2f23f 100644 --- a/app/src/main/res/menu/menu_main.xml +++ b/app/src/main/res/menu/menu_main.xml @@ -7,7 +7,4 @@ android:id="@+id/dark_mode" android:checkable="true" android:title="@string/dark_mode"/> - diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..80b730f --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 0000000..80b730f --- /dev/null +++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index d1698c3..a86dbab 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..eb43a7b Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..4567198 Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index cccfa5b..60056be 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..666c904 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..3baff41 Binary files /dev/null and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index a4f8356..27f30d2 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..4224797 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..1d29a54 Binary files /dev/null and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 49dd226..60a8d1a 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..7cf19eb Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..1548eb9 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index bd57c86..ac61bd3 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..9c43fc9 Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..04806fd Binary files /dev/null and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index db28598..84ad226 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -13,10 +13,4 @@ JavaScript Evaluation - - via PayPal - via Cash App - via Venmo - - diff --git a/app/src/main/res/values/ic_launcher_background.xml b/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 0000000..70daa76 --- /dev/null +++ b/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #758F9A + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 2267417..3ac40a0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -14,6 +14,7 @@ LinkedIn

Nock Nock is open source! Check out the GitHub page!
Icon by Kevin Aguilar of 221 Pixels. +
View the Privacy Policy. ]]> Dark Mode @@ -84,14 +85,6 @@ exception to pass custom error messages to Nock Nock. - Donate - Nock Nock was created and is maintained by one person. Donations are much - appreciated and encourage continued support. - ]]> - Thank you very much! - Next - Please install a web browser app, such as Google Chrome. diff --git a/common/build.gradle b/common/build.gradle index 76d7d02..5004349 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -12,6 +12,10 @@ android { versionName versions.publishVersion } + packagingOptions { + exclude 'META-INF/atomicfu.kotlin_module' + } + // For Mozilla Rhino lintOptions { abortOnError false diff --git a/data/build.gradle b/data/build.gradle index 5512756..e413d4c 100644 --- a/data/build.gradle +++ b/data/build.gradle @@ -14,6 +14,10 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + + packagingOptions { + exclude 'META-INF/atomicfu.kotlin_module' + } } dependencies { diff --git a/data/src/androidTest/java/com/afollestad/nocknock/data/AppDatabaseTest.kt b/data/src/androidTest/java/com/afollestad/nocknock/data/AppDatabaseTest.kt index db9edd7..e7d4400 100644 --- a/data/src/androidTest/java/com/afollestad/nocknock/data/AppDatabaseTest.kt +++ b/data/src/androidTest/java/com/afollestad/nocknock/data/AppDatabaseTest.kt @@ -431,9 +431,30 @@ class AppDatabaseTest() { val allSites = db.allSites() assertThat(allSites.size).isEqualTo(3) - assertThat(allSites[0]).isEqualTo(MOCK_MODEL_1) - assertThat(allSites[1]).isEqualTo(MOCK_MODEL_2) - assertThat(allSites[2]).isEqualTo(MOCK_MODEL_3) + assertThat(allSites[0]).isEqualTo( + MOCK_MODEL_1.copy( + headers = listOf( + MOCK_MODEL_1.headers.first().copy(id = 1), + MOCK_MODEL_1.headers.last().copy(id = 2) + ) + ) + ) + assertThat(allSites[1]).isEqualTo( + MOCK_MODEL_2.copy( + headers = listOf( + MOCK_MODEL_2.headers.first().copy(id = 3), + MOCK_MODEL_2.headers.last().copy(id = 4) + ) + ) + ) + assertThat(allSites[2]).isEqualTo( + MOCK_MODEL_3.copy( + headers = listOf( + MOCK_MODEL_3.headers.first().copy(id = 5), + MOCK_MODEL_3.headers.last().copy(id = 6) + ) + ) + ) } @Test fun extension_put_getSite() { @@ -470,10 +491,12 @@ class AppDatabaseTest() { ) val updatedHeaders = listOf( modelToUpdate.headers.first().copy( + id = 7, key = "One", value = "Hello" ), modelToUpdate.headers.last().copy( + id = 8, key = "Two", value = "Hey" ) diff --git a/dependencies.gradle b/dependencies.gradle index 4225186..e0e2412 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -3,23 +3,23 @@ ext.versions = [ minSdk : 21, compileSdk : 28, buildTools : '28.0.3', - publishVersion : '0.8.7', - publishVersionCode : 43, + publishVersion : '0.8.8', + publishVersionCode : 46, // Plugins - gradlePlugin : '3.3.2', - spotlessPlugin : '3.19.0', + gradlePlugin : '3.4.0', + spotlessPlugin : '3.22.0', versionPlugin : '0.21.0', googleServices : '4.2.0', fabricPlugin : '1.+', // Misc - okHttp : '3.14.0', + okHttp : '3.14.1', rhino : '1.7.10', // Kotlin - kotlin : '1.3.21', - coroutines : '1.1.1', + kotlin : '1.3.30', + coroutines : '1.2.0', koin : '1.0.2', // Google/AndroidX @@ -30,16 +30,16 @@ ext.versions = [ googleMaterial : '1.0.0', room : '2.0.0', lifecycle : '2.0.0', - firebaseCore : '16.0.7', + firebaseCore : '16.0.8', // Rx - rxJava : '2.2.7', + rxJava : '2.2.8', rxBinding : '3.0.0-alpha1', // afollestad - materialDialogs : '2.0.3', + materialDialogs : '2.8.1', rxkPrefs : '1.2.5', - vvalidator : '0.3.1', + vvalidator : '0.4.1', // Debugging timber : '4.7.1', @@ -47,12 +47,12 @@ ext.versions = [ // Unit testing junit : '4.12', - mockito : '2.25.0', + mockito : '2.27.0', mockitoKotlin : '2.1.0', - truth : '0.43', + truth : '0.44', // UI testing androidxTestRunner : '1.1.1', androidxTest : '1.1.0', - archTesting : '2.0.0' + archTesting : '2.0.1' ] diff --git a/ic_web.png b/ic_web.png index 509177f..d54b6ec 100644 Binary files a/ic_web.png and b/ic_web.png differ diff --git a/viewcomponents/src/main/java/com/afollestad/nocknock/viewcomponents/headers/HeaderStackLayout.kt b/viewcomponents/src/main/java/com/afollestad/nocknock/viewcomponents/headers/HeaderStackLayout.kt index 092d416..6abff33 100644 --- a/viewcomponents/src/main/java/com/afollestad/nocknock/viewcomponents/headers/HeaderStackLayout.kt +++ b/viewcomponents/src/main/java/com/afollestad/nocknock/viewcomponents/headers/HeaderStackLayout.kt @@ -56,9 +56,22 @@ class HeaderStackLayout( override fun onClick(v: View) { val index = v.tag as Int - list.removeViewAt(index) - headers.removeAt(index) - postLiveData() + check(index >= 0 || index < list.childCount) { + "Index $index is out of bounds in the header stack (size ${list.childCount})." + } + list.post { + list.removeViewAt(index) + headers.removeAt(index) + invalidateTags() + postLiveData() + } + } + + private fun invalidateTags() { + for (i in 0 until list.childCount) { + val entry = list.getChildAt(i) as HeaderItemLayout + entry.btnRemove.tag = i + } } private fun addEntry(forHeader: Header) { @@ -67,9 +80,7 @@ class HeaderStackLayout( val li = LayoutInflater.from(context) val entry = li.inflate(R.layout.header_stack_item, list, false) as HeaderItemLayout - list.addView(entry) - - entry.run { + list.addView(entry.apply { inputKey.setText(forHeader.key) inputKey.post { entry.inputKey.requestFocus() } attachHeader(forHeader, this@HeaderStackLayout) @@ -77,6 +88,6 @@ class HeaderStackLayout( btnRemove.tag = headers.size - 1 btnRemove.setOnClickListener(this@HeaderStackLayout) - } + }) } }