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
alias c="clear" # Clears your terminal window of all output | |
alias d="adb devices" # Lists all connected Android devices and emulators | |
alias gs="git status" # Displays status of your working tree in a repository | |
alias gb="git branch" # Displays local branches | |
alias gas="git add *" # Adds all files to the git staging area | |
alias log="adb logcat" # Displays the android logcat | |
alias adbr="adb kill-server; adb start-server; d" # Restarts the adb server, adb can be quite finnicky and restarting helps to alleviate those problems. That last d character is a reference to the alias defined above, which points to “adb devices” |
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
button.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View view) { | |
doSomethingCool(); | |
} | |
}); |
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
button.setOnClickListener { doSomethingCool() } |
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
Picasso.with(context).load("http://i.imgur.com/W3C6LA1.png").into(imageView); | |
Glide.with(context).load("http://i.imgur.com/W3C6LA1.png").into(imageView); |
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" | |
package="com.orobator.konstellations"> | |
<application | |
android:name=".KonstellationsApplication" | |
android:allowBackup="true" | |
android:icon="@drawable/app_icon" | |
android:label="@string/app_name" | |
android:supportsRtl="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
<?xml version="1.0" encoding="utf-8"?> | |
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android"> | |
<shortcut | |
android:enabled="true" | |
android:icon="@drawable/random_constellation" | |
android:shortcutDisabledMessage="@string/shortcut_disabled_message" | |
android:shortcutId="random_constellation" | |
android:shortcutLongLabel="@string/shortcut_long_label" | |
android:shortcutShortLabel="@string/shortcut_short_label"> | |
<!-- Each one of these intents needs an android:action, even if you don't |
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
val shortcutManager = context.getSystemService(ShortcutManager::class.java) |
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 shortcutAction(action: (ShortcutManager) -> Unit): Unit { | |
if (SDK_INT >= N_MR1) { | |
val shortcutManager = APP_CONTEXT.getSystemService(ShortcutManager::class.java) | |
action(shortcutManager) | |
} | |
} |
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
/** | |
* Sets the new Shortcut List by providing the three most visited | |
* constellations | |
* */ | |
@TargetApi(N_MR1) | |
fun updateShortcuts(shortcutManager: ShortcutManager) { | |
shortcutManager.dynamicShortcuts = | |
Constellation | |
.values() | |
.sortedWith(compareBy { -getConstellationVisitedCount(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
@TargetApi(N_MR1) | |
override fun onOptionsItemSelected(item: MenuItem): Boolean { | |
when (item.itemId) { | |
R.id.enable_shortcut -> shortcutAction { | |
it.enableShortcuts(listOf(constellation.name)) | |
alertUser(R.string.shortcut_enabled) | |
} | |
R.id.disable_shortcut -> shortcutAction { | |
it.disableShortcuts(listOf(constellation.name)) | |
alertUser(R.string.shortcut_disabled) |
OlderNewer