Skip to content

Instantly share code, notes, and snippets.

View vipulasri's full-sized avatar
👨‍💻
https://vipulasri.com/

Vipul Asri vipulasri

👨‍💻
https://vipulasri.com/
View GitHub Profile
package com.example.marcin.splitlayout;
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.Region;
@vipulasri
vipulasri / MultipartRequest.java
Last active April 8, 2016 11:41
Android MultipartRequest using Volley with PHP code
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyLog;
import com.android.volley.toolbox.HttpHeaderParser;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
@vipulasri
vipulasri / ApiModule.java
Created December 29, 2016 08:12 — forked from rahulgautam/ApiModule.java
Retrofit 1 error handling behaviour in Retrofit 2
// Dagger 1 example
@Module(
complete = false,
library = true
)
public final class ApiModule {
@Provides
@Singleton
Retrofit provideRetrofit(Gson gson, Application app) {
return new Retrofit.Builder()
@vipulasri
vipulasri / LollipopBitmapMemoryCacheParamsSupplier.java
Created April 12, 2017 03:43 — forked from sensen/LollipopBitmapMemoryCacheParamsSupplier.java
Fresco's custom BitmapMemoryCacheParamsSupplier for Lollipop devices
public class LollipopBitmapMemoryCacheParamsSupplier implements Supplier<MemoryCacheParams> {
private ActivityManager activityManager;
public LollipopBitmapMemoryCacheParamsSupplier(ActivityManager activityManager) {
this.activityManager = activityManager;
}
@Override
public MemoryCacheParams get() {
//
// Created by Vipul Asri on 02/04/17.
//
#include <jni.h>
extern "C" {
JNIEXPORT jstring JNICALL
Java_com_squareboat_secretkeys_MainActivity_getAPIKey(JNIEnv *env, jobject instance) {
@vipulasri
vipulasri / CMakeLists.txt
Last active May 31, 2017 04:13
Secret Keys
# Sets the minimum version of CMake required to build your native library.
# This ensures that a certain set of CMake features is available to
# your build.
cmake_minimum_required(VERSION 3.4.1)
# Specifies a library name, specifies whether the library is STATIC or
# SHARED, and provides relative paths to the source code. You can
# define multiple libraries by adding multiple add.library() commands,
# and CMake builds them for you. When you build your app, Gradle
@vipulasri
vipulasri / Spectrum AVD.java
Created September 29, 2017 06:41
Spectrum AVD
@BindView(R.id.image_progress)
AppCompatImageView mLoadingProgress;
private AnimatedVectorDrawableCompat mAVD = AnimatedVectorDrawableCompat.create(getContext(), R.drawable.avd_spectrum_logo);
if (mLoadingProgress != null && mAVD != null) {
mLoadingProgress.setImageDrawable(mAVD);
mAVD.start();
mAVD.registerAnimationCallback(new Animatable2Compat.AnimationCallback() {
@vipulasri
vipulasri / CustomTabIndicator_Step1.dart
Last active May 22, 2018 03:35
Flutter: Bubble Tab Indicator
import 'package:flutter/widgets.dart';
class CustomTabIndicator extends Decoration {
@override
BoxPainter createBoxPainter([VoidCallback onChanged]) {
// TODO: implement createBoxPainter
}
}
@vipulasri
vipulasri / CustomTabIndicator_Step2.dart
Last active May 22, 2018 03:46
Flutter: Bubble Tab Indicator
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
class CustomTabIndicator extends Decoration {
@override
_CustomPainter createBoxPainter([VoidCallback onChanged]) {
return new _CustomPainter(this, onChanged);
}
@vipulasri
vipulasri / CustomTabIndicator_Step3.dart
Created May 22, 2018 04:02
Flutter: Bubble Tab Indicator
//In this, we will create a variable to hold [indicatorHeight] i.e 15.0
//Now, we will create a new offset to set the x-axis position of tab according to the TabIndicatorSize i.e label or tab start.
//And set the y-axis to tab height center position and subtracting the value of indicatorHeight center value.
final Rect rect = Offset(offset.dx, (configuration.size.height/2) - indicatorHeight/2) & Size(configuration.size.width, indicatorHeight);