This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ----------------- | |
// AppWidgetHostView | |
// ----------------- | |
class LauncherAppWidgetHostView(context: Context) : AppWidgetHostView(context) { | |
private var hasPerformedLongPress: Boolean = false | |
private var pointDown = PointF() | |
private val pendingCheckForLongPress = CheckForLongPress() | |
private val pendingCheckTouched = CheckTouched() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// show a crash notifcation - on notification click the user can send a feedback mail including the log file | |
L.showCrashNotification(context, logFile /* may be null */, "[email protected]", R.mipmap.ic_launcher, "NotificationChannelID", 1234 /* notification id */) | |
// show a notification to allow the user the report some interesting internal proplems | |
L.showCrashNotification(context, fileLoggingSetup, "[email protected]", R.mipmap.ic_launcher, "NotificationChannelID", 1234 /* notification id */) | |
// show an information notification to the user (or for dev purposes) | |
L.showInfoNotification(context, "NotificationChannelID", 1234 /* notification id */, "Notification Title", "Notification Text", R.mipmap.ic_launcher) | |
// as above, but on notification click it will open the log viewer showing the provided log file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if you provide a mail address, the viewer will add a "send mail" entry to its menu | |
L.showLog(context, fileLoggingSetup, "[email protected]" /* optional */) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// send the most recent log file via mail | |
L.sendFeedback(context, fileLoggingSetup, "[email protected]") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// e.g. completely disable logs in debug | |
L.enabled = BuildConfig.DEBUG | |
// e.g. disable all tags that are not starting with "IMPORTANT_" | |
L.tagNameFilter = { it.startsWith("IMPORTANT_") } | |
// e.g. disable logs from any non app package name | |
L.packageNameFilter = { it.startsWith("com.my.package.name") } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[MainActivity:2 onCreate]: This is my first log entry (MainActivity.kt:2) | |
[MainActivity:3 onCreate]: This is my second log entry - it will be logged because logIf evaluates to true (MainActivity.kt:3) | |
[MainActivity:5 onCreate]: Log line 3 will not slow down this code because the function inside the log will never be called because the logIf evaluates to false (MainActivity.kt:5) | |
[<TAG1> MainActivity:8 onCreate]: Log with tag (MainActivity.kt:8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// simple logs | |
L.d { "This is my first log entry" } | |
L.logIf { true }?.d { "This is my second log entry - it will be logged because logIf evaluates to true" } | |
L.logIf { false }?.d { "Slow log line without any impact at runtime - sleeping 5s: ${ Thread.sleep(5000) }"} | |
L.d { "Log line 3 will not slow down this code because the function inside the log will never be called because the logIf evaluates to false" } | |
// optionally tag a log line - tags are useful to group logs and can be disabled at runtime | |
L.tag("TAG1").d { "Log with tag" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1) plant the console logging tree | |
L.plant(ConsoleTree()) | |
// 2) plant a file logging tree | |
val setup = FileLoggingSetup.Setup(logsToKeep = 1, fileExtension = "txt") | |
val fileLoggingSetup = FileLoggingSetup.DateFiles(context, setup) | |
// alternatively use number file names instead of date based file names if desired | |
// val fileLoggingSetup = FileLoggingSetup.NumberedFiles(context, setup) | |
L.plant(FileLoggingTree(fileLoggingSetup)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
apply from: './versions.gradle' | |
buildscript { | |
repositories { | |
// ... | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:' + versions.gradlePlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.appindustry.everywherelauncher.mvi; | |
import android.app.Activity; | |
import android.app.Application; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.os.Parcelable; | |
import android.support.annotation.NonNull; | |
import android.util.Log; | |
import android.view.View; |
NewerOlder