Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View luongvo's full-sized avatar
🚀
flying in the sky

Luong Vo (Lucas) luongvo

🚀
flying in the sky
View GitHub Profile
@luongvo
luongvo / adb+
Created June 8, 2016 03:21 — forked from christopherperry/adb+
A bash script that let's you issue adb commands to multiple devices at once
#!/bin/bash
# Script adb+
# Usage
# You can run any command adb provides on all your currently connected devices
# ./adb+ <command> is the equivalent of ./adb -s <serial number> <command>
#
# Examples
# ./adb+ version
# ./adb+ install apidemo.apk
# ./adb+ uninstall com.example.android.apis
@luongvo
luongvo / ADB+.BAT
Created June 8, 2016 03:22 — forked from thebagchi/ADB+.BAT
script for issuing commands to multiple android devices on windows
:: Inspired by Linux version of the same https://gist.github.com/christopherperry/3208109
@echo off
SET ARGUMENTS=%~1
if "%ARGUMENTS%" == "" (
GOTO EOF
)
SET "ARGUMENTS=%ARGUMENTS:""="%"
@luongvo
luongvo / node-folder-structure-options.md
Created August 12, 2016 04:41 — forked from lancejpollard/node-folder-structure-options.md
What is your folder-structure preference for a large-scale Node.js project?

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
@luongvo
luongvo / Connectivity.java
Created March 17, 2017 04:20 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
@luongvo
luongvo / PausableChronometer.java
Created March 17, 2017 04:30
A pausable Chronometer implementation. This implementation adds an additional timestamp that tracks the timespan for the pause and compensate for that.
/*
* Copyright (C) 2015 The Android Open Source Project
*
* 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
@luongvo
luongvo / ConnectivityUtils.java
Created March 17, 2017 04:53
Get mobile network info
import android.content.Context;
import android.telephony.TelephonyManager;
/**
* @author luongvo.
*/
public class ConnectivityUtils {
public static String getMobileNetworkType(Context context) {
@luongvo
luongvo / GridSpacingItemDecoration.md
Created April 18, 2017 04:25 — forked from cxyxlxdm/GridSpacingItemDecoration.md
Add column spacing in RecyclerView with GridLayoutManager

Android Recyclerview GridLayoutManager column spacing Here is the question, the first answer does not work well in my project,and it makes the spacing bigger between item and item. the second answer is quite perfect.But if RecyclerView has headers,it does not work well. Then I fixed it.

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
@luongvo
luongvo / build.gradle
Created April 27, 2017 02:23 — forked from alexsinger/build.gradle
Separate Crashlytics reporting for debug and release buildTypes using a Gradle build
// The following code allows an app to report Crashlytics crashes separately
// for release and debug buildTypes when using Gradle. This code should be inserted
// into the specified locations within your build.gradle (Module:app) file
// The buildTypes { } block should be inserted inside the android { } block
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
ext.crashlyticsApiSecret = "release api secret"
@luongvo
luongvo / HideSoftkeyboardOnTap
Created May 21, 2017 18:26 — forked from elqsar/HideSoftkeyboardOnTap
Hide softkeyboard in android application if user tap outside EditText control
protected void setupParent(View view) {
//Set up touch listener for non-text box views to hide keyboard.
if(!(view instanceof EditText)) {
view.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
hideSoftKeyboard();
return false;
}
});
}
@luongvo
luongvo / FontAwareTabLayout.java
Created June 12, 2017 21:01 — forked from LuigiPapino/FontAwareTabLayout.java
Android - Calligraphy and TabLayout
/**
* Simple helper class which extends a TabLayout to allow us to customize the font of the tab.
* https://gist.github.com/tmtrademarked/09926077a406959be15fc8a824a52751
* https://github.com/chrisjenx/Calligraphy/issues/180
*/
public final class FontAwareTabLayout extends TabLayout {
private String fontPath;
public FontAwareTabLayout(Context context, AttributeSet attrs) {