diff --git a/README.OPENSOURCE b/README.OPENSOURCE index 900aff879b0ad1a8c407da6b14b81cd37c38ea1b..a78038e903c712b92734228424927073cd466fd5 100644 --- a/README.OPENSOURCE +++ b/README.OPENSOURCE @@ -8,7 +8,7 @@ "License File": "LICENSE", - "Version Number": "Release v3.2.0" + "Version Number": "v3.2.0" "Upstream URL": "https://github.com/sjwall/MaterialTapTargetPrompt", diff --git a/entry/src/main/config.json b/entry/src/main/config.json index be61fe5bed237fd65286a63db690f5388d84ad56..181cf44332cad03051b2da70bce12b86ad401eb5 100644 --- a/entry/src/main/config.json +++ b/entry/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": {}, diff --git a/entry/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/DialogStyleAbility.java b/entry/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/DialogStyleAbility.java index fded84aa94783adcf6d085661da0d64c70dea649..3c400d6f0f9b6742424b1051c8c438be4e703e6a 100644 --- a/entry/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/DialogStyleAbility.java +++ b/entry/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/DialogStyleAbility.java @@ -61,8 +61,8 @@ public class DialogStyleAbility extends CommonDialog implements Component.Clicke super.onCreate(); setAutoClosable(false); setTransparent(true); - Component contentView = LayoutScatter.getInstance(mAbility). - parse(ResourceTable.Layout_ability_dialog_style, null, false); + Component contentView = LayoutScatter.getInstance(mAbility) + .parse(ResourceTable.Layout_ability_dialog_style, null, false); setContentCustomComponent(contentView); initViews(); } diff --git a/entry/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/MainAbility.java b/entry/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/MainAbility.java index 91906a8b973fc948656a020713b0c60d413c174d..90c001fe71e60bc933787b712ff1892d8655435f 100644 --- a/entry/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/MainAbility.java +++ b/entry/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/MainAbility.java @@ -298,8 +298,8 @@ public class MainAbility extends FractionAbility implements Component.ClickedLis public void onResume(Animator animator) { } }); - animatorValue.setValueUpdateListener((animatorValue1, v) -> fabToast. - setHeight(DensityUtils.pxToFp(getContext(), NumUtil.INT_56 * v))); + animatorValue.setValueUpdateListener((animatorValue1, v) -> + fabToast.setHeight(DensityUtils.pxToFp(getContext(), NumUtil.INT_56 * v))); animatorValue.start(); } } diff --git a/library/build.gradle b/library/build.gradle index 71c572134039702aaf67ac1e1a5e2d9fe75593f8..4fc67c483f8efce384b80d41536903808859b9dc 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'com.huawei.ohos.library' +apply from: '../upload.gradle' ohos { compileSdkVersion 6 defaultConfig { diff --git a/library/src/main/config.json b/library/src/main/config.json index 45e35fea05a52d10561141367cc25750c232fdee..1d55e3df27733544196b2dffc29696673c4890ca 100644 --- a/library/src/main/config.json +++ b/library/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1000000, "name": "1.0.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": { diff --git a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/MaterialTapTargetPrompt.java b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/MaterialTapTargetPrompt.java index 5912e9a82f0678615c4b7ffdb91f2faf2234d420..882c8d31865f4b50648751d4868d21625da31ff9 100644 --- a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/MaterialTapTargetPrompt.java +++ b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/MaterialTapTargetPrompt.java @@ -550,10 +550,10 @@ public class MaterialTapTargetPrompt { mAnimationFocalBreathing.setLoopedCount(AnimatorValue.INFINITE); AnimatorValue animatorValue1 = new AnimatorValue(); animatorValue1.setValueUpdateListener((animatorValue, value) -> - onAnimationUpdate(1 + Constants.NUM_01F * value,false)); + onAnimationUpdate(1 + Constants.NUM_01F * value, false)); AnimatorValue animatorValue2 = new AnimatorValue(); animatorValue2.setValueUpdateListener((animatorValue, value) -> - onAnimationUpdate(Constants.NUM_1_1F - Constants.NUM_01F * value,true)); + onAnimationUpdate(Constants.NUM_1_1F - Constants.NUM_01F * value, true)); mAnimationFocalBreathing.runSerially(animatorValue1, animatorValue2); mAnimationFocalRipple = new AnimatorValue(); mAnimationFocalRipple.setCurveType(mView.mPromptOptions.getAnimationCurveType()); @@ -914,7 +914,7 @@ public class MaterialTapTargetPrompt { * @param ability ability. */ public Builder(final ComponentContainer component, final Ability ability) { - this(component, ability,null); + this(component, ability, null); } /** @@ -940,7 +940,7 @@ public class MaterialTapTargetPrompt { * @param componentContainer componentContainer */ public Builder(final Ability ability, ComponentContainer componentContainer) { - this(ability, componentContainer,null); + this(ability, componentContainer, null); } /** diff --git a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/MaterialTapTargetSequence.java b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/MaterialTapTargetSequence.java index 1725430fd569d337064d7d86d54e16c32230e416..9a582a054a806fe3dd27ad26f4155418c9b0d659 100644 --- a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/MaterialTapTargetSequence.java +++ b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/MaterialTapTargetSequence.java @@ -38,11 +38,18 @@ public class MaterialTapTargetSequence { * Pointer to the next prompt to be shown */ int nextPromptIndex = Constants.NUM_F1; + /** * The list of prompts to display when the sequence is shown */ private final List items = new ArrayList<>(); + /** + * The listener to call when this sequence completes + */ + @Nullable + private SequenceCompleteListener mOnCompleteListener; + /** * Listener added to a sequence item for it completing. */ @@ -68,12 +75,6 @@ public class MaterialTapTargetSequence { } }; - /** - * The listener to call when this sequence completes - */ - @Nullable - private SequenceCompleteListener mOnCompleteListener; - /** * Set the listener to listen with the action to call when the sequence ends * @@ -103,8 +104,8 @@ public class MaterialTapTargetSequence { * @param milliseconds The number of milliseconds to show the prompt for. * @return This. */ - public MaterialTapTargetSequence addPrompt(@Nullable MaterialTapTargetPrompt prompt, - final long milliseconds) { + public MaterialTapTargetSequence addPrompt( + @Nullable MaterialTapTargetPrompt prompt, final long milliseconds) { this.addItem(new SequenceItemShowFor(new SequenceState(prompt), milliseconds)); return this; } @@ -127,8 +128,8 @@ public class MaterialTapTargetSequence { * @param milliseconds The number of milliseconds to show the prompt for. * @return This. */ - public MaterialTapTargetSequence addPrompt(PromptOptions promptOptions, - final long milliseconds) { + public MaterialTapTargetSequence addPrompt( + PromptOptions promptOptions, final long milliseconds) { this.addItem(new SequenceItemShowFor(new SequenceStatePromptOptions(promptOptions), milliseconds)); return this; } diff --git a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptBackground.java b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptBackground.java index 22792d37b175f927be529c126f404c35a94988f0..49208ea5cae7079234196a44ce2b516472651158 100644 --- a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptBackground.java +++ b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptBackground.java @@ -43,6 +43,6 @@ public abstract class PromptBackground implements PromptUIElement { * @param isClip Should the prompt be clipped to the supplied clipBounds. * @param clipBounds The bounds to clip the drawing to. */ - public abstract void prepare(PromptOptions options, - boolean isClip, Rect clipBounds); + public abstract void prepare( + PromptOptions options, boolean isClip, Rect clipBounds); } diff --git a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptFocal.java b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptFocal.java index 60d9bc45cc75bc3014258cf331c96df5411591f6..103dae3a0c190f0cfcdeff2636ae736ecb247972 100644 --- a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptFocal.java +++ b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptFocal.java @@ -134,6 +134,7 @@ public abstract class PromptFocal implements PromptUIElement { * @param revealModifier The amount to scale the ripple by where a 1 value is the same size as the focal. * @param alphaModifier The amount to modify the ripple alpha by. */ - public abstract void updateRipple(@Range(from = 0, to = 2) float revealModifier, - @Range(from = 0, to = 1) float alphaModifier); + public abstract void updateRipple( + @Range(from = 0, to = 2) float revealModifier, + @Range(from = 0, to = 1) float alphaModifier); } diff --git a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java index 0e82bfcaf0f90db16af4a826e4488a61410dd7fa..31db45537ba3836f0b9e1ae2b652c174f721557f 100644 --- a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java +++ b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java @@ -89,8 +89,9 @@ public class PromptText implements PromptUIElement { * @param isClip clipToBounds * @param clipBounds clipBounds */ - public void prepare(PromptOptions options, - boolean isClip, Rect clipBounds) { + public void prepare( + PromptOptions options, + boolean isClip, Rect clipBounds) { mPromptOptions = options; isClipToBounds = isClip; mClipBounds = clipBounds; @@ -219,8 +220,9 @@ public class PromptText implements PromptUIElement { * @param maxWidth The maximum width that the text can be * @param alphaModifier alphaModifier */ - void createTextLayout(final PromptOptions options, final float maxWidth, - final float alphaModifier) { + void createTextLayout( + final PromptOptions options, final float maxWidth, + final float alphaModifier) { if (options.getPrimaryText() != null) { mPrimaryTextLayout = PromptUtils.createStaticTextLayout(options.getPrimaryText(), mPaintPrimaryText, (int) maxWidth, mPrimaryTextAlignment, diff --git a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java index 63b975b8552d6ef81fc28966d5aeca1e30ed4683..98d32c76e95eefdb8121621251d398572c5574e3 100644 --- a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java +++ b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java @@ -49,9 +49,10 @@ public class PromptUtils { * @param radius The radius of the circle. * @return True if the point (x, y) is in the circle. */ - public static boolean isPointInCircle(final float x, final float y, - final Point circleCentre, - final float radius) { + public static boolean isPointInCircle( + final float x, final float y, + final Point circleCentre, + final float radius) { return Math.pow(x - circleCentre.getPointX(), Constants.NUM_2) + Math.pow(y - circleCentre.getPointY(), Constants.NUM_2) < Math.pow(radius, Constants.NUM_2); } @@ -97,8 +98,9 @@ public class PromptUtils { * @param styleIndex styleIndex * @return Font */ - public static Font setFontFromAttrs(@Nullable String familyName, Font font, - @Range(from = 0,to = Constants.NUM_2) int styleIndex) { + public static Font setFontFromAttrs( + @Nullable String familyName, Font font, + @Range(from = 0, to = Constants.NUM_2) int styleIndex) { Font tf; if (familyName != null) { tf = new Font.Builder(familyName).build(); @@ -151,9 +153,10 @@ public class PromptUtils { * @param text text * @return absolute layout direction */ - public static int getTextAlignment(final ResourceManager resources, - final int gravity, - @Nullable final CharSequence text) { + public static int getTextAlignment( + final ResourceManager resources, + final int gravity, + @Nullable final CharSequence text) { return LayoutAlignment.CENTER; } @@ -186,9 +189,10 @@ public class PromptUtils { * @param scale The amount to scale the rectangle by. * @param isEven Should the rectangle be scaled evenly in both directions. */ - public static void scale(final Point origin, RectFloat base, - RectFloat out, - final float scale, final boolean isEven) { + public static void scale( + final Point origin, + RectFloat base, RectFloat out, + final float scale, final boolean isEven) { if (scale == 1) { out.modify(base); return; @@ -236,9 +240,11 @@ public class PromptUtils { * @param textPadding textPadding * @return Maximum width in pixels that the prompt can be. */ - public static float calculateMaxWidth(final float maxTextWidth, - @Nullable final Rect clipBounds, - final int parentWidth, final float textPadding) { + public static float calculateMaxWidth( + final float maxTextWidth, + @Nullable final Rect clipBounds, + final int parentWidth, + final float textPadding) { return Math.max(Constants.NUM_80, Math.min(maxTextWidth, (clipBounds != null ? clipBounds.right - clipBounds.left : parentWidth) - (textPadding * Constants.NUM_2))); @@ -269,8 +275,11 @@ public class PromptUtils { * @param y The point y coordinate. * @return True if the point is within the inset rectangle, false otherwise. */ - public static boolean containsInset(final Rect bounds, - final int inset, final int x, final int y) { + public static boolean containsInset( + final Rect bounds, + final int inset, + final int x, + final int y) { return x > bounds.left + inset && x < bounds.right - inset && y > bounds.top + inset diff --git a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/CirclePromptBackground.java b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/CirclePromptBackground.java index 0c701e01e33f38e740f8663ba4d16f10861444a8..d5b14448b42a69d8cdc94c3faf83564f41de0a04 100644 --- a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/CirclePromptBackground.java +++ b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/CirclePromptBackground.java @@ -86,8 +86,9 @@ public class CirclePromptBackground extends PromptBackground { } @Override - public void prepare(final PromptOptions options, final boolean isClipToBounds, - final Rect clipBounds) { + public void prepare( + final PromptOptions options, final boolean isClipToBounds, + final Rect clipBounds) { mPromptOptions = options; // Obtain values from the prompt options. @@ -104,7 +105,7 @@ public class CirclePromptBackground extends PromptBackground { final float inset88dp = 88f * DensityUtils.getDeviceAttr(options.getResourceFinder().getContext()) .getAttributes().densityPixels; clipBoundsInset88dp.modify(clipBounds.left + inset88dp, clipBounds.top + inset88dp, - clipBounds.right - inset88dp,clipBounds.bottom - inset88dp); + clipBounds.right - inset88dp, clipBounds.bottom - inset88dp); // Is the focal centre more than 88dp from the clip bounds edge if ((focalCentreX - clipBoundsInset88dp.left > 0 diff --git a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java index 672b8cd76675b1432b4aa182d61adb5f9fc45416..2f4435f8c4bc61f8f2b4322fa51818ace9aa3af9 100644 --- a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java +++ b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java @@ -170,7 +170,7 @@ public class CirclePromptFocal extends PromptFocal { public void draw(Canvas canvas) { if (mPromptOptions.getTargetView() != null && mPromptOptions.getIconDrawable() == null) { RectFloat rectFloat = new RectFloat( - 0,0, + 0, 0, mPosition.getPointX() + mPromptOptions.getTargetView().getWidth() * Constants.NUM_2, mPosition.getPointY() + mPromptOptions.getTargetView().getHeight() * Constants.NUM_2); int layerId = canvas.saveLayer(rectFloat, new Paint()); diff --git a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java index 6a3dd5d9a76feabe332b31760e1ab41fb6b5711a..c77b0cdf5fbe1cf1c679d1bbb95737b4a49d7b09 100644 --- a/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java +++ b/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java @@ -106,7 +106,7 @@ public class RectanglePromptFocal extends PromptFocal { if (size == null) { mSize = null; } else { - mSize = new Point(size.getPointX(),size.getPointY()); + mSize = new Point(size.getPointX(), size.getPointY()); } return this; } @@ -129,7 +129,7 @@ public class RectanglePromptFocal extends PromptFocal { } @Override - public void prepare(PromptOptions options,final int[] promptViewPosition) { + public void prepare(PromptOptions options, final int[] promptViewPosition) { mPromptOptions = options; Component target = options.getTargetView(); final int[] targetPosition = target.getLocationOnScreen(); @@ -142,7 +142,7 @@ public class RectanglePromptFocal extends PromptFocal { mBaseBounds.top = top - mPadding; mBaseBounds.right = left + width + mPadding; mBaseBounds.bottom = top + height + mPadding; - mBaseBoundsCentre.modify(left + (width / Constants.NUM_2F),top + (height / Constants.NUM_2F)); + mBaseBoundsCentre.modify(left + (width / Constants.NUM_2F), top + (height / Constants.NUM_2F)); } else { prepare(options, left + (width / Constants.NUM_2F), top + (height / Constants.NUM_2F)); } @@ -193,7 +193,7 @@ public class RectanglePromptFocal extends PromptFocal { public void draw(Canvas canvas) { if (mPromptOptions.getTargetView() != null && mPromptOptions.getIconDrawable() == null) { RectFloat rectFloat = new RectFloat( - 0,0, + 0, 0, mBaseBoundsCentre.getPointX() + mPromptOptions.getTargetView().getWidth() * Constants.NUM_2F, mBaseBoundsCentre.getPointY() + mPromptOptions.getTargetView().getHeight() * Constants.NUM_2F); int layerId = canvas.saveLayer(rectFloat, new Paint());