Skip to content

Instantly share code, notes, and snippets.

View hendrawd's full-sized avatar
☺️
Happy

Hendra Wijaya Djiono hendrawd

☺️
Happy
View GitHub Profile
@hendrawd
hendrawd / android_studio_shortcuts.md
Created November 22, 2016 09:54 — forked from stkent/android_studio_shortcuts.md
Android Studio Shortcuts (Mac)

Android Studio Shortcuts (Mac)

Notes:

  • Two of the most useful shortcuts utilize the Fn (function) keys. It is therefore recommended that you enable the "Use all F1, F2, etc. keys as standard function keys" option [System Preferences > Keyboard].
  • Be sure to enable the Mac OS X 10.5+ keymap in Android Studio [Preferences > Keymap].
  • A fairly complete shortcut list can be found here.

Useful symbols:

@isfaaghyth
isfaaghyth / ListAdapter.java
Last active June 7, 2017 04:13
Generic Class for Recyclerview Adapter
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
public abstract class ListAdapter<T, VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> {
@runemart
runemart / WrappingGridView.java
Created March 26, 2014 11:57
A GridView that uses the necessary height to wrap all of it's children, instead of scrolling
// http://www.jayway.com/2012/10/04/how-to-make-the-height-of-a-gridview-wrap-its-content/
public class WrappingGridView extends GridView {
public WrappingGridView(Context context) {
super(context);
}
public WrappingGridView(Context context, AttributeSet attrs) {
super(context, attrs);
@ultraon
ultraon / IoUtils.java
Created May 25, 2017 21:37
Utils for I/O operations
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import okhttp3.internal.io.FileSystem;
import okio.BufferedSource;
import okio.Okio;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
class MyFragment: Fragment(){
companion object{
private val ARG_CAUGHT = "myFragment_caught"
fun newInstance(caught: Pokemon):MyFragment{
val args: Bundle = Bundle()
args.putSerializable(ARG_CAUGHT, caught)
val fragment = MyFragment()
fragment.arguments = args
return fragment
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 - Nathan Barraille
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@chrislacy
chrislacy / action3_as_system_app.md
Last active April 24, 2021 16:34
Installing Action Launcher 3 as a system app via ADB

DISCLAIMER: Follow these instructions entirely at your own risk. I, nor my company (Digital Ashes PTY LTD) take any responsibility whatsoever for any damage done to any device/property that occurs as a result of following these instructions.

The following steps describe how to install Action Launcher 3 on a rooted device as a system app, so that you will be able to enable Action Launcher 3's Google Now integration.

Prerequisites

  1. A rooted device (Google if you need help here).
  2. A computer with [ADB][0] installed, and a working knowledge of ADB.
  3. A copy of an Action Launcher 3 APK on your computer. [APKMirror.com][1] is a good place to grab a copy from. All you're doing here is setting Action 3 as a system app, so any version of the app will work. From there, the Action 3 will update via the Play Store like a typical pre-installed app (such as Gmail or YouTube).
@gtomek
gtomek / IoUtilsWithOkIo.java
Created February 10, 2016 10:55
Read files with Okio
/**
* Utils for I/O operations.
* <p/>
* Created by Tomek on 09/06/15.
*/
public class IoUtils {
/**
* Reads file and returns a String.
*
@Antarix
Antarix / LocalBroadcastExampleActivity.java
Created December 26, 2013 08:31
Simple Example of using LocalBroadcastManager in Android
import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
@mirmilad
mirmilad / debounce.kt
Last active June 21, 2023 22:46
Simple debounce extension for LiveData by using Coroutines
import androidx.lifecycle.LiveData
import androidx.lifecycle.MediatorLiveData
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
fun <T> LiveData<T>.debounce(duration: Long = 1000L, coroutineScope: CoroutineScope) = MediatorLiveData<T>().also { mld ->
val source = this