diff --git a/app/src/main/java/com/github/ivbaranov/mli/example/MainActivity.java b/app/src/main/java/com/github/ivbaranov/mli/example/MainActivity.java index fc96cbc..4a3e2a5 100644 --- a/app/src/main/java/com/github/ivbaranov/mli/example/MainActivity.java +++ b/app/src/main/java/com/github/ivbaranov/mli/example/MainActivity.java @@ -138,7 +138,7 @@ public SimpleStringRecyclerViewAdapter(Context context, List items, int break; } holder.mBoundString = mValues.get(position); - holder.mIcon.setCircleColor(mMaterialColors[RANDOM.nextInt(mMaterialColors.length)]); + holder.mIcon.setShapeColor(mMaterialColors[RANDOM.nextInt(mMaterialColors.length)]); holder.mTextView.setText(mValues.get(position)); holder.mIcon.setLetter(mValues.get(position)); } diff --git a/materiallettericon/src/main/java/com/github/ivbaranov/mli/MaterialLetterIcon.java b/materiallettericon/src/main/java/com/github/ivbaranov/mli/MaterialLetterIcon.java index bb582ed..8962a36 100644 --- a/materiallettericon/src/main/java/com/github/ivbaranov/mli/MaterialLetterIcon.java +++ b/materiallettericon/src/main/java/com/github/ivbaranov/mli/MaterialLetterIcon.java @@ -14,17 +14,22 @@ import com.example.ivbaranov.ma.R; public class MaterialLetterIcon extends View { - private final static int DEFAULT_CIRCLE_COLOR = Color.BLACK; + public final static int SHAPE_CIRCLE = 0; + public final static int SHAPE_RECT = 1; + private final static Rect textBounds = new Rect(); + + private final static int DEFAULT_SHAPE_COLOR = Color.BLACK; + private final static int DEFAULT_SHAPE = SHAPE_CIRCLE; private final static int DEFAULT_LETTER_COLOR = Color.WHITE; private final static int DEFAULT_LETTER_SIZE = 26; private final static String DEFAULT_FONT_PATH = "fonts/Roboto-Light.ttf"; private final static int DEFAULT_LETTERS_NUMBER = 1; - private final static Rect textBounds = new Rect(); private Context context; - private Paint mCirclePaint; + private Paint mShapePaint; private Paint mLetterPaint; - private int mCircleColor; + private int mShapeColor; + private int mShapeType; private String mLetter; private int mLetterColor; private int mLetterSize; @@ -58,7 +63,8 @@ public MaterialLetterIcon(Context context, AttributeSet attrs, int defStyleAttr, /** * Initialize the default values *