Skip to content

Instantly share code, notes, and snippets.

View jayrambhia's full-sized avatar

Jay Rambhia jayrambhia

View GitHub Profile
@jayrambhia
jayrambhia / Android Privacy Policy Template
Created February 13, 2017 09:11 — forked from alphamu/Android Privacy Policy Template
A template for creating your own privacy policy for Android apps. Look for "[" and "<!--" to see where you need to edit this app in order to create your own privacy olicy.
<html>
<body>
<h2>Privacy Policy</h2>
<p>[Individual or Company Name] built the [App Name] app as a [open source | free | freemium | ad-supported | commercial] app. This SERVICE is provided by [Individual or company name] [at no cost] and is intended
for use as is.</p>
<p>This page is used to inform website visitors regarding [my|our] policies with the collection, use, and
disclosure of Personal Information if anyone decided to use [my|our] Service.</p>
<p>If you choose to use [my|our] Service, then you agree to the collection and use of information in
relation with this policy. The Personal Information that [I|we] collect are used for providing and
improving the Service. [I|We] will not use or share your information with anyone except as described
public class CustomAnimationUtils {
public static void animateY(@NonNull View view, int startY, int endY, int duration) {
animateY(view, startY, endY, duration, new AccelerateDecelerateInterpolator());
}
public static void animateY(@NonNull View view, int startY, int endY, int duration,
@NonNull Interpolator interpolator) {
view.clearAnimation();
@jayrambhia
jayrambhia / CardPagerTransformerBasic.java
Last active December 21, 2019 05:55
ViewPager Cards
public class CardsPagerTransformerBasic implements ViewPager.PageTransformer {
private int baseElevation;
private int raisingElevation;
private float smallerScale;
public CardsPagerTransformerBasic(int baseElevation, int raisingElevation, float smallerScale) {
this.baseElevation = baseElevation;
this.raisingElevation = raisingElevation;
this.smallerScale = smallerScale;
@jayrambhia
jayrambhia / BitmapUtils.java
Last active December 8, 2020 21:26
Android Background Blur
public static Bitmap getBitmapFromView(View view) {
Bitmap bitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(bitmap);
view.layout(view.getLeft(), view.getTop(), view.getRight(), view.getBottom());
view.draw(c);
return bitamp;
}
public interface AvailabilityChecker {
Observable<ValidationResult<String>> isEmailAvailable(@NonNull String email);
Observable<ValidationResult<String>> isUsernameAvailable(@NonNull String email);
ValidationResult<String> isEmailAvailableSync(@NonNull String email);
ValidationResult<String> isUsernameAvailableSync(@NonNull String email);
}
@jayrambhia
jayrambhia / HorizontalTwoTextView.java
Last active December 23, 2015 11:20
TextView which holds two texts horizontally
/**
* Created by Jay Rambhia on 28/11/15.
*/
public class HorizontalTwoTextView extends TextView {
private final String TAG = getClass().getSimpleName();
private Layout mSubTextLayout;
private CharSequence mSubText;
private TextPaint mSubTextPaint;
package com.fenchtose.footerloaderadapterdemo.adapters;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.fenchtose.footerloaderadapterdemo.R;
@jayrambhia
jayrambhia / activity_contacts_layout.xml
Last active December 28, 2015 15:13
Contacts Demo App
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/main_content"
tools:context=".ContactsActivity">
<android.support.design.widget.AppBarLayout
@jayrambhia
jayrambhia / ObservableImageLoader.java
Created April 30, 2015 05:24
Observable image loader.
// LoaderCallback is just some callback that I use
private void fetchBitmap(String path, final LoaderCallback loaderCallback){
// Retrofit call.
Observable<Response> responseObservable = loaderService.getImage(path);
// ObservableBitmap is a class that wraps Bitmap and has other fields like local_path, remote_path.
responseObservable.flatMap(new Func1<Response, Observable<ObservableBitmap>>() {
import android.content.Context;
import com.j256.ormlite.android.apptools.OpenHelperManager;
/**
* Created by Jay Rambhia on 05/04/15.
*/
public class DatabaseManager {
private DatabaseHelper databaseHelper = null;