code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
void createTextLayout(@NonNull final PromptOptions options, final float maxWidth,
final float alphaModifier)
{
if (options.getPrimaryText() != null)
{
mPrimaryTextLayout = PromptUtils.createStaticTextLayout(options.getPrimaryText(),
mPaintPri... | Creates the text layouts for the primary and secondary text.
@param maxWidth The maximum width that the text can be. | createTextLayout | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java | Apache-2.0 |
@Override
public void update(@NonNull final PromptOptions options, float revealModifier,
float alphaModifier)
{
final float maxWidth = PromptUtils.calculateMaxWidth(options.getMaxTextWidth(),
mClipToBounds ? mClipBounds : null,
options.getResourceFi... | Creates the text layouts for the primary and secondary text.
@param maxWidth The maximum width that the text can be. | update | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java | Apache-2.0 |
@Override
public void draw(@NonNull Canvas canvas)
{
canvas.translate(mPrimaryTextLeft - mPrimaryTextLeftChange, mPrimaryTextTop);
if (mPrimaryTextLayout != null)
{
mPrimaryTextLayout.draw(canvas);
}
if (mSecondaryTextLayout != null)
{
canv... | Creates the text layouts for the primary and secondary text.
@param maxWidth The maximum width that the text can be. | draw | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java | Apache-2.0 |
@Override
public boolean contains(float x, float y)
{
return mTextBounds.contains(x, y);
} | Creates the text layouts for the primary and secondary text.
@param maxWidth The maximum width that the text can be. | contains | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptText.java | Apache-2.0 |
public static boolean isPointInCircle(final float x, final float y,
@NonNull final PointF circleCentre,
final float radius)
{
return Math.pow(x - circleCentre.x, 2) + Math.pow(y - circleCentre.y, 2) < Math.pow(radius, 2);
... | Determines if a point is in the centre of a circle with a radius from the point.
@param x The x position in the view.
@param y The y position in the view.
@param circleCentre The circle centre position
@param radius The radius of the circle.
@return True if the point (x, y) is in the circle... | isPointInCircle | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | Apache-2.0 |
@SuppressLint("RtlHardcoded")
@NonNull
public static Layout.Alignment getTextAlignment(@NonNull final Resources resources,
final int gravity,
@Nullable final CharSequence text)
{
final int absolut... | Gets the absolute text alignment value based on the supplied gravity and the activities
layout direction.
@param gravity The gravity to convert to absolute values
@return absolute layout direction | getTextAlignment | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | Apache-2.0 |
@NonNull
public static StaticLayout createStaticTextLayout(@NonNull final CharSequence text,
@NonNull final TextPaint paint,
final int maxTextWidth,
@NonN... | Creates a static text layout. Uses the {@link android.text.StaticLayout.Builder} if
available.
@param text The text to be laid out, optionally with spans
@param paint The base paint used for layout
@param maxTextWidth The width in pixels
@param textAlignment Alignment for the resulting {@link StaticL... | createStaticTextLayout | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | Apache-2.0 |
public static void scale(@NonNull final PointF origin, @NonNull final RectF base,
@NonNull final RectF out,
final float scale, final boolean even)
{
if (scale == 1)
{
out.set(base);
return;
}
final flo... | Scales a rectangle.
@param origin The point to scale from.
@param base The rectangle at scale 1.0.
@param out The rectangle to put the scaled size in.
@param scale The amount to scale the rectangle by.
@param even Should the rectangle be scaled evenly in both directions. | scale | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | Apache-2.0 |
public static boolean isRtlText(@Nullable final Layout layout, @NonNull final Resources resources)
{
boolean result = false;
if (layout != null)
{
// Treat align opposite as right to left by default
result = layout.getAlignment() == Layout.Alignment.ALIGN_OPPOSITE;
... | Determines if the text in the supplied layout is displayed right to left.
@param layout The layout to check.
@return True if the text in the supplied layout is displayed right to left. False otherwise. | isRtlText | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | Apache-2.0 |
public static float calculateMaxWidth(final float maxTextWidth, @Nullable final Rect clipBounds, final int parentWidth, final float textPadding)
{
return Math.max(80, Math.min(maxTextWidth, (clipBounds != null ? clipBounds.right - clipBounds.left : parentWidth) - (textPadding * 2)));
} | Calculates the maximum width that the prompt can be.
@return Maximum width in pixels that the prompt can be. | calculateMaxWidth | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | Apache-2.0 |
public static float calculateMaxTextWidth(@Nullable final Layout textLayout)
{
float maxTextWidth = 0f;
if (textLayout != null)
{
for (int i = 0, count = textLayout.getLineCount(); i < count; i++)
{
maxTextWidth = Math.max(maxTextWidth, textLayout.getL... | Calculates the maximum width line in a text layout.
@param textLayout The text layout
@return The maximum length line | calculateMaxTextWidth | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | Apache-2.0 |
public static boolean containsInset(@NonNull 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
&& y < bounds.bottom - ins... | Determines if a point is within a rectangle that has been inset.
@param bounds The rectangle bounds.
@param inset The amount that the rectangle is inset by.
@param x The point x coordinate.
@param y The point y coordinate.
@return True if the point is within the inset rectangle, false otherwise. | containsInset | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/PromptUtils.java | Apache-2.0 |
@NonNull
public FullscreenPromptBackground setCornerRadius(final float rx, final float ry)
{
mRx = rx;
mRy = ry;
return this;
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | setCornerRadius | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | Apache-2.0 |
@Override
public void setColour(@ColorInt int colour)
{
mPaint.setColor(colour);
mBaseColourAlpha = Color.alpha(colour);
mPaint.setAlpha(mBaseColourAlpha);
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | setColour | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | Apache-2.0 |
@Override
public void prepare(@NonNull final PromptOptions options, final boolean clipToBounds, @NonNull Rect clipBounds)
{
final RectF focalBounds = options.getPromptFocal().getBounds();
mBaseBounds.set(clipBounds.left, clipBounds.top, clipBounds.right, clipBounds.bottom);
mFocalCentr... | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | prepare | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | Apache-2.0 |
@NonNull
protected DisplayMetrics getDisplayMetrics() {
return Resources.getSystem().getDisplayMetrics();
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | getDisplayMetrics | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | Apache-2.0 |
@Override
public void update(@NonNull final PromptOptions prompt, float revealModifier,
float alphaModifier)
{
mPaint.setAlpha((int) (mBaseColourAlpha * alphaModifier));
PromptUtils.scale(mFocalCentre, mBaseBounds, mBounds, revealModifier, false);
mPath.reset();
... | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | update | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | Apache-2.0 |
@Override
public void draw(@NonNull Canvas canvas)
{
canvas.drawRect(mBounds, mPaint);
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | draw | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | Apache-2.0 |
@Override
public boolean contains(float x, float y)
{
return mBounds.contains(x, y);
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | contains | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | Apache-2.0 |
@Override
public Path getPath()
{
return mPath;
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | getPath | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/FullscreenPromptBackground.java | Apache-2.0 |
@NonNull
@Override
protected DisplayMetrics getDisplayMetrics() {
Display defaultDisplay = mWindowManager.getDefaultDisplay();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
defaultDisplay.getRealMetrics(mBaseMetrics);
} else {
defaultDisplay.g... | {@link ImmersiveModeCompatPromptBackground} implementation that renders the prompt background as a rectangle for supporting immersive mode. | getDisplayMetrics | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/ImmersiveModeCompatPromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/ImmersiveModeCompatPromptBackground.java | Apache-2.0 |
@NonNull
public RectanglePromptBackground setCornerRadius(final float rx, final float ry)
{
mRx = rx;
mRy = ry;
return this;
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | setCornerRadius | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | Apache-2.0 |
@Override
public void setColour(@ColorInt int colour)
{
mPaint.setColor(colour);
mBaseColourAlpha = Color.alpha(colour);
mPaint.setAlpha(mBaseColourAlpha);
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | setColour | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | Apache-2.0 |
@Override
public void prepare(@NonNull final PromptOptions options, final boolean clipToBounds, @NonNull Rect clipBounds)
{
final RectF focalBounds = options.getPromptFocal().getBounds();
final RectF textBounds = options.getPromptText().getBounds();
final float textPadding = options.getT... | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | prepare | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | Apache-2.0 |
@Override
public void update(@NonNull final PromptOptions prompt, float revealModifier,
float alphaModifier)
{
mPaint.setAlpha((int) (mBaseColourAlpha * alphaModifier));
PromptUtils.scale(mFocalCentre, mBaseBounds, mBounds, revealModifier, false);
mPath.reset();
... | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | update | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | Apache-2.0 |
@Override
public void draw(@NonNull Canvas canvas)
{
canvas.drawRoundRect(mBounds, mRx, mRy, mPaint);
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | draw | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | Apache-2.0 |
@Override
public boolean contains(float x, float y)
{
return mBounds.contains(x, y);
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | contains | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | Apache-2.0 |
@Override
public Path getPath()
{
return mPath;
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt background | getPath | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/backgrounds/RectanglePromptBackground.java | Apache-2.0 |
@NonNull
public CirclePromptFocal setRadius(final float radius)
{
mBaseRadius = radius;
return this;
} | Set the focal radius.
@param radius The radius for the circle to be drawn.
@return This prompt focal | setRadius | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@NonNull
@Override
public RectF getBounds()
{
return mBounds;
} | Set the focal radius.
@param radius The radius for the circle to be drawn.
@return This prompt focal | getBounds | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@NonNull
@Override
public Path getPath()
{
return mPath;
} | Set the focal radius.
@param radius The radius for the circle to be drawn.
@return This prompt focal | getPath | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@NonNull
@Override
public PointF calculateAngleEdgePoint(final float angle, final float padding)
{
// Calculate the x and y on the focal from the angle calculated
final float focalRadius = mBounds.width() + padding;
final float x = calculateX(angle, focalRadius, mBounds.centerX());
... | Set the focal radius.
@param radius The radius for the circle to be drawn.
@return This prompt focal | calculateAngleEdgePoint | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
private float calculateX(final float angle, final float radius, final float centreX)
{
return centreX + radius * (float) Math.cos(Math.toRadians(angle));
} | Calculates the x position on a circle for an angle and centre point x.
@param angle The angle on the circle to get the x position for.
@param radius The circle radius.
@param centreX The centre x position for the circle.
@return The calculated x position for the angle. | calculateX | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
private float calculateY(final float angle, final float radius, final float centreY)
{
return centreY + radius * (float) Math.sin(Math.toRadians(angle));
} | Calculates the y position on a circle for an angle and centre point y.
@param angle The angle on the circle to get the y position for.
@param radius The circle radius.
@param centreY The centre y position for the circle.
@return The calculated y position for the angle. | calculateY | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@Override
public void setColour(@ColorInt int colour)
{
mPaint.setColor(colour);
mBaseAlpha = Color.alpha(colour);
mPaint.setAlpha(mBaseAlpha);
} | Calculates the y position on a circle for an angle and centre point y.
@param angle The angle on the circle to get the y position for.
@param radius The circle radius.
@param centreY The centre y position for the circle.
@return The calculated y position for the angle. | setColour | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@Override
public void prepare(@NonNull PromptOptions options, @NonNull View target, final int[] promptViewPosition)
{
final int[] targetPosition = new int[2];
target.getLocationInWindow(targetPosition);
prepare(options, targetPosition[0] - promptViewPosition[0] + (target.getWidth() / 2)... | Calculates the y position on a circle for an angle and centre point y.
@param angle The angle on the circle to get the y position for.
@param radius The circle radius.
@param centreY The centre y position for the circle.
@return The calculated y position for the angle. | prepare | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@Override
public void prepare(@NonNull PromptOptions options, float targetX, float targetY)
{
mPosition.x = targetX;
mPosition.y = targetY;
mBounds.left = targetX - mBaseRadius;
mBounds.top = targetY - mBaseRadius;
mBounds.right = targetX + mBaseRadius;
mBounds.bo... | Calculates the y position on a circle for an angle and centre point y.
@param angle The angle on the circle to get the y position for.
@param radius The circle radius.
@param centreY The centre y position for the circle.
@return The calculated y position for the angle. | prepare | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@Override
public void update(@NonNull PromptOptions options, float revealModifier,
float alphaModifier)
{
mPaint.setAlpha((int) (mBaseAlpha * alphaModifier));
mRadius = mBaseRadius * revealModifier;
mPath = new Path();
mPath.addCircle(mPosition.x, mPositio... | Calculates the y position on a circle for an angle and centre point y.
@param angle The angle on the circle to get the y position for.
@param radius The circle radius.
@param centreY The centre y position for the circle.
@return The calculated y position for the angle. | update | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@Override
public void updateRipple(float revealModifier, float alphaModifier)
{
mRippleRadius = mBaseRadius * revealModifier;
mRippleAlpha = (int) (mBaseRippleAlpha * alphaModifier);
} | Calculates the y position on a circle for an angle and centre point y.
@param angle The angle on the circle to get the y position for.
@param radius The circle radius.
@param centreY The centre y position for the circle.
@return The calculated y position for the angle. | updateRipple | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@Override
public void draw(@NonNull Canvas canvas)
{
//Draw the ripple
if (mDrawRipple)
{
final int oldAlpha = mPaint.getAlpha();
final int oldColor = mPaint.getColor();
if (oldColor == Color.TRANSPARENT)
{
mPaint.setColor(C... | Calculates the y position on a circle for an angle and centre point y.
@param angle The angle on the circle to get the y position for.
@param radius The circle radius.
@param centreY The centre y position for the circle.
@return The calculated y position for the angle. | draw | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@Override
public boolean contains(float x, float y)
{
return PromptUtils.isPointInCircle(x, y, mPosition, mRadius);
} | Calculates the y position on a circle for an angle and centre point y.
@param angle The angle on the circle to get the y position for.
@param radius The circle radius.
@param centreY The centre y position for the circle.
@return The calculated y position for the angle. | contains | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/CirclePromptFocal.java | Apache-2.0 |
@NonNull
public RectanglePromptFocal setCornerRadius(final float rx, final float ry)
{
mRx = rx;
mRy = ry;
return this;
} | Set the radius for the rectangle corners.
@param rx The x-radius of the oval used to round the corners
@param ry The y-radius of the oval used to round the corners
@return This prompt focal | setCornerRadius | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@NonNull
public RectanglePromptFocal setTargetPadding(@Dimension final float padding)
{
mPadding = padding;
return this;
} | Set the padding between the target bounds and the rectangle edge.
@param padding The distance from the target edge to the rectangle edge.
@return This prompt focal. | setTargetPadding | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@NonNull
public RectanglePromptFocal setSize(@Nullable final PointF size)
{
if (size == null)
{
mSize = null;
}
else
{
mSize = new PointF();
mSize.x = size.x;
mSize.y = size.y;
}
return this;
} | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | setSize | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@NonNull
@Override
public RectF getBounds()
{
return mBaseBounds;
} | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | getBounds | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@NonNull
@Override
public Path getPath()
{
return mPath;
} | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | getPath | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@Override
public void setColour(@ColorInt int colour)
{
mPaint.setColor(colour);
mBaseAlpha = Color.alpha(colour);
mPaint.setAlpha(mBaseAlpha);
} | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | setColour | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@Override
public void prepare(@NonNull PromptOptions options, @NonNull View target, final int[] promptViewPosition)
{
final int[] targetPosition = new int[2];
target.getLocationInWindow(targetPosition);
final float left = targetPosition[0] - promptViewPosition[0];
final float top... | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | prepare | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@Override
public void prepare(@NonNull PromptOptions options, float targetX, float targetY)
{
if (mSize != null)
{
final float halfWidth = mSize.x / 2;
final float halfHeight = mSize.y / 2;
mBaseBounds.left = targetX - halfWidth - mPadding;
mBaseBo... | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | prepare | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@Override
public void update(@NonNull PromptOptions options, float revealModifier,
float alphaModifier)
{
PromptUtils.scale(mBaseBoundsCentre, mBaseBounds, mBounds, revealModifier, true);
mPath = new Path();
mPath.addRoundRect(mBounds, mRx, mRy, Path.Direction.CW)... | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | update | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@Override
public void updateRipple(float revealModifier, final float alphaModifier)
{
PromptUtils.scale(mBaseBoundsCentre, mBaseBounds, mRippleBounds, revealModifier, true);
mRippleAlpha = (int) (mBaseRippleAlpha * alphaModifier);
} | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | updateRipple | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@Override
public void draw(@NonNull Canvas canvas)
{
//Draw the ripple
if (mDrawRipple)
{
final int oldAlpha = mPaint.getAlpha();
final int oldColor = mPaint.getColor();
if (oldColor == Color.TRANSPARENT)
{
mPaint.setColor(C... | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | draw | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
@Override
public boolean contains(float x, float y)
{
return mBounds.contains(x, y);
} | Sets the focal to a fixed size. Set as null to change it back to dynamic.
@param size The fixed focal size or null to change back to the default dynamic size.
@return This prompt focal | contains | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/focals/RectanglePromptFocal.java | Apache-2.0 |
public void addStateChanger(final int state)
{
this.stateChangers.add(state);
} | Add a state that will trigger the sequence to move on.
@see MaterialTapTargetPrompt#STATE_REVEALING
@see MaterialTapTargetPrompt#STATE_REVEALED
@see MaterialTapTargetPrompt#STATE_FOCAL_PRESSED
@see MaterialTapTargetPrompt#STATE_FINISHING
@see MaterialTapTargetPrompt#STATE_FINISHED
@see MaterialTapTargetPrompt#STATE_NO... | addStateChanger | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | Apache-2.0 |
public void removeStateChanger(final int state)
{
this.stateChangers.remove((Integer) state);
} | Remove a specific state changer.
@see MaterialTapTargetPrompt#STATE_REVEALING
@see MaterialTapTargetPrompt#STATE_REVEALED
@see MaterialTapTargetPrompt#STATE_FOCAL_PRESSED
@see MaterialTapTargetPrompt#STATE_FINISHING
@see MaterialTapTargetPrompt#STATE_FINISHED
@see MaterialTapTargetPrompt#STATE_NON_FOCAL_PRESSED
@see M... | removeStateChanger | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | Apache-2.0 |
public void setSequenceListener(@Nullable final MaterialTapTargetSequence.SequenceCompleteListener listener)
{
this.sequenceListener = listener;
} | Set the listener for this sequence item completing.
@param listener The item finish listener. | setSequenceListener | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | Apache-2.0 |
@NonNull
public SequenceState getState()
{
return this.sequenceState;
} | Get the prompt state that this sequence item uses.
@return The prompt state. | getState | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | Apache-2.0 |
public void finish()
{
final MaterialTapTargetPrompt prompt = this.sequenceState.getPrompt();
if (prompt != null)
{
prompt.finish();
}
} | Calls {@link MaterialTapTargetPrompt#finish()} on this items states prompt. | finish | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | Apache-2.0 |
public void dismiss()
{
final MaterialTapTargetPrompt prompt = this.sequenceState.getPrompt();
if (prompt != null)
{
prompt.dismiss();
}
} | Calls {@link MaterialTapTargetPrompt#dismiss()} on this items states prompt. | dismiss | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | Apache-2.0 |
protected void show(@NonNull final MaterialTapTargetPrompt prompt)
{
prompt.show();
} | Show the created prompt for this sequence item.
@param prompt The prompt to show, this will never be null here. | show | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | Apache-2.0 |
@Override
public void onPromptStateChanged(@NonNull final MaterialTapTargetPrompt prompt, final int state)
{
if (this.stateChangers.contains(state))
{
this.onItemComplete();
}
} | Show the created prompt for this sequence item.
@param prompt The prompt to show, this will never be null here. | onPromptStateChanged | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItem.java | Apache-2.0 |
@Override
protected void show(@NonNull final MaterialTapTargetPrompt prompt)
{
prompt.showFor(milliseconds);
} | Constructor.
@param state The prompt that this item will show.
@param milliseconds The number of milliseconds to show the prompt for. | show | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItemShowFor.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceItemShowFor.java | Apache-2.0 |
@Nullable
public MaterialTapTargetPrompt getPrompt()
{
return this.prompt;
} | Get the stored prompt.
@return The prompt. | getPrompt | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceState.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceState.java | Apache-2.0 |
@Nullable
@Override
public MaterialTapTargetPrompt getPrompt()
{
if (this.prompt == null)
{
this.prompt = this.promptOptions.create();
}
return this.prompt;
} | Constructor.
@param promptOptions The builder to create the prompt from. | getPrompt | java | sjwall/MaterialTapTargetPrompt | library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceStatePromptOptions.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/main/java/uk/co/samuelwall/materialtaptargetprompt/extras/sequence/SequenceStatePromptOptions.java | Apache-2.0 |
public static PromptOptions createPromptOptions()
{
return createPromptOptions(false);
} | Creates a new {@link PromptOptions} by calling {@link #createPromptOptions(boolean)} with
false as parameter.
@return The created prompt. | createPromptOptions | java | sjwall/MaterialTapTargetPrompt | library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | Apache-2.0 |
public static PromptOptions createPromptOptions(final boolean mock)
{
final ResourceFinder resourceFinder;
if (mock)
{
resourceFinder = mock(ResourceFinder.class);
final Resources resources = mock(Resources.class);
when(resourceFinder.getResources()).thenR... | Creates a new {@link PromptOptions}.
With mock as false a {@link ActivityResourceFinder} will be used.
With mock as true a mocked {@link ResourceFinder} will be created with the
{@link ResourceFinder#getResources()} method mocked.
@param mock True to mock the {@link ResourceFinder} or use a {@link ActivityResourceFind... | createPromptOptions | java | sjwall/MaterialTapTargetPrompt | library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | Apache-2.0 |
public static PromptOptions createPromptOptionsWithTestResourceFinder()
{
return new PromptOptions(new TestResourceFinder(Robolectric.buildActivity(Activity.class)
.create().get()));
} | Creates a new {@link PromptOptions} with {@link TestResourceFinder}.
@return The created options. | createPromptOptionsWithTestResourceFinder | java | sjwall/MaterialTapTargetPrompt | library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | Apache-2.0 |
public static void initSequenceItem(final MaterialTapTargetPrompt prompt, final SequenceItem item)
{
prompt.mView.mPromptOptions.setSequenceListener(item);
} | Calls {@link PromptOptions#setSequenceListener(MaterialTapTargetPrompt.PromptStateChangeListener)}
with the supplied sequence item.
@param prompt The prompt to add the listener to.
@param item The listener to add. | initSequenceItem | java | sjwall/MaterialTapTargetPrompt | library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | Apache-2.0 |
public static void endCurrentAnimation(final MaterialTapTargetPrompt prompt)
{
if (prompt.mAnimationCurrent != null)
{
if (!prompt.mAnimationCurrent.isStarted())
{
prompt.mAnimationCurrent.addListener(
new MaterialTapTargetPrompt.Animat... | Robolectric isn't calling {@link Animator.AnimatorListener#onAnimationEnd(Animator)} so for
those use cases end needs to be manually called.
@param prompt The prompt to listen to the current animation. | endCurrentAnimation | java | sjwall/MaterialTapTargetPrompt | library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | Apache-2.0 |
@Override
public void onAnimationStart(Animator animation)
{
animation.end();
} | Robolectric isn't calling {@link Animator.AnimatorListener#onAnimationEnd(Animator)} so for
those use cases end needs to be manually called.
@param prompt The prompt to listen to the current animation. | onAnimationStart | java | sjwall/MaterialTapTargetPrompt | library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | Apache-2.0 |
public static void runPromptTimeOut(final MaterialTapTargetPrompt prompt)
{
// Post to prevent recursion
prompt.mView.post(new Runnable()
{
@Override
public void run()
{
// Manually run because the test won't wait
prompt.mTi... | Calls the show for timeout run method.
@param prompt The prompt to call the timeout on. | runPromptTimeOut | java | sjwall/MaterialTapTargetPrompt | library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | Apache-2.0 |
@Override
public void run()
{
// Manually run because the test won't wait
prompt.mTimeoutRunnable.run();
} | Calls the show for timeout run method.
@param prompt The prompt to call the timeout on. | run | java | sjwall/MaterialTapTargetPrompt | library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | Apache-2.0 |
public static void runPromptMainLooperTimeOut(final MaterialTapTargetPrompt prompt)
{
shadowOf(Looper.getMainLooper()).postAtFrontOfQueue(prompt.mTimeoutRunnable);
} | Calls the show for timeout run method.
@param prompt The prompt to call the timeout on. | runPromptMainLooperTimeOut | java | sjwall/MaterialTapTargetPrompt | library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/library/src/test/java/uk/co/samuelwall/materialtaptargetprompt/UnitTestUtils.java | Apache-2.0 |
@NotNull
@Override
public Dialog onCreateDialog(final Bundle savedInstanceState) {
final Dialog dialog = super.onCreateDialog(savedInstanceState);
View contentView = View.inflate(getContext(), R.layout.fragment_bottom_sheet, null);
dialog.setContentView(contentView);
dialog.setO... | Example {@link BottomSheetDialogFragment} that shows a prompt when displayed. | onCreateDialog | java | sjwall/MaterialTapTargetPrompt | sample/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/BottomSheetDialogFragmentExample.java | https://github.com/sjwall/MaterialTapTargetPrompt/blob/master/sample/src/main/java/uk/co/samuelwall/materialtaptargetprompt/sample/BottomSheetDialogFragmentExample.java | Apache-2.0 |
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.ittianyu.bottomnavigationviewex", appContext.getPackageName());
} | Instrumentation test, which will execute on an Android device.
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | useAppContext | java | ittianyu/BottomNavigationViewEx | app/src/androidTest/java/com/ittianyu/bottomnavigationviewexsample/ExampleInstrumentedTest.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/app/src/androidTest/java/com/ittianyu/bottomnavigationviewexsample/ExampleInstrumentedTest.java | MIT |
private void initLeakCanary() {
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
LeakCanary.install(this);
} | use LeakCanary to check mey leak | initLeakCanary | java | ittianyu/BottomNavigationViewEx | app/src/main/java/com/ittianyu/bottomnavigationviewexsample/common/base/BaseApplication.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/app/src/main/java/com/ittianyu/bottomnavigationviewexsample/common/base/BaseApplication.java | MIT |
private void initUncheckedFirstTime() {
disableAllAnimation(bind.bnveUncheckedFirstTime);
// use the unchecked color for first item
bind.bnveUncheckedFirstTime.setIconTintList(0, getResources()
.getColorStateList(R.color.colorGray));
bind.bnveUncheckedFirstTime.setTextTin... | There is no idea to set no check item first time.
But we can let user think it is unchecked first time by control the color | initUncheckedFirstTime | java | ittianyu/BottomNavigationViewEx | app/src/main/java/com/ittianyu/bottomnavigationviewexsample/features/style/StyleActivity.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/app/src/main/java/com/ittianyu/bottomnavigationviewexsample/features/style/StyleActivity.java | MIT |
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
// restore the color when click
if (firstClick) {
int position = bind.bnveUncheckedFirstTime.getMenuItemPosition(item);
if (0 == position) {
... | There is no idea to set no check item first time.
But we can let user think it is unchecked first time by control the color | onNavigationItemSelected | java | ittianyu/BottomNavigationViewEx | app/src/main/java/com/ittianyu/bottomnavigationviewexsample/features/style/StyleActivity.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/app/src/main/java/com/ittianyu/bottomnavigationviewexsample/features/style/StyleActivity.java | MIT |
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
} | Example local unit test, which will execute on the development machine (host).
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | addition_isCorrect | java | ittianyu/BottomNavigationViewEx | app/src/test/java/com/ittianyu/bottomnavigationviewexsample/ExampleUnitTest.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/app/src/test/java/com/ittianyu/bottomnavigationviewexsample/ExampleUnitTest.java | MIT |
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.ittianyu.bottomnavigationviewex.test", appContext.getPackageName());
} | Instrumentation test, which will execute on an Android device.
@see <a href="http://d.android.com/tools/testing">Testing documentation</a> | useAppContext | java | ittianyu/BottomNavigationViewEx | widget/src/androidTest/java/com/ittianyu/bottomnavigationviewex/ExampleInstrumentedTest.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/androidTest/java/com/ittianyu/bottomnavigationviewex/ExampleInstrumentedTest.java | MIT |
public BottomNavigationViewInner setIconVisibility(boolean visibility) {
/*
1. get field in this class
private final BottomNavigationMenuView mMenuView;
2. get field in mButtons
private BottomNavigationItemView[] mButtons;
3. get mIcon in mButtons
private ImageV... | change the visibility of icon
@param visibility | setIconVisibility | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
@Override
public void run() {
// System.out.println("mIcon.getMeasuredHeight():" + mIcon.getMeasuredHeight());
setItemHeight(mItemHeight - mIcon.getMeasuredHeight());
} | change the visibility of icon
@param visibility | run | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationViewInner setTextVisibility(boolean visibility) {
this.textVisibility = visibility;
/*
1. get field in this class
private final BottomNavigationMenuView mMenuView;
2. get field in mButtons
private BottomNavigationItemView[] mButtons;
3. se... | change the visibility of text
@param visibility | setTextVisibility | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
private static int getFontHeight(float fontSize) {
Paint paint = new Paint();
paint.setTextSize(fontSize);
Paint.FontMetrics fm = paint.getFontMetrics();
return (int) Math.ceil(fm.descent - fm.top) + 2;
} | get text height by font size
@param fontSize
@return | getFontHeight | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationViewInner enableAnimation(boolean enable) {
/*
1. get field in this class
private final BottomNavigationMenuView mMenuView;
2. get field in mButtons
private BottomNavigationItemView[] mButtons;
3. chang mShiftAmount to 0 in mButtons
privat... | enable or disable click item animation(text scale and icon move animation in no item shifting mode)
@param enable It means the text won't scale and icon won't move when active it in no item shifting mode if false. | enableAnimation | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
@Deprecated
public BottomNavigationViewInner enableShiftingMode(boolean enable) {
/*
1. get field in this class
private final BottomNavigationMenuView mMenuView;
2. change field mShiftingMode value in mMenuView
private boolean mShiftingMode = true;
*/
// 1. ... | @Deprecated use {@link #setLabelVisibilityMode }
enable the shifting mode for navigation
@param enable It will has a shift animation if true. Otherwise all items are the same width. | enableShiftingMode | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
@Deprecated
public BottomNavigationViewInner enableItemShiftingMode(boolean enable) {
/*
1. get field in this class
private final BottomNavigationMenuView mMenuView;
2. get field in this mMenuView
private BottomNavigationItemView[] mButtons;
3. change field mShiftin... | @Deprecated use {@link #setItemHorizontalTranslationEnabled(boolean)}
enable the shifting mode for each item
@param enable It will has a shift animation for item if true. Otherwise the item text always be shown. | enableItemShiftingMode | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public int getCurrentItem() {
/*
1. get field in this class
private final BottomNavigationMenuView mMenuView;
2. get field in mMenuView
private BottomNavigationItemView[] mButtons;
3. get menu and traverse it to get the checked one
*/
// 2. get mButton... | get the current checked item position
@return index of item, start from 0. | getCurrentItem | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public int getMenuItemPosition(MenuItem item) {
// get item id
int itemId = item.getItemId();
// get meunu
Menu menu = getMenu();
int size = menu.size();
for (int i = 0; i < size; i++) {
if (menu.getItem(i).getItemId() == itemId) {
return i;
... | get menu item position in menu
@param item
@return position if success, -1 otherwise | getMenuItemPosition | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationViewInner setCurrentItem(int index) {
setSelectedItemId(getMenu().getItem(index).getItemId());
return this;
} | set the current checked item
@param index start from 0. | setCurrentItem | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationViewInner clearIconTintColor() {
getBottomNavigationMenuView().setIconTintList(null);
return this;
} | The lib has a default icon tint color. You can call this method to clear it if no need.
It usually used when you set two image for item.
@return | clearIconTintColor | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationItemView[] getBottomNavigationItemViews() {
if (null != mButtons)
return mButtons;
/*
* 1 private final BottomNavigationMenuView mMenuView;
* 2 private BottomNavigationItemView[] mButtons;
*/
BottomNavigationMenuView mMenuView = getBo... | get private mButtons in mMenuView
@return | getBottomNavigationItemViews | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationItemView getBottomNavigationItemView(int position) {
return getBottomNavigationItemViews()[position];
} | get private mButton in mMenuView at position
@param position
@return | getBottomNavigationItemView | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public ImageView getIconAt(int position) {
/*
* 1 private final BottomNavigationMenuView mMenuView;
* 2 private BottomNavigationItemView[] mButtons;
* 3 private ImageView mIcon;
*/
BottomNavigationItemView mButtons = getBottomNavigationItemView(position);
Imag... | get icon at position
@param position
@return | getIconAt | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public TextView getSmallLabelAt(int position) {
/*
* 1 private final BottomNavigationMenuView mMenuView;
* 2 private BottomNavigationItemView[] mButtons;
* 3 private final TextView mSmallLabel;
*/
BottomNavigationItemView mButtons = getBottomNavigationItemView(positio... | get small label at position
Each item has tow label, one is large, another is small.
@param position
@return | getSmallLabelAt | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public TextView getLargeLabelAt(int position) {
/*
* 1 private final BottomNavigationMenuView mMenuView;
* 2 private BottomNavigationItemView[] mButtons;
* 3 private final TextView mLargeLabel;
*/
BottomNavigationItemView mButtons = getBottomNavigationItemView(positio... | get large label at position
Each item has tow label, one is large, another is small.
@param position
@return | getLargeLabelAt | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationViewInner setSmallTextSize(float sp) {
int count = getItemCount();
for (int i = 0; i < count; i++) {
getSmallLabelAt(i).setTextSize(sp);
}
mMenuView.updateMenuView();
return this;
} | set all item small TextView size
Each item has tow label, one is large, another is small.
Small one will be shown when item state is normal
Large one will be shown when item checked.
@param sp | setSmallTextSize | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationViewInner setLargeTextSize(float sp) {
int count = getItemCount();
for (int i = 0; i < count; i++) {
TextView tvLarge = getLargeLabelAt(i);
if (null != tvLarge)
tvLarge.setTextSize(sp);
}
mMenuView.updateMenuView();
r... | set all item large TextView size
Each item has tow label, one is large, another is small.
Small one will be shown when item state is normal.
Large one will be shown when item checked.
@param sp | setLargeTextSize | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationViewInner setTextSize(float sp) {
setLargeTextSize(sp);
setSmallTextSize(sp);
return this;
} | set all item large and small TextView size
Each item has tow label, one is large, another is small.
Small one will be shown when item state is normal
Large one will be shown when item checked.
@param sp | setTextSize | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
public BottomNavigationViewInner setIconSizeAt(int position, float width, float height) {
ImageView icon = getIconAt(position);
// update size
ViewGroup.LayoutParams layoutParams = icon.getLayoutParams();
layoutParams.width = dp2px(getContext(), width);
layoutParams.height = dp2p... | set item ImageView size which at position
@param position position start from 0
@param width in dp
@param height in dp | setIconSizeAt | java | ittianyu/BottomNavigationViewEx | widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | https://github.com/ittianyu/BottomNavigationViewEx/blob/master/widget/src/main/java/com/ittianyu/bottomnavigationviewex/BottomNavigationViewInner.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.