Skip to content

Instantly share code, notes, and snippets.

View kishandonga's full-sized avatar
😎

Kishan Donga kishandonga

😎
View GitHub Profile
@kishandonga
kishandonga / card_view_type_shadow_drwable.xml
Created June 13, 2020 07:08
Drop Shadow using drawable as like CardView
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
@kishandonga
kishandonga / FrequentClickBlocker.java
Last active June 26, 2020 04:44
Android Preventing Double Click On A Button
import android.os.Handler;
public class FrequentClickBlocker {
private boolean mIsBlockClick = true;
public void release() {
new Handler().postDelayed(() -> mIsBlockClick = true, 1000);
}
import android.app.Activity;
import android.content.Context;
import android.content.IntentSender;
import android.location.LocationManager;
import android.util.Log;
import android.widget.Toast;
import com.google.android.gms.common.api.ApiException;
import com.google.android.gms.common.api.ResolvableApiException;
import com.google.android.gms.location.LocationRequest;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.disposables.Disposable;
public class RxDisposable {
private static final RxDisposable RX_DISPOSABLE = new RxDisposable();
private CompositeDisposable compositeDisposable = new CompositeDisposable();
public static void addDisposable(Disposable disposable) {
RX_DISPOSABLE.compositeDisposable.add(disposable);
@kishandonga
kishandonga / IUnits.java
Created May 3, 2023 07:45
Storage Util in Java
/**
* Created by KishanDonga on 10/18/2017
*/
public interface IUnits {
String format(long size, String pattern);
long getUnitSize();
}
@kishandonga
kishandonga / ExecutionTimeCalc.java
Created May 3, 2023 08:47
To Calculate Execution time of the functions
import java.text.DecimalFormat;
import java.text.NumberFormat;
public class ExecutionTimeCalc {
private static final NumberFormat formatter = new DecimalFormat("#0.00");
private static long startTime = 0;
public static void startTime(){
startTime = System.currentTimeMillis();
}
@kishandonga
kishandonga / IntentEmail.java
Created May 3, 2023 08:48
To Send Email Using Intent
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.util.Patterns;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.io.File;
@kishandonga
kishandonga / dio_refresh_token.dart
Created August 9, 2023 13:34
Using Dio lib interceptor handle refresh token case in the flutter
import 'package:dio/dio.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class Api {
final Dio api = Dio();
String? accessToken;
final _storage = const FlutterSecureStorage();
Api() {