Docs cleanup

This commit is contained in:
Aidan Follestad 2018-12-01 01:31:46 -08:00
commit cf802dfa2f
37 changed files with 47 additions and 47 deletions

View file

@ -12,7 +12,7 @@ import android.os.Bundle
typealias ActivityLifeChange = (activity: Activity, resumed: Boolean) -> Unit typealias ActivityLifeChange = (activity: Activity, resumed: Boolean) -> Unit
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
fun Application.onActivityLifeChange(cb: ActivityLifeChange) { fun Application.onActivityLifeChange(cb: ActivityLifeChange) {
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks { registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
override fun onActivitySaveInstanceState( override fun onActivitySaveInstanceState(

View file

@ -20,7 +20,7 @@ import com.afollestad.nocknock.utilities.ext.systemService
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import javax.inject.Inject import javax.inject.Inject
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class NockNockApp : Application(), Injector { class NockNockApp : Application(), Injector {
companion object { companion object {

View file

@ -21,7 +21,7 @@ import kotlinx.android.synthetic.main.list_item_server.view.textUrl
typealias Listener = (model: ServerModel, longClick: Boolean) -> Unit typealias Listener = (model: ServerModel, longClick: Boolean) -> Unit
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class ServerVH constructor( class ServerVH constructor(
itemView: View, itemView: View,
private val adapter: ServerAdapter private val adapter: ServerAdapter
@ -62,7 +62,7 @@ class ServerVH constructor(
} }
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class ServerAdapter(private val listener: Listener) : RecyclerView.Adapter<ServerVH>() { class ServerAdapter(private val listener: Listener) : RecyclerView.Adapter<ServerVH>() {
private val models = mutableListOf<ServerModel>() private val models = mutableListOf<ServerModel>()

View file

@ -22,7 +22,7 @@ import dagger.Component
import okhttp3.OkHttpClient import okhttp3.OkHttpClient
import javax.inject.Singleton import javax.inject.Singleton
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
@Singleton @Singleton
@Component( @Component(
modules = [ modules = [

View file

@ -13,7 +13,7 @@ import dagger.Binds
import dagger.Module import dagger.Module
import javax.inject.Singleton import javax.inject.Singleton
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
@Module @Module
abstract class MainBindModule { abstract class MainBindModule {

View file

@ -11,7 +11,7 @@ import dagger.Module
import dagger.Provides import dagger.Provides
import javax.inject.Singleton import javax.inject.Singleton
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
@Module @Module
open class MainModule { open class MainModule {

View file

@ -12,7 +12,7 @@ import androidx.fragment.app.DialogFragment
import com.afollestad.materialdialogs.MaterialDialog import com.afollestad.materialdialogs.MaterialDialog
import com.afollestad.nocknock.R import com.afollestad.nocknock.R
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class AboutDialog : DialogFragment() { class AboutDialog : DialogFragment() {
companion object { companion object {
private const val TAG = "[ABOUT_DIALOG]" private const val TAG = "[ABOUT_DIALOG]"

View file

@ -52,7 +52,7 @@ private const val KEY_FAB_X = "fab_x"
private const val KEY_FAB_Y = "fab_y" private const val KEY_FAB_Y = "fab_y"
private const val KEY_FAB_SIZE = "fab_size" private const val KEY_FAB_SIZE = "fab_size"
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
fun MainActivity.intentToAdd( fun MainActivity.intentToAdd(
x: Float, x: Float,
y: Float, y: Float,
@ -64,7 +64,7 @@ fun MainActivity.intentToAdd(
addFlags(FLAG_ACTIVITY_NO_ANIMATION) addFlags(FLAG_ACTIVITY_NO_ANIMATION)
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class AddSiteActivity : AppCompatActivity(), AddSiteView { class AddSiteActivity : AppCompatActivity(), AddSiteView {
companion object { companion object {

View file

@ -21,7 +21,7 @@ import kotlinx.coroutines.launch
import okhttp3.HttpUrl import okhttp3.HttpUrl
import javax.inject.Inject import javax.inject.Inject
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
data class InputErrors( data class InputErrors(
var name: Int? = null, var name: Int? = null,
var url: Int? = null, var url: Int? = null,
@ -35,7 +35,7 @@ data class InputErrors(
} }
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
interface AddSitePresenter { interface AddSitePresenter {
fun takeView(view: AddSiteView) fun takeView(view: AddSiteView)
@ -58,7 +58,7 @@ interface AddSitePresenter {
fun dropView() fun dropView()
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class RealAddSitePresenter @Inject constructor( class RealAddSitePresenter @Inject constructor(
private val serverModelStore: ServerModelStore, private val serverModelStore: ServerModelStore,
private val checkStatusManager: CheckStatusManager private val checkStatusManager: CheckStatusManager

View file

@ -9,7 +9,7 @@ import androidx.annotation.StringRes
import com.afollestad.nocknock.utilities.ext.ScopeReceiver import com.afollestad.nocknock.utilities.ext.ScopeReceiver
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
interface AddSiteView { interface AddSiteView {
fun setLoading() fun setLoading()

View file

@ -41,7 +41,7 @@ import kotlinx.android.synthetic.main.include_empty_view.emptyText
import javax.inject.Inject import javax.inject.Inject
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class MainActivity : AppCompatActivity(), MainView { class MainActivity : AppCompatActivity(), MainView {
companion object { companion object {

View file

@ -18,7 +18,7 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import javax.inject.Inject import javax.inject.Inject
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
interface MainPresenter { interface MainPresenter {
fun takeView(view: MainView) fun takeView(view: MainView)
@ -34,7 +34,7 @@ interface MainPresenter {
fun dropView() fun dropView()
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class RealMainPresenter @Inject constructor( class RealMainPresenter @Inject constructor(
private val serverModelStore: ServerModelStore, private val serverModelStore: ServerModelStore,
private val notificationManager: NockNotificationManager, private val notificationManager: NockNotificationManager,

View file

@ -9,7 +9,7 @@ import com.afollestad.nocknock.data.ServerModel
import com.afollestad.nocknock.utilities.ext.ScopeReceiver import com.afollestad.nocknock.utilities.ext.ScopeReceiver
import kotlin.coroutines.CoroutineContext import kotlin.coroutines.CoroutineContext
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
interface MainView { interface MainView {
fun setModels(models: List<ServerModel>) fun setModels(models: List<ServerModel>)

View file

@ -80,13 +80,13 @@ import javax.inject.Inject
private const val KEY_VIEW_MODEL = "site_model" private const val KEY_VIEW_MODEL = "site_model"
/** @author Aidan Follestad (afViewSiteActivityollestad) */ /** @author Aidan Follestad (@afollestad) */
fun MainActivity.intentToView(model: ServerModel) = fun MainActivity.intentToView(model: ServerModel) =
Intent(this, ViewSiteActivity::class.java).apply { Intent(this, ViewSiteActivity::class.java).apply {
putExtra(KEY_VIEW_MODEL, model) putExtra(KEY_VIEW_MODEL, model)
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class ViewSiteActivity : AppCompatActivity(), class ViewSiteActivity : AppCompatActivity(),
View.OnClickListener, View.OnClickListener,
Toolbar.OnMenuItemClickListener { Toolbar.OnMenuItemClickListener {

View file

@ -16,7 +16,7 @@ import kotlin.math.max
const val CHECK_INTERVAL_UNSET = -1L const val CHECK_INTERVAL_UNSET = -1L
const val LAST_CHECK_NONE = -1L const val LAST_CHECK_NONE = -1L
/** @author Aidan Follestad (afollestad)*/ /** @author Aidan Follestad (@afollestad)*/
data class ServerModel( data class ServerModel(
var id: Int = 0, var id: Int = 0,
val name: String, val name: String,

View file

@ -9,7 +9,7 @@ import com.afollestad.nocknock.data.ServerStatus.CHECKING
import com.afollestad.nocknock.data.ServerStatus.OK import com.afollestad.nocknock.data.ServerStatus.OK
import com.afollestad.nocknock.data.ServerStatus.WAITING import com.afollestad.nocknock.data.ServerStatus.WAITING
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
enum class ServerStatus(val value: Int) { enum class ServerStatus(val value: Int) {
OK(1), OK(1),
WAITING(2), WAITING(2),

View file

@ -5,7 +5,7 @@
*/ */
package com.afollestad.nocknock.data package com.afollestad.nocknock.data
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
enum class ValidationMode(val value: Int) { enum class ValidationMode(val value: Int) {
STATUS_CODE(1), STATUS_CODE(1),
TERM_SEARCH(2), TERM_SEARCH(2),

View file

@ -13,7 +13,7 @@ import dagger.Binds
import dagger.Module import dagger.Module
import javax.inject.Singleton import javax.inject.Singleton
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
@Module @Module
abstract class EngineModule { abstract class EngineModule {

View file

@ -25,7 +25,7 @@ private const val SQL_CREATE_ENTRIES =
private const val SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS ${ServerModel.TABLE_NAME}" private const val SQL_DELETE_ENTRIES = "DROP TABLE IF EXISTS ${ServerModel.TABLE_NAME}"
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class ServerModelDbHelper(context: Context) : SQLiteOpenHelper( class ServerModelDbHelper(context: Context) : SQLiteOpenHelper(
context, DATABASE_NAME, null, DATABASE_VERSION context, DATABASE_NAME, null, DATABASE_VERSION
) { ) {

View file

@ -14,7 +14,7 @@ import com.afollestad.nocknock.data.ServerModel.Companion.TABLE_NAME
import com.afollestad.nocknock.utilities.ext.diffFrom import com.afollestad.nocknock.utilities.ext.diffFrom
import javax.inject.Inject import javax.inject.Inject
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
interface ServerModelStore { interface ServerModelStore {
suspend fun get(id: Int? = null): List<ServerModel> suspend fun get(id: Int? = null): List<ServerModel>
@ -30,7 +30,7 @@ interface ServerModelStore {
suspend fun deleteAll(): Int suspend fun deleteAll(): Int
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class RealServerModelStore @Inject constructor( class RealServerModelStore @Inject constructor(
app: Application app: Application
) : ServerModelStore { ) : ServerModelStore {

View file

@ -19,7 +19,7 @@ import kotlinx.coroutines.async
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import javax.inject.Inject import javax.inject.Inject
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class BootReceiver : BroadcastReceiver() { class BootReceiver : BroadcastReceiver() {
companion object { companion object {

View file

@ -33,7 +33,7 @@ import kotlinx.coroutines.withContext
import java.lang.System.currentTimeMillis import java.lang.System.currentTimeMillis
import javax.inject.Inject import javax.inject.Inject
/** @author Aidan Follestad (afollestad)*/ /** @author Aidan Follestad (@afollestad)*/
class CheckStatusJob : JobService() { class CheckStatusJob : JobService() {
companion object { companion object {

View file

@ -25,13 +25,13 @@ import okhttp3.Response
import java.net.SocketTimeoutException import java.net.SocketTimeoutException
import javax.inject.Inject import javax.inject.Inject
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
data class CheckResult( data class CheckResult(
val model: ServerModel, val model: ServerModel,
val response: Response? = null val response: Response? = null
) )
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
interface CheckStatusManager { interface CheckStatusManager {
suspend fun ensureScheduledChecks() suspend fun ensureScheduledChecks()

View file

@ -11,7 +11,7 @@ import android.os.Build.VERSION_CODES
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.core.app.NotificationManagerCompat.IMPORTANCE_DEFAULT import androidx.core.app.NotificationManagerCompat.IMPORTANCE_DEFAULT
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
enum class Channel( enum class Channel(
val id: String, val id: String,
val title: Int, val title: Int,
@ -26,7 +26,7 @@ enum class Channel(
) )
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
@RequiresApi(VERSION_CODES.O) @RequiresApi(VERSION_CODES.O)
fun Channel.toNotificationChannel(context: Context): NotificationChannel { fun Channel.toNotificationChannel(context: Context): NotificationChannel {
val titleText = context.getString(this.title) val titleText = context.getString(this.title)

View file

@ -37,7 +37,7 @@ interface NockNotificationManager {
fun cancelStatusNotifications() fun cancelStatusNotifications()
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class RealNockNotificationManager @Inject constructor( class RealNockNotificationManager @Inject constructor(
private val app: Application, private val app: Application,
@AppIconRes private val appIconRes: Int, @AppIconRes private val appIconRes: Int,

View file

@ -12,7 +12,7 @@ import androidx.core.app.NotificationCompat
typealias NotificationBuilder = NotificationCompat.Builder typealias NotificationBuilder = NotificationCompat.Builder
typealias NotificationConstructor = NotificationBuilder.() -> Unit typealias NotificationConstructor = NotificationBuilder.() -> Unit
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
fun notification( fun notification(
context: Context, context: Context,
channel: Channel, channel: Channel,

View file

@ -9,7 +9,7 @@ import dagger.Binds
import dagger.Module import dagger.Module
import javax.inject.Singleton import javax.inject.Singleton
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
@Module @Module
abstract class NotificationsModule { abstract class NotificationsModule {

View file

@ -5,7 +5,7 @@
*/ */
package com.afollestad.nocknock.utilities package com.afollestad.nocknock.utilities
/** @author Aidan Follestad (afollestad)*/ /** @author Aidan Follestad (@afollestad)*/
interface Injector { interface Injector {
fun injectInto(target: Any) fun injectInto(target: Any)

View file

@ -13,7 +13,7 @@ import dagger.Binds
import dagger.Module import dagger.Module
import javax.inject.Singleton import javax.inject.Singleton
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
@Module @Module
abstract class UtilitiesModule { abstract class UtilitiesModule {

View file

@ -7,7 +7,7 @@ package com.afollestad.nocknock.utilities.ext
import android.content.Context import android.content.Context
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
inline fun <reified T> Context.systemService(name: String): T { inline fun <reified T> Context.systemService(name: String): T {
return getSystemService(name) as T return getSystemService(name) as T
} }

View file

@ -11,7 +11,7 @@ import org.mozilla.javascript.Context
import org.mozilla.javascript.EvaluatorException import org.mozilla.javascript.EvaluatorException
import org.mozilla.javascript.Function import org.mozilla.javascript.Function
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
object JavaScript { object JavaScript {
fun eval( fun eval(

View file

@ -11,13 +11,13 @@ import android.graphics.BitmapFactory.decodeResource
import androidx.annotation.DrawableRes import androidx.annotation.DrawableRes
import javax.inject.Inject import javax.inject.Inject
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
interface BitmapProvider { interface BitmapProvider {
fun get(@DrawableRes res: Int): Bitmap fun get(@DrawableRes res: Int): Bitmap
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class RealBitmapProvider @Inject constructor( class RealBitmapProvider @Inject constructor(
private val app: Application private val app: Application
) : BitmapProvider { ) : BitmapProvider {

View file

@ -15,7 +15,7 @@ interface StringProvider {
fun get(@StringRes res: Int): String fun get(@StringRes res: Int): String
} }
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class RealStringProvider @Inject constructor( class RealStringProvider @Inject constructor(
private val app: Application private val app: Application
) : StringProvider { ) : StringProvider {

View file

@ -8,7 +8,7 @@ package com.afollestad.nocknock.utilities.qualifiers
import javax.inject.Qualifier import javax.inject.Qualifier
import kotlin.annotation.AnnotationRetention.RUNTIME import kotlin.annotation.AnnotationRetention.RUNTIME
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
@Qualifier @Qualifier
@Retention(RUNTIME) @Retention(RUNTIME)
annotation class AppIconRes annotation class AppIconRes

View file

@ -20,7 +20,7 @@ import kotlinx.android.synthetic.main.check_interval_layout.view.input
import kotlinx.android.synthetic.main.check_interval_layout.view.spinner import kotlinx.android.synthetic.main.check_interval_layout.view.spinner
import kotlin.math.ceil import kotlin.math.ceil
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class CheckIntervalLayout( class CheckIntervalLayout(
context: Context, context: Context,
attrs: AttributeSet? = null attrs: AttributeSet? = null

View file

@ -16,7 +16,7 @@ import com.afollestad.nocknock.viewcomponents.ext.trimmedText
import kotlinx.android.synthetic.main.javascript_input_layout.view.error_text import kotlinx.android.synthetic.main.javascript_input_layout.view.error_text
import kotlinx.android.synthetic.main.javascript_input_layout.view.userInput import kotlinx.android.synthetic.main.javascript_input_layout.view.userInput
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class JavaScriptInputLayout( class JavaScriptInputLayout(
context: Context, context: Context,
attrs: AttributeSet? = null attrs: AttributeSet? = null

View file

@ -14,7 +14,7 @@ import com.afollestad.nocknock.data.ServerStatus.ERROR
import com.afollestad.nocknock.data.ServerStatus.OK import com.afollestad.nocknock.data.ServerStatus.OK
import com.afollestad.nocknock.data.ServerStatus.WAITING import com.afollestad.nocknock.data.ServerStatus.WAITING
/** @author Aidan Follestad (afollestad) */ /** @author Aidan Follestad (@afollestad) */
class StatusImageView( class StatusImageView(
context: Context, context: Context,
attrs: AttributeSet? = null attrs: AttributeSet? = null