This commit is contained in:
Aidan Follestad 2019-01-06 21:33:54 -08:00
commit 1569871524
19 changed files with 10 additions and 61 deletions

View file

@ -44,10 +44,6 @@ abstract class DarkModeSwitchActivity : AppCompatActivity() {
.attachLifecycle(this) .attachLifecycle(this)
} }
override fun onResume() {
super.onResume()
}
private fun themeRes() = if (darkModePref.get()) { private fun themeRes() = if (darkModePref.get()) {
R.style.AppTheme_Dark R.style.AppTheme_Dark
} else { } else {

View file

@ -19,7 +19,6 @@ import androidx.lifecycle.ViewModel
import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import org.jetbrains.annotations.TestOnly
/** @author Aidan Follestad (@afollestad) */ /** @author Aidan Follestad (@afollestad) */
abstract class ScopedViewModel(mainDispatcher: CoroutineDispatcher) : ViewModel() { abstract class ScopedViewModel(mainDispatcher: CoroutineDispatcher) : ViewModel() {
@ -32,5 +31,5 @@ abstract class ScopedViewModel(mainDispatcher: CoroutineDispatcher) : ViewModel(
job.cancel() job.cancel()
} }
@TestOnly open fun destroy() = job.cancel() //@TestOnly open fun destroy() = job.cancel()
} }

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppThemeParent.Ink" parent="AppThemeParent.Dark">
<item name="android:navigationBarColor">@color/inkColorDark</item>
</style>
</resources>

View file

@ -1,10 +1,6 @@
<resources> <resources>
<dimen name="empty_text_size">28sp</dimen> <dimen name="empty_text_size">28sp</dimen>
<dimen name="list_text_spacing">6dp</dimen> <dimen name="list_text_spacing">6dp</dimen>
<dimen name="fab_elevation">4dp</dimen>
<dimen name="fab_elevation_pressed">8dp</dimen>
</resources> </resources>

View file

@ -38,7 +38,6 @@
<string name="next_check">Next Validation</string> <string name="next_check">Next Validation</string>
<string name="next_check_x">Next Validation: %1$s</string> <string name="next_check_x">Next Validation: %1$s</string>
<string name="now">Now</string> <string name="now">Now</string>
<string name="none_turned_off">None (turned off)</string>
<string name="none">None</string> <string name="none">None</string>
<string name="disable_automatic_checks">Disable Automatic Validation</string> <string name="disable_automatic_checks">Disable Automatic Validation</string>
@ -83,7 +82,6 @@
<string name="thank_you">Thank you very much!</string> <string name="thank_you">Thank you very much!</string>
<string name="next">Next</string> <string name="next">Next</string>
<string name="install_video_viewer">Please install a video viewer app, such as Google Photos.</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>

View file

@ -43,6 +43,8 @@
<item name="md_font_button">@font/lato_bold</item> <item name="md_font_button">@font/lato_bold</item>
</style> </style>
<style name="AppThemeParent.Ink" parent="AppThemeParent.Dark"/> <style name="AppThemeParent.Ink" parent="AppThemeParent.Dark">
<item name="android:navigationBarColor">@color/inkColorDark</item>
</style>
</resources> </resources>

View file

@ -1,20 +0,0 @@
/**
* Designed and developed by Aidan Follestad (@afollestad)
*
* 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 com.afollestad.nocknock.utilities.ext
import android.net.Uri
fun Uri.isHttpOrHttps() = scheme == "http" || scheme == "https"

View file

@ -21,5 +21,5 @@ import androidx.lifecycle.Transformations
fun <X, Y> LiveData<X>.map(mapper: (X) -> Y) = fun <X, Y> LiveData<X>.map(mapper: (X) -> Y) =
Transformations.map(this, mapper)!! Transformations.map(this, mapper)!!
fun <X, Y> LiveData<X>.switchMap(mapper: (X) -> LiveData<Y>) = //fun <X, Y> LiveData<X>.switchMap(mapper: (X) -> LiveData<Y>) =
Transformations.switchMap(this, mapper)!! // Transformations.switchMap(this, mapper)!!

View file

@ -55,5 +55,3 @@ fun Status.textRes() = when (this) {
} }
fun Status?.isPending() = this == WAITING || this == CHECKING fun Status?.isPending() = this == WAITING || this == CHECKING
fun Int.toSiteStatus() = Status.fromValue(this)

View file

@ -66,7 +66,7 @@ class ValidationJob : JobService() {
val siteId = params.extras.getLong(KEY_SITE_ID) val siteId = params.extras.getLong(KEY_SITE_ID)
GlobalScope.launch(Main) { GlobalScope.launch(Main) {
val site = async(IO) { database.getSite(siteId) }.await() val site = withContext(IO) { database.getSite(siteId) }
if (site == null) { if (site == null) {
log("Unable to find a site for ID $siteId, this job will not be rescheduled.") log("Unable to find a site for ID $siteId, this job will not be rescheduled.")
return@launch jobFinished(params, false) return@launch jobFinished(params, false)

View file

@ -30,7 +30,6 @@ import com.afollestad.nocknock.utilities.providers.StringProvider
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
import org.jetbrains.annotations.TestOnly
import java.net.SocketTimeoutException import java.net.SocketTimeoutException
import java.util.concurrent.TimeUnit.MILLISECONDS import java.util.concurrent.TimeUnit.MILLISECONDS
import timber.log.Timber.d as log import timber.log.Timber.d as log
@ -193,7 +192,7 @@ class RealValidationManager(
jobScheduler.allPendingJobs jobScheduler.allPendingJobs
.firstOrNull { job -> job.id == site.id.toInt() } .firstOrNull { job -> job.id == site.id.toInt() }
@TestOnly fun setClientTimeoutChanger(changer: ClientTimeoutChanger) { // @TestOnly fun setClientTimeoutChanger(changer: ClientTimeoutChanger) {
this.clientTimeoutChanger = changer // this.clientTimeoutChanger = changer
} // }
} }

View file

Before

Width:  |  Height:  |  Size: 998 B

After

Width:  |  Height:  |  Size: 998 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 661 B

After

Width:  |  Height:  |  Size: 661 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Before After
Before After

View file

@ -34,14 +34,6 @@ fun View.hide() {
visibility = GONE visibility = GONE
} }
fun View.enable() {
isEnabled = true
}
fun View.disable() {
isEnabled = false
}
fun View.showOrHide(show: Boolean) = if (show) show() else hide() fun View.showOrHide(show: Boolean) = if (show) show() else hide()
fun View.onLayout(cb: () -> Unit) { fun View.onLayout(cb: () -> Unit) {

View file

@ -63,8 +63,6 @@ class JavaScriptInputLayout(
visibility.toViewVisibility(lifecycleOwner(), this) visibility.toViewVisibility(lifecycleOwner(), this)
} }
fun clear() = userInput.setText("")
private fun setError(error: String?) { private fun setError(error: String?) {
error_text.showOrHide(error != null) error_text.showOrHide(error != null)
error_text.text = error error_text.text = error

View file

@ -14,7 +14,6 @@
<dimen name="title_font_size">20sp</dimen> <dimen name="title_font_size">20sp</dimen>
<dimen name="body_font_size">14sp</dimen> <dimen name="body_font_size">14sp</dimen>
<dimen name="code_font_size">14sp</dimen> <dimen name="code_font_size">14sp</dimen>
<dimen name="footnote_font_size">12sp</dimen>
<dimen name="caption_font_size">12sp</dimen> <dimen name="caption_font_size">12sp</dimen>
<dimen name="button_height">52dp</dimen> <dimen name="button_height">52dp</dimen>