Skip to content

Instantly share code, notes, and snippets.

View truongngoclinh's full-sized avatar
🎯
Focusing

Trương Ngọc Linh truongngoclinh

🎯
Focusing
  • Tokyo
View GitHub Profile
@truongngoclinh
truongngoclinh / PopupWindow.java
Last active September 7, 2016 07:27
Popup window was not shown
popup.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
popup.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
popup.showAsDropDown(view);
popup.update();
@truongngoclinh
truongngoclinh / NetworkUtils.java
Last active September 8, 2016 08:57
Fully check network condition in android
public class NetworkUtil {
private static Context sCtx;
public static void init(Context context) {
sCtx = context.getApplicationContext();
}
public static Result check() {
return new Result(getNetworkInfo(sCtx));
@truongngoclinh
truongngoclinh / MainActivity.java
Created September 20, 2016 16:37 — forked from pboos/MainActivity.java
Sample code for ViewPager + PagerTabStrip.
package ch.pboos.android.sample.viewpager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion versions.compileSdk
buildToolsVersion versions.buildTools
defaultConfig {
applicationId "samples.linhtruong.com.ui_reactive_rxjava_realm"
minSdkVersion versions.minSdk
@truongngoclinh
truongngoclinh / Activity.java
Last active November 7, 2022 06:53
Handle permission on Android 6.0 and above versions.
public class Activity extends AppCompatActivity {
private static final String TAG = "FVPermissionsActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (FVPermissionUtils.isPermissionGranted(this, FVPermissionUtils.Permissions.OVERLAY)) {
@truongngoclinh
truongngoclinh / gist:960322e51132b2c4265d30fd438488a1
Created November 22, 2016 05:24 — forked from ishikawa/gist:88599
Java Sample Code for Calculating HMAC-SHA1 Signatures
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.Formatter;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/**
@truongngoclinh
truongngoclinh / README.md
Created November 22, 2016 10:57 — forked from zenorocha/README.md
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

View view = yourrecyclerview.findViewHolderForAdapterPosition(position);
@truongngoclinh
truongngoclinh / GetUrlBitmap.java
Last active January 18, 2017 09:12
Get bitmap from url, scale down by set BitmapOptions.
private Bitmap getBitmapFromUrl(String src) {
if (!TextUtils.isEmpty(src)) {
try {
URL url = new URL(src);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream inputStream = connection.getInputStream();
BitmapFactory.Options options = new BitmapFactory.Options();
@truongngoclinh
truongngoclinh / learning.md
Created April 2, 2017 08:01 — forked from sibelius/learning.md
Learning Path React Native

Basics

  • Learn how to start a new react native project
  • Run it on ios simulator, on android emulator, on a real iPhone device and on a real Android device, with and without debugging enabled.
  • Learn how to upgrade a react native project
  • Learn how to add a package to the project
  • Learn how to add a package that has a native dependency (https://github.com/airbnb/react-native-maps, https://github.com/evollu/react-native-fcm) - DO NOT USE COCOAPODS
  • Learn how to use fetch to get data from your backend

Learn Navigation