Skip to content

Instantly share code, notes, and snippets.

View Ikhiloya's full-sized avatar

Ikhiloya Ikhiloya

View GitHub Profile
//Java
webview.getSettings().setJavaScriptEnabled(true);
webview.loadUrl("<your html file>"); //not in scope of this gist
webview.setWebViewClient(new WebViewClient(){
public void onPageFinished(WebView view, String url){
//Here you want to use .loadUrl again
//on the webview object and pass in
//"javascript:<your javaScript function"
webview.loadUrl("javascript:myJavaScriptFunc('" + argumentPassingIn + "')"); //if passing in an object. Mapping may need to take place
}
package test;
import android.arch.lifecycle.LiveData;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@Ikhiloya
Ikhiloya / EmptyRecyclerView.java
Created January 12, 2020 20:25 — forked from mobiRic/EmptyRecyclerView.java
RecyclerView doesn't have an emptyView support, we gotta fix that
/*
* Copyright (C) 2015 Glowworm Software
* Copyright (C) 2014 Nizamutdinov Adel
*
* 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
*
@Ikhiloya
Ikhiloya / EmptyRecyclerView.java
Created January 12, 2020 20:19 — forked from meoyawn/EmptyRecyclerView.java
RecyclerView doesn't have an emptyView support, we gotta fix that
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class EmptyRecyclerView extends RecyclerView {
@Nullable View emptyView;
@Ikhiloya
Ikhiloya / AESEnDecryption.java
Created September 16, 2019 18:06 — forked from FrankWu100/AESEnDecryption.java
AES Encryption/Decryption on Android's Java
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.spec.IvParameterSpec;
import java.security.MessageDigest;
import java.security.spec.AlgorithmParameterSpec;
import android.util.Base64;
public class AESEnDecryption {
@Ikhiloya
Ikhiloya / SearchViewStyle.java
Created June 17, 2019 16:28 — forked from jaredrummler/SearchViewStyle.java
Customize the SearchView in an ActionBar for Android
/*
* Copyright (C) 2015 Jared Rummler <jared.rummler@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
/**
* Created by Balram Pandey on 12/29/16.
*/
public class EncryptionInterceptor implements Interceptor {
private static final String TAG = EncryptionInterceptor.class.getSimpleName();
private static final boolean DEBUG = true;
/**
* Created by Balram Pandey on 12/29/16.
*/
public class EncryptionInterceptor implements Interceptor {
private static final String TAG = EncryptionInterceptor.class.getSimpleName();
private static final boolean DEBUG = true;
@Ikhiloya
Ikhiloya / HttpsRequestPoster.java
Created March 18, 2019 15:05 — forked from xSAVIKx/HttpsRequestPoster.java
Simple HTTPS POST request using raw JAVA for quering web-form
import javax.net.ssl.*;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;
@Ikhiloya
Ikhiloya / ApiResponse.java
Last active April 29, 2020 15:40 — forked from AkshayChordiya/ApiResponse.java
LiveData adapter for Retrofit
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.util.ArrayMap;
import java.io.IOException;
import java.util.Collections;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;