Compare commits
No commits in common. "master" and "0.8.7" have entirely different histories.
22
.travis.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
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
|
|
@ -1,5 +1,6 @@
|
||||||
## Nock Nock
|
## Nock Nock
|
||||||
|
|
||||||
|
[](https://travis-ci.org/afollestad/nock-nock)
|
||||||
[](https://www.apache.org/licenses/LICENSE-2.0.html)
|
[](https://www.apache.org/licenses/LICENSE-2.0.html)
|
||||||
|
|
||||||

|

|
||||||
|
|
|
@ -20,10 +20,6 @@ android {
|
||||||
sourceCompatibility 1.8
|
sourceCompatibility 1.8
|
||||||
targetCompatibility 1.8
|
targetCompatibility 1.8
|
||||||
}
|
}
|
||||||
|
|
||||||
packagingOptions {
|
|
||||||
exclude 'META-INF/atomicfu.kotlin_module'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -55,7 +55,8 @@ abstract class DarkModeSwitchActivity : AppCompatActivity() {
|
||||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.P) {
|
||||||
return UNKNOWN
|
return UNKNOWN
|
||||||
}
|
}
|
||||||
return when (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) {
|
val currentNightMode = resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
|
||||||
|
return when (currentNightMode) {
|
||||||
Configuration.UI_MODE_NIGHT_YES -> return ENABLED
|
Configuration.UI_MODE_NIGHT_YES -> return ENABLED
|
||||||
Configuration.UI_MODE_NIGHT_NO -> return DISABLED
|
Configuration.UI_MODE_NIGHT_NO -> return DISABLED
|
||||||
else -> UNKNOWN
|
else -> UNKNOWN
|
||||||
|
|
|
@ -24,6 +24,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL
|
import androidx.recyclerview.widget.LinearLayoutManager.HORIZONTAL
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
import com.afollestad.materialdialogs.list.listItems
|
import com.afollestad.materialdialogs.list.listItems
|
||||||
|
import com.afollestad.materialdialogs.list.listItemsSingleChoice
|
||||||
import com.afollestad.nocknock.R
|
import com.afollestad.nocknock.R
|
||||||
import com.afollestad.nocknock.adapter.SiteAdapter
|
import com.afollestad.nocknock.adapter.SiteAdapter
|
||||||
import com.afollestad.nocknock.adapter.TagAdapter
|
import com.afollestad.nocknock.adapter.TagAdapter
|
||||||
|
@ -34,6 +35,9 @@ import com.afollestad.nocknock.notifications.NockNotificationManager
|
||||||
import com.afollestad.nocknock.ui.DarkModeSwitchActivity
|
import com.afollestad.nocknock.ui.DarkModeSwitchActivity
|
||||||
import com.afollestad.nocknock.ui.NightMode.UNKNOWN
|
import com.afollestad.nocknock.ui.NightMode.UNKNOWN
|
||||||
import com.afollestad.nocknock.utilities.providers.IntentProvider
|
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 com.afollestad.nocknock.viewcomponents.livedata.toViewVisibility
|
||||||
import kotlinx.android.synthetic.main.activity_main.fab
|
import kotlinx.android.synthetic.main.activity_main.fab
|
||||||
import kotlinx.android.synthetic.main.activity_main.list
|
import kotlinx.android.synthetic.main.activity_main.list
|
||||||
|
@ -101,6 +105,7 @@ class MainActivity : DarkModeSwitchActivity() {
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.about -> AboutDialog.show(this@MainActivity)
|
R.id.about -> AboutDialog.show(this@MainActivity)
|
||||||
R.id.dark_mode -> toggleDarkMode()
|
R.id.dark_mode -> toggleDarkMode()
|
||||||
|
R.id.support_me -> supportMe()
|
||||||
}
|
}
|
||||||
return@setOnMenuItemClickListener true
|
return@setOnMenuItemClickListener true
|
||||||
}
|
}
|
||||||
|
@ -146,4 +151,20 @@ class MainActivity : DarkModeSwitchActivity() {
|
||||||
viewSite(model)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,4 +7,7 @@
|
||||||
android:id="@+id/dark_mode"
|
android:id="@+id/dark_mode"
|
||||||
android:checkable="true"
|
android:checkable="true"
|
||||||
android:title="@string/dark_mode"/>
|
android:title="@string/dark_mode"/>
|
||||||
|
<item
|
||||||
|
android:id="@+id/support_me"
|
||||||
|
android:title="@string/support_me"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
|
||||||
</adaptive-icon>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<background android:drawable="@color/ic_launcher_background"/>
|
|
||||||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
|
|
||||||
</adaptive-icon>
|
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 4.4 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 7 KiB |
Before Width: | Height: | Size: 9 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 9.8 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 15 KiB |
|
@ -13,4 +13,10 @@
|
||||||
<item>JavaScript Evaluation</item>
|
<item>JavaScript Evaluation</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
<string-array name="donation_options">
|
||||||
|
<item>via PayPal</item>
|
||||||
|
<item>via Cash App</item>
|
||||||
|
<item>via Venmo</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<color name="ic_launcher_background">#758F9A</color>
|
|
||||||
</resources>
|
|
|
@ -14,7 +14,6 @@
|
||||||
<a href=\'https://www.linkedin.com/in/afollestad\'>LinkedIn</a>
|
<a href=\'https://www.linkedin.com/in/afollestad\'>LinkedIn</a>
|
||||||
<br/><br/><i>Nock Nock is open source! Check out the <a href=\'https://github.com/afollestad/nock-nock\'>GitHub page</a>!</i>
|
<br/><br/><i>Nock Nock is open source! Check out the <a href=\'https://github.com/afollestad/nock-nock\'>GitHub page</a>!</i>
|
||||||
<br/>Icon by <a href=\'https://plus.google.com/+KevinAguilarC\'>Kevin Aguilar</a> of <b>221 Pixels</b>.
|
<br/>Icon by <a href=\'https://plus.google.com/+KevinAguilarC\'>Kevin Aguilar</a> of <b>221 Pixels</b>.
|
||||||
<br/>View the <a href=\'https://af.codes/privacypolicies/nocknock.html\'>Privacy Policy</a>.
|
|
||||||
]]></string>
|
]]></string>
|
||||||
<string name="dark_mode">Dark Mode</string>
|
<string name="dark_mode">Dark Mode</string>
|
||||||
|
|
||||||
|
@ -85,6 +84,14 @@
|
||||||
exception to pass custom error messages to Nock Nock.
|
exception to pass custom error messages to Nock Nock.
|
||||||
</string>
|
</string>
|
||||||
|
|
||||||
|
<string name="support_me">Donate</string>
|
||||||
|
<string name="support_me_message"><![CDATA[
|
||||||
|
<b>Nock Nock</b> was created and is maintained by one person. Donations are <b>much</b>
|
||||||
|
appreciated and encourage continued support.
|
||||||
|
]]></string>
|
||||||
|
<string name="thank_you">Thank you very much!</string>
|
||||||
|
<string name="next">Next</string>
|
||||||
|
|
||||||
<string name="install_web_browser">Please install a web browser app, such as Google Chrome.</string>
|
<string name="install_web_browser">Please install a web browser app, such as Google Chrome.</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -12,10 +12,6 @@ android {
|
||||||
versionName versions.publishVersion
|
versionName versions.publishVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
packagingOptions {
|
|
||||||
exclude 'META-INF/atomicfu.kotlin_module'
|
|
||||||
}
|
|
||||||
|
|
||||||
// For Mozilla Rhino
|
// For Mozilla Rhino
|
||||||
lintOptions {
|
lintOptions {
|
||||||
abortOnError false
|
abortOnError false
|
||||||
|
|
|
@ -14,10 +14,6 @@ android {
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
|
|
||||||
packagingOptions {
|
|
||||||
exclude 'META-INF/atomicfu.kotlin_module'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
@ -431,30 +431,9 @@ class AppDatabaseTest() {
|
||||||
|
|
||||||
val allSites = db.allSites()
|
val allSites = db.allSites()
|
||||||
assertThat(allSites.size).isEqualTo(3)
|
assertThat(allSites.size).isEqualTo(3)
|
||||||
assertThat(allSites[0]).isEqualTo(
|
assertThat(allSites[0]).isEqualTo(MOCK_MODEL_1)
|
||||||
MOCK_MODEL_1.copy(
|
assertThat(allSites[1]).isEqualTo(MOCK_MODEL_2)
|
||||||
headers = listOf(
|
assertThat(allSites[2]).isEqualTo(MOCK_MODEL_3)
|
||||||
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() {
|
@Test fun extension_put_getSite() {
|
||||||
|
@ -491,12 +470,10 @@ class AppDatabaseTest() {
|
||||||
)
|
)
|
||||||
val updatedHeaders = listOf(
|
val updatedHeaders = listOf(
|
||||||
modelToUpdate.headers.first().copy(
|
modelToUpdate.headers.first().copy(
|
||||||
id = 7,
|
|
||||||
key = "One",
|
key = "One",
|
||||||
value = "Hello"
|
value = "Hello"
|
||||||
),
|
),
|
||||||
modelToUpdate.headers.last().copy(
|
modelToUpdate.headers.last().copy(
|
||||||
id = 8,
|
|
||||||
key = "Two",
|
key = "Two",
|
||||||
value = "Hey"
|
value = "Hey"
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,23 +3,23 @@ ext.versions = [
|
||||||
minSdk : 21,
|
minSdk : 21,
|
||||||
compileSdk : 28,
|
compileSdk : 28,
|
||||||
buildTools : '28.0.3',
|
buildTools : '28.0.3',
|
||||||
publishVersion : '0.8.8',
|
publishVersion : '0.8.7',
|
||||||
publishVersionCode : 46,
|
publishVersionCode : 43,
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
gradlePlugin : '3.4.0',
|
gradlePlugin : '3.3.2',
|
||||||
spotlessPlugin : '3.22.0',
|
spotlessPlugin : '3.19.0',
|
||||||
versionPlugin : '0.21.0',
|
versionPlugin : '0.21.0',
|
||||||
googleServices : '4.2.0',
|
googleServices : '4.2.0',
|
||||||
fabricPlugin : '1.+',
|
fabricPlugin : '1.+',
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
okHttp : '3.14.1',
|
okHttp : '3.14.0',
|
||||||
rhino : '1.7.10',
|
rhino : '1.7.10',
|
||||||
|
|
||||||
// Kotlin
|
// Kotlin
|
||||||
kotlin : '1.3.30',
|
kotlin : '1.3.21',
|
||||||
coroutines : '1.2.0',
|
coroutines : '1.1.1',
|
||||||
koin : '1.0.2',
|
koin : '1.0.2',
|
||||||
|
|
||||||
// Google/AndroidX
|
// Google/AndroidX
|
||||||
|
@ -30,16 +30,16 @@ ext.versions = [
|
||||||
googleMaterial : '1.0.0',
|
googleMaterial : '1.0.0',
|
||||||
room : '2.0.0',
|
room : '2.0.0',
|
||||||
lifecycle : '2.0.0',
|
lifecycle : '2.0.0',
|
||||||
firebaseCore : '16.0.8',
|
firebaseCore : '16.0.7',
|
||||||
|
|
||||||
// Rx
|
// Rx
|
||||||
rxJava : '2.2.8',
|
rxJava : '2.2.7',
|
||||||
rxBinding : '3.0.0-alpha1',
|
rxBinding : '3.0.0-alpha1',
|
||||||
|
|
||||||
// afollestad
|
// afollestad
|
||||||
materialDialogs : '2.8.1',
|
materialDialogs : '2.0.3',
|
||||||
rxkPrefs : '1.2.5',
|
rxkPrefs : '1.2.5',
|
||||||
vvalidator : '0.4.1',
|
vvalidator : '0.3.1',
|
||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
timber : '4.7.1',
|
timber : '4.7.1',
|
||||||
|
@ -47,12 +47,12 @@ ext.versions = [
|
||||||
|
|
||||||
// Unit testing
|
// Unit testing
|
||||||
junit : '4.12',
|
junit : '4.12',
|
||||||
mockito : '2.27.0',
|
mockito : '2.25.0',
|
||||||
mockitoKotlin : '2.1.0',
|
mockitoKotlin : '2.1.0',
|
||||||
truth : '0.44',
|
truth : '0.43',
|
||||||
|
|
||||||
// UI testing
|
// UI testing
|
||||||
androidxTestRunner : '1.1.1',
|
androidxTestRunner : '1.1.1',
|
||||||
androidxTest : '1.1.0',
|
androidxTest : '1.1.0',
|
||||||
archTesting : '2.0.1'
|
archTesting : '2.0.0'
|
||||||
]
|
]
|
||||||
|
|
BIN
ic_web.png
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 25 KiB |
|
@ -56,23 +56,10 @@ class HeaderStackLayout(
|
||||||
|
|
||||||
override fun onClick(v: View) {
|
override fun onClick(v: View) {
|
||||||
val index = v.tag as Int
|
val index = v.tag as Int
|
||||||
check(index >= 0 || index < list.childCount) {
|
|
||||||
"Index $index is out of bounds in the header stack (size ${list.childCount})."
|
|
||||||
}
|
|
||||||
list.post {
|
|
||||||
list.removeViewAt(index)
|
list.removeViewAt(index)
|
||||||
headers.removeAt(index)
|
headers.removeAt(index)
|
||||||
invalidateTags()
|
|
||||||
postLiveData()
|
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) {
|
private fun addEntry(forHeader: Header) {
|
||||||
// Keep track of reference for posting future changes.
|
// Keep track of reference for posting future changes.
|
||||||
|
@ -80,7 +67,9 @@ class HeaderStackLayout(
|
||||||
|
|
||||||
val li = LayoutInflater.from(context)
|
val li = LayoutInflater.from(context)
|
||||||
val entry = li.inflate(R.layout.header_stack_item, list, false) as HeaderItemLayout
|
val entry = li.inflate(R.layout.header_stack_item, list, false) as HeaderItemLayout
|
||||||
list.addView(entry.apply {
|
list.addView(entry)
|
||||||
|
|
||||||
|
entry.run {
|
||||||
inputKey.setText(forHeader.key)
|
inputKey.setText(forHeader.key)
|
||||||
inputKey.post { entry.inputKey.requestFocus() }
|
inputKey.post { entry.inputKey.requestFocus() }
|
||||||
attachHeader(forHeader, this@HeaderStackLayout)
|
attachHeader(forHeader, this@HeaderStackLayout)
|
||||||
|
@ -88,6 +77,6 @@ class HeaderStackLayout(
|
||||||
|
|
||||||
btnRemove.tag = headers.size - 1
|
btnRemove.tag = headers.size - 1
|
||||||
btnRemove.setOnClickListener(this@HeaderStackLayout)
|
btnRemove.setOnClickListener(this@HeaderStackLayout)
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|