aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/AndroidBootstrap/src/com/beardedhen
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/AndroidBootstrap/src/com/beardedhen')
-rw-r--r--libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapButton.java445
-rw-r--r--libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapCircleThumbnail.java215
-rw-r--r--libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapEditText.java188
-rw-r--r--libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapThumbnail.java209
-rw-r--r--libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/FontAwesome.java390
-rw-r--r--libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/FontAwesomeText.java274
-rw-r--r--libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/utils/AutoResizeTextView.java303
-rw-r--r--libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/utils/ImageUtils.java77
8 files changed, 0 insertions, 2101 deletions
diff --git a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapButton.java b/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapButton.java
deleted file mode 100644
index 374d004a8..000000000
--- a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapButton.java
+++ /dev/null
@@ -1,445 +0,0 @@
-package com.beardedhen.androidbootstrap;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Typeface;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-import android.widget.TextView;
-
-import com.beardedhen.androidbootstrap.R;
-
-
-public class BootstrapButton extends FrameLayout {
-
- private static Map<String, BootstrapTypes> bbuttonTypeMap;
- private static Map<String, BootstrapTypes> bbuttonTypeMapRounded;
- private static Typeface font;
-
- private static Map<String, String> faMap;
-
- private TextView lblMiddle;
- private TextView lblRight;
- private TextView lblLeft;
- private ViewGroup layout;
- private boolean roundedCorners = false;
- private boolean fillparent = false;
-
- private static final String FA_ICON_QUESTION = "fa-question";
-
- static{
-
- bbuttonTypeMap = new HashMap<String, BootstrapTypes>();
-
- bbuttonTypeMap.put("default", BootstrapTypes.DEFAULT);
- bbuttonTypeMap.put("primary", BootstrapTypes.PRIMARY);
- bbuttonTypeMap.put("success", BootstrapTypes.SUCCESS);
- bbuttonTypeMap.put("info", BootstrapTypes.INFO);
- bbuttonTypeMap.put("warning", BootstrapTypes.WARNING);
- bbuttonTypeMap.put("danger", BootstrapTypes.DANGER);
- bbuttonTypeMap.put("inverse", BootstrapTypes.INVERSE);
-
- bbuttonTypeMapRounded = new HashMap<String, BootstrapTypes>();
-
- bbuttonTypeMapRounded.put("default", BootstrapTypes.DEFAULT_ROUNDED);
- bbuttonTypeMapRounded.put("primary", BootstrapTypes.PRIMARY_ROUNDED);
- bbuttonTypeMapRounded.put("success", BootstrapTypes.SUCCESS_ROUNDED);
- bbuttonTypeMapRounded.put("info", BootstrapTypes.INFO_ROUNDED);
- bbuttonTypeMapRounded.put("warning", BootstrapTypes.WARNING_ROUNDED);
- bbuttonTypeMapRounded.put("danger", BootstrapTypes.DANGER_ROUNDED);
- bbuttonTypeMapRounded.put("inverse", BootstrapTypes.INVERSE_ROUNDED);
-
-
- faMap = FontAwesome.getFaMap();
-
- }
-
- public BootstrapButton(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- initialise(attrs);
- }
-
- public BootstrapButton(Context context, AttributeSet attrs) {
- super(context, attrs);
- initialise(attrs);
- }
-
- public BootstrapButton(Context context) {
- super(context);
- initialise(null);
- }
-
- //set up the bootstrap types
- private enum BootstrapTypes
- {
- DEFAULT(R.drawable.bbuton_default, R.color.black),
- PRIMARY(R.drawable.bbuton_primary, R.color.white),
- SUCCESS(R.drawable.bbuton_success, R.color.white),
- INFO(R.drawable.bbuton_info, R.color.white),
- WARNING(R.drawable.bbuton_warning, R.color.white),
- DANGER(R.drawable.bbuton_danger, R.color.white),
- INVERSE(R.drawable.bbuton_inverse, R.color.white),
-
- DEFAULT_ROUNDED(R.drawable.bbuton_default_rounded, R.color.black),
- PRIMARY_ROUNDED(R.drawable.bbuton_primary_rounded, R.color.white),
- SUCCESS_ROUNDED(R.drawable.bbuton_success_rounded, R.color.white),
- INFO_ROUNDED(R.drawable.bbuton_info_rounded, R.color.white),
- WARNING_ROUNDED(R.drawable.bbuton_warning_rounded, R.color.white),
- DANGER_ROUNDED(R.drawable.bbuton_danger_rounded, R.color.white),
- INVERSE_ROUNDED(R.drawable.bbuton_inverse_rounded, R.color.white);
-
- private int backgroundDrawable;
- private int textColour;
-
- BootstrapTypes(int backgroundDrawable, int textColour)
- {
- this.backgroundDrawable = backgroundDrawable;
- this.textColour = textColour;
- }
- }
-
-
- private void initialise( AttributeSet attrs )
- {
- LayoutInflater inflator = (LayoutInflater)getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
-
- //get font
- readFont(getContext());
-
- TypedArray a = getContext().obtainStyledAttributes(attrs,
- R.styleable.BootstrapButton);
-
- //defaults
- BootstrapTypes type = null;
- String bootstrapType = "default";
- String iconLeft = "";
- String iconRight = "";
- String text = "";
- //boolean roundedCorners = false;
- float fontSize = 14.0f;
- float scale = getResources().getDisplayMetrics().density; //for padding
- String size = "default";
- int paddingA = (int) (10 *scale + 0.5f);
- int paddingB = (int) (15 *scale + 0.5f);
-
-
- //attribute values
-
- if (a.getString(R.styleable.BootstrapButton_bb_type) != null) {
- bootstrapType = a.getString(R.styleable.BootstrapButton_bb_type);
- }
-
- if (a.getString(R.styleable.BootstrapButton_bb_roundedCorners) != null) {
- roundedCorners = a.getBoolean(R.styleable.BootstrapButton_bb_roundedCorners, false) ;
- }
-
- if(a.getString(R.styleable.BootstrapButton_bb_size) != null) {
- size = a.getString(R.styleable.BootstrapButton_bb_size);
- }
-
- if ( a.getString(R.styleable.BootstrapButton_bb_icon_left) != null) {
- iconLeft = a.getString(R.styleable.BootstrapButton_bb_icon_left );
- }
-
- if(a.getString(R.styleable.BootstrapButton_bb_icon_right) != null) {
- iconRight = a.getString(R.styleable.BootstrapButton_bb_icon_right );
- }
-
- if(a.getString(R.styleable.BootstrapButton_android_text) != null) {
- text = a.getString(R.styleable.BootstrapButton_android_text);
- }
- String gravity = "";
- if(a.getString(R.styleable.BootstrapButton_bb_text_gravity) != null) {
- gravity = a.getString(R.styleable.BootstrapButton_bb_text_gravity);
- }
-
- boolean enabled = true;
- if(a.getString(R.styleable.BootstrapButton_android_enabled) != null) {
- enabled = a.getBoolean(R.styleable.BootstrapButton_android_enabled, true);
- }
-
- int layoutWidth = 0;
- if(a.getString(R.styleable.BootstrapButton_android_layout_width) != null) {
- layoutWidth = a.getInt(R.styleable.BootstrapButton_android_layout_width, 0);
- }
-
- //works even if it's fill_parent or match_parent
- if( (layoutWidth == LayoutParams.MATCH_PARENT)) {
- fillparent = true;
- }
-
- if(a.getString(R.styleable.BootstrapButton_android_textSize) != null) {
-
- //font sizes
- String xmlProvidedSize = attrs.getAttributeValue(
- "http://schemas.android.com/apk/res/android", "textSize");
- final Pattern PATTERN_FONT_SIZE = Pattern
- .compile("([0-9]+[.]?[0-9]*)sp");
- Matcher m = PATTERN_FONT_SIZE.matcher(xmlProvidedSize);
-
- if (m.find()) {
-
- if (m.groupCount() == 1) {
-
- fontSize = Float.valueOf(m.group(1));
- }
-
- }
-
- }
-
- a.recycle();
- View v = null;
- if(fillparent){
- v = inflator.inflate(R.layout.bootstrap_button_fill, null, false);
- } else {
- v = inflator.inflate(R.layout.bootstrap_button, null, false);
- }
-
-
- //set up font sizes and padding for different button sizes
- if(size.equals("large")){
- fontSize = 20.0f;
- paddingA = (int) (15 *scale + 0.5f);;
- paddingB = (int) (20 *scale + 0.5f);;
- }
-
- if(size.equals("small")){
- fontSize = 12.0f;
- paddingA = (int) (5 *scale + 0.5f);;
- paddingB = (int) (10 *scale + 0.5f);;
- }
-
- if(size.equals("xsmall")){
- fontSize = 10.0f;
- paddingA = (int) (2 *scale + 0.5f);;
- paddingB = (int) (5 *scale + 0.5f);;
- }
-
- //get layout items
- layout = (ViewGroup) v.findViewById(R.id.layout);
- lblLeft = (TextView) v.findViewById(R.id.lblLeft);
- lblMiddle = (TextView) v.findViewById(R.id.lblMiddle);
- lblRight = (TextView) v.findViewById(R.id.lblRight);
-
- //set the background
- //setBootstrapType(bootstrapType);
-
- //get the correct background type
- if(roundedCorners == true)
- {
- type = bbuttonTypeMapRounded.get(bootstrapType);
- } else {
- type = bbuttonTypeMap.get(bootstrapType);
- }
-
- //set up as default
- if (type == null)
- {
- type = BootstrapTypes.DEFAULT;
- }
-
- //apply the background type
- layout.setBackgroundResource(type.backgroundDrawable);
- lblLeft.setTextColor(getResources().getColor(type.textColour));
- lblMiddle.setTextColor(getResources().getColor(type.textColour));
- lblRight.setTextColor(getResources().getColor(type.textColour));
-
- //set the font awesome icon typeface
- lblLeft.setTypeface(font);
- lblRight.setTypeface(font);
-
- //set up the font size
- lblLeft.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
- lblMiddle.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
- lblRight.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
-
- //deal with gravity
-
- if(gravity.length() > 0) {
- setTextGravity(gravity);
- }
-
-
- boolean onlyIcon = true;
-
- //set the text
- if(text.length() > 0){
- lblMiddle.setText(text );
- lblMiddle.setVisibility(View.VISIBLE);
- onlyIcon = false;
- }
-
- //set up the padding
-
- if (iconLeft.length() > 0) {
- //lblLeft.setText(iconLeft);
- setLeftIcon(iconLeft);
- lblLeft.setVisibility(View.VISIBLE);
-
- if (onlyIcon == false){
- lblLeft.setPadding(paddingB, 0, 0, 0);
- } else {
- lblLeft.setPadding(paddingB, 0, paddingB, 0);
- }
-
- //padding for symmetry
- if ( ( iconRight.length() == 0) && onlyIcon == false ) {
- lblMiddle.setPadding(paddingA, 0, (int) paddingB, 0);
- }
-
- }
-
- if (iconRight.length() > 0) {
- //lblRight.setText(iconRight);
- setRightIcon(iconRight);
- lblRight.setVisibility(View.VISIBLE);
-
- if (onlyIcon == false){
- lblRight.setPadding(0, 0, paddingB, 0);
- }else {
- lblRight.setPadding(paddingB, 0, paddingB, 0);
- }
-
- //padding for symmetry
- if ( (iconLeft.length() == 0) && onlyIcon == false ) {
- lblMiddle.setPadding(paddingB, 0, (int) paddingA, 0);
- }
- }
-
- if(iconLeft.length() > 0 && iconRight.length() > 0 )
- {
- lblMiddle.setPadding(paddingA, 0, paddingA, 0);
- }
- this.setClickable(true);
-
- this.setEnabled(enabled);
-
- layout.setPadding(0, paddingB, 0, paddingB);
-
- addView(v);
- }
-
- //static class to read in font
- private static void readFont(Context context)
- {
-
- if(font == null){
- try {
- font = Typeface.createFromAsset(context.getAssets(), "fontawesome-webfont.ttf");
- } catch (Exception e) {
- Log.e("BootstrapButton", "Could not get typeface because " + e.getMessage());
- font = Typeface.DEFAULT;
- }
- }
-
- }
-
-
- /**
- * Changes the button text
- * @param text - String value for what is displayed on the button
- */
- public void setText(String text) {
- lblMiddle.setText(text);
- }
-
-
- /**
- * Changes the left icon on a BootstrapButton
- * @param leftIcon- String value for the icon as per http://fortawesome.github.io/Font-Awesome/cheatsheet/
- */
- public void setLeftIcon(String leftIcon) {
-
- String icon = faMap.get(leftIcon);
-
- if (icon == null)
- {
- icon = faMap.get(FA_ICON_QUESTION);
- }
-
- lblLeft.setText(icon);
- }
-
- /**
- * Changes the right icon on a BootstrapButton
- * @param rightIcon - String value for the icon as per http://fortawesome.github.io/Font-Awesome/cheatsheet/
- */
- public void setRightIcon(String rightIcon) {
-
- String icon = faMap.get(rightIcon);
-
- if (icon == null)
- {
- icon = faMap.get(FA_ICON_QUESTION);
- }
-
- lblRight.setText(icon);
-
- }
-
- /**
- * Changes the type of BootstrapButton
- * @param bootstrapType - String value for the type of button e.g. "primary"
- */
- public void setBootstrapType(String bootstrapType) {
-
- BootstrapTypes type = null;
-
- //get the correct background type
- if (roundedCorners == true) {
- type = bbuttonTypeMapRounded.get(bootstrapType);
- } else {
- type = bbuttonTypeMap.get(bootstrapType);
- }
-
- //set up as default
- if (type == null) {
- type = BootstrapTypes.DEFAULT;
- }
-
-
- layout.setBackgroundResource(type.backgroundDrawable);
- lblLeft.setTextColor(getResources().getColor(type.textColour));
- lblMiddle.setTextColor(getResources().getColor(type.textColour));
- lblRight.setTextColor(getResources().getColor(type.textColour));
-
- }
-
- /**
- * Specifies whether the BootstrapButton is enabled or disabled
- * @param enabled - boolean state for either enabled or disabled
- */
- public void setBootstrapButtonEnabled(boolean enabled)
- {
- this.setEnabled(enabled);
- }
-
-
- /**
- * Changes the gravity for the text on a bootstrap button that is not wrap_content
- * @param gravity - string for either center, right, or left.
- */
- public void setTextGravity(String gravity) {
- if(gravity.equals("left")) {
- lblMiddle.setGravity(Gravity.LEFT | Gravity.CENTER_VERTICAL);
- } else if (gravity.equals("center")) {
- lblMiddle.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
- } else if (gravity.equals("right")) {
- lblMiddle.setGravity(Gravity.RIGHT | Gravity.CENTER_VERTICAL);
- }
-
- }
-}
diff --git a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapCircleThumbnail.java b/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapCircleThumbnail.java
deleted file mode 100644
index 1eb353770..000000000
--- a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapCircleThumbnail.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package com.beardedhen.androidbootstrap;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.util.AttributeSet;
-import android.util.DisplayMetrics;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.widget.FrameLayout;
-import android.widget.ImageView;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-import com.beardedhen.androidbootstrap.utils.ImageUtils;
-
-public class BootstrapCircleThumbnail extends FrameLayout
-{
- private static final int PADDING_SMALL = 4;
- private static final int PADDING_MEDIUM = 4;
- private static final int PADDING_LARGE = 6;
- private static final int PADDING_XLARGE = 8;
-
- private static final int SIZE_SMALL = 48; //dp total size (outer circle)
- private static final int SIZE_MEDIUM = 80;//dp
- private static final int SIZE_LARGE = 112;//dp
- private static final int SIZE_XLARGE = 176;//dp
- private static final int SIZE_DEFAULT = SIZE_MEDIUM;
-
- private static final String SMALL = "small";
- private static final String MEDIUM = "medium";
- private static final String LARGE = "large";
- private static final String XLARGE = "xlarge";
-
- private LinearLayout container;
- private LinearLayout placeholder;
- private ImageView image;
- private TextView dimensionsLabel;
- private String size = MEDIUM;
- private boolean minimal = false;//minimal means display just the image, no padding
- private String text = "";
- private int imageWidth = SIZE_DEFAULT;
- private int imageHeight = SIZE_DEFAULT;
- private int padding = 0;
-
- public BootstrapCircleThumbnail(Context context, AttributeSet attrs, int defStyle)
- {
- super(context, attrs, defStyle);
- initialise(attrs);
- }
-
- public BootstrapCircleThumbnail(Context context, AttributeSet attrs)
- {
- super(context, attrs);
- initialise(attrs);
- }
-
- public BootstrapCircleThumbnail(Context context)
- {
- super(context);
- initialise(null);
- }
-
- private void initialise( AttributeSet attrs )
- {
- LayoutInflater inflator = (LayoutInflater)getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
-
-
- TypedArray a = getContext().obtainStyledAttributes(attrs,
- R.styleable.BootstrapCircleThumbnail);
-
-
- int imageDrawable = 0;
-
- if(a.getString(R.styleable.BootstrapCircleThumbnail_bct_image) != null)
- {
- imageDrawable = a.getResourceId(R.styleable.BootstrapCircleThumbnail_bct_image, 0);
-
- }
-
- if(a.getString(R.styleable.BootstrapCircleThumbnail_android_text) != null)
- {
- text = a.getString(R.styleable.BootstrapCircleThumbnail_android_text);
- }
-
- if(a.getString(R.styleable.BootstrapCircleThumbnail_bct_size) != null)
- {
- this.size = a.getString(R.styleable.BootstrapCircleThumbnail_bct_size);
- }
-
- if(a.getString(R.styleable.BootstrapCircleThumbnail_bct_minimal) != null)
- {
- this.minimal = a.getBoolean(R.styleable.BootstrapCircleThumbnail_bct_minimal, false);
- }
-
- a.recycle();
-
- View v = inflator.inflate(R.layout.bootstrap_thumbnail_circle, null, false);
- dimensionsLabel = (TextView) v.findViewById(R.id.dimensionsLabel);
- container = (LinearLayout) v.findViewById(R.id.container);
- placeholder = (LinearLayout) v.findViewById(R.id.placeholder);
- image = (ImageView) v.findViewById(R.id.image);
- float scale = getResources().getDisplayMetrics().density;
-
-
-
- //small image
- if(this.size.equals(SMALL))
- {
- padding = PADDING_SMALL;
- imageWidth = SIZE_SMALL;
- imageHeight = SIZE_SMALL;
-
- }
- else if(this.size.equals(MEDIUM))
- {
- padding = PADDING_MEDIUM;
- imageWidth = SIZE_MEDIUM;
- imageHeight = SIZE_MEDIUM;
- }
- else if(this.size.equals(LARGE))
- {
- padding = PADDING_LARGE;
- imageWidth = SIZE_LARGE;
- imageHeight = SIZE_LARGE;
- }
- else if(this.size.equals(XLARGE))
- {
- padding = PADDING_XLARGE;
- imageWidth = SIZE_XLARGE;
- imageHeight = SIZE_XLARGE;
- }
- //no valid size is given, set image to default size
- else
- {
- padding = PADDING_MEDIUM;
- imageWidth = SIZE_DEFAULT;
- imageHeight = SIZE_DEFAULT;
- }
-
- //convert padding to pixels
- DisplayMetrics displayMetrics = getContext().getResources().getDisplayMetrics();
- int paddingPX = (int)((padding * scale) + 0.5);
-
- //convert image size to pixels
- int imageSizeWidthPX = (int)((imageWidth * scale) + 0.5);
- int imageSizeHeightPX = (int)((imageHeight * scale) + 0.5);
-
- //make inner image smaller to compensate for the padding so that entire circle including padding equals the size
- //ex. small image = 48dp, small padding = 4dp, inner image = 48 - (4 * 2) = 40
- if(this.minimal == false)
- {
- imageSizeWidthPX = imageSizeWidthPX - (paddingPX * 2);
- imageSizeHeightPX = imageSizeHeightPX - (paddingPX * 2);
-
- this.container.setPadding(paddingPX, paddingPX, paddingPX, paddingPX);
- container.setBackgroundResource(R.drawable.thumbnail_circle_container);
- }
- else
- {
- container.setBackgroundResource(R.drawable.thumbnail_circle_minimal);
- }
-
- //if no image is given
- if(imageDrawable == 0)
- {
- this.image.setVisibility(View.GONE);
- placeholder.setLayoutParams(new LinearLayout.LayoutParams(imageSizeWidthPX, imageSizeHeightPX));
- placeholder.setPadding(paddingPX, paddingPX, paddingPX, paddingPX);
-
- //set placeholder image
- placeholder.setBackgroundResource(R.drawable.thumbnail_circle);
-
- this.dimensionsLabel.setText(text);
- }
- else
- {
- placeholder.setPadding(0, 0, 0, 0);
- this.dimensionsLabel.setVisibility(View.GONE);
- Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(), imageDrawable);
-
- Bitmap roundBitmap = ImageUtils.getCircleBitmap(bitmap, imageSizeWidthPX, imageSizeHeightPX);
- image.setImageBitmap(roundBitmap);
- }
-
- this.addView(v);
- }
-
- public void setImage(int drawable)
- {
- Bitmap bitmap = BitmapFactory.decodeResource(getContext().getResources(), drawable);
-
- float scale = getResources().getDisplayMetrics().density;
-
- //convert image size to pixels
- int widthPX = (int)((this.imageWidth * scale) + 0.5);
- int heightPX = (int)((this.imageHeight * scale) + 0.5);
-
- int paddingPX = (int)((this.padding * scale) + 0.5);
-
- if(this.minimal == false)
- {
- widthPX = widthPX - (paddingPX * 2);
- heightPX = heightPX - (paddingPX * 2);
- }
-
- Bitmap roundBitmap = ImageUtils.getCircleBitmap(bitmap, widthPX, heightPX);
- image.setImageBitmap(roundBitmap);
-
- invalidate();
- requestLayout();
- }
-}
diff --git a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapEditText.java b/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapEditText.java
deleted file mode 100644
index c258f8a09..000000000
--- a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapEditText.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package com.beardedhen.androidbootstrap;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.util.AttributeSet;
-import android.util.TypedValue;
-import android.widget.EditText;
-
-public class BootstrapEditText extends EditText {
-
- private boolean roundedCorners = false;
-
- public BootstrapEditText(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- initialise(attrs);
- }
-
- public BootstrapEditText(Context context, AttributeSet attrs) {
- super(context, attrs);
- initialise(attrs);
- }
-
- public BootstrapEditText(Context context) {
- super(context);
- initialise(null);
- }
-
- public static final String BOOTSTRAP_EDIT_TEXT_DEFAULT = "default";
- public static final String BOOTSTRAP_EDIT_TEXT_SUCCESS = "success";
- public static final String BOOTSTRAP_EDIT_TEXT_WARNING = "warning";
- public static final String BOOTSTRAP_EDIT_TEXT_DANGER = "danger";
-
-
- private void initialise( AttributeSet attrs )
- {
-
- TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.BootstrapEditText);
-
- //get defaults
- float fontSize = 14.0f;
- String state = "default";
- String text = "";
- String hint = "";
- boolean enabled = true;
-
- //font size
- if (a.getString(R.styleable.BootstrapEditText_android_textSize) != null) {
-
- String xmlProvidedSize = attrs.getAttributeValue( "http://schemas.android.com/apk/res/android", "textSize");
- final Pattern PATTERN_FONT_SIZE = Pattern
- .compile("([0-9]+[.]?[0-9]*)sp");
- Matcher m = PATTERN_FONT_SIZE.matcher(xmlProvidedSize);
-
- if (m.find()) {
- if (m.groupCount() == 1) {
- fontSize = Float.valueOf(m.group(1));
- }
- }
- }
-
- //rounded corners
- if(a.getString(R.styleable.BootstrapEditText_be_roundedCorners) != null) {
- roundedCorners = a.getBoolean(R.styleable.BootstrapEditText_be_roundedCorners, false);
- }
-
- //state
- if(a.getString(R.styleable.BootstrapEditText_be_state) != null) {
- state = a.getString(R.styleable.BootstrapEditText_be_state);
- }
-
- //text
- if(a.getString(R.styleable.BootstrapEditText_android_text) != null) {
- text = a.getString(R.styleable.BootstrapEditText_android_text);
- }
-
- //hint
- if(a.getString(R.styleable.BootstrapEditText_android_hint) != null) {
- hint = a.getString(R.styleable.BootstrapEditText_android_hint);
- }
-
- //enabled
- if(a.getString(R.styleable.BootstrapEditText_android_enabled) != null) {
- enabled = a.getBoolean(R.styleable.BootstrapEditText_android_enabled, true);
- }
-
- //set values
- this.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
- this.setText(text);
- this.setHint(hint);
- this.setEnabled(enabled);
-
- if (enabled){
- //work out the right background
- setBackgroundDrawable(state);
-
- }
-
- a.recycle();
-
- //addView(editTextView);
- }
-
-
- private void setBackgroundDrawable(String state)
- {
- if(roundedCorners){
- this.setBackgroundResource(R.drawable.edittext_background_rounded);
- } else {
- this.setBackgroundResource(R.drawable.edittext_background);
- }
-
- if(roundedCorners){
-
- if (state.equals(BOOTSTRAP_EDIT_TEXT_SUCCESS)){
- this.setBackgroundResource(R.drawable.edittext_background_rounded_success);
- } else if (state.equals(BOOTSTRAP_EDIT_TEXT_WARNING)){
- this.setBackgroundResource(R.drawable.edittext_background_rounded_warning);
- } else if (state.equals(BOOTSTRAP_EDIT_TEXT_DANGER)){
- this.setBackgroundResource(R.drawable.edittext_background_rounded_danger);
- }
-
- } else {
-
- if (state.equals(BOOTSTRAP_EDIT_TEXT_SUCCESS)){
- this.setBackgroundResource(R.drawable.edittext_background_success);
- } else if (state.equals(BOOTSTRAP_EDIT_TEXT_WARNING)){
- this.setBackgroundResource(R.drawable.edittext_background_warning);
- } else if (state.equals(BOOTSTRAP_EDIT_TEXT_DANGER)){
- this.setBackgroundResource(R.drawable.edittext_background_danger);
- }
-
- }
- }
-
-
- /**
- * Change the BootstrapEditTextState
- * @param state
- */
- public void setState(String state){
- setBackgroundDrawable(state);
- }
-
- /**
- * Set the BootstrapEditText to a successful state
- */
- public void setSuccess()
- {
- setBackgroundDrawable(BOOTSTRAP_EDIT_TEXT_SUCCESS);
- }
-
- /**
- * Set the BootstrapEditText to a warning state
- */
- public void setWarning()
- {
- setBackgroundDrawable(BOOTSTRAP_EDIT_TEXT_WARNING);
- }
-
- /**
- * Set the BootstrapEditText to a danger state
- */
- public void setDanger()
- {
- setBackgroundDrawable(BOOTSTRAP_EDIT_TEXT_DANGER);
- }
-
- /**
- * Set the BootstrapEditText to a default state
- */
- public void setDefault()
- {
- setBackgroundDrawable(BOOTSTRAP_EDIT_TEXT_DEFAULT);
- }
-
- /**
- * Specifies whether the BootstrapEditText is enabled or disabled
- * @param enabled - boolean state for either enabled or disabled
- */
- public void setBootstrapEditTextEnabled(boolean enabled)
- {
- this.setEnabled(enabled);
- }
-
-}
diff --git a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapThumbnail.java b/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapThumbnail.java
deleted file mode 100644
index a4e1ba1bc..000000000
--- a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/BootstrapThumbnail.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package com.beardedhen.androidbootstrap;
-
-import java.util.HashMap;
-import java.util.Map;
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Typeface;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.FrameLayout;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-
-public class BootstrapThumbnail extends FrameLayout
-{
- private static final int DEFAULT_WIDTH = 150; //width of thumbnail when no width is given
- private static final int DEFAULT_HEIGHT = 150;//height of thumbnail when no height is given
- private static final int DEFAULT_MAX_PADDING = 8; //8dp is max padding size when padding isn't specified by user
- private static final int DEFAULT_MIN_PADDING = 4; //4dp
- private static final String DEFAULT_TYPE = "rounded";
-
- private static Map<String, ThumbnailTypes> bThumbnailTypeMap;
- private static Typeface font;
- private ViewGroup container;
- private LinearLayout placeholder;
- private TextView dimensionsLabel;
- private boolean roundedCorners = true;
-
- static{
- bThumbnailTypeMap = new HashMap<String, ThumbnailTypes>();
-
- bThumbnailTypeMap.put("rounded", ThumbnailTypes.ROUNDED);//default is rounded if user doesn't specify to use square
- bThumbnailTypeMap.put("square", ThumbnailTypes.SQUARE);
- }
-
- public BootstrapThumbnail(Context context, AttributeSet attrs, int defStyle)
- {
- super(context, attrs, defStyle);
- initialise(attrs);
- }
-
- public BootstrapThumbnail(Context context, AttributeSet attrs)
- {
- super(context, attrs);
- initialise(attrs);
- }
-
- public BootstrapThumbnail(Context context)
- {
- super(context);
- initialise(null);
- }
-
- public void setImage(int drawable)
- {
- this.placeholder.setBackgroundResource(drawable);
- invalidate();
- requestLayout();
- }
-
- //set up the bootstrap types
- private enum ThumbnailTypes
- {
- ROUNDED(R.drawable.bthumbnail_container_rounded, R.drawable.bthumbnail_placeholder_default),
- SQUARE(R.drawable.bthumbnail_container_square, R.drawable.bthumbnail_placeholder_default);
-
- private int containerDrawable;
- private int placeholderDrawable;
-
- ThumbnailTypes(int containerDrawable, int placeholderDrawable)
- {
- this.containerDrawable = containerDrawable;
- this.placeholderDrawable = placeholderDrawable;
- }
- }
-
- private void initialise( AttributeSet attrs )
- {
- LayoutInflater inflator = (LayoutInflater)getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
-
- readFont(getContext());
-
- TypedArray a = getContext().obtainStyledAttributes(attrs,
- R.styleable.BootstrapThumbnail);
-
- //defaults
- ThumbnailTypes type = null;
- String thumbnailType = DEFAULT_TYPE;
- String text = "";
- int imageDrawable = 0;
- float scale = getResources().getDisplayMetrics().density; //for padding
- int width = DEFAULT_WIDTH;
- int height = DEFAULT_HEIGHT;
- int padding = 0;
- int paddingDP = 0;
-
- //attribute values
- if(a.getString(R.styleable.BootstrapThumbnail_bt_width) != null) {
- width = (int) a.getDimension(R.styleable.BootstrapThumbnail_bt_width, 0);
- Log.v("width", Integer.toString(width));
- }
-
- if(a.getString(R.styleable.BootstrapThumbnail_bt_height) != null) {
- height = (int) a.getDimension(R.styleable.BootstrapThumbnail_bt_height, 0);
- }
-
- if(a.getString(R.styleable.BootstrapThumbnail_bt_inside_padding) != null) {
- paddingDP = (int) a.getDimension(R.styleable.BootstrapThumbnail_bt_inside_padding, 0);
- }
- else{
- padding = (int) (((Math.sqrt(width * height)) / 100) * 2);
- if(padding > DEFAULT_MAX_PADDING)
- padding = DEFAULT_MAX_PADDING;
- if(padding < DEFAULT_MIN_PADDING)
- padding = DEFAULT_MIN_PADDING;
-
- paddingDP = (int) (padding * scale + 0.5f);//container padding in DP
- }
-
- if(a.getString(R.styleable.BootstrapThumbnail_bt_roundedCorners) != null){
- roundedCorners = a.getBoolean(R.styleable.BootstrapThumbnail_bt_roundedCorners, false) ;
- }
-
- if(a.getString(R.styleable.BootstrapThumbnail_bt_image) != null){
- imageDrawable = a.getResourceId(R.styleable.BootstrapThumbnail_bt_image, 0);
- }
-
- a.recycle();
-
- text = (int)(width/scale) + "x" + (int)(height/scale);
- View v = inflator.inflate(R.layout.bootstrap_thumbnail, null, false);
-
- //get layout items
- container = (ViewGroup) v.findViewById(R.id.container);
- placeholder = (LinearLayout) v.findViewById(R.id.placeholder);
- dimensionsLabel = (TextView) v.findViewById(R.id.dimensionsLabel);
-
- Log.v("size", "width:" + width + " height:" + height);
-
-
- type = bThumbnailTypeMap.get(thumbnailType);
-
- //get the correct background type
- if(roundedCorners == true)
- {
- type = bThumbnailTypeMap.get("rounded");
- } else {
- type = bThumbnailTypeMap.get("square");
- }
-
- //apply the background type
- container.setBackgroundResource(type.containerDrawable);
-
- //if no image is provided by user
- if(imageDrawable == 0){
- //set default grey placeholder background
- placeholder.setBackgroundResource(type.placeholderDrawable);
-
- //set the text
- if(text.length() > 0){
- dimensionsLabel.setText(text);
- dimensionsLabel.setVisibility(View.VISIBLE);
- }
- }
- else{
- //set background to user's provided image
- placeholder.setBackgroundResource(imageDrawable);
-
- //remove textview dimensions
- dimensionsLabel.setVisibility(View.GONE);
- }
-
- //placeholder padding
- int paddingP = (int) (((Math.sqrt(width * height)) / 100) * 4);
-
- //convert to DP
- int paddingDPP = (int) (paddingP * scale + 0.5f);//placeholder padding in DP
-
- container.setPadding(paddingDP, paddingDP, paddingDP, paddingDP);
- placeholder.setPadding(paddingDPP, paddingDPP, paddingDPP, paddingDPP);
-
- placeholder.setLayoutParams(new LinearLayout.LayoutParams(width,height));
-
- //set the font awesome icon typeface
- dimensionsLabel.setTypeface(font);
-
- this.setClickable(true);
-
- addView(v);
- }
-
- //static class to read in font
- private static void readFont(Context context)
- {
- if(font == null){
- try {
- font = Typeface.createFromAsset(context.getAssets(), "fontawesome-webfont.ttf");
- } catch (Exception e) {
- Log.e("BootstrapButton", "Could not get typeface because " + e.getMessage());
- font = Typeface.DEFAULT;
- }
- }
-
- }
-}
diff --git a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/FontAwesome.java b/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/FontAwesome.java
deleted file mode 100644
index 2038094ac..000000000
--- a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/FontAwesome.java
+++ /dev/null
@@ -1,390 +0,0 @@
-package com.beardedhen.androidbootstrap;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class FontAwesome {
-
- private static Map<String, String> faMap = new HashMap<String, String>();
-
- //font awesome map as per
- //http://fortawesome.github.io/Font-Awesome/cheatsheet/
-
- static {
- faMap.put("fa-glass", "\uf000");
- faMap.put("fa-music", "\uf001");
- faMap.put("fa-search", "\uf002");
- faMap.put("fa-envelope-o", "\uf003");
- faMap.put("fa-heart", "\uf004");
- faMap.put("fa-star", "\uf005");
- faMap.put("fa-star-o", "\uf006");
- faMap.put("fa-user", "\uf007");
- faMap.put("fa-film", "\uf008");
- faMap.put("fa-th-large", "\uf009");
- faMap.put("fa-th", "\uf00a");
- faMap.put("fa-th-list", "\uf00b");
- faMap.put("fa-check", "\uf00c");
- faMap.put("fa-times", "\uf00d");
- faMap.put("fa-search-plus", "\uf00e");
- faMap.put("fa-search-minus", "\uf010");
- faMap.put("fa-power-off", "\uf011");
- faMap.put("fa-signal", "\uf012");
- faMap.put("fa-cog", "\uf013");
- faMap.put("fa-trash-o", "\uf014");
- faMap.put("fa-home", "\uf015");
- faMap.put("fa-file-o", "\uf016");
- faMap.put("fa-clock-o", "\uf017");
- faMap.put("fa-road", "\uf018");
- faMap.put("fa-download", "\uf019");
- faMap.put("fa-arrow-circle-o-down", "\uf01a");
- faMap.put("fa-arrow-circle-o-up", "\uf01b");
- faMap.put("fa-inbox", "\uf01c");
- faMap.put("fa-play-circle-o", "\uf01d");
- faMap.put("fa-repeat", "\uf01e");
- faMap.put("fa-refresh", "\uf021");
- faMap.put("fa-list-alt", "\uf022");
- faMap.put("fa-lock", "\uf023");
- faMap.put("fa-flag", "\uf024");
- faMap.put("fa-headphones", "\uf025");
- faMap.put("fa-volume-off", "\uf026");
- faMap.put("fa-volume-down", "\uf027");
- faMap.put("fa-volume-up", "\uf028");
- faMap.put("fa-qrcode", "\uf029");
- faMap.put("fa-barcode", "\uf02a");
- faMap.put("fa-tag", "\uf02b");
- faMap.put("fa-tags", "\uf02c");
- faMap.put("fa-book", "\uf02d");
- faMap.put("fa-bookmark", "\uf02e");
- faMap.put("fa-print", "\uf02f");
- faMap.put("fa-camera", "\uf030");
- faMap.put("fa-font", "\uf031");
- faMap.put("fa-bold", "\uf032");
- faMap.put("fa-italic", "\uf033");
- faMap.put("fa-text-height", "\uf034");
- faMap.put("fa-text-width", "\uf035");
- faMap.put("fa-align-left", "\uf036");
- faMap.put("fa-align-center", "\uf037");
- faMap.put("fa-align-right", "\uf038");
- faMap.put("fa-align-justify", "\uf039");
- faMap.put("fa-list", "\uf03a");
- faMap.put("fa-outdent", "\uf03b");
- faMap.put("fa-indent", "\uf03c");
- faMap.put("fa-video-camera", "\uf03d");
- faMap.put("fa-picture-o", "\uf03e");
- faMap.put("fa-pencil", "\uf040");
- faMap.put("fa-map-marker", "\uf041");
- faMap.put("fa-adjust", "\uf042");
- faMap.put("fa-tint", "\uf043");
- faMap.put("fa-pencil-square-o", "\uf044");
- faMap.put("fa-share-square-o", "\uf045");
- faMap.put("fa-check-square-o", "\uf046");
- faMap.put("fa-move", "\uf047");
- faMap.put("fa-step-backward", "\uf048");
- faMap.put("fa-fast-backward", "\uf049");
- faMap.put("fa-backward", "\uf04a");
- faMap.put("fa-play", "\uf04b");
- faMap.put("fa-pause", "\uf04c");
- faMap.put("fa-stop", "\uf04d");
- faMap.put("fa-forward", "\uf04e");
- faMap.put("fa-fast-forward", "\uf050");
- faMap.put("fa-step-forward", "\uf051");
- faMap.put("fa-eject", "\uf052");
- faMap.put("fa-chevron-left", "\uf053");
- faMap.put("fa-chevron-right", "\uf054");
- faMap.put("fa-plus-circle", "\uf055");
- faMap.put("fa-minus-circle", "\uf056");
- faMap.put("fa-times-circle", "\uf057");
- faMap.put("fa-check-circle", "\uf058");
- faMap.put("fa-question-circle", "\uf059");
- faMap.put("fa-info-circle", "\uf05a");
- faMap.put("fa-crosshairs", "\uf05b");
- faMap.put("fa-times-circle-o", "\uf05c");
- faMap.put("fa-check-circle-o", "\uf05d");
- faMap.put("fa-ban", "\uf05e");
- faMap.put("fa-arrow-left", "\uf060");
- faMap.put("fa-arrow-right", "\uf061");
- faMap.put("fa-arrow-up", "\uf062");
- faMap.put("fa-arrow-down", "\uf063");
- faMap.put("fa-share", "\uf064");
- faMap.put("fa-resize-full", "\uf065");
- faMap.put("fa-resize-small", "\uf066");
- faMap.put("fa-plus", "\uf067");
- faMap.put("fa-minus", "\uf068");
- faMap.put("fa-asterisk", "\uf069");
- faMap.put("fa-exclamation-circle", "\uf06a");
- faMap.put("fa-gift", "\uf06b");
- faMap.put("fa-leaf", "\uf06c");
- faMap.put("fa-fire", "\uf06d");
- faMap.put("fa-eye", "\uf06e");
- faMap.put("fa-eye-slash", "\uf070");
- faMap.put("fa-exclamation-triangle", "\uf071");
- faMap.put("fa-plane", "\uf072");
- faMap.put("fa-calendar", "\uf073");
- faMap.put("fa-random", "\uf074");
- faMap.put("fa-comment", "\uf075");
- faMap.put("fa-magnet", "\uf076");
- faMap.put("fa-chevron-up", "\uf077");
- faMap.put("fa-chevron-down", "\uf078");
- faMap.put("fa-retweet", "\uf079");
- faMap.put("fa-shopping-cart", "\uf07a");
- faMap.put("fa-folder", "\uf07b");
- faMap.put("fa-folder-open", "\uf07c");
- faMap.put("fa-resize-vertical", "\uf07d");
- faMap.put("fa-resize-horizontal", "\uf07e");
- faMap.put("fa-bar-chart-o", "\uf080");
- faMap.put("fa-twitter-square", "\uf081");
- faMap.put("fa-facebook-square", "\uf082");
- faMap.put("fa-camera-retro", "\uf083");
- faMap.put("fa-key", "\uf084");
- faMap.put("fa-cogs", "\uf085");
- faMap.put("fa-comments", "\uf086");
- faMap.put("fa-thumbs-o-up", "\uf087");
- faMap.put("fa-thumbs-o-down", "\uf088");
- faMap.put("fa-star-half", "\uf089");
- faMap.put("fa-heart-o", "\uf08a");
- faMap.put("fa-sign-out", "\uf08b");
- faMap.put("fa-linkedin-square", "\uf08c");
- faMap.put("fa-thumb-tack", "\uf08d");
- faMap.put("fa-external-link", "\uf08e");
- faMap.put("fa-sign-in", "\uf090");
- faMap.put("fa-trophy", "\uf091");
- faMap.put("fa-github-square", "\uf092");
- faMap.put("fa-upload", "\uf093");
- faMap.put("fa-lemon-o", "\uf094");
- faMap.put("fa-phone", "\uf095");
- faMap.put("fa-square-o", "\uf096");
- faMap.put("fa-bookmark-o", "\uf097");
- faMap.put("fa-phone-square", "\uf098");
- faMap.put("fa-twitter", "\uf099");
- faMap.put("fa-facebook", "\uf09a");
- faMap.put("fa-github", "\uf09b");
- faMap.put("fa-unlock", "\uf09c");
- faMap.put("fa-credit-card", "\uf09d");
- faMap.put("fa-rss", "\uf09e");
- faMap.put("fa-hdd", "\uf0a0");
- faMap.put("fa-bullhorn", "\uf0a1");
- faMap.put("fa-bell", "\uf0f3");
- faMap.put("fa-certificate", "\uf0a3");
- faMap.put("fa-hand-o-right", "\uf0a4");
- faMap.put("fa-hand-o-left", "\uf0a5");
- faMap.put("fa-hand-o-up", "\uf0a6");
- faMap.put("fa-hand-o-down", "\uf0a7");
- faMap.put("fa-arrow-circle-left", "\uf0a8");
- faMap.put("fa-arrow-circle-right", "\uf0a9");
- faMap.put("fa-arrow-circle-up", "\uf0aa");
- faMap.put("fa-arrow-circle-down", "\uf0ab");
- faMap.put("fa-globe", "\uf0ac");
- faMap.put("fa-wrench", "\uf0ad");
- faMap.put("fa-tasks", "\uf0ae");
- faMap.put("fa-filter", "\uf0b0");
- faMap.put("fa-briefcase", "\uf0b1");
- faMap.put("fa-fullscreen", "\uf0b2");
- faMap.put("fa-group", "\uf0c0");
- faMap.put("fa-link", "\uf0c1");
- faMap.put("fa-cloud", "\uf0c2");
- faMap.put("fa-flask", "\uf0c3");
- faMap.put("fa-scissors", "\uf0c4");
- faMap.put("fa-files-o", "\uf0c5");
- faMap.put("fa-paperclip", "\uf0c6");
- faMap.put("fa-floppy-o", "\uf0c7");
- faMap.put("fa-square", "\uf0c8");
- faMap.put("fa-reorder", "\uf0c9");
- faMap.put("fa-list-ul", "\uf0ca");
- faMap.put("fa-list-ol", "\uf0cb");
- faMap.put("fa-strikethrough", "\uf0cc");
- faMap.put("fa-underline", "\uf0cd");
- faMap.put("fa-table", "\uf0ce");
- faMap.put("fa-magic", "\uf0d0");
- faMap.put("fa-truck", "\uf0d1");
- faMap.put("fa-pinterest", "\uf0d2");
- faMap.put("fa-pinterest-square", "\uf0d3");
- faMap.put("fa-google-plus-square", "\uf0d4");
- faMap.put("fa-google-plus", "\uf0d5");
- faMap.put("fa-money", "\uf0d6");
- faMap.put("fa-caret-down", "\uf0d7");
- faMap.put("fa-caret-up", "\uf0d8");
- faMap.put("fa-caret-left", "\uf0d9");
- faMap.put("fa-caret-right", "\uf0da");
- faMap.put("fa-columns", "\uf0db");
- faMap.put("fa-sort", "\uf0dc");
- faMap.put("fa-sort-asc", "\uf0dd");
- faMap.put("fa-sort-desc", "\uf0de");
- faMap.put("fa-envelope", "\uf0e0");
- faMap.put("fa-linkedin", "\uf0e1");
- faMap.put("fa-undo", "\uf0e2");
- faMap.put("fa-gavel", "\uf0e3");
- faMap.put("fa-tachometer", "\uf0e4");
- faMap.put("fa-comment-o", "\uf0e5");
- faMap.put("fa-comments-o", "\uf0e6");
- faMap.put("fa-bolt", "\uf0e7");
- faMap.put("fa-sitemap", "\uf0e8");
- faMap.put("fa-umbrella", "\uf0e9");
- faMap.put("fa-clipboard", "\uf0ea");
- faMap.put("fa-lightbulb-o", "\uf0eb");
- faMap.put("fa-exchange", "\uf0ec");
- faMap.put("fa-cloud-download", "\uf0ed");
- faMap.put("fa-cloud-upload", "\uf0ee");
- faMap.put("fa-user-md", "\uf0f0");
- faMap.put("fa-stethoscope", "\uf0f1");
- faMap.put("fa-suitcase", "\uf0f2");
- faMap.put("fa-bell-o", "\uf0a2");
- faMap.put("fa-coffee", "\uf0f4");
- faMap.put("fa-cutlery", "\uf0f5");
- faMap.put("fa-file-text-o", "\uf0f6");
- faMap.put("fa-building", "\uf0f7");
- faMap.put("fa-hospital", "\uf0f8");
- faMap.put("fa-ambulance", "\uf0f9");
- faMap.put("fa-medkit", "\uf0fa");
- faMap.put("fa-fighter-jet", "\uf0fb");
- faMap.put("fa-beer", "\uf0fc");
- faMap.put("fa-h-square", "\uf0fd");
- faMap.put("fa-plus-square", "\uf0fe");
- faMap.put("fa-angle-double-left", "\uf100");
- faMap.put("fa-angle-double-right", "\uf101");
- faMap.put("fa-angle-double-up", "\uf102");
- faMap.put("fa-angle-double-down", "\uf103");
- faMap.put("fa-angle-left", "\uf104");
- faMap.put("fa-angle-right", "\uf105");
- faMap.put("fa-angle-up", "\uf106");
- faMap.put("fa-angle-down", "\uf107");
- faMap.put("fa-desktop", "\uf108");
- faMap.put("fa-laptop", "\uf109");
- faMap.put("fa-tablet", "\uf10a");
- faMap.put("fa-mobile", "\uf10b");
- faMap.put("fa-circle-o", "\uf10c");
- faMap.put("fa-quote-left", "\uf10d");
- faMap.put("fa-quote-right", "\uf10e");
- faMap.put("fa-spinner", "\uf110");
- faMap.put("fa-circle", "\uf111");
- faMap.put("fa-reply", "\uf112");
- faMap.put("fa-github-alt", "\uf113");
- faMap.put("fa-folder-o", "\uf114");
- faMap.put("fa-folder-open-o", "\uf115");
- faMap.put("fa-expand-o", "\uf116");
- faMap.put("fa-collapse-o", "\uf117");
- faMap.put("fa-smile-o", "\uf118");
- faMap.put("fa-frown-o", "\uf119");
- faMap.put("fa-meh-o", "\uf11a");
- faMap.put("fa-gamepad", "\uf11b");
- faMap.put("fa-keyboard-o", "\uf11c");
- faMap.put("fa-flag-o", "\uf11d");
- faMap.put("fa-flag-checkered", "\uf11e");
- faMap.put("fa-terminal", "\uf120");
- faMap.put("fa-code", "\uf121");
- faMap.put("fa-reply-all", "\uf122");
- faMap.put("fa-mail-reply-all", "\uf122");
- faMap.put("fa-star-half-o", "\uf123");
- faMap.put("fa-location-arrow", "\uf124");
- faMap.put("fa-crop", "\uf125");
- faMap.put("fa-code-fork", "\uf126");
- faMap.put("fa-chain-broken", "\uf127");
- faMap.put("fa-question", "\uf128");
- faMap.put("fa-info", "\uf129");
- faMap.put("fa-exclamation", "\uf12a");
- faMap.put("fa-superscript", "\uf12b");
- faMap.put("fa-subscript", "\uf12c");
- faMap.put("fa-eraser", "\uf12d");
- faMap.put("fa-puzzle-piece", "\uf12e");
- faMap.put("fa-microphone", "\uf130");
- faMap.put("fa-microphone-slash", "\uf131");
- faMap.put("fa-shield", "\uf132");
- faMap.put("fa-calendar-o", "\uf133");
- faMap.put("fa-fire-extinguisher", "\uf134");
- faMap.put("fa-rocket", "\uf135");
- faMap.put("fa-maxcdn", "\uf136");
- faMap.put("fa-chevron-circle-left", "\uf137");
- faMap.put("fa-chevron-circle-right", "\uf138");
- faMap.put("fa-chevron-circle-up", "\uf139");
- faMap.put("fa-chevron-circle-down", "\uf13a");
- faMap.put("fa-html5", "\uf13b");
- faMap.put("fa-css3", "\uf13c");
- faMap.put("fa-anchor", "\uf13d");
- faMap.put("fa-unlock-o", "\uf13e");
- faMap.put("fa-bullseye", "\uf140");
- faMap.put("fa-ellipsis-horizontal", "\uf141");
- faMap.put("fa-ellipsis-vertical", "\uf142");
- faMap.put("fa-rss-square", "\uf143");
- faMap.put("fa-play-circle", "\uf144");
- faMap.put("fa-ticket", "\uf145");
- faMap.put("fa-minus-square", "\uf146");
- faMap.put("fa-minus-square-o", "\uf147");
- faMap.put("fa-level-up", "\uf148");
- faMap.put("fa-level-down", "\uf149");
- faMap.put("fa-check-square", "\uf14a");
- faMap.put("fa-pencil-square", "\uf14b");
- faMap.put("fa-external-link-square", "\uf14c");
- faMap.put("fa-share-square", "\uf14d");
- faMap.put("fa-compass", "\uf14e");
- faMap.put("fa-caret-square-o-down", "\uf150");
- faMap.put("fa-caret-square-o-up", "\uf151");
- faMap.put("fa-caret-square-o-right", "\uf152");
- faMap.put("fa-eur", "\uf153");
- faMap.put("fa-gbp", "\uf154");
- faMap.put("fa-usd", "\uf155");
- faMap.put("fa-inr", "\uf156");
- faMap.put("fa-jpy", "\uf157");
- faMap.put("fa-rub", "\uf158");
- faMap.put("fa-krw", "\uf159");
- faMap.put("fa-btc", "\uf15a");
- faMap.put("fa-file", "\uf15b");
- faMap.put("fa-file-text", "\uf15c");
- faMap.put("fa-sort-alpha-asc", "\uf15d");
- faMap.put("fa-sort-alpha-desc", "\uf15e");
- faMap.put("fa-sort-amount-asc", "\uf160");
- faMap.put("fa-sort-amount-desc", "\uf161");
- faMap.put("fa-sort-numeric-asc", "\uf162");
- faMap.put("fa-sort-numeric-desc", "\uf163");
- faMap.put("fa-thumbs-up", "\uf164");
- faMap.put("fa-thumbs-down", "\uf165");
- faMap.put("fa-youtube-square", "\uf166");
- faMap.put("fa-youtube", "\uf167");
- faMap.put("fa-xing", "\uf168");
- faMap.put("fa-xing-square", "\uf169");
- faMap.put("fa-youtube-play", "\uf16a");
- faMap.put("fa-dropbox", "\uf16b");
- faMap.put("fa-stack-overflow", "\uf16c");
- faMap.put("fa-instagram", "\uf16d");
- faMap.put("fa-flickr", "\uf16e");
- faMap.put("fa-adn", "\uf170");
- faMap.put("fa-bitbucket", "\uf171");
- faMap.put("fa-bitbucket-square", "\uf172");
- faMap.put("fa-tumblr", "\uf173");
- faMap.put("fa-tumblr-square", "\uf174");
- faMap.put("fa-long-arrow-down", "\uf175");
- faMap.put("fa-long-arrow-up", "\uf176");
- faMap.put("fa-long-arrow-left", "\uf177");
- faMap.put("fa-long-arrow-right", "\uf178");
- faMap.put("fa-apple", "\uf179");
- faMap.put("fa-windows", "\uf17a");
- faMap.put("fa-android", "\uf17b");
- faMap.put("fa-linux", "\uf17c");
- faMap.put("fa-dribbble", "\uf17d");
- faMap.put("fa-skype", "\uf17e");
- faMap.put("fa-foursquare", "\uf180");
- faMap.put("fa-trello", "\uf181");
- faMap.put("fa-female", "\uf182");
- faMap.put("fa-male", "\uf183");
- faMap.put("fa-gittip", "\uf184");
- faMap.put("fa-sun-o", "\uf185");
- faMap.put("fa-moon-o", "\uf186");
- faMap.put("fa-archive", "\uf187");
- faMap.put("fa-bug", "\uf188");
- faMap.put("fa-vk", "\uf189");
- faMap.put("fa-weibo", "\uf18a");
- faMap.put("fa-renren", "\uf18b");
- faMap.put("fa-pagelines", "\uf18c");
- faMap.put("fa-stack-exchange", "\uf18d");
- faMap.put("fa-arrow-circle-o-right", "\uf18e");
- faMap.put("fa-arrow-circle-o-left", "\uf190");
- faMap.put("fa-caret-square-o-left", "\uf191");
- faMap.put("fa-dot-circle-o", "\uf192");
- faMap.put("fa-wheelchair", "\uf193");
- faMap.put("fa-vimeo-square", "\uf194");
- }
-
- public static Map<String, String> getFaMap()
- {
- return faMap;
- }
-
-}
diff --git a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/FontAwesomeText.java b/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/FontAwesomeText.java
deleted file mode 100644
index 75a130c5a..000000000
--- a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/FontAwesomeText.java
+++ /dev/null
@@ -1,274 +0,0 @@
-package com.beardedhen.androidbootstrap;
-
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Typeface;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.util.TypedValue;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.animation.AlphaAnimation;
-import android.view.animation.Animation;
-import android.view.animation.LinearInterpolator;
-import android.view.animation.RotateAnimation;
-import android.widget.FrameLayout;
-import android.widget.TextView;
-
-import com.beardedhen.androidbootstrap.R;
-
-public class FontAwesomeText extends FrameLayout {
-
- private static Typeface font;
- private static Map<String, String> faMap;
-
- private TextView tv;
-
- private static final String FA_ICON_QUESTION = "fa-question";
-
- public enum AnimationSpeed
- {
- FAST,
- MEDIUM,
- SLOW;
- }
-
- static{
- faMap = FontAwesome.getFaMap();
- }
-
- public FontAwesomeText(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- initialise(attrs);
- }
-
- public FontAwesomeText(Context context, AttributeSet attrs) {
- super(context, attrs);
- initialise(attrs);
- }
-
- public FontAwesomeText(Context context) {
- super(context);
- initialise(null);
- }
-
-
-
-
- private void initialise( AttributeSet attrs )
- {
- LayoutInflater inflator = (LayoutInflater)getContext().getSystemService(
- Context.LAYOUT_INFLATER_SERVICE);
-
- //get font
- readFont(getContext());
-
- TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.FontAwesomeText);
-
- //inflate the view
- View fontAwesomeTextView = inflator.inflate(R.layout.font_awesome_text, null, false);
- tv = (TextView)fontAwesomeTextView.findViewById(R.id.lblText);
-
- String icon = "";
- float fontSize = 14.0f;
-
- //icon
- if (a.getString(R.styleable.FontAwesomeText_fa_icon) != null) {
- icon = a.getString(R.styleable.FontAwesomeText_fa_icon);
- }
-
- //font size
- if (a.getString(R.styleable.FontAwesomeText_android_textSize) != null) {
-
- String xmlProvidedSize = attrs.getAttributeValue(
- "http://schemas.android.com/apk/res/android", "textSize");
- final Pattern PATTERN_FONT_SIZE = Pattern
- .compile("([0-9]+[.]?[0-9]*)sp");
- Matcher m = PATTERN_FONT_SIZE.matcher(xmlProvidedSize);
-
- if (m.find()) {
- if (m.groupCount() == 1) {
- fontSize = Float.valueOf(m.group(1));
- }
- }
- }
-
- //text colour
- if(a.getString(R.styleable.FontAwesomeText_android_textColor) != null){
- tv.setTextColor(a.getColor(R.styleable.FontAwesomeText_android_textColor, R.color.bbutton_inverse));
- }
-
- setIcon(icon);
-
- tv.setTypeface(font);
- tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, fontSize);
-
- a.recycle();
- addView(fontAwesomeTextView);
- }
-
- private static void readFont(Context context)
- {
-
- if(font == null){
- try {
- font = Typeface.createFromAsset(context.getAssets(), "fontawesome-webfont.ttf");
- } catch (Exception e) {
- Log.e("BButton", "Could not get typeface because " + e.getMessage());
- font = Typeface.DEFAULT;
- }
- }
-
- }
-
-
- /**
- * Used to start flashing a FontAwesomeText item
- * @param context the current applications context
- * @param forever whether the item should flash repeatedly or just once
- * @param speed how fast the item should flash, chose between FontAwesomeText.AnimationSpeed.SLOW /
- * FontAwesomeText.AnimationSpeed.MEDIUM / FontAwesomeText.AnimationSpeed.FAST
- */
- public void startFlashing(Context context, boolean forever, AnimationSpeed speed)
- {
-
- Animation fadeIn = new AlphaAnimation(0, 1);
-
- //set up extra variables
- fadeIn.setDuration(50);
- fadeIn.setRepeatMode(Animation.REVERSE);
-
- //default repeat count is 0, however if user wants, set it up to be infinite
- fadeIn.setRepeatCount(0);
- if (forever){
- fadeIn.setRepeatCount(Animation.INFINITE);
- }
-
- //default speed
- fadeIn.setStartOffset(1000);
-
- //fast
- if (speed.equals(AnimationSpeed.FAST))
- {
- fadeIn.setStartOffset(200);
- }
-
- //medium
- if (speed.equals(AnimationSpeed.MEDIUM))
- {
- fadeIn.setStartOffset(500);
- }
-
- //set the new animation to a final animation
- final Animation animation = fadeIn;
-
- //run the animation - used to work correctly on older devices
- tv.postDelayed(new Runnable() {
- @Override
- public void run() {
- tv.startAnimation(animation);
- }
- }, 100);
- }
-
-
- /**
- * Used to start rotating a FontAwesomeText item
- * @param context the current applications context
- * @param clockwise true for clockwise, false for anti clockwise spinning
- * @param speed how fast the item should flash, chose between FontAwesomeText.AnimationSpeed.SLOW /
- * FontAwesomeText.AnimationSpeed.MEDIUM / FontAwesomeText.AnimationSpeed.FAST
- */
- public void startRotate(Context context, boolean clockwise, AnimationSpeed speed)
- {
- Animation rotate;
-
- //set up the rotation animation
- if (clockwise){
- rotate = new RotateAnimation(0, 360, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
- } else {
- rotate = new RotateAnimation(360, 0, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,0.5f);
- }
-
- //set up some extra variables
- rotate.setRepeatCount(Animation.INFINITE);
- rotate.setInterpolator(new LinearInterpolator());
- rotate.setStartOffset(0);
- rotate.setRepeatMode(Animation.RESTART);
-
- //defaults
- rotate.setDuration(2000);
-
- //fast
- if (speed.equals(AnimationSpeed.FAST))
- {
- rotate.setDuration(500);
- }
-
- //medium
- if (speed.equals(AnimationSpeed.MEDIUM))
- {
- rotate.setDuration(1000);
- }
-
- //send the new animation to a final animation
- final Animation animation = rotate;
-
- //run the animation - used to work correctly on older devices
- tv.postDelayed(new Runnable() {
- @Override
- public void run() {
- tv.startAnimation(animation);
- }
- }, 100);
-
- }
-
-
- /**
- * Used to stop animating any FontAwesomeText item
- */
- public void stopAnimation(){
- //stop the animation
- tv.clearAnimation();
- }
-
-
- /**
- * Used to set the icon for a FontAwesomeText item
- * @param faIcon - String value for the icon as per http://fortawesome.github.io/Font-Awesome/cheatsheet/
- */
- public void setIcon(String faIcon) {
-
- String icon = faMap.get(faIcon);
-
- if (icon == null)
- {
- icon = faMap.get(FA_ICON_QUESTION);
- }
-
- tv.setText(icon);
- }
-
- /**
- * Used to set the text color of the underlying text view.
- * @param color - Integer value representing a color resource.
- */
- public void setTextColor(int color) {
- tv.setTextColor(color);
- }
-
- /**
- * Used to set the text size of the underlying text view.
- * @param unit - Integer value representing a unit size
- * @param size - Float value representing text size
- */
- public void setTextSize(int unit, float size) {
- tv.setTextSize(unit, size);
- }
-
-}
diff --git a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/utils/AutoResizeTextView.java b/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/utils/AutoResizeTextView.java
deleted file mode 100644
index be6f328d3..000000000
--- a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/utils/AutoResizeTextView.java
+++ /dev/null
@@ -1,303 +0,0 @@
-package com.beardedhen.androidbootstrap.utils;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.Resources;
-import android.graphics.RectF;
-import android.os.Build;
-import android.text.Layout.Alignment;
-import android.text.StaticLayout;
-import android.text.TextPaint;
-import android.util.AttributeSet;
-import android.util.SparseIntArray;
-import android.util.TypedValue;
-import android.widget.TextView;
-
-/**
- *
- * Code from user M-WaJeEh on StackOverflow at
- * http://stackoverflow.com/questions/5033012/auto-scale-textview-text-to-fit-within-bounds/17782522#17782522
- *
- */
-
-public class AutoResizeTextView extends TextView {
-private interface SizeTester {
- /**
- *
- * @param suggestedSize
- * Size of text to be tested
- * @param availableSpace
- * available space in which text must fit
- * @return an integer < 0 if after applying {@code suggestedSize} to
- * text, it takes less space than {@code availableSpace}, > 0
- * otherwise
- */
- public int onTestSize(int suggestedSize, RectF availableSpace);
-}
-
-private RectF mTextRect = new RectF();
-
-private RectF mAvailableSpaceRect;
-
-private SparseIntArray mTextCachedSizes;
-
-private TextPaint mPaint;
-
-private float mMaxTextSize;
-
-private float mSpacingMult = 1.0f;
-
-private float mSpacingAdd = 0.0f;
-
-private float mMinTextSize = 20;
-
-private int mWidthLimit;
-
-private static final int NO_LINE_LIMIT = -1;
-private int mMaxLines;
-
-private boolean mEnableSizeCache = true;
-private boolean mInitiallized;
-
-public AutoResizeTextView(Context context) {
- super(context);
- initialize();
-}
-
-public AutoResizeTextView(Context context, AttributeSet attrs) {
- super(context, attrs);
- initialize();
-}
-
-public AutoResizeTextView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- initialize();
-}
-
-private void initialize() {
- mPaint = new TextPaint(getPaint());
- mMaxTextSize = getTextSize();
- mAvailableSpaceRect = new RectF();
- mTextCachedSizes = new SparseIntArray();
- if (mMaxLines == 0) {
- // no value was assigned during construction
- mMaxLines = NO_LINE_LIMIT;
- }
- mInitiallized = true;
-}
-
-@Override
-public void setText(final CharSequence text, BufferType type) {
- super.setText(text, type);
- adjustTextSize(text.toString());
-}
-
-@Override
-public void setTextSize(float size) {
- mMaxTextSize = size;
- mTextCachedSizes.clear();
- adjustTextSize(getText().toString());
-}
-
-@Override
-public void setMaxLines(int maxlines) {
- super.setMaxLines(maxlines);
- mMaxLines = maxlines;
- reAdjust();
-}
-
-public int getMaxLines() {
- return mMaxLines;
-}
-
-@Override
-public void setSingleLine() {
- super.setSingleLine();
- mMaxLines = 1;
- reAdjust();
-}
-
-@Override
-public void setSingleLine(boolean singleLine) {
- super.setSingleLine(singleLine);
- if (singleLine) {
- mMaxLines = 1;
- } else {
- mMaxLines = NO_LINE_LIMIT;
- }
- reAdjust();
-}
-
-@Override
-public void setLines(int lines) {
- super.setLines(lines);
- mMaxLines = lines;
- reAdjust();
-}
-
-@Override
-public void setTextSize(int unit, float size) {
- Context c = getContext();
- Resources r;
-
- if (c == null)
- r = Resources.getSystem();
- else
- r = c.getResources();
- mMaxTextSize = TypedValue.applyDimension(unit, size,
- r.getDisplayMetrics());
- mTextCachedSizes.clear();
- adjustTextSize(getText().toString());
-}
-
-@Override
-public void setLineSpacing(float add, float mult) {
- super.setLineSpacing(add, mult);
- mSpacingMult = mult;
- mSpacingAdd = add;
-}
-
-/**
- * Set the lower text size limit and invalidate the view
- *
- * @param minTextSize
- */
-public void setMinTextSize(float minTextSize) {
- mMinTextSize = minTextSize;
- reAdjust();
-}
-
-private void reAdjust() {
- adjustTextSize(getText().toString());
-}
-
-private void adjustTextSize(String string) {
- if (!mInitiallized) {
- return;
- }
- int startSize = (int) mMinTextSize;
- int heightLimit = getMeasuredHeight() - getCompoundPaddingBottom()
- - getCompoundPaddingTop();
- mWidthLimit = getMeasuredWidth() - getCompoundPaddingLeft()
- - getCompoundPaddingRight();
- mAvailableSpaceRect.right = mWidthLimit;
- mAvailableSpaceRect.bottom = heightLimit;
- super.setTextSize(
- TypedValue.COMPLEX_UNIT_PX,
- efficientTextSizeSearch(startSize, (int) mMaxTextSize,
- mSizeTester, mAvailableSpaceRect));
-}
-
-private final SizeTester mSizeTester = new SizeTester() {
- @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
- @Override
- public int onTestSize(int suggestedSize, RectF availableSPace) {
- mPaint.setTextSize(suggestedSize);
- String text = getText().toString();
- boolean singleline = getMaxLines() == 1;
- if (singleline) {
- mTextRect.bottom = mPaint.getFontSpacing();
- mTextRect.right = mPaint.measureText(text);
- } else {
- StaticLayout layout = new StaticLayout(text, mPaint,
- mWidthLimit, Alignment.ALIGN_NORMAL, mSpacingMult,
- mSpacingAdd, true);
- // return early if we have more lines
- if (getMaxLines() != NO_LINE_LIMIT
- && layout.getLineCount() > getMaxLines()) {
- return 1;
- }
- mTextRect.bottom = layout.getHeight();
- int maxWidth = -1;
- for (int i = 0; i < layout.getLineCount(); i++) {
- if (maxWidth < layout.getLineWidth(i)) {
- maxWidth = (int) layout.getLineWidth(i);
- }
- }
- mTextRect.right = maxWidth;
- }
-
- mTextRect.offsetTo(0, 0);
- if (availableSPace.contains(mTextRect)) {
- // may be too small, don't worry we will find the best match
- return -1;
- } else {
- // too big
- return 1;
- }
- }
-};
-
-/**
- * Enables or disables size caching, enabling it will improve performance
- * where you are animating a value inside TextView. This stores the font
- * size against getText().length() Be careful though while enabling it as 0
- * takes more space than 1 on some fonts and so on.
- *
- * @param enable
- * enable font size caching
- */
-public void enableSizeCache(boolean enable) {
- mEnableSizeCache = enable;
- mTextCachedSizes.clear();
- adjustTextSize(getText().toString());
-}
-
-private int efficientTextSizeSearch(int start, int end,
- SizeTester sizeTester, RectF availableSpace) {
- if (!mEnableSizeCache) {
- return binarySearch(start, end, sizeTester, availableSpace);
- }
- String text = getText().toString();
- int key = text == null ? 0 : text.length();
- int size = mTextCachedSizes.get(key);
- if (size != 0) {
- return size;
- }
- size = binarySearch(start, end, sizeTester, availableSpace);
- mTextCachedSizes.put(key, size);
- return size;
-}
-
-private static int binarySearch(int start, int end, SizeTester sizeTester,
- RectF availableSpace) {
- int lastBest = start;
- int lo = start;
- int hi = end - 1;
- int mid = 0;
- while (lo <= hi) {
- mid = (lo + hi) >>> 1;
- int midValCmp = sizeTester.onTestSize(mid, availableSpace);
- if (midValCmp < 0) {
- lastBest = lo;
- lo = mid + 1;
- } else if (midValCmp > 0) {
- hi = mid - 1;
- lastBest = hi;
- } else {
- return mid;
- }
- }
- // make sure to return last best
- // this is what should always be returned
- return lastBest;
-
-}
-
-@Override
-protected void onTextChanged(final CharSequence text, final int start,
- final int before, final int after) {
- super.onTextChanged(text, start, before, after);
- reAdjust();
-}
-
-@Override
-protected void onSizeChanged(int width, int height, int oldwidth,
- int oldheight) {
- mTextCachedSizes.clear();
- super.onSizeChanged(width, height, oldwidth, oldheight);
- if (width != oldwidth || height != oldheight) {
- reAdjust();
- }
-}
-}
diff --git a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/utils/ImageUtils.java b/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/utils/ImageUtils.java
deleted file mode 100644
index 3eefa9366..000000000
--- a/libraries/AndroidBootstrap/src/com/beardedhen/androidbootstrap/utils/ImageUtils.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package com.beardedhen.androidbootstrap.utils;
-
-
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PorterDuffXfermode;
-import android.graphics.Rect;
-import android.graphics.RectF;
-import android.graphics.Bitmap.Config;
-import android.graphics.PorterDuff.Mode;
-
-public class ImageUtils
-{
-
- public static Bitmap getCircleBitmap(Bitmap bitmap)
- {
- return getCircleBitmap(bitmap, bitmap.getWidth(), bitmap.getHeight());
- }
-
- public static Bitmap getCircleBitmap(Bitmap bitmap, int width, int height)
- {
- Bitmap croppedBitmap = scaleCenterCrop(bitmap, width, height);
- Bitmap output = Bitmap.createBitmap(width, height, Config.ARGB_8888);
- Canvas canvas = new Canvas(output);
-
- final int color = 0xff424242;
- final Paint paint = new Paint();
-
- final Rect rect = new Rect(0, 0, width, height);
- final RectF rectF = new RectF(rect);
-
- paint.setAntiAlias(true);
- canvas.drawARGB(0, 0, 0, 0);
- paint.setColor(color);
-
- int radius = 0;
- if(width > height)
- {
- radius = height / 2;
- }
- else
- {
- radius = width / 2;
- }
-
- canvas.drawCircle(width / 2, height / 2, radius, paint);
- paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
- canvas.drawBitmap(croppedBitmap, rect, rect, paint);
-
- return output;
- }
-
- public static Bitmap scaleCenterCrop(Bitmap source, int newHeight, int newWidth)
- {
- int sourceWidth = source.getWidth();
- int sourceHeight = source.getHeight();
-
- float xScale = (float) newWidth / sourceWidth;
- float yScale = (float) newHeight / sourceHeight;
- float scale = Math.max(xScale, yScale);
-
- float scaledWidth = scale * sourceWidth;
- float scaledHeight = scale * sourceHeight;
-
- float left = (newWidth - scaledWidth) / 2;
- float top = (newHeight - scaledHeight) / 2;
-
- RectF targetRect = new RectF(left, top, left + scaledWidth, top + scaledHeight);
-
- Bitmap dest = Bitmap.createBitmap(newWidth, newHeight, source.getConfig());
- Canvas canvas = new Canvas(dest);
- canvas.drawBitmap(source, null, targetRect, null);
-
- return dest;
- }
-} \ No newline at end of file