mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
refactor(build): simplify lint, spotless, and detekt configurations (#3133)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
df90256959
commit
e4bfce0989
5 changed files with 11 additions and 15 deletions
|
|
@ -21,20 +21,16 @@ import android.widget.EditText
|
|||
import com.geeksville.mesh.ConfigProtos
|
||||
|
||||
/**
|
||||
* When printing strings to logs sometimes we want to print useful debugging information about users
|
||||
* or positions. But we don't want to leak things like usernames or locations. So this function
|
||||
* if given a string, will return a string which is a maximum of three characters long, taken from the tail
|
||||
* of the string. Which should effectively hide real usernames and locations,
|
||||
* but still let us see if values were zero, empty or different.
|
||||
* When printing strings to logs sometimes we want to print useful debugging information about users or positions. But
|
||||
* we don't want to leak things like usernames or locations. So this function if given a string, will return a string
|
||||
* which is a maximum of three characters long, taken from the tail of the string. Which should effectively hide real
|
||||
* usernames and locations, but still let us see if values were zero, empty or different.
|
||||
*/
|
||||
val Any?.anonymize: String
|
||||
get() = this.anonymize()
|
||||
|
||||
/**
|
||||
* A version of anonymize that allows passing in a custom minimum length
|
||||
*/
|
||||
fun Any?.anonymize(maxLen: Int = 3) =
|
||||
if (this != null) ("..." + this.toString().takeLast(maxLen)) else "null"
|
||||
/** A version of anonymize that allows passing in a custom minimum length */
|
||||
fun Any?.anonymize(maxLen: Int = 3) = if (this != null) ("..." + this.toString().takeLast(maxLen)) else "null"
|
||||
|
||||
// A toString that makes sure all newlines are removed (for nice logging).
|
||||
fun Any.toOneLineString() = this.toString().replace('\n', ' ')
|
||||
|
|
@ -66,7 +62,6 @@ fun formatAgo(lastSeenUnix: Int, currentTimeMillis: Long = System.currentTimeMil
|
|||
// Allows usage like email.onEditorAction(EditorInfo.IME_ACTION_NEXT, { confirm() })
|
||||
fun EditText.onEditorAction(actionId: Int, func: () -> Unit) {
|
||||
setOnEditorActionListener { _, receivedActionId, _ ->
|
||||
|
||||
if (actionId == receivedActionId) {
|
||||
func()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue