Skip to content

Instantly share code, notes, and snippets.

View StelianMorariu's full-sized avatar

Stelian Morariu StelianMorariu

View GitHub Profile
@StelianMorariu
StelianMorariu / NumericPreference
Created September 10, 2013 09:31
Example of extending EditTextPreference to create a preference that saves numbers (EditTextPreference saves strings even if you specify "android:inputType=number ")
/*
* NumericPreference.java
*
*Copyright © Ropardo™ 2013.
*/
package ro.ropardo.imobiledistribution.utils;
import android.content.Context;
import android.preference.EditTextPreference;
import android.util.AttributeSet;
@StelianMorariu
StelianMorariu / proguard.cfg
Last active December 22, 2015 21:39
Proguard example
-injars bin/classes
-injars libs
-outjars bin/classes-processed.jar
-libraryjars C:\android-sdk\platforms\android-17\android.jar
-libraryjars C:\android-sdk\add-ons\addon-google_apis-google-17\libs\maps.jar
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
@StelianMorariu
StelianMorariu / NotificationCompat example
Created November 15, 2013 14:20
Example of a notification with sound, lights and vibration
final Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
final Intent cancelIntent = new Intent(this, MHRCancelNotificationsActivity.class);
cancelIntent.putExtra(MyHeartRateKeys.CANCEL_NOTIFICATION, true);
cancelIntent.putExtra(MyHeartRateKeys.USER_ID, mUserId);
cancelIntent.putExtra(MyHeartRateKeys.NOTIFICATION_ID, ALERT_NOTIFICATION_ID);
cancelIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingCancel = PendingIntent.getActivity(this, 0, cancelIntent, PendingIntent.FLAG_UPDATE_CURRENT);
final Intent sessionActivityIntent = new Intent(this, MHRSessionActivity.class);
@StelianMorariu
StelianMorariu / SeekBarPreference.java
Last active June 27, 2019 13:26
Seek bar preference
package ro.stemo.android.clockwidget.preferences;
import android.content.Context;
import android.content.res.TypedArray;
import android.preference.Preference;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
@StelianMorariu
StelianMorariu / GrayScaleAndroid
Last active August 29, 2015 14:06
Android - create gray scale image from drawable
private Drawable getGrayScaleDrawable() {
int id = getAreaCharacterId();
Bitmap bmp = BitmapFactory.decodeResource(getResources(),id);
int width = bmp.getWidth();
int height = bmp.getHeight();
Bitmap grayScale = Bitmap.createBitmap(width,height, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(grayScale);
Paint paint = new Paint();
ColorMatrix cm = new ColorMatrix();
@StelianMorariu
StelianMorariu / Unity3DSwipeDetection
Last active August 29, 2015 14:09
Detect swipes in Unity 3D
#pragma strict
var minSwipeDistY : float;
var minSwipeDistX : float;
var Swipe: GUIText;
private var startPos :Vector2;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
*
*/
public final class StackBlur {
private static final int PARALLEL_THRESHOLD = 2048 * 2048;
package com.owncloud.android.ui.activity;
import android.app.Dialog;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.os.Bundle;
import android.preference.Preference;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.security.KeyPairGeneratorSpec;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import java.io.ByteArrayInputStream;
@StelianMorariu
StelianMorariu / GIF-Screencast-OSX.md
Created September 25, 2016 18:48 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application: