Skip to content

Instantly share code, notes, and snippets.

View rinav's full-sized avatar
🏗️
building...

Rinav rinav

🏗️
building...
  • HTC Global Services Pvt Ltd
  • Bangalore
View GitHub Profile
@rinav
rinav / android avd launcher
Last active May 25, 2017 10:35
Create a launcher to launch the specified AVD to deal with the famous lib64stdc++6 conflict with the system libs on linux systems
# create a launcher on your prefered Desktop Environment, mine is XFCE and add the below line to 'command' section.
# next, Select an icon for the launcher and thats it.
``` fish
/run/media/rinav/sdk/android-sdk/tools/emulator -avd Nexus_6P_API_25 -use-system-libs
```
OR
you can also add the following environment to your shell. I am using fish shell, so below is the syntax for the same
@rinav
rinav / DistanceCalculator.java
Created July 13, 2016 15:27 — forked from danielgomezrico/DistanceCalculator.java
Java / Android - calculate the distance between two coordinates with great circle formula.
import static java.lang.Math.acos;
import static java.lang.Math.cos;
import static java.lang.Math.sin;
/**
* Calculate distance between coordinates.
*/
public class DistanceCalculator {
static double PI_RAD = Math.PI / 180.0;
@rinav
rinav / android_toolbar_color_changes.txt
Created June 23, 2016 13:01
Android Toolbar text and popup color tests
Toolbar text and popup color tests
1)
Input:
app:theme="@style/ThemeOverlay.AppCompat.Light"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
Output:
Toolbar: black text, primaryColor background
Popup: black text, white background
@rinav
rinav / LocalBroadcastExampleActivity.java
Created May 27, 2016 07:36 — forked from Antarix/LocalBroadcastExampleActivity.java
Simple Example of using LocalBroadcastManager in Android
import android.app.Activity;
import android.app.Service;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.os.IBinder;
import android.support.v4.content.LocalBroadcastManager;
@rinav
rinav / findNCopy.md
Created April 14, 2016 09:49
find files by extension and copy them to specific directory

shell find . -type f -name "*.aar" -exec cp {} /run/media/rinav/sdk/video\ aar/ \;

@rinav
rinav / Interceptor.java
Created January 20, 2016 11:18 — forked from alex-shpak/Interceptor.java
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
@rinav
rinav / .gitconfig
Last active September 17, 2017 17:47
default git config
# https://gist.github.com/pksunkara/988716
# https://gist.github.com/arlimus/5883472
[user]
name = Rinav Gangar
email = rinav4all@gmail.com
[core]
# excludesfile = /home/rinav/.gitignore-global
pager = less -FRX
@rinav
rinav / AnimatedActivity.java
Created October 13, 2015 09:56 — forked from kwent/AnimatedActivity.java
Activity transition animations like the Vine Android application. - See more at: http://blog.quent.in/index.php/2013/06/activity-transition-animations-like-the-vine-android-application/
public class AnimatedActivity extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//opening transition animations
overridePendingTransition(R.anim.activity_open_translate,R.anim.activity_close_scale);
}
Ionic and ngCordova upload example
// Copyright 2012 Square, Inc.
package com.squareup.widgets;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.widget.ImageView;
/** Maintains an aspect ratio based on either width or height. Disabled by default. */
public class AspectRatioImageView extends ImageView {