Skip to content

Instantly share code, notes, and snippets.

View hendrawd's full-sized avatar
☺️
Happy

Hendra Wijaya Djiono hendrawd

☺️
Happy
View GitHub Profile
@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
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
@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;
@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> {
@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:

@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.
*
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 6, 2024 07:22
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

/*
* 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
@skyfishjy
skyfishjy / CursorRecyclerViewAdapter.java
Last active December 16, 2023 08:55
CursorRecyclerViewAdapter
/*
* Copyright (C) 2014 skyfish.jy@gmail.com
*
* 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