Skip to content
This repository has been archived by the owner on Nov 10, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Adw41t committed Aug 15, 2021
2 parents b81d2b8 + e22ec89 commit 877406d
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 40 deletions.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,36 @@ new GuideView.Builder(this)
.setDismissType(DismissType.outSide) //optional - default dismissible by TargetView
.build()
.show();
```
```

## Change title and Content text color

```java
new GuideView.Builder(this)
.setTitle("Guide Title Text")
.setContentText("Guide Description Text\n .....Guide Description Text\n .....Guide Description Text .....")
.setTargetView(view)
.setMessageTitleColor(Color.BLACK)//optional - default is BLACK
.setMessageContentTextColor(Color.BLACK)//optional - default is BLACK
.setDismissType(DismissType.outSide) //optional - default dismissible by TargetView
.build()
.show();
```

## Change MessageBox color and color of Line and Pointer

```java
new GuideView.Builder(this)
.setTitle("Guide Title Text")
.setContentText("Guide Description Text\n .....Guide Description Text\n .....Guide Description Text .....")
.setTargetView(view)
.setMessageBoxColor(Color.WHITE) //optional - default is WHITE
.setLineAndPointerColor(Color.WHITE) //optional - default is WHITE
.setDismissType(DismissType.outSide) //optional - default dismissible by TargetView
.build()
.show();
```

## Change Gravity

```java
Expand All @@ -112,6 +141,17 @@ new GuideView.Builder(this)
.build()
.show();
```
## use Skip for Sequence of ShowCase
```java
new GuideView.Builder(this)
.setTitle("Guide Title Text")
.setTargetView(view)
.setSkip(true,view6) // view6 is supposed to be the last target view of the sequence.
.setDismissType(DismissType.outSide) //optional - default dismissible by TargetView
.build()
.show();
```

## Set Listener
```java
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ android {
compileSdkVersion 26
defaultConfig {
applicationId "smartdevelop.ir.eram.showcaseview"
minSdkVersion 21
targetSdkVersion 26
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected void onCreate(Bundle savedInstanceState) {
.setLineAndPointerColor(Color.WHITE)
.setMessageTitleColor(Color.WHITE)
.setMessageContentTextColor(Color.WHITE)
.setSkip(true,view6)
.enableSkipButton(view6)
.setGuideListener(new GuideListener() {
@Override
public void onDismiss(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,16 @@ public void setColor(int color) {
invalidate();
}

public void setTitleColor(int color) {
if(color!=0)
mTitleTextView.setTextColor(color);
public void setTitleColor(int titleColor) {
if(titleColor!=0) {
mTitleTextView.setTextColor(titleColor);
}
}

public void setContentTextColor(int color) {
if(color!=0)
mContentTextView.setTextColor(color);
public void setContentTextColor(int contentTextColor) {
if(contentTextColor!=0) {
mContentTextView.setTextColor(contentTextColor);
}
}
@Override
protected void onDraw(Canvas canvas) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public class GuideView extends FrameLayout {
private static final int MARGIN_INDICATOR = 15;

private static final int BACKGROUND_COLOR = 0x99000000;
private static int CIRCLE_INNER_INDICATOR_COLOR = 0xffcccccc;
private static int CIRCLE_INDICATOR_COLOR = Color.WHITE;
private static int LINE_INDICATOR_COLOR = Color.WHITE;
private static final int CIRCLE_INNER_INDICATOR_COLOR = 0xffcccccc;
private static final int CIRCLE_INDICATOR_COLOR = Color.WHITE;
private static final int LINE_INDICATOR_COLOR = Color.WHITE;

private final Paint selfPaint = new Paint();
private final Paint paintLine = new Paint();
Expand Down Expand Up @@ -87,6 +87,9 @@ public class GuideView extends FrameLayout {
private int messageBoxColor = Color.WHITE;
private int messageTitleColor = Color.BLACK;
private int messageContentTextColor = Color.BLACK;
private int circleInnerIndicatorColor = 0xffcccccc;
private int circleIndicatorColor = Color.WHITE;
private int lineIndicatorColor = Color.WHITE;

private boolean isPerformedAnimationSize = false;

Expand All @@ -97,8 +100,9 @@ public class GuideView extends FrameLayout {
private final GuideMessageView mMessageView;
private final TextView skipButton;
private View lastTargetView;
//Skip button is false by default
private boolean setSkip =false;
private boolean enableSkipButton = false;
private static final String SKIP_BUTTON_TEXT = "SKIP";
private static final int MARGIN_SIZE = 10;
FrameLayout.LayoutParams skipParams;

private GuideView(Context context, View view) {
Expand All @@ -124,7 +128,7 @@ private GuideView(Context context, View view) {

mMessageView = new GuideMessageView(getContext());
skipButton = new TextView(context);
skipButton.setText("SKIP");
skipButton.setText(SKIP_BUTTON_TEXT);
skipButton.setTextColor(Color.WHITE);
skipButton.setGravity(android.view.Gravity.CENTER);
skipButton.setPadding(
Expand Down Expand Up @@ -155,7 +159,7 @@ private GuideView(Context context, View view) {
skipButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if(setSkip && lastTargetView!=null)
if(enableSkipButton && lastTargetView!=null)
dismiss(lastTargetView);
}
});
Expand Down Expand Up @@ -282,7 +286,9 @@ private boolean isLandscape() {

private int checkOrientation(){
try{
Display display = ((WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
Display display = ((WindowManager) getContext()
.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
int rotation = display.getRotation();
return rotation;
}
Expand All @@ -305,18 +311,18 @@ protected void onDraw(final Canvas canvas) {
canvas.drawRect(selfRect, selfPaint);

paintLine.setStyle(Paint.Style.FILL);
paintLine.setColor(LINE_INDICATOR_COLOR);
paintLine.setColor(lineIndicatorColor);
paintLine.setStrokeWidth(lineIndicatorWidthSize);
paintLine.setAntiAlias(true);

paintCircle.setStyle(Paint.Style.STROKE);
paintCircle.setColor(CIRCLE_INDICATOR_COLOR);
paintCircle.setColor(circleIndicatorColor);
paintCircle.setStrokeCap(Paint.Cap.ROUND);
paintCircle.setStrokeWidth(strokeCircleWidth);
paintCircle.setAntiAlias(true);

paintCircleInner.setStyle(Paint.Style.FILL);
paintCircleInner.setColor(CIRCLE_INNER_INDICATOR_COLOR);
paintCircleInner.setColor(circleInnerIndicatorColor);
paintCircleInner.setAntiAlias(true);

final float x = (targetRect.left / 2 + targetRect.right / 2);
Expand Down Expand Up @@ -484,21 +490,21 @@ public void show() {
startAnimation.setFillAfter(true);
this.startAnimation(startAnimation);
mIsShowing = true;
if(setSkip) {
if(enableSkipButton) {

switch(checkOrientation()){
case Surface.ROTATION_0:
((LayoutParams)skipParams).setMargins(0,0,10,140);
((LayoutParams)skipParams).setMargins(0,0,MARGIN_SIZE,getNavigationBarSize());
((LayoutParams)skipParams).gravity = android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM;
break;

case Surface.ROTATION_90:
((LayoutParams)skipParams).setMargins(10,0,0,0);
((LayoutParams)skipParams).setMargins(MARGIN_SIZE,0,0,0);
((LayoutParams)skipParams).gravity = android.view.Gravity.LEFT | android.view.Gravity.BOTTOM;
break;

case Surface.ROTATION_270:
((LayoutParams)skipParams).setMargins(0,0,10,0);
((LayoutParams)skipParams).setMargins(0,0,MARGIN_SIZE,0);
((LayoutParams)skipParams).gravity = android.view.Gravity.RIGHT | android.view.Gravity.BOTTOM;
break;
}
Expand Down Expand Up @@ -558,7 +564,7 @@ public static class Builder {
private int lineAndPointerColor;
private int pointerColor;
private int lineColor;
private boolean setSkip;
private boolean enableSkipButton;
private View lastTargetView;
private int messageTitleColor;
private int messageContentTextColor;
Expand Down Expand Up @@ -809,12 +815,11 @@ public Builder setMessageContentTextColor(int messageContentTextColor) {
/**
* the defined setSkip overrides any defined setSkip in the default
*
* @param setSkip true if to show Skip button
* @param lastTargetView Last target view
* @return builder
*/
public Builder setSkip(boolean setSkip,View lastTargetView) {
this.setSkip = setSkip;
public Builder enableSkipButton(View lastTargetView) {
this.enableSkipButton = true;
this.lastTargetView = lastTargetView;
return this;
}
Expand All @@ -825,7 +830,7 @@ public GuideView build() {
guideView.dismissType = dismissType != null ? dismissType : DismissType.targetView;
guideView.pointerType = pointerType != null ? pointerType : PointerType.circle;
float density = context.getResources().getDisplayMetrics().density;
guideView.setSkip = setSkip;
guideView.enableSkipButton = enableSkipButton;
guideView.setTitle(title);
if (contentText != null) {
guideView.setContentText(contentText);
Expand Down Expand Up @@ -867,30 +872,30 @@ public GuideView build() {
guideView.messageBoxColor = messageBoxColor;
}
if (messageBoxAndLineAndPointerColor != 0) {
guideView.LINE_INDICATOR_COLOR = messageBoxAndLineAndPointerColor;
guideView.CIRCLE_INDICATOR_COLOR = messageBoxAndLineAndPointerColor;
guideView.CIRCLE_INNER_INDICATOR_COLOR = messageBoxAndLineAndPointerColor;
guideView.lineIndicatorColor = messageBoxAndLineAndPointerColor;
guideView.circleIndicatorColor = messageBoxAndLineAndPointerColor;
guideView.circleInnerIndicatorColor = messageBoxAndLineAndPointerColor;
guideView.messageBoxColor = messageBoxAndLineAndPointerColor;
}
if (lineAndPointerColor != 0) {
guideView.LINE_INDICATOR_COLOR = lineAndPointerColor;
guideView.CIRCLE_INDICATOR_COLOR = lineAndPointerColor;
guideView.CIRCLE_INNER_INDICATOR_COLOR = lineAndPointerColor;
guideView.lineIndicatorColor = lineAndPointerColor;
guideView.circleIndicatorColor = lineAndPointerColor;
guideView.circleInnerIndicatorColor = lineAndPointerColor;
}
if (lineColor != 0) {
guideView.LINE_INDICATOR_COLOR = lineColor;
guideView.lineIndicatorColor = lineColor;
}
if (pointerColor != 0) {
guideView.CIRCLE_INDICATOR_COLOR = pointerColor;
guideView.CIRCLE_INNER_INDICATOR_COLOR = pointerColor;
guideView.circleIndicatorColor = pointerColor;
guideView.circleInnerIndicatorColor = pointerColor;
}
if (messageTitleColor != 0) {
guideView.messageTitleColor = messageTitleColor;
}
if (messageContentTextColor != 0) {
guideView.messageContentTextColor = messageContentTextColor;
}
if (setSkip) {
if (enableSkipButton) {
guideView.lastTargetView = lastTargetView;
}

Expand Down

0 comments on commit 877406d

Please sign in to comment.