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
object Logger { | |
@JvmStatic | |
inline fun log(crossinline configure: Log.() -> Unit) { | |
if (isWritersAvailable) { | |
Log().let { | |
configure(it) | |
write(it) | |
} | |
} |
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
inline fun info(crossinline message: () -> String?) { | |
level { Level.INFO } | |
this.message = message.invoke() | |
} |
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
inline fun tag(crossinline tag: () -> String) { | |
this.tag = tag.invoke() | |
} | |
inline fun throwable(crossinline throwable: () -> Throwable) { | |
this.throwable = throwable.invoke() | |
} | |
inline fun level(crossinline level: () -> Level) { | |
this.level = level.invoke() |
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
class Log { | |
var level: Level = Level.DEBUG | |
var tag: String? = null | |
var throwable: Throwable? = null | |
var message: String? = null | |
} |
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
listOf(42).foreach { inc() } |
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
fun <T> Iterable<T>.foreach(action: T.() -> Unit) { | |
for (element in this) element.action() | |
} |
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
fun <T> Iterable<T>.foreach(action: (T) -> Unit) { | |
for (element in this) action(element) | |
} |
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
@Override | |
public void onAccessibilityEvent(AccessibilityEvent event) { | |
final String messageViewId = "android:id/message"; | |
final String buttonViewId = "android:id/button1"; | |
// get root layout node of dialog | |
AccessibilityNodeInfo rootNode = event.getSource(); | |
// find textview with message & button nodes | |
List<AccessibilityNodeInfo> ussdResponseTextViewNodesList = |
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
<?xml version="1.0" encoding="utf-8"?> | |
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" | |
android:description="@string/accessibility_service_description" | |
android:packageNames="com.android.phone" | |
android:accessibilityEventTypes="typeWindowStateChanged" | |
android:accessibilityFeedbackType="feedbackGeneric" | |
android:canRetrieveWindowContent="true" | |
/> |
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
-keep class dmax.dialog.** { | |
*; | |
} |