Skip to content

Instantly share code, notes, and snippets.

View funkyidol's full-sized avatar

Kshitij Aggarwal funkyidol

View GitHub Profile
@himanshuvirmani
himanshuvirmani / AndroidShareUtil.java
Last active February 11, 2021 18:39
Android app share util with fb, twitter, whatsapp, gtalk etc
public class AndroidShareUtil {
private static final String DEFAULT_SHARE_TITLE = "Check XXX!";
private static final String DEFAULT_SHARE_URL_PREFIX = "http://MARKET_URL";
public static void performShare(ShareData shareData, Activity activity, Uri uri) {
try {
if (activity != null && shareData != null && (!(activity.isFinishing()))) {
String title = shareData.getTitle();
String shareUrl = shareData.getShareUrl();
@bryanstern
bryanstern / OkHttpStack.java
Last active April 24, 2022 03:17
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@alexfu
alexfu / ColorUtils.java
Last active January 30, 2023 00:04
Automatic text color selection using relative luminance.
public class ColorUtils {
private static final double LM_RED_COEFFICIENT = 0.2126;
private static final double LM_GREEN_COEFFICIENT = 0.7152;
private static final double LM_BLUE_COEFFICIENT = 0.0722;
public static int calculateRelativeLuminance(int color) {
int red = (int) (Color.red(color) * LM_RED_COEFFICIENT);
int green = (int) (Color.green(color) * LM_GREEN_COEFFICIENT);
int blue = (int) (Color.blue(color) * LM_BLUE_COEFFICIENT);
return red + green + blue;