mirror of
https://github.com/afollestad/nock-nock.git
synced 2025-08-03 14:48:39 +00:00
0.8.3
This commit is contained in:
parent
002149cd3f
commit
f85fc9d8bb
9 changed files with 132 additions and 70 deletions
35
.idea/misc.xml
generated
35
.idea/misc.xml
generated
|
@ -5,6 +5,41 @@
|
||||||
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" />
|
||||||
</configurations>
|
</configurations>
|
||||||
</component>
|
</component>
|
||||||
|
<component name="NullableNotNullManager">
|
||||||
|
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
|
||||||
|
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
|
||||||
|
<option name="myNullables">
|
||||||
|
<value>
|
||||||
|
<list size="10">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="javax.annotation.CheckForNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.Nullable" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNullable" />
|
||||||
|
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.Nullable" />
|
||||||
|
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableDecl" />
|
||||||
|
<item index="9" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NullableType" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myNotNulls">
|
||||||
|
<value>
|
||||||
|
<list size="9">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="androidx.annotation.NonNull" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="androidx.annotation.RecentlyNonNull" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.qual.NonNull" />
|
||||||
|
<item index="7" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullDecl" />
|
||||||
|
<item index="8" class="java.lang.String" itemvalue="org.checkerframework.checker.nullness.compatqual.NonNullType" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
|
|
Binary file not shown.
|
@ -189,7 +189,8 @@ class AddSiteViewModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate timeout
|
// Validate timeout
|
||||||
if (timeout.value.isNullOrLessThan(1)) {
|
val timeout = timeout.value ?: 10_000
|
||||||
|
if (timeout < 0) {
|
||||||
timeoutError.value = R.string.please_enter_networkTimeout
|
timeoutError.value = R.string.please_enter_networkTimeout
|
||||||
errorCount++
|
errorCount++
|
||||||
} else {
|
} else {
|
||||||
|
@ -232,7 +233,7 @@ class AddSiteViewModel(
|
||||||
validationIntervalMs = getCheckIntervalMs(),
|
validationIntervalMs = getCheckIntervalMs(),
|
||||||
validationMode = validationMode.value!!,
|
validationMode = validationMode.value!!,
|
||||||
validationArgs = getValidationArgs(),
|
validationArgs = getValidationArgs(),
|
||||||
networkTimeout = timeout.value!!,
|
networkTimeout = timeout,
|
||||||
disabled = false
|
disabled = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -108,8 +108,17 @@ class MainViewModel(
|
||||||
emptyTextVisibility.value = false
|
emptyTextVisibility.value = false
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
|
|
||||||
val result = withContext(ioDispatcher) {
|
val unfiltered = withContext(ioDispatcher) {
|
||||||
database.allSites(forTags)
|
database.allSites()
|
||||||
|
}
|
||||||
|
var result = unfiltered
|
||||||
|
|
||||||
|
if (forTags.isNotEmpty()) {
|
||||||
|
result = result.filter { site ->
|
||||||
|
val itemTags = site.tags.toLowerCase()
|
||||||
|
.split(",")
|
||||||
|
itemTags.any { tag -> forTags.contains(tag) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sites.value = result
|
sites.value = result
|
||||||
|
@ -117,13 +126,11 @@ class MainViewModel(
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
emptyTextVisibility.value = result.isEmpty()
|
emptyTextVisibility.value = result.isEmpty()
|
||||||
|
|
||||||
if (forTags.isEmpty()) {
|
val tagsValues = pullOutTags(unfiltered)
|
||||||
val tagsValues = pullOutTags(result)
|
|
||||||
tags.value = tagsValues
|
tags.value = tagsValues
|
||||||
tagsListVisibility.value = tagsValues.isNotEmpty()
|
tagsListVisibility.value = tagsValues.isNotEmpty()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private suspend fun ensureCheckJobs() {
|
private suspend fun ensureCheckJobs() {
|
||||||
withContext(ioDispatcher) {
|
withContext(ioDispatcher) {
|
||||||
|
|
|
@ -269,7 +269,8 @@ class ViewSiteViewModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate timeout
|
// Validate timeout
|
||||||
if (timeout.value.isNullOrLessThan(1)) {
|
val timeout = timeout.value ?: 10_000
|
||||||
|
if (timeout < 0) {
|
||||||
timeoutError.value = R.string.please_enter_networkTimeout
|
timeoutError.value = R.string.please_enter_networkTimeout
|
||||||
errorCount++
|
errorCount++
|
||||||
} else {
|
} else {
|
||||||
|
@ -312,7 +313,7 @@ class ViewSiteViewModel(
|
||||||
validationIntervalMs = getCheckIntervalMs(),
|
validationIntervalMs = getCheckIntervalMs(),
|
||||||
validationMode = validationMode.value!!,
|
validationMode = validationMode.value!!,
|
||||||
validationArgs = getValidationArgs(),
|
validationArgs = getValidationArgs(),
|
||||||
networkTimeout = timeout.value!!,
|
networkTimeout = timeout,
|
||||||
disabled = false
|
disabled = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
android:paddingBottom="@dimen/content_inset"
|
android:paddingBottom="@dimen/content_inset"
|
||||||
android:paddingLeft="@dimen/content_inset"
|
android:paddingLeft="@dimen/content_inset"
|
||||||
android:paddingRight="@dimen/content_inset"
|
android:paddingRight="@dimen/content_inset"
|
||||||
|
android:paddingTop="@dimen/content_inset_half"
|
||||||
>
|
>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
@ -35,7 +36,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginLeft="-4dp"
|
android:layout_marginLeft="-4dp"
|
||||||
android:layout_marginRight="-4dp"
|
android:layout_marginRight="-4dp"
|
||||||
android:layout_marginTop="@dimen/content_inset"
|
android:nextFocusDown="@+id/urlTiLayout"
|
||||||
>
|
>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
@ -44,27 +45,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/site_name"
|
android:hint="@string/site_name"
|
||||||
android:inputType="textPersonName|textCapWords|textAutoCorrect"
|
android:inputType="textPersonName|textCapWords|textAutoCorrect"
|
||||||
style="@style/NockText.Body"
|
android:nextFocusDown="@+id/inputUrl"
|
||||||
/>
|
|
||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
|
||||||
android:id="@+id/tagsTiLayout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="-4dp"
|
|
||||||
android:layout_marginRight="-4dp"
|
|
||||||
android:layout_marginTop="@dimen/content_inset_less"
|
|
||||||
>
|
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
|
||||||
android:id="@+id/inputTags"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:digits=",.?-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
|
||||||
android:hint="@string/site_tags_hint"
|
|
||||||
android:inputType="textPersonName|textCapWords|textAutoCorrect"
|
|
||||||
style="@style/NockText.Body"
|
style="@style/NockText.Body"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -77,6 +58,7 @@
|
||||||
android:layout_marginLeft="-4dp"
|
android:layout_marginLeft="-4dp"
|
||||||
android:layout_marginRight="-4dp"
|
android:layout_marginRight="-4dp"
|
||||||
android:layout_marginTop="@dimen/content_inset_half"
|
android:layout_marginTop="@dimen/content_inset_half"
|
||||||
|
android:nextFocusDown="@+id/tagsTiLayout"
|
||||||
>
|
>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputEditText
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
@ -85,6 +67,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/site_url"
|
android:hint="@string/site_url"
|
||||||
android:inputType="textUri"
|
android:inputType="textUri"
|
||||||
|
android:nextFocusDown="@+id/inputTags"
|
||||||
style="@style/NockText.Body"
|
style="@style/NockText.Body"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -100,6 +83,31 @@
|
||||||
style="@style/NockText.Footnote"
|
style="@style/NockText.Footnote"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/tagsTiLayout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginLeft="-4dp"
|
||||||
|
android:layout_marginRight="-4dp"
|
||||||
|
android:layout_marginTop="@dimen/content_inset_half"
|
||||||
|
android:nextFocusDown="@+id/urlTiLayout"
|
||||||
|
>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/inputTags"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:digits=",.?-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
||||||
|
android:hint="@string/site_tags_hint"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:inputType="text|textCapWords"
|
||||||
|
android:nextFocusDown="@+id/inputUrl"
|
||||||
|
android:singleLine="true"
|
||||||
|
style="@style/NockText.Body"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<include layout="@layout/include_divider"/>
|
<include layout="@layout/include_divider"/>
|
||||||
|
|
||||||
<com.afollestad.nocknock.viewcomponents.interval.ValidationIntervalLayout
|
<com.afollestad.nocknock.viewcomponents.interval.ValidationIntervalLayout
|
||||||
|
@ -179,6 +187,13 @@
|
||||||
style="@style/NockText.Body.Light"
|
style="@style/NockText.Body.Light"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginTop="@dimen/content_inset_less"
|
||||||
|
android:background="?dividerColor"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.afollestad.nocknock.viewcomponents.retrypolicy.RetryPolicyLayout
|
<com.afollestad.nocknock.viewcomponents.retrypolicy.RetryPolicyLayout
|
||||||
android:id="@+id/retryPolicyLayout"
|
android:id="@+id/retryPolicyLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
android:paddingBottom="@dimen/content_inset"
|
android:paddingBottom="@dimen/content_inset"
|
||||||
android:paddingLeft="@dimen/content_inset"
|
android:paddingLeft="@dimen/content_inset"
|
||||||
android:paddingRight="@dimen/content_inset"
|
android:paddingRight="@dimen/content_inset"
|
||||||
android:paddingTop="@dimen/content_inset"
|
android:paddingTop="@dimen/content_inset_half"
|
||||||
>
|
>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -61,30 +61,20 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/site_name"
|
android:hint="@string/site_name"
|
||||||
android:inputType="textPersonName|textCapWords|textAutoCorrect"
|
android:inputType="textPersonName|textCapWords|textAutoCorrect"
|
||||||
|
android:nextFocusDown="@+id/inputUrl"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:transitionName="site_name"
|
android:transitionName="site_name"
|
||||||
tools:ignore="Autofill,UnusedAttribute"
|
tools:ignore="Autofill,UnusedAttribute"
|
||||||
style="@style/NockText.Body"
|
style="@style/NockText.Body"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/inputTags"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:digits=",.?-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
|
||||||
android:hint="@string/site_tags_hint"
|
|
||||||
android:inputType="text|textCapWords"
|
|
||||||
android:singleLine="true"
|
|
||||||
tools:ignore="Autofill,UnusedAttribute"
|
|
||||||
style="@style/NockText.Body"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/inputUrl"
|
android:id="@+id/inputUrl"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:hint="@string/site_url"
|
android:hint="@string/site_url"
|
||||||
android:inputType="textUri"
|
android:inputType="textUri"
|
||||||
|
android:nextFocusDown="@+id/inputTags"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:transitionName="site_url"
|
android:transitionName="site_url"
|
||||||
tools:ignore="Autofill,UnusedAttribute"
|
tools:ignore="Autofill,UnusedAttribute"
|
||||||
|
@ -103,6 +93,19 @@
|
||||||
style="@style/NockText.Footnote"
|
style="@style/NockText.Footnote"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/inputTags"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:digits=",.?-_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ "
|
||||||
|
android:hint="@string/site_tags_hint"
|
||||||
|
android:imeOptions="actionNext"
|
||||||
|
android:inputType="text|textCapWords"
|
||||||
|
android:singleLine="true"
|
||||||
|
tools:ignore="Autofill,UnusedAttribute"
|
||||||
|
style="@style/NockText.Body"
|
||||||
|
/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -198,6 +201,13 @@
|
||||||
style="@style/NockText.Body.Light"
|
style="@style/NockText.Body.Light"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginTop="@dimen/content_inset_less"
|
||||||
|
android:background="?dividerColor"
|
||||||
|
/>
|
||||||
|
|
||||||
<com.afollestad.nocknock.viewcomponents.retrypolicy.RetryPolicyLayout
|
<com.afollestad.nocknock.viewcomponents.retrypolicy.RetryPolicyLayout
|
||||||
android:id="@+id/retryPolicyLayout"
|
android:id="@+id/retryPolicyLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -52,16 +52,9 @@ abstract class AppDatabase : RoomDatabase() {
|
||||||
*
|
*
|
||||||
* @author Aidan Follestad (@afollestad)
|
* @author Aidan Follestad (@afollestad)
|
||||||
*/
|
*/
|
||||||
fun AppDatabase.allSites(tags: List<String> = emptyList()): List<Site> {
|
fun AppDatabase.allSites(): List<Site> {
|
||||||
var all = siteDao().all()
|
return siteDao().all()
|
||||||
if (tags.isNotEmpty()) {
|
.map {
|
||||||
all = all.filter { site ->
|
|
||||||
val itemTags = site.tags.toLowerCase()
|
|
||||||
.split(",")
|
|
||||||
return@filter itemTags.any { tag -> tags.contains(tag) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return all.map {
|
|
||||||
val settings = siteSettingsDao().forSite(it.id)
|
val settings = siteSettingsDao().forSite(it.id)
|
||||||
.single()
|
.single()
|
||||||
val lastResult = validationResultsDao().forSite(it.id)
|
val lastResult = validationResultsDao().forSite(it.id)
|
||||||
|
|
|
@ -3,8 +3,8 @@ ext.versions = [
|
||||||
minSdk : 21,
|
minSdk : 21,
|
||||||
compileSdk : 28,
|
compileSdk : 28,
|
||||||
buildTools : '28.0.3',
|
buildTools : '28.0.3',
|
||||||
publishVersion : '0.8.2b',
|
publishVersion : '0.8.3',
|
||||||
publishVersionCode : 33,
|
publishVersionCode : 35,
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
gradlePlugin : '3.2.1',
|
gradlePlugin : '3.2.1',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue