Skip to content

Commit

Permalink
fix oval shape and add rectangle tooltip example
Browse files Browse the repository at this point in the history
  • Loading branch information
Dean Wild committed Apr 3, 2019
1 parent c240b39 commit 800ef6e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,7 @@ public MaterialShowcaseView build() {
}
case OVAL_SHAPE: {
showcaseView.setShape(new OvalShape(showcaseView.mTarget));
break;
}
default:
throw new IllegalArgumentException("Unsupported shape type: " + shapeType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import android.graphics.Color;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
Expand All @@ -18,6 +19,7 @@ public class TooltipExample extends Activity implements View.OnClickListener {
private Button mButtonShow;
private Button mButtonReset;
private FloatingActionButton fab;
private Toolbar toolbar;

private static final String SHOWCASE_ID = "tooltip example";

Expand All @@ -35,6 +37,8 @@ protected void onCreate(Bundle savedInstanceState) {
fab = findViewById(R.id.fab);
fab.setOnClickListener(this);

toolbar = findViewById(R.id.toolbar);

presentShowcaseView(); // one second delay
}

Expand Down Expand Up @@ -71,6 +75,7 @@ void presentShowcaseView() {
new MaterialShowcaseView.Builder(this)
.setTarget(mButtonShow)
.setToolTip(toolTip1)
.withRectangleShape()
.setTooltipMargin(30)
.setShapePadding(50)
.setDismissOnTouch(true)
Expand Down
15 changes: 11 additions & 4 deletions sample/src/main/res/layout/activity_tooltip_example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="uk.co.deanwild.materialshowcaseviewsample.CustomExample">


<FrameLayout
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:background="#00c2eb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#00c2eb">
android:layout_height="?attr/actionBarSize"
android:elevation="4dp"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light">


<Button
Expand All @@ -20,7 +25,9 @@
android:backgroundTint="@android:color/white"
android:text="Show" />

</FrameLayout>
</android.support.v7.widget.Toolbar>



<Button
android:id="@+id/btn_reset"
Expand Down

0 comments on commit 800ef6e

Please sign in to comment.