diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index c631715..d8bada3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip diff --git a/sample/.DS_Store b/sample/.DS_Store new file mode 100644 index 0000000..74bb733 Binary files /dev/null and b/sample/.DS_Store differ diff --git a/sample/src/.DS_Store b/sample/src/.DS_Store new file mode 100644 index 0000000..d1aafd5 Binary files /dev/null and b/sample/src/.DS_Store differ diff --git a/sample/src/main/.DS_Store b/sample/src/main/.DS_Store new file mode 100644 index 0000000..ef53c16 Binary files /dev/null and b/sample/src/main/.DS_Store differ diff --git a/sample/src/main/java/com/vinaygaba/sample/MainActivity.java b/sample/src/main/java/com/vinaygaba/sample/MainActivity.java index 9e36ce2..e374c6d 100644 --- a/sample/src/main/java/com/vinaygaba/sample/MainActivity.java +++ b/sample/src/main/java/com/vinaygaba/sample/MainActivity.java @@ -111,11 +111,8 @@ public boolean onTouch(View v, MotionEvent event) { mColorPicker.setCallback(new ColorPickerCallback() { @Override public void onColorChosen(@ColorInt int color) { - Drawable background = mTextColor.getCompoundDrawables()[2]; - GradientDrawable gradientDrawable = (GradientDrawable) background; - gradientDrawable.setColor(color); + setColor(mTextColor, color); mTextColorValue = color; - mColorPicker.dismiss(); } }); return false; @@ -129,10 +126,7 @@ public boolean onTouch(View v, MotionEvent event) { mColorPicker.setCallback(new ColorPickerCallback() { @Override public void onColorChosen(@ColorInt int color) { - Drawable background = mTextBackgroundColor.getCompoundDrawables()[2]; - GradientDrawable gradientDrawable = (GradientDrawable) background; - gradientDrawable.setColor(color); - mTextBackgroundColorValue = color; + setColor(mTextBackgroundColor, color); mColorPicker.dismiss(); } }); @@ -154,25 +148,22 @@ public void generateRubberStamp() { RubberStampPosition rubberStampPosition = convertToRubberStampPosition(mRubberStampPosition.getSelectedItemPosition()); + RubberStampConfig.RubberStampConfigBuilder builder = new RubberStampConfig.RubberStampConfigBuilder() + .base(mBaseBitmap) + .alpha(alpha) + .rotation(rotation) + .rubberStampPosition(rubberStampPosition); + if(mRadioGroup.getCheckedRadioButtonId() == R.id.bitmapRubberStamp) { Bitmap logo = BitmapFactory.decodeResource(getResources(), R.drawable.logo); - - config = new RubberStampConfig.RubberStampConfigBuilder() - .base(mBaseBitmap) - .rubberStamp(logo) - .alpha(alpha) - .rotation(rotation) - .rubberStampPosition(rubberStampPosition) - .build(); + config = builder + .rubberStamp(logo) + .build(); } else { String path = convertFontPositionToPath(mTextFonts.getSelectedItemPosition()); Shader shader = getShader(); - config = new RubberStampConfig.RubberStampConfigBuilder() - .base(mBaseBitmap) - .alpha(alpha) - .rotation(rotation) - .rubberStampPosition(rubberStampPosition) + config = builder .rubberStamp(mRubberStampText.getText().toString()) .textColor(mTextColorValue) .textBackgroundColor(mTextBackgroundColorValue) @@ -283,4 +274,11 @@ public Shader getShader() { } return null; } + + public void setColor(TextView textView, int color) { + Drawable background = textView.getCompoundDrawables()[2]; + GradientDrawable gradientDrawable = (GradientDrawable) background; + gradientDrawable.setColor(color); + mColorPicker.dismiss(); + } } \ No newline at end of file diff --git a/sample/src/main/res/.DS_Store b/sample/src/main/res/.DS_Store new file mode 100644 index 0000000..a315c4a Binary files /dev/null and b/sample/src/main/res/.DS_Store differ diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index a00edf5..14d598c 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -9,6 +9,7 @@ android:layout_width="match_parent" android:layout_height="@dimen/base_image_height" android:layout_alignParentTop="true" + android:src="@drawable/lenna" android:scaleType="centerInside" />