Skip to content

Instantly share code, notes, and snippets.

View imandaliya's full-sized avatar
🐢

Rahul Mandaliya imandaliya

🐢
View GitHub Profile
java single and multi line
http://blog.ostermiller.org/find-comment
html or xml
https://stackoverflow.com/questions/1084741/regexp-to-strip-html-comments
// Get dialog button by reference
class dialogRef {
Button positiveButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
Button negativeButton = dialog.getButton(AlertDialog.BUTTON_NEGATIVE);
Button neutralButton = dialog.getButton(AlertDialog.BUTTON_NEUTRAL);
}
public class AndroidShareUtil {
// special thanks to @himanshuvirmani
// https://gist.github.com/himanshuvirmani/30d7aa0c0c2779fa80ed
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 {
Remove Comment https://gist.github.com/himanshuvirmani
Drawable shadow https://gist.github.com/lecho/6473458
@imandaliya
imandaliya / material-colors.json
Created November 1, 2018 11:48 — forked from kawanet/material-colors.json
Material Design Style Color Palette as JSON
{
"red": {
"50": "#ffebee",
"100": "#ffcdd2",
"200": "#ef9a9a",
"300": "#e57373",
"400": "#ef5350",
"500": "#f44336",
"600": "#e53935",
"700": "#d32f2f",
@imandaliya
imandaliya / Android Studio.txt
Created November 23, 2018 14:56
Android studio utils
1. Android Studio Update Error on Mac, Apple
Open Android Studio using terminal
sudo /Applications/Android\ Studio.app/Contents/MacOS/studio
update android studio, after updating studio close it.
Now open android studio normally
2. Increase android studio heap size in mac
public class AndroidDeviceSignHashKey {
public static String printKeyHash(Activity context) {
PackageInfo packageInfo;
String key = null;
try {
//getting application package name, as defined in manifest
String packageName = context.getApplicationContext().getPackageName();
//Retriving package info
public class RecyclerViewUtils {
// To remove fading edge from start and end scroll
// android:fadingEdge="none”
}
Change Application or View Typeface
// step 1
public final class FontsOverride {
public static void setDefaultFont(Context context,
String staticTypefaceFieldName, String fontAssetName) {
final Typeface regular = Typeface.createFromAsset(context.getAssets(),
fontAssetName);
class TextViewUtils {
// Text get blurry after rotating canvas
private void closeHardwareAcceleration() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
setLayerType(LAYER_TYPE_SOFTWARE, null);
}
}