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 / 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
@hendrawd
hendrawd / DeviceInformation.java
Last active June 28, 2023 04:22
Helper class for getting Device Information
package your.app.util;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
@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 / 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 / IoUtils.java
Created August 24, 2017 08:21
Read files with Okio
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import okhttp3.internal.io.FileSystem;
import okio.BufferedSource;
import okio.Okio;
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 / OkHttp3Stack.java
Last active October 15, 2019 22:56
latest volley singleton
import com.android.volley.Request;
import com.android.volley.error.AuthFailureError;
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;
class MyFragment private constructor() : 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
@hendrawd
hendrawd / StringPermutation.kt
Created May 10, 2019 14:54
Permutasi String dengan Metode Rekursif Menggunakan Bahasa Pemrograman Kotlin
import java.util.*
fun main(args: Array<String>) {
println("Masukkan Kata/String")
// Mendapatkan kata dari
val word = Scanner(System.`in`).next()
// Membuat list kosong
val indices = mutableListOf<Int>()
@hendrawd
hendrawd / ByteUrlGenerator.java
Created August 15, 2018 13:07
An helper method for creating byte url from a string url, then we can copy the result from the console to the actual code
/**
* An helper method for creating byte url from a string url,
* then we can copy the result from the console to the actual code.
* This is useful for fighting against reverse engineering in java/android apps.
* Can be combined with other methods to make your apps more secure.
* Just keep in mind that there is no ways to win against a determined hacker,
* so do all of critical processes in server
*/
public final class ByteUrlGenerator {