mirror of
https://github.com/afollestad/nock-nock.git
synced 2025-04-20 03:25:14 +00:00
Docs cleanup
This commit is contained in:
parent
225434b41a
commit
cf802dfa2f
37 changed files with 47 additions and 47 deletions
|
@ -12,7 +12,7 @@ import android.os.Bundle
|
|||
|
||||
typealias ActivityLifeChange = (activity: Activity, resumed: Boolean) -> Unit
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
fun Application.onActivityLifeChange(cb: ActivityLifeChange) {
|
||||
registerActivityLifecycleCallbacks(object : ActivityLifecycleCallbacks {
|
||||
override fun onActivitySaveInstanceState(
|
||||
|
|
|
@ -20,7 +20,7 @@ import com.afollestad.nocknock.utilities.ext.systemService
|
|||
import okhttp3.OkHttpClient
|
||||
import javax.inject.Inject
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class NockNockApp : Application(), Injector {
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -21,7 +21,7 @@ import kotlinx.android.synthetic.main.list_item_server.view.textUrl
|
|||
|
||||
typealias Listener = (model: ServerModel, longClick: Boolean) -> Unit
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class ServerVH constructor(
|
||||
itemView: View,
|
||||
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>() {
|
||||
|
||||
private val models = mutableListOf<ServerModel>()
|
||||
|
|
|
@ -22,7 +22,7 @@ import dagger.Component
|
|||
import okhttp3.OkHttpClient
|
||||
import javax.inject.Singleton
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
@Singleton
|
||||
@Component(
|
||||
modules = [
|
||||
|
|
|
@ -13,7 +13,7 @@ import dagger.Binds
|
|||
import dagger.Module
|
||||
import javax.inject.Singleton
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
@Module
|
||||
abstract class MainBindModule {
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ import dagger.Module
|
|||
import dagger.Provides
|
||||
import javax.inject.Singleton
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
@Module
|
||||
open class MainModule {
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import androidx.fragment.app.DialogFragment
|
|||
import com.afollestad.materialdialogs.MaterialDialog
|
||||
import com.afollestad.nocknock.R
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class AboutDialog : DialogFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[ABOUT_DIALOG]"
|
||||
|
|
|
@ -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_SIZE = "fab_size"
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
fun MainActivity.intentToAdd(
|
||||
x: Float,
|
||||
y: Float,
|
||||
|
@ -64,7 +64,7 @@ fun MainActivity.intentToAdd(
|
|||
addFlags(FLAG_ACTIVITY_NO_ANIMATION)
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class AddSiteActivity : AppCompatActivity(), AddSiteView {
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -21,7 +21,7 @@ import kotlinx.coroutines.launch
|
|||
import okhttp3.HttpUrl
|
||||
import javax.inject.Inject
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
data class InputErrors(
|
||||
var name: Int? = null,
|
||||
var url: Int? = null,
|
||||
|
@ -35,7 +35,7 @@ data class InputErrors(
|
|||
}
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
interface AddSitePresenter {
|
||||
|
||||
fun takeView(view: AddSiteView)
|
||||
|
@ -58,7 +58,7 @@ interface AddSitePresenter {
|
|||
fun dropView()
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class RealAddSitePresenter @Inject constructor(
|
||||
private val serverModelStore: ServerModelStore,
|
||||
private val checkStatusManager: CheckStatusManager
|
||||
|
|
|
@ -9,7 +9,7 @@ import androidx.annotation.StringRes
|
|||
import com.afollestad.nocknock.utilities.ext.ScopeReceiver
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
interface AddSiteView {
|
||||
|
||||
fun setLoading()
|
||||
|
|
|
@ -41,7 +41,7 @@ import kotlinx.android.synthetic.main.include_empty_view.emptyText
|
|||
import javax.inject.Inject
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class MainActivity : AppCompatActivity(), MainView {
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -18,7 +18,7 @@ import kotlinx.coroutines.async
|
|||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
interface MainPresenter {
|
||||
|
||||
fun takeView(view: MainView)
|
||||
|
@ -34,7 +34,7 @@ interface MainPresenter {
|
|||
fun dropView()
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class RealMainPresenter @Inject constructor(
|
||||
private val serverModelStore: ServerModelStore,
|
||||
private val notificationManager: NockNotificationManager,
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.afollestad.nocknock.data.ServerModel
|
|||
import com.afollestad.nocknock.utilities.ext.ScopeReceiver
|
||||
import kotlin.coroutines.CoroutineContext
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
interface MainView {
|
||||
|
||||
fun setModels(models: List<ServerModel>)
|
||||
|
|
|
@ -80,13 +80,13 @@ import javax.inject.Inject
|
|||
|
||||
private const val KEY_VIEW_MODEL = "site_model"
|
||||
|
||||
/** @author Aidan Follestad (afViewSiteActivityollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
fun MainActivity.intentToView(model: ServerModel) =
|
||||
Intent(this, ViewSiteActivity::class.java).apply {
|
||||
putExtra(KEY_VIEW_MODEL, model)
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class ViewSiteActivity : AppCompatActivity(),
|
||||
View.OnClickListener,
|
||||
Toolbar.OnMenuItemClickListener {
|
||||
|
|
|
@ -16,7 +16,7 @@ import kotlin.math.max
|
|||
const val CHECK_INTERVAL_UNSET = -1L
|
||||
const val LAST_CHECK_NONE = -1L
|
||||
|
||||
/** @author Aidan Follestad (afollestad)*/
|
||||
/** @author Aidan Follestad (@afollestad)*/
|
||||
data class ServerModel(
|
||||
var id: Int = 0,
|
||||
val name: String,
|
||||
|
|
|
@ -9,7 +9,7 @@ import com.afollestad.nocknock.data.ServerStatus.CHECKING
|
|||
import com.afollestad.nocknock.data.ServerStatus.OK
|
||||
import com.afollestad.nocknock.data.ServerStatus.WAITING
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
enum class ServerStatus(val value: Int) {
|
||||
OK(1),
|
||||
WAITING(2),
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
package com.afollestad.nocknock.data
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
enum class ValidationMode(val value: Int) {
|
||||
STATUS_CODE(1),
|
||||
TERM_SEARCH(2),
|
||||
|
|
|
@ -13,7 +13,7 @@ import dagger.Binds
|
|||
import dagger.Module
|
||||
import javax.inject.Singleton
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
@Module
|
||||
abstract class EngineModule {
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ private const val SQL_CREATE_ENTRIES =
|
|||
|
||||
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(
|
||||
context, DATABASE_NAME, null, DATABASE_VERSION
|
||||
) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.afollestad.nocknock.data.ServerModel.Companion.TABLE_NAME
|
|||
import com.afollestad.nocknock.utilities.ext.diffFrom
|
||||
import javax.inject.Inject
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
interface ServerModelStore {
|
||||
|
||||
suspend fun get(id: Int? = null): List<ServerModel>
|
||||
|
@ -30,7 +30,7 @@ interface ServerModelStore {
|
|||
suspend fun deleteAll(): Int
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class RealServerModelStore @Inject constructor(
|
||||
app: Application
|
||||
) : ServerModelStore {
|
||||
|
|
|
@ -19,7 +19,7 @@ import kotlinx.coroutines.async
|
|||
import kotlinx.coroutines.launch
|
||||
import javax.inject.Inject
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class BootReceiver : BroadcastReceiver() {
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -33,7 +33,7 @@ import kotlinx.coroutines.withContext
|
|||
import java.lang.System.currentTimeMillis
|
||||
import javax.inject.Inject
|
||||
|
||||
/** @author Aidan Follestad (afollestad)*/
|
||||
/** @author Aidan Follestad (@afollestad)*/
|
||||
class CheckStatusJob : JobService() {
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -25,13 +25,13 @@ import okhttp3.Response
|
|||
import java.net.SocketTimeoutException
|
||||
import javax.inject.Inject
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
data class CheckResult(
|
||||
val model: ServerModel,
|
||||
val response: Response? = null
|
||||
)
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
interface CheckStatusManager {
|
||||
|
||||
suspend fun ensureScheduledChecks()
|
||||
|
|
|
@ -11,7 +11,7 @@ import android.os.Build.VERSION_CODES
|
|||
import androidx.annotation.RequiresApi
|
||||
import androidx.core.app.NotificationManagerCompat.IMPORTANCE_DEFAULT
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
enum class Channel(
|
||||
val id: String,
|
||||
val title: Int,
|
||||
|
@ -26,7 +26,7 @@ enum class Channel(
|
|||
)
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
@RequiresApi(VERSION_CODES.O)
|
||||
fun Channel.toNotificationChannel(context: Context): NotificationChannel {
|
||||
val titleText = context.getString(this.title)
|
||||
|
|
|
@ -37,7 +37,7 @@ interface NockNotificationManager {
|
|||
fun cancelStatusNotifications()
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class RealNockNotificationManager @Inject constructor(
|
||||
private val app: Application,
|
||||
@AppIconRes private val appIconRes: Int,
|
||||
|
|
|
@ -12,7 +12,7 @@ import androidx.core.app.NotificationCompat
|
|||
typealias NotificationBuilder = NotificationCompat.Builder
|
||||
typealias NotificationConstructor = NotificationBuilder.() -> Unit
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
fun notification(
|
||||
context: Context,
|
||||
channel: Channel,
|
||||
|
|
|
@ -9,7 +9,7 @@ import dagger.Binds
|
|||
import dagger.Module
|
||||
import javax.inject.Singleton
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
@Module
|
||||
abstract class NotificationsModule {
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
*/
|
||||
package com.afollestad.nocknock.utilities
|
||||
|
||||
/** @author Aidan Follestad (afollestad)*/
|
||||
/** @author Aidan Follestad (@afollestad)*/
|
||||
interface Injector {
|
||||
|
||||
fun injectInto(target: Any)
|
||||
|
|
|
@ -13,7 +13,7 @@ import dagger.Binds
|
|||
import dagger.Module
|
||||
import javax.inject.Singleton
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
@Module
|
||||
abstract class UtilitiesModule {
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ package com.afollestad.nocknock.utilities.ext
|
|||
|
||||
import android.content.Context
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
inline fun <reified T> Context.systemService(name: String): T {
|
||||
return getSystemService(name) as T
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.mozilla.javascript.Context
|
|||
import org.mozilla.javascript.EvaluatorException
|
||||
import org.mozilla.javascript.Function
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
object JavaScript {
|
||||
|
||||
fun eval(
|
||||
|
|
|
@ -11,13 +11,13 @@ import android.graphics.BitmapFactory.decodeResource
|
|||
import androidx.annotation.DrawableRes
|
||||
import javax.inject.Inject
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
interface BitmapProvider {
|
||||
|
||||
fun get(@DrawableRes res: Int): Bitmap
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class RealBitmapProvider @Inject constructor(
|
||||
private val app: Application
|
||||
) : BitmapProvider {
|
||||
|
|
|
@ -15,7 +15,7 @@ interface StringProvider {
|
|||
fun get(@StringRes res: Int): String
|
||||
}
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class RealStringProvider @Inject constructor(
|
||||
private val app: Application
|
||||
) : StringProvider {
|
||||
|
|
|
@ -8,7 +8,7 @@ package com.afollestad.nocknock.utilities.qualifiers
|
|||
import javax.inject.Qualifier
|
||||
import kotlin.annotation.AnnotationRetention.RUNTIME
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
@Qualifier
|
||||
@Retention(RUNTIME)
|
||||
annotation class AppIconRes
|
||||
|
|
|
@ -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 kotlin.math.ceil
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class CheckIntervalLayout(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
|
|
|
@ -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.userInput
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class JavaScriptInputLayout(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
|
|
|
@ -14,7 +14,7 @@ import com.afollestad.nocknock.data.ServerStatus.ERROR
|
|||
import com.afollestad.nocknock.data.ServerStatus.OK
|
||||
import com.afollestad.nocknock.data.ServerStatus.WAITING
|
||||
|
||||
/** @author Aidan Follestad (afollestad) */
|
||||
/** @author Aidan Follestad (@afollestad) */
|
||||
class StatusImageView(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null
|
||||
|
|
Loading…
Add table
Reference in a new issue