Skip to content

Instantly share code, notes, and snippets.

View JaydipZala's full-sized avatar

Jaydipsinh Zala JaydipZala

  • Apexon
  • Ahmedabad, India
  • 11:46 (UTC +05:30)
View GitHub Profile
@JaydipZala
JaydipZala / Git
Last active September 14, 2018 10:43
Git basic commands
git init
git clone [repository url]
git remote add origin [repository url]
touch .gitignore
git add [path to file]
@chrisbanes
chrisbanes / CoroutineLifecycleObserver.kt
Last active September 9, 2022 14:07
LifecycleObserver which allows easy cancelling of coroutines
/*
* Copyright 2018 Google LLC
*
* 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
@balzss
balzss / CryptoUtil.java
Last active October 30, 2022 05:23
Utility library for RSA cryptography on Android
import android.util.Base64;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.PublicKey;
@JaydipZala
JaydipZala / DBUtils.java
Created November 10, 2016 13:14
SQLite Database Sample
public class DBUtils {
public static ArrayList<String> getColumns(SQLiteDatabase db, String tableName) {
ArrayList<String> al = null;
Cursor c = null;
try {
c = db.rawQuery("SELECT * FROM " + tableName + " LIMIT 1", null);
if (c != null) {
al = new ArrayList<>(Arrays.asList(c.getColumnNames()));
}
@PareshMayani
PareshMayani / ic_password_visibility.xml
Last active January 9, 2020 07:49
Android Support library 24.2.0 - passwordToggleDrawable example
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="24.0"
android:viewportWidth="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M12,4.5C7,4.5 2.73,7.61 1,12c1.73,4.39 6,7.5 11,7.5s9.27,-3.11 11,-7.5c-1.73,-4.39 -6,-7.5 -11,-7.5zM12,17c-2.76,0 -5,-2.24 -5,-5s2.24,-5 5,-5 5,2.24 5,5 -2.24,5 -5,5zm0,-8c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z" />
</vector>
@danielgomezrico
danielgomezrico / jacoco.gradle
Last active October 5, 2020 13:15
Gradle - jacoco gradle file that is setup to run tests and create test coverage reports for Android (junit tests or connectedTests...). apply to your project and check "reporting" in gradle tasks. Thanks to https://github.com/artem-zinnatullin/qualitymatters for it.
project.afterEvaluate {
// Grab all build types and product flavors
def buildTypes = android.buildTypes.collect { type -> type.name }
def productFlavors = android.productFlavors.collect { flavor -> flavor.name }
// When no product flavors defined, use empty
if (!productFlavors) productFlavors.add('')
productFlavors.each { productFlavorName ->
buildTypes.each { buildTypeName ->
@Mariovc
Mariovc / ImagePicker.java
Last active June 13, 2024 11:49
Utility for picking an image from Gallery/Camera with Android Intents
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.content.res.AssetFileDescriptor;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
@PomepuyN
PomepuyN / SettingsAdapter.java
Last active June 5, 2018 09:02
Functional example of WearableListView
public class SettingsAdapter extends WearableListView.Adapter {
private final Context context;
private final List<SettingsItems> items;
public SettingsAdapter(Context context, List<SettingsItems> items) {
this.context = context;
this.items = items;
}