A theme engine for Android.
Themes are immutable, possibilities are beautiful.
fun Resources.getValue(id: Int, resolveRefs: Boolean = true) = TypedValue().also {
try {
(if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Resources::class.java.getDeclaredField("mResourcesImpl").apply {
isAccessible = true
}.get(this)
} else this)?.run obj@{
this::class.java.getDeclaredMethod("getValue",
Int::class.java, TypedValue::class.java, Boolean::class.java).apply {
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
/* | |
* Copyright 2013 Chris Banes | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
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"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
package="com.jaredrummler.usagestatsperm"> | |
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" | |
tools:ignore="ProtectedPermissions"/> | |
<application | |
android:allowBackup="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
import android.annotation.SuppressLint | |
import android.content.Context | |
import android.content.SharedPreferences | |
import android.preference.PreferenceManager | |
class Prefs( | |
private val preferences: SharedPreferences, | |
private val encryptor: StringEncryptor? = null, | |
private val obfuscator: Obfuscator? = 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
<manifest package="com.jaredrummler.android.common" | |
xmlns:android="http://schemas.android.com/apk/res/android"> | |
<application> | |
<provider | |
android:name="com.jaredrummler.android.files.FileProvider" | |
android:authorities="${applicationId}.fileprovider" | |
android:exported="false" | |
android:grantUriPermissions="true"> | |
<meta-data |
Method to set all @Inject
fields in a class to mocks:
fun mockInjectables(obj: Any) {
obj::class.java.declaredFields.forEach { field ->
field.getAnnotation(Inject::class.java)?.apply {
if (field.type.isAssignableFrom(dagger.Lazy::class.java)) {
if (!field.isAccessible) field.isAccessible = true
val type = field.genericType as ParameterizedType
Root Browser File Manager allows users to copy, move, delete and modify files on internal, external, root and cloud storages. To accomplish this Root Browser requires various permssions as explained below:
The Internal Storage on an Android device is often referred to as the SD card. This is not a removable storage.
Root Browser needs the user to grant the WRITE_EXTERNAL_STORAGE permission to work properly. The permission is requested when the app is first launched on Android 6.0+. For previous versions of Android, the permission is granted when the app is downloaded from the Google Play Store.
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
#!/bin/bash | |
################################################################################ | |
# | |
# boot2gif.sh | |
# | |
# DESCRIPTION: Convert an Android boot animation to a GIF | |
# You will need ImageMagick to run this script. | |
# | |
# USAGE: | |
# |
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 main(args: Array<String>) { | |
for (i in 1..100) { | |
println(if (i % 15 == 0) "FizzBuzz" else if (i % 3 == 0) "Fizz" else if (i % 5 == 0) "Buzz" else i) | |
} | |
} |