Skip to content

Instantly share code, notes, and snippets.

View json_schema
const formioPortalUri = {
"_id": "5a24c7b3b29588000162731f",
"machineName": "cznodnazrvizwmz:LCAP2017",
"modified": "2017-12-15T00:49:59.498Z",
"title": "DO NOT CHANGE - LCAP",
"display": "form",
"settings": {},
"name": "LCAP2017",
"path": "lcap",
atermenji /
Created Nov 30, 2012
BitmapFactory.Options inSampleSize calculating
public static int calculateInSampleSizeInside(BitmapFactory.Options options, int maxWidth, int maxHeight) {
final int height = options.outHeight;
final int width = options.outWidth;
int inSampleSize = 1;
if (height > maxHeight || width > maxWidth) {
if (width > height) {
inSampleSize = Math.round((float) height / (float) maxHeight);
} else {
inSampleSize = Math.round((float) width / (float) maxWidth);
atermenji /
Created Nov 8, 2012
A layout that expands/collapses its content by pressing on some view
package some.awesome.package;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.Transformation;
import android.widget.RelativeLayout;
private void loadEntypoFont() {
Typeface entypo = Typeface.createFromAsset(getAssets(), "fonts/Entypo.otf");
int codePoint = 0x1F4F1;
char[] text = Character.toChars(codePoint);
mTvEntypo.setText(text, 0, text.length);
package some.awesome.package;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
public class ImageViewTouchViewPager extends ViewPager {
atermenji /
Created Jun 4, 2012 — forked from JakeWharton/
Base fragment to ensure the parent activity implements a contract interface.
/* Base fragment to ensure the parent activity implements a contract interface. */
public abstract class ContractFragment<T> extends Fragment {
private T mContract;
public void onAttach(Activity activity) {
try {
mContract = (T)activity;
} catch (ClassCastException e) {
throw new IllegalStateException(activity.getClass().getSimpleName()