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
atermenji / SampleSize.java
Created Nov 30, 2012
BitmapFactory.Options inSampleSize calculating
View SampleSize.java
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
atermenji / ExpandablePanel.java
Created Nov 8, 2012
A layout that expands/collapses its content by pressing on some view
View ExpandablePanel.java
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;
View LoadEntypo.java
private void loadEntypoFont() {
Typeface entypo = Typeface.createFromAsset(getAssets(), "fonts/Entypo.otf");
mTvEntypo.setTypeface(entypo);
int codePoint = 0x1F4F1;
char[] text = Character.toChars(codePoint);
mTvEntypo.setText(text, 0, text.length);
mTvEntypo.setTextColor(Color.RED);
}
View ImageViewTouchViewPager.java
package some.awesome.package;
import it.sephiroth.android.library.imagezoom.ImageViewTouch;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
public class ImageViewTouchViewPager extends ViewPager {
@atermenji
atermenji / ContractFragment.java
Created Jun 4, 2012 — forked from JakeWharton/ContractFragment.java
Base fragment to ensure the parent activity implements a contract interface.
View ContractFragment.java
/* Base fragment to ensure the parent activity implements a contract interface. */
public abstract class ContractFragment<T> extends Fragment {
private T mContract;
@Override
public void onAttach(Activity activity) {
try {
mContract = (T)activity;
} catch (ClassCastException e) {
throw new IllegalStateException(activity.getClass().getSimpleName()