This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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 { |
NewerOlder