Skip to content

Instantly share code, notes, and snippets.

View gouravd's full-sized avatar

das_vicky gouravd

  • Cayfay
  • Hyderabad, India
View GitHub Profile
@gouravd
gouravd / Connectivity.java
Last active September 8, 2015 16:59 — forked from emil2k/Connectivity.java
Android utility class for checking device's network connectivity and speed.
package com.emil.android.util;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
/**
* Check device's network connectivity and speed
* @author emil http://stackoverflow.com/users/220710/emil
@gouravd
gouravd / ControllableAppBarLayout.java
Last active August 29, 2015 14:28 — forked from iftekhar-ahmed/ControllableAppBarLayout.java
A modified version of ControllableAppBarLayout that allows to add/remove multiple listeners for layout state change (collapsed, expanded or idle). The original ControllableAppBarLayout is here https://gist.github.com/blipinsk/3f8fb37209de6d3eea99
/**
* Copyright 2015 Bartosz Lipinski
* <p/>
* 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
* <p/>
* http://www.apache.org/licenses/LICENSE-2.0
* <p/>
* Unless required by applicable law or agreed to in writing, software
@gouravd
gouravd / ICloud.java
Last active August 29, 2015 14:24 — forked from funseiki/ICloud.java
// Uses retrofit to generate an implementation
public interface ICloud {
static String serviceProviderHeader = "X-Auth-Service-Provider";
static String credentialsAuthorizationHeader = "X-Verify-Credentials-Authorization";
@GET("/verify_credentials?provider=digits")
void verifyCredentials(
@Header(serviceProviderHeader) String serviceProvider,
@Header(credentialsAuthorizationHeader) String authorization,
@Query("id") long id,
@gouravd
gouravd / urvHideToolbar
Created April 19, 2015 20:12
UltimateRecyclerView hidetoolbar
popularFeed.setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
@Override
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
}
@Override
public void onDownMotionEvent() {
}
@Override
@gouravd
gouravd / rvHideToobar
Created April 19, 2015 20:11
recyclerview hide toolbar
popularFeed.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
View toolbarholder = (getActivity().findViewById(R.id.hometoolbarholder));
View toolbar = (getActivity().findViewById(R.id.toolbar));
float y = recyclerView.getY();
super.onScrolled(recyclerView, dx, dy);
if (y < dy) {
toolbarholder.animate()
.translationY(-toolbar.getBottom())
@gouravd
gouravd / ICloud.java
Last active August 29, 2015 14:19 — forked from funseiki/ICloud.java
// Uses retrofit to generate an implementation
public interface ICloud {
static String serviceProviderHeader = "X-Auth-Service-Provider";
static String credentialsAuthorizationHeader = "X-Verify-Credentials-Authorization";
@GET("/verify_credentials?provider=digits")
void verifyCredentials(
@Header(serviceProviderHeader) String serviceProvider,
@Header(credentialsAuthorizationHeader) String authorization,
@Query("id") long id,

Google's authentication-less on-the-fly image resizing service

I found it while poking around the Google+ HTML. Jotting down some notes felt like a good idea, so here goes. If you know more about this API, let me know, please!

(Word of warning: I spent ~30 minutes on both my experimentation and this here write-up, so it might not be the most thought-provoking, brilliant thing you read today.)

@gouravd
gouravd / RetrofitReadResponseBody
Created March 4, 2015 18:49
Retrofit read Response Body
package com.groupshoppy.helpers;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import retrofit.client.Response;
import retrofit.mime.MimeUtil;
import retrofit.mime.TypedByteArray;
import retrofit.mime.TypedInput;
@gouravd
gouravd / gist:82dfe5a7634912094b41
Last active August 29, 2015 14:10
LongerRectangleImageView
public class SquareImageView extends ImageView
{
public SquareImageView(Context context)
{
super(context);
}
public SquareImageView(Context context, AttributeSet attrs)
{
super(context, attrs);
@gouravd
gouravd / gist:6cfe74c30c6dcbf47299
Created December 8, 2014 00:10
SquareImageView
public class SquareImageView extends ImageView
{
public SquareImageView(Context context)
{
super(context);
}
public SquareImageView(Context context, AttributeSet attrs)
{
super(context, attrs);