Cleanup
|
@ -44,10 +44,6 @@ abstract class DarkModeSwitchActivity : AppCompatActivity() {
|
|||
.attachLifecycle(this)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
private fun themeRes() = if (darkModePref.get()) {
|
||||
R.style.AppTheme_Dark
|
||||
} else {
|
||||
|
|
|
@ -19,7 +19,6 @@ import androidx.lifecycle.ViewModel
|
|||
import kotlinx.coroutines.CoroutineDispatcher
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
abstract class ScopedViewModel(mainDispatcher: CoroutineDispatcher) : ViewModel() {
|
||||
|
@ -32,5 +31,5 @@ abstract class ScopedViewModel(mainDispatcher: CoroutineDispatcher) : ViewModel(
|
|||
job.cancel()
|
||||
}
|
||||
|
||||
@TestOnly open fun destroy() = job.cancel()
|
||||
//@TestOnly open fun destroy() = job.cancel()
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -1,10 +1,6 @@
|
|||
<resources>
|
||||
|
||||
<dimen name="empty_text_size">28sp</dimen>
|
||||
|
||||
<dimen name="list_text_spacing">6dp</dimen>
|
||||
|
||||
<dimen name="fab_elevation">4dp</dimen>
|
||||
<dimen name="fab_elevation_pressed">8dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
<string name="next_check">Next Validation</string>
|
||||
<string name="next_check_x">Next Validation: %1$s</string>
|
||||
<string name="now">Now</string>
|
||||
<string name="none_turned_off">None (turned off)</string>
|
||||
<string name="none">None</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="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>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -43,6 +43,8 @@
|
|||
<item name="md_font_button">@font/lato_bold</item>
|
||||
</style>
|
||||
|
||||
<style name="AppThemeParent.Ink" parent="AppThemeParent.Dark"/>
|
||||
<style name="AppThemeParent.Ink" parent="AppThemeParent.Dark">
|
||||
<item name="android:navigationBarColor">@color/inkColorDark</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -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"
|
|
@ -21,5 +21,5 @@ import androidx.lifecycle.Transformations
|
|||
fun <X, Y> LiveData<X>.map(mapper: (X) -> Y) =
|
||||
Transformations.map(this, mapper)!!
|
||||
|
||||
fun <X, Y> LiveData<X>.switchMap(mapper: (X) -> LiveData<Y>) =
|
||||
Transformations.switchMap(this, mapper)!!
|
||||
//fun <X, Y> LiveData<X>.switchMap(mapper: (X) -> LiveData<Y>) =
|
||||
// Transformations.switchMap(this, mapper)!!
|
||||
|
|
|
@ -55,5 +55,3 @@ fun Status.textRes() = when (this) {
|
|||
}
|
||||
|
||||
fun Status?.isPending() = this == WAITING || this == CHECKING
|
||||
|
||||
fun Int.toSiteStatus() = Status.fromValue(this)
|
||||
|
|
|
@ -66,7 +66,7 @@ class ValidationJob : JobService() {
|
|||
val siteId = params.extras.getLong(KEY_SITE_ID)
|
||||
|
||||
GlobalScope.launch(Main) {
|
||||
val site = async(IO) { database.getSite(siteId) }.await()
|
||||
val site = withContext(IO) { database.getSite(siteId) }
|
||||
if (site == null) {
|
||||
log("Unable to find a site for ID $siteId, this job will not be rescheduled.")
|
||||
return@launch jobFinished(params, false)
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.afollestad.nocknock.utilities.providers.StringProvider
|
|||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import java.net.SocketTimeoutException
|
||||
import java.util.concurrent.TimeUnit.MILLISECONDS
|
||||
import timber.log.Timber.d as log
|
||||
|
@ -193,7 +192,7 @@ class RealValidationManager(
|
|||
jobScheduler.allPendingJobs
|
||||
.firstOrNull { job -> job.id == site.id.toInt() }
|
||||
|
||||
@TestOnly fun setClientTimeoutChanger(changer: ClientTimeoutChanger) {
|
||||
this.clientTimeoutChanger = changer
|
||||
}
|
||||
// @TestOnly fun setClientTimeoutChanger(changer: ClientTimeoutChanger) {
|
||||
// this.clientTimeoutChanger = changer
|
||||
// }
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 998 B After Width: | Height: | Size: 998 B |
Before Width: | Height: | Size: 661 B After Width: | Height: | Size: 661 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
|
@ -34,14 +34,6 @@ fun View.hide() {
|
|||
visibility = GONE
|
||||
}
|
||||
|
||||
fun View.enable() {
|
||||
isEnabled = true
|
||||
}
|
||||
|
||||
fun View.disable() {
|
||||
isEnabled = false
|
||||
}
|
||||
|
||||
fun View.showOrHide(show: Boolean) = if (show) show() else hide()
|
||||
|
||||
fun View.onLayout(cb: () -> Unit) {
|
||||
|
|
|
@ -63,8 +63,6 @@ class JavaScriptInputLayout(
|
|||
visibility.toViewVisibility(lifecycleOwner(), this)
|
||||
}
|
||||
|
||||
fun clear() = userInput.setText("")
|
||||
|
||||
private fun setError(error: String?) {
|
||||
error_text.showOrHide(error != null)
|
||||
error_text.text = error
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<dimen name="title_font_size">20sp</dimen>
|
||||
<dimen name="body_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="button_height">52dp</dimen>
|
||||
|
|