Skip to content

Instantly share code, notes, and snippets.

View yishai-glide's full-sized avatar

thepoosh yishai-glide

  • Glide
  • Jerusalem IL
View GitHub Profile
/* */ package android.support.design.widget;
/* */
/* */ import android.content.Context;
/* */ import android.content.res.ColorStateList;
/* */ import android.content.res.Resources.Theme;
/* */ import android.content.res.TypedArray;
/* */ import android.graphics.Canvas;
/* */ import android.graphics.Paint;
/* */ import android.os.Handler;
/* */ import android.os.Handler.Callback;
// Add code to print out the key hash
try {
PackageInfo info = getPackageManager().getPackageInfo(
"com.facebook.samples.hellofacebook",
PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
try {
ArrayList<Object> list = getListOfPreExistingItems();
for(int i = 0; ; i++) {
Object item = list.get(i)
doSomething(item);
}
} catch (ArrayOutOfBoundsException e) {
// loop is over
}
Point mCenter;
float mRadious;
public float animateToX(Point src, float deltaX) {
float newX = src.x + deltaX;
float newY = mCenter.y + Math.sqrt(Math.pow(mRadious, 2) - Math.pow(newX - mCenter.x), 2));
return newY;
}
public static void scheduleAutoCancel(@NonNull Context context) {
Intent intent = new Intent(context, MyReceiver.class);
AlarmManager manager = (AlarmManager)context.getSystemService(ALARM_SERVICE);
int requestCode = REQUEST_CODE;
PendingIntent action = PendingIntent.getBroadcast(context, requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
long when = System.currentTimeMillis() + TIME_TO_WAUT_UNTIL_NOTIFICATION;
manager.set(AlarmManager.RTC, when, action);
}
public static class MyReceiver extends BroadcastReceiver {
// create CUSTOMER table
db.execSQL("CREATE TABLE \"CUSTOMER\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"NAME\" TEXT NOT NULL );"); // 1: name
// create NOTE table
db.execSQL("CREATE TABLE \"NOTE\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"TEXT\" TEXT NOT NULL ," + // 1: text
"\"COMMENT\" TEXT," + // 2: comment
"\"DATE\" INTEGER);"); // 3: date
# built application files
*.apk
*.ap_
.classpath
# files for the dex VM
*.dex
# Java class files
*.class
@override
public void onCreate() {
initCrashHandeling();
/// other init code
AppRight.start(this, GRYPHONET_APP_ID, LifeCyclePhase.DEVELOPMENT ,true);
}
private void initCrashHandeling(){
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public synchronized static void registerService(Context applicationContext) {
Intent serviceIntent = new Intent(applicationContext, GcmRegistrationService.class);
PendingIntent scheduleIntetnt = PendingIntent.getService(GlideApplication.applicationContext, REQUEST_CODE, serviceIntent, PendingIntent.FLAG_UPDATE_CURRENT);
if (scheduleIntetnt == null) {
if(DEBUG) {
Utils.log(TAG, "no need to schedule again since there is already a PendingIntent in the queue", 1);
}
return;
}
long now = System.currentTimeMillis();
package org.teamsik.apps.hackingchallenge;
import android.content.Context;
import android.util.Base64;
public abstract class a
{
public static boolean a(Context paramContext, String paramString)
{
byte[] arrayOfByte1 = a(paramString);