
Prevent the search TextView from being able to scroll the toolbar when there are no results.
35 lines
905 B
Kotlin
35 lines
905 B
Kotlin
package org.oxycblt.auxio
|
|
|
|
import android.util.Log
|
|
|
|
// Shortcut functions for logging.
|
|
// Yes, I know timber exists but this does what I need.
|
|
|
|
/**
|
|
* Shortcut method for logging a non-string [obj] to debug. Should only be used for debug preferably.
|
|
*/
|
|
fun Any.logD(obj: Any) {
|
|
logD(obj.toString())
|
|
}
|
|
|
|
/**
|
|
* Shortcut method for logging [msg] to the debug console., handles debug builds and anonymous objects
|
|
*/
|
|
fun Any.logD(msg: String) {
|
|
if (BuildConfig.DEBUG) {
|
|
Log.d(getName(), msg)
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Shortcut method for logging [msg] as an error to the console. Handles anonymous objects
|
|
*/
|
|
fun Any.logE(msg: String) {
|
|
Log.e(getName(), msg)
|
|
}
|
|
|
|
/**
|
|
* Get a non-nullable name, used so that logs will always show up in the console.
|
|
* @return The name of the object, otherwise "Anonymous Object"
|
|
*/
|
|
private fun Any.getName(): String = this::class.simpleName ?: "Anonymous Object"
|