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 / TimeUtil.class
Created November 12, 2015 05:50
A Java class with a method that can return relative time span string with Indonesian language(bahasa)
package com;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import java.util.TimeZone;
import java.util.concurrent.TimeUnit;
/**
* Created by hendrawd on 11/12/15.
@hendrawd
hendrawd / CheckableImageView.java
Last active September 3, 2022 07:33
An image view that checkable
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Checkable;
import android.widget.ImageView;
/**
* @author hendrawd on 6/23/16
*/
public class CheckableImageView extends ImageView implements Checkable {
@hendrawd
hendrawd / DuAdHelper.java
Last active June 24, 2016 06:41
An helper class to load interstitial and overwall DU AD
import android.app.Activity;
import android.content.Intent;
import android.util.Log;
import com.duapps.ad.AbsInterstitialListener;
import com.duapps.ad.InterstitialAd;
import com.duapps.ad.offerwall.ui.OfferWallAct;
/**
* @author hendrawd on 6/24/16
@hendrawd
hendrawd / OkHttp3Stack.java
Last active December 5, 2016 18:47
An OkHttp3Stack for Volley library to boost the performance of Volley itself
import com.android.volley.AuthFailureError;
import com.android.volley.Request;
import com.android.volley.toolbox.HttpStack;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.StatusLine;
import org.apache.http.entity.BasicHttpEntity;
import org.apache.http.message.BasicHeader;
@hendrawd
hendrawd / ProxiedHurlStack.java
Last active October 3, 2023 09:52
Use proxy with Volley
import com.android.volley.toolbox.HurlStack;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
/**
* @author hendrawd on 6/29/16
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
@hendrawd
hendrawd / NecrobotMultipleRunner.bat
Last active August 3, 2016 06:36
A runner script to run multiple Necrobot.exe files
@echo off
FOR /D %%s IN (.\*) DO (cd %%s & start Necrobot.exe & cd ..)
exit
@hendrawd
hendrawd / Base64Image
Last active May 30, 2022 14:16
Helper class to easily encode and decode image with base64
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Environment;
import android.util.Base64;
import java.io.ByteArrayOutputStream;
/**
* Helper class to easily encode and decode image with base64
*
@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:

@hendrawd
hendrawd / MainActivity.java
Last active December 29, 2017 04:16 — forked from hbcafe/gist:e6d53488acfdf6ae0fdf81caea0d2dfe
Simpler implementation for connecting native Android app to Watson Text to Speech in under 10 minutes (TTS interface)
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.ibm.watson.developer_cloud.android.library.audio.StreamPlayer;
import com.ibm.watson.developer_cloud.text_to_speech.v1.TextToSpeech;