This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.tomgibara.android.util; | |
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.util.AttributeSet; | |
| import android.view.View; | |
| import android.view.ViewGroup; | |
| /** | |
| * A layout that arranges views into a grid of same-sized squares. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.graphics.Canvas; | |
| import android.graphics.Rect; | |
| import android.graphics.drawable.Drawable; | |
| import android.graphics.drawable.NinePatchDrawable; | |
| import android.util.AttributeSet; | |
| import android.widget.RelativeLayout; | |
| public class FRelativeLayout extends RelativeLayout { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.graphics.Canvas; | |
| import android.graphics.drawable.Drawable; | |
| import android.util.AttributeSet; | |
| import android.widget.ImageView; | |
| public class ForegroundImageView extends ImageView { | |
| private Drawable foreground; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Copyright 2012 Square, Inc. | |
| package com.squareup.widgets; | |
| import android.content.Context; | |
| import android.content.res.TypedArray; | |
| import android.util.AttributeSet; | |
| import android.widget.ImageView; | |
| /** Maintains an aspect ratio based on either width or height. Disabled by default. */ | |
| public class AspectRatioImageView extends ImageView { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class URLUtils { | |
| private static final String fGOOGLE_DOC_URL = "http://docs.google.com/gview?embedded=true&url=%s"; | |
| private enum GoogleDocType{ | |
| PDF(".pdf"), DOC(".doc"), XLS(".xls"), DOCX(".docx"), XLSX(".xlsx"); | |
| private String mSuffix; | |
| GoogleDocType(String suffix){ | |
| mSuffix = suffix; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import android.graphics.*; | |
| import com.squareup.picasso.Transformation; | |
| /** | |
| * Transforms an image into a circle representation. Such as a avatar. | |
| */ | |
| public class CircularTransformation implements Transformation | |
| { | |
| int radius = 10; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ColoredSnackBar { | |
| private static final int red = 0xfff44336; | |
| private static final int green = 0xff4caf50; | |
| private static final int blue = 0xff2195f3; | |
| private static final int orange = 0xffffc107; | |
| private static View getSnackBarLayout(Snackbar snackbar) { | |
| if (snackbar != null) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image); | |
| Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose); | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ | |
| //Default | |
| imageView.setBackgroundResource(R.drawable.rose); | |
| } else { | |
| //RoundCorners | |
| RoundCornersDrawable round = new RoundCornersDrawable(mBitmap, | |
| getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.aracem.utils.animations.pagetransformation; | |
| import org.jetbrains.annotations.NotNull; | |
| import android.support.v4.view.ViewPager; | |
| import android.view.View; | |
| import java.util.ArrayList; | |
| import java.util.List; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.aracem.utils.animations.pagetransformation; | |
| import org.jetbrains.annotations.NotNull; | |
| import android.support.v4.view.ViewPager; | |
| import android.view.View; | |
| import java.util.ArrayList; | |
| import java.util.List; |