@nativescript-community/ui-material-ripple
Advanced tools
Comparing version 4.0.8 to 4.0.9
{ | ||
"name": "@nativescript-community/ui-material-ripple", | ||
"version": "4.0.8", | ||
"version": "4.0.9", | ||
"description": "Material ripple component", | ||
@@ -40,3 +40,3 @@ "main": "./ripple", | ||
}, | ||
"gitHead": "28738301ad876f23fa533ca7e9e89f66db8b0e7e" | ||
"gitHead": "bd4421242dd4aba6711039ed7c499b3647bdbebc" | ||
} |
@@ -23,115 +23,139 @@ import { getRippleColor, rippleColorProperty } from '@nativescript-community/ui-material-core'; | ||
} | ||
let PreLollipopStackLayoutImpl = class PreLollipopStackLayoutImpl extends org.nativescript.widgets.StackLayout { | ||
constructor(context) { | ||
super(context); | ||
this.mSelfBounds = new android.graphics.Rect(); | ||
this.mOverlayBounds = new android.graphics.Rect(); | ||
this.mForegroundGravity = android.view.Gravity.FILL; | ||
this.mForegroundInPadding = true; | ||
this.mForegroundBoundsChanged = false; | ||
return global.__native(this); | ||
var PreLollipopStackLayoutImpl = /** @class */ (function (_super) { | ||
__extends(PreLollipopStackLayoutImpl, _super); | ||
function PreLollipopStackLayoutImpl(context) { | ||
var _this = _super.call(this, context) || this; | ||
_this.mSelfBounds = new android.graphics.Rect(); | ||
_this.mOverlayBounds = new android.graphics.Rect(); | ||
_this.mForegroundGravity = android.view.Gravity.FILL; | ||
_this.mForegroundInPadding = true; | ||
_this.mForegroundBoundsChanged = false; | ||
return global.__native(_this); | ||
} | ||
/** | ||
* Describes how the foreground is positioned. | ||
* | ||
* @return foreground gravity. | ||
* @see #setForegroundGravity(int) | ||
*/ | ||
PreLollipopStackLayoutImpl.prototype.getForegroundGravity = function () { | ||
return this.mForegroundGravity; | ||
}; | ||
/** | ||
* Describes how the foreground is positioned. Defaults to START and TOP. | ||
* | ||
* @param foregroundGravity See {@link android.view.Gravity} | ||
* @see #getForegroundGravity() | ||
*/ | ||
PreLollipopStackLayoutImpl.prototype.setForegroundGravity = function (foregroundGravity) { | ||
if (this.mForegroundGravity !== foregroundGravity) { | ||
if ((foregroundGravity & android.view.Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) === 0) { | ||
foregroundGravity |= android.view.Gravity.START; | ||
} | ||
if ((foregroundGravity & android.view.Gravity.VERTICAL_GRAVITY_MASK) === 0) { | ||
foregroundGravity |= android.view.Gravity.TOP; | ||
} | ||
this.mForegroundGravity = foregroundGravity; | ||
if (this.mForegroundGravity === android.view.Gravity.FILL && this.mForeground != null) { | ||
var padding = new android.graphics.Rect(); | ||
this.mForeground.getPadding(padding); | ||
} | ||
this.requestLayout(); | ||
} | ||
getForegroundGravity() { | ||
return this.mForegroundGravity; | ||
}; | ||
PreLollipopStackLayoutImpl.prototype.verifyDrawable = function (who) { | ||
return _super.prototype.verifyDrawable.call(this, who) || who === this.mForeground; | ||
}; | ||
PreLollipopStackLayoutImpl.prototype.jumpDrawablesToCurrentState = function () { | ||
_super.prototype.jumpDrawablesToCurrentState.call(this); | ||
if (this.mForeground != null) { | ||
this.mForeground.jumpToCurrentState(); | ||
} | ||
setForegroundGravity(foregroundGravity) { | ||
if (this.mForegroundGravity !== foregroundGravity) { | ||
if ((foregroundGravity & android.view.Gravity.RELATIVE_HORIZONTAL_GRAVITY_MASK) === 0) { | ||
foregroundGravity |= android.view.Gravity.START; | ||
}; | ||
PreLollipopStackLayoutImpl.prototype.drawableStateChanged = function () { | ||
_super.prototype.drawableStateChanged.call(this); | ||
if (this.mForeground != null && this.mForeground.isStateful()) { | ||
this.mForeground.setState(this.getDrawableState()); | ||
} | ||
}; | ||
/** | ||
* Supply a Drawable that is to be rendered on top of all of the child | ||
* views in the frame Utils.layout. Any padding in the Drawable will be taken | ||
* into account by ensuring that the children are inset to be placed | ||
* inside of the padding area. | ||
* | ||
* @param drawable The Drawable to be drawn on top of the children. | ||
*/ | ||
PreLollipopStackLayoutImpl.prototype.setForeground = function (drawable) { | ||
if (this.mForeground !== drawable) { | ||
if (this.mForeground != null) { | ||
this.mForeground.setCallback(null); | ||
this.unscheduleDrawable(this.mForeground); | ||
} | ||
this.mForeground = drawable; | ||
if (drawable != null) { | ||
this.setWillNotDraw(false); | ||
drawable.setCallback(this); | ||
if (drawable.isStateful()) { | ||
drawable.setState(this.getDrawableState()); | ||
} | ||
if ((foregroundGravity & android.view.Gravity.VERTICAL_GRAVITY_MASK) === 0) { | ||
foregroundGravity |= android.view.Gravity.TOP; | ||
if (this.mForegroundGravity === android.view.Gravity.FILL) { | ||
var padding = new android.graphics.Rect(); | ||
drawable.getPadding(padding); | ||
} | ||
this.mForegroundGravity = foregroundGravity; | ||
if (this.mForegroundGravity === android.view.Gravity.FILL && this.mForeground != null) { | ||
const padding = new android.graphics.Rect(); | ||
this.mForeground.getPadding(padding); | ||
} | ||
this.requestLayout(); | ||
} | ||
} | ||
verifyDrawable(who) { | ||
return super.verifyDrawable(who) || who === this.mForeground; | ||
} | ||
jumpDrawablesToCurrentState() { | ||
super.jumpDrawablesToCurrentState(); | ||
if (this.mForeground != null) { | ||
this.mForeground.jumpToCurrentState(); | ||
else { | ||
this.setWillNotDraw(true); | ||
} | ||
this.requestLayout(); | ||
this.invalidate(); | ||
} | ||
drawableStateChanged() { | ||
super.drawableStateChanged(); | ||
if (this.mForeground != null && this.mForeground.isStateful()) { | ||
this.mForeground.setState(this.getDrawableState()); | ||
} | ||
} | ||
setForeground(drawable) { | ||
if (this.mForeground !== drawable) { | ||
if (this.mForeground != null) { | ||
this.mForeground.setCallback(null); | ||
this.unscheduleDrawable(this.mForeground); | ||
}; | ||
/** | ||
* Returns the drawable used as the foreground of this FrameLayout. The | ||
* foreground drawable, if non-null, is always drawn on top of the children. | ||
* | ||
* @return A Drawable or null if no foreground was set. | ||
*/ | ||
PreLollipopStackLayoutImpl.prototype.getForeground = function () { | ||
return this.mForeground; | ||
}; | ||
PreLollipopStackLayoutImpl.prototype.onLayout = function (changed, left, top, right, bottom) { | ||
_super.prototype.onLayout.call(this, changed, left, top, right, bottom); | ||
this.mForegroundBoundsChanged = this.mForegroundBoundsChanged || changed; | ||
}; | ||
PreLollipopStackLayoutImpl.prototype.onSizeChanged = function (w, h, oldw, oldh) { | ||
_super.prototype.onSizeChanged.call(this, w, h, oldw, oldh); | ||
this.mForegroundBoundsChanged = true; | ||
}; | ||
PreLollipopStackLayoutImpl.prototype.draw = function (canvas) { | ||
_super.prototype.draw.call(this, canvas); | ||
if (this.mForeground != null) { | ||
var foreground = this.mForeground; | ||
if (this.mForegroundBoundsChanged) { | ||
this.mForegroundBoundsChanged = false; | ||
var selfBounds = this.mSelfBounds; | ||
var overlayBounds = this.mOverlayBounds; | ||
var w = this.getRight() - this.getLeft(); | ||
var h = this.getBottom() - this.getTop(); | ||
if (this.mForegroundInPadding) { | ||
selfBounds.set(0, 0, w, h); | ||
} | ||
this.mForeground = drawable; | ||
if (drawable != null) { | ||
this.setWillNotDraw(false); | ||
drawable.setCallback(this); | ||
if (drawable.isStateful()) { | ||
drawable.setState(this.getDrawableState()); | ||
} | ||
if (this.mForegroundGravity === android.view.Gravity.FILL) { | ||
const padding = new android.graphics.Rect(); | ||
drawable.getPadding(padding); | ||
} | ||
} | ||
else { | ||
this.setWillNotDraw(true); | ||
selfBounds.set(this.getPaddingLeft(), this.getPaddingTop(), w - this.getPaddingRight(), h - this.getPaddingBottom()); | ||
} | ||
this.requestLayout(); | ||
this.invalidate(); | ||
android.view.Gravity.apply(this.mForegroundGravity, foreground.getIntrinsicWidth(), foreground.getIntrinsicHeight(), selfBounds, overlayBounds); | ||
foreground.setBounds(overlayBounds); | ||
} | ||
foreground.draw(canvas); | ||
} | ||
getForeground() { | ||
return this.mForeground; | ||
}; | ||
PreLollipopStackLayoutImpl.prototype.drawableHotspotChanged = function (x, y) { | ||
_super.prototype.drawableHotspotChanged.call(this, x, y); | ||
if (this.mForeground != null) { | ||
this.mForeground.setHotspot(x, y); | ||
} | ||
onLayout(changed, left, top, right, bottom) { | ||
super.onLayout(changed, left, top, right, bottom); | ||
this.mForegroundBoundsChanged = this.mForegroundBoundsChanged || changed; | ||
} | ||
onSizeChanged(w, h, oldw, oldh) { | ||
super.onSizeChanged(w, h, oldw, oldh); | ||
this.mForegroundBoundsChanged = true; | ||
} | ||
draw(canvas) { | ||
super.draw(canvas); | ||
if (this.mForeground != null) { | ||
const foreground = this.mForeground; | ||
if (this.mForegroundBoundsChanged) { | ||
this.mForegroundBoundsChanged = false; | ||
const selfBounds = this.mSelfBounds; | ||
const overlayBounds = this.mOverlayBounds; | ||
const w = this.getRight() - this.getLeft(); | ||
const h = this.getBottom() - this.getTop(); | ||
if (this.mForegroundInPadding) { | ||
selfBounds.set(0, 0, w, h); | ||
} | ||
else { | ||
selfBounds.set(this.getPaddingLeft(), this.getPaddingTop(), w - this.getPaddingRight(), h - this.getPaddingBottom()); | ||
} | ||
android.view.Gravity.apply(this.mForegroundGravity, foreground.getIntrinsicWidth(), foreground.getIntrinsicHeight(), selfBounds, overlayBounds); | ||
foreground.setBounds(overlayBounds); | ||
} | ||
foreground.draw(canvas); | ||
} | ||
} | ||
drawableHotspotChanged(x, y) { | ||
super.drawableHotspotChanged(x, y); | ||
if (this.mForeground != null) { | ||
this.mForeground.setHotspot(x, y); | ||
} | ||
} | ||
}; | ||
PreLollipopStackLayoutImpl = __decorate([ | ||
NativeClass, | ||
__metadata("design:paramtypes", [Object]) | ||
], PreLollipopStackLayoutImpl); | ||
return PreLollipopStackLayoutImpl; | ||
}(org.nativescript.widgets.StackLayout)); | ||
PreLollipopStackLayout = PreLollipopStackLayoutImpl; | ||
@@ -138,0 +162,0 @@ } |
Sorry, the diff of this file is not supported yet
374
59922