Skip to content

Commit

Permalink
Nits
Browse files Browse the repository at this point in the history
  • Loading branch information
vinaygaba committed Jun 28, 2017
1 parent 89ff623 commit a3a07bc
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 22 deletions.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file added sample/.DS_Store
Binary file not shown.
Binary file added sample/src/.DS_Store
Binary file not shown.
Binary file added sample/src/main/.DS_Store
Binary file not shown.
40 changes: 19 additions & 21 deletions sample/src/main/java/com/vinaygaba/sample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
});
Expand All @@ -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)
Expand Down Expand Up @@ -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();
}
}
Binary file added sample/src/main/res/.DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions sample/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>

Expand Down

0 comments on commit a3a07bc

Please sign in to comment.