Skip to content

Instantly share code, notes, and snippets.

View atermenji's full-sized avatar

Artur Termenji atermenji

View GitHub Profile
@atermenji
atermenji / ImageViewTouchViewPager.java
Created September 25, 2012 12:58
A viewpager which works with ImageViewTouch (https://github.com/sephiroth74/ImageViewZoom)
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 / ExpandablePanel.java
Created November 8, 2012 11:06
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;
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 November 30, 2012 09:21
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
atermenji / LoadEntypo.java
Created November 6, 2012 10:56
Load Entypo font (http://www.entypo.com/) to a TextView
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);
}
@atermenji
atermenji / ContractFragment.java
Created June 4, 2012 10:13 — forked from JakeWharton/ContractFragment.java
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;
@Override
public void onAttach(Activity activity) {
try {
mContract = (T)activity;
} catch (ClassCastException e) {
throw new IllegalStateException(activity.getClass().getSimpleName()