Skip to content

Commit

Permalink
set manual dismiss type
Browse files Browse the repository at this point in the history
  • Loading branch information
Raldes Pratama committed Oct 28, 2020
1 parent 98a42a1 commit 75db67f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.happyfresh.showcaseview;

import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
Expand Down Expand Up @@ -34,6 +35,8 @@ private void showCoachLayout() {
.setTitleGravity(Gravity.LEFT)
.setContentGravity(Gravity.LEFT)
.setButtonGravity(Gravity.RIGHT)
.setButtonBackground(ContextCompat.getDrawable(this, R.drawable.rounded))
.setButtonTextColor(ContextCompat.getColor(this, R.color.colorAccent))
.setPaddingTitle(50,10,40,10)
.setPaddingMessage(50,10,40,10)
.setPaddingButton(0,10,40,10)
Expand Down
9 changes: 9 additions & 0 deletions sample/src/main/res/drawable/rounded.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#fff15b2a" />
<corners android:bottomRightRadius="8dp"
android:bottomLeftRadius="8dp"
android:topRightRadius="8dp"
android:topLeftRadius="8dp"/>
</shape>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.ColorInt;
import android.support.annotation.DrawableRes;
import android.text.Spannable;
import android.view.MotionEvent;
import android.view.View;
Expand Down Expand Up @@ -267,6 +268,10 @@ public boolean onTouchEvent(MotionEvent event) {
float x = event.getX();
float y = event.getY();

if(dismissType == null) {
return false;
}

if (event.getAction() == MotionEvent.ACTION_DOWN) {
switch (dismissType) {

Expand Down Expand Up @@ -751,7 +756,7 @@ public Builder setCircleStrokeIndicatorSize(float size) {
public GuideView build() {
GuideView guideView = new GuideView(context, targetView);
guideView.mAlignType = alignType != null ? alignType : AlignType.auto;
guideView.dismissType = dismissType != null ? dismissType : DismissType.targetView;
guideView.dismissType = dismissType;
float density = context.getResources().getDisplayMetrics().density;

guideView.setTitle(title);
Expand Down

0 comments on commit 75db67f

Please sign in to comment.