Skip to content

Instantly share code, notes, and snippets.

AmandaRiu AmandaRiu

Block or report user

Report or block AmandaRiu

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AmandaRiu
AmandaRiu / logcatapp.sh
Created Oct 11, 2018 — forked from kevinxucs/logcatapp.sh
Filter logcat by app package name
View logcatapp.sh
#!/bin/bash
usage() {
echo "Usage: $(basename $0) [package] ..."
}
app_package=$1
shift
if [ -z $app_package ]; then
View view_single_option_toggle.xml
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true">
<TextView
android:id="@+id/switchSetting_title"
@AmandaRiu
AmandaRiu / pr.md
Created Jul 23, 2018 — forked from piscisaureus/pr.md
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@AmandaRiu
AmandaRiu / kotlin_tricks.md
Last active May 5, 2018
Random kotlin tricks
View kotlin_tricks.md

Change generated getter/setter methods

Kotlin does something strange with boolean types. If you have a boolean called isCanceled, the setter will be setCanceled(boolean) and the getter will be isCanceled(). Override this naming convention:

var isCanceled = false
  @JvmName("setIsCanceled")
  get

Assign method to variable and pass as argument

@AmandaRiu
AmandaRiu / BottomNav_disableShift.kt
Created Apr 21, 2018
Disable android 'BottomNavigationView' shift mode
View BottomNav_disableShift.kt
// Extension function
@SuppressLint("RestrictedApi")
fun BottomNavigationView.disableShiftMode() {
val menuView = getChildAt(0) as BottomNavigationMenuView
try {
val shiftingMode = menuView::class.java.getDeclaredField("mShiftingMode")
shiftingMode.isAccessible = true
shiftingMode.setBoolean(menuView, false)
shiftingMode.isAccessible = false
for (i in 0 until menuView.childCount) {
View homebrew_commands.md

Global commands

Command Description
brew update Update brew and cask
brew list List installed packages
brew outdated List packages that need updating

Package Commands

Command Description
@AmandaRiu
AmandaRiu / android_utility_code_snippets
Created Oct 4, 2017
Android Utility Code Snippets
View android_utility_code_snippets
/**
* Toggles the status of a component to enabled or disabled. Specifically used for enabling
* and disabling broadcast receivers. So in the case of a broadcast receiver listening for
* connectivity change...you may not want this always running, rather to toggle it on or off
* as needed.
*
* @param context Application-specific context
* @param componentClass The class to enable or disable
* @param enable Action to be taken on the class
*/
@AmandaRiu
AmandaRiu / fav_android_tools
Created Dec 20, 2016
List of all the Android gems I've found to date
View fav_android_tools
# ImageView with support for gesture and double-click zooming and panning. Also supports rotations.
https://github.com/chrisbanes/PhotoView
You can’t perform that action at this time.