Skip to content

Instantly share code, notes, and snippets.

View intrications's full-sized avatar

Michael Basil intrications

View GitHub Profile
@pocmo
pocmo / ViewPagerAdapter.java
Created October 21, 2012 15:02
ViewPagerAdapter: Implementation of PagerAdapter that represents each page as a View
/*
* Copyright (C) 2012 Sebastian Kaspari
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@romannurik
romannurik / CheatSheet.java
Last active May 16, 2023 13:42
Android helper class for showing cheat sheets (tooltips) for icon-only UI elements on long-press. This is already default platform behavior for icon-only action bar items and tabs. This class provides this behavior for any other such UI element.
/*
* Copyright 2012 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ManuelPeinado
ManuelPeinado / IsPastTest.java
Created November 1, 2012 16:32
See if a certain time has already passed in a given time zone
public class IsPastTest {
public static final String SPAIN = "Europe/Madrid";
public static final String PORTUGAL = "Europe/Lisbon";
public boolean isPast(int year, int month, int day, int hour, int minute) {
return isPast(year, month, day, hour, minute, null);
}
public boolean isPast(int year, int month, int day, int hour, int minute, String timeZone) {
@devunwired
devunwired / background_dialog.xml
Created November 14, 2012 20:09
XML Shape Drawable for Dialog Backgrounds. Applies a fixed outer margin to keep background from fully stretching to screen edge, and allows for additional internal padding to apply to the dialog content.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- Apply the margin value on the "item" element -->
<!-- This example creates a 15dp visible margin around the dialog -->
<item
android:top="15dp"
android:bottom="15dp"
android:left="15dp"
android:right="15dp">
<shape
@cyrilmottier
cyrilmottier / LicensesActivity.java
Created November 21, 2012 11:10
"Open source licenses" screen
package com.cyrilmottier.android.citybikes;
import android.os.Bundle;
import com.cyrilmottier.android.avelov.R;
import com.cyrilmottier.android.citybikes.app.BaseActivity;
public class LicensesActivity extends BaseActivity {
private WebView mWebView;
@jgilfelt
jgilfelt / ScaleFadePageTransformer.java
Created December 3, 2012 20:05
An ICS+ app/widget drawer style PageTransformer for your ViewPager
/***
* Copyright (c) 2012 readyState Software Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain
* a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@jdamcd
jdamcd / gist:4224231
Created December 6, 2012 12:52
Thumbnail scaling for Android notfications
public class NotificationThumbnailHelper {
private float targetWidth;
private float targetHeight;
public NotificationThumbnailHelper(Context context) {
targetWidth = getTargetWidth(context);
targetHeight = getTargetHeight(context);
}
@seratch
seratch / build.gradle
Created December 8, 2012 05:41
Tweet from Gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.twitter4j', name: 'twitter4j-core', version: '3.0.2'
}
}
import twitter4j.*
@ndarville
ndarville / business-models.md
Last active January 13, 2024 17:27
Business models based on the compiled list at http://news.ycombinator.com/item?id=4924647. I find the link very hard to browse, so I made a simple version in Markdown instead.

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google
@lucasr
lucasr / DeveloperUtils.java
Created December 18, 2012 13:05
Simple and fairly reliable way of checking if you're running a debug build of your Android app.
package org.lucasr;
import java.io.ByteArrayInputStream;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import javax.security.auth.x500.X500Principal;
import android.content.Context;
import android.content.pm.PackageManager;