Skip to content

Instantly share code, notes, and snippets.

View esabook's full-sized avatar
🛰️
Seeking planet

esabook

🛰️
Seeking planet
View GitHub Profile
class MaskingGenerator extends AsyncTask<ActivityCameraBinding, Void, BitmapDrawable> {
@Override
protected BitmapDrawable doInBackground(ActivityCameraBinding... bindings) {
try {
ActivityCameraBinding b = bindings[0];
int maxDispayW = b.camera.getWidth();
int maxDispayH = b.camera.getHeight();
if (maxDispayH <= 0 || maxDispayW <= 0) return null;
package com.auzen.app
import android.app.Activity
import android.app.Application
import android.content.Intent
import android.os.Handler
import android.os.Looper
import androidx.appcompat.app.AlertDialog
import timber.log.Timber
import java.util.concurrent.atomic.AtomicReference
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<androidx.constraintlayout.helper.widget.Flow
android:layout_width="match_parent"
android:layout_height="@dimen/padding_20"
package ***;
import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Build;
import androidx.core.content.ContextCompat;
@esabook
esabook / HttpSignatureUtils.java
Last active January 19, 2020 09:14
HMAC signer for http req
/*Request
1. Date Format RFC1123 (Sun, 06 Nov 1994 08:49:37 UTC)
2. Request Line (POST /v1/account/check HTTP/1.1)
Signature
signing_string = ‘date: Sun, 06 Nov 1994 08:49:37 UTC\nPOST /v1/account/check HTTP/1.1’
digest=HMAC-SHA256(signing_string)
signature=BASE64(digest)
Body
{
@esabook
esabook / MobileAppInterface.java
Last active January 22, 2020 09:20
Multi JS Listener for android webview
package ***;
import android.net.Uri;
import android.webkit.JavascriptInterface;
import android.webkit.WebView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import java.util.HashMap;
@esabook
esabook / ItemIndicator.java
Last active January 19, 2020 09:07
banner card indicator
package ***;
/*
* The MIT License (MIT)
*
* Copyright (c) 2017 David Medenjak
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
@esabook
esabook / BannerAdapter.java
Last active January 19, 2020 09:07
for BannerRecycleView
package ***;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatImageView;
@esabook
esabook / BannerRecycleView.java
Last active January 19, 2020 09:08
switchable card view
package ***;
import android.content.Context;
import android.graphics.Rect;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewConfiguration;
@esabook
esabook / push_android_cert_to_system_dir.txt
Last active January 9, 2020 09:07
I want to always able to tracing android https call in AVD (tested in API <29) with MitmProxy and Fiddler, without setup PIN
#Installing CA Cert to android system
1. get cert file
cd ~/.mitmproxy
2. get cert hash
// convert cer to pem
openssl x509 -inform der -in certificate.cer -out certificate.pem