Skip to content

Instantly share code, notes, and snippets.

View vivekgidmare's full-sized avatar

Vivek Gidmare vivekgidmare

  • Bengaluru
View GitHub Profile
@vivekgidmare
vivekgidmare / KeyBoardHide.java
Created August 30, 2015 14:57
Hide Keyboard by calling this method
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow((null == getCurrentFocus()) ? null : getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
@vivekgidmare
vivekgidmare / HideKey.java
Created September 23, 2015 19:50
Hide KayBoard
//Hide the keyboard
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(mNameText.getWindowToken(), 0);
@vivekgidmare
vivekgidmare / activity.xml
Last active October 20, 2015 09:40
Transparent StatusBar,Actionar Hack
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
@vivekgidmare
vivekgidmare / progress_ring_bg.xml
Last active October 28, 2015 08:18
Circular Progress ring customization for usage see comment
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="720">
<!--To Increase speed increase toDegree value in multiple of 360-->
<shape
android:innerRadius="20dp"
android:shape="ring"
@vivekgidmare
vivekgidmare / ApiModule.java
Created February 18, 2016 20:02 — forked from koesie10/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()
@vivekgidmare
vivekgidmare / File.java
Created April 7, 2016 16:59 — forked from dlew/File.java
Automated onError() message generation
public static Action1<Throwable> crashOnError() {
final Throwable checkpoint = new Throwable();
return throwable -> {
StackTraceElement[] stackTrace = checkpoint.getStackTrace();
StackTraceElement element = stackTrace[1]; // First element after `crashOnError()`
String msg = String.format("onError() crash from subscribe() in %s.%s(%s:%s)",
element.getClassName(),
element.getMethodName(),
element.getFileName(),
element.getLineNumber());
@vivekgidmare
vivekgidmare / build.gradle
Created April 13, 2016 06:45 — forked from cesarferreira/build.gradle
A full build.gradle
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// Google Play Services
compile 'com.google.android.gms:play-services:4.4.52'
// Support Libraries
compile 'com.android.support:support-v4:20.+'
@vivekgidmare
vivekgidmare / TimeUtils.java
Last active April 22, 2016 12:45
Cnnvert DateTime to --ago format
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* 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
@vivekgidmare
vivekgidmare / README.md
Created April 28, 2016 11:54 — forked from polbins/README.md
Android Response Caching using Retrofit 1.9 + OkHttp 2.2

Android REST Controller with Cache-Control

Android REST Controller with Simple Cache Control Headers using Retrofit 1.9.0 + OkHttp 2.2.0

@vivekgidmare
vivekgidmare / tweet_dumper.py
Created June 29, 2016 14:58 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""