Skip to content

Commit

Permalink
Merge pull request #15 from PatrickDattilio/master
Browse files Browse the repository at this point in the history
Added "motion" prefix to attributes, to prevent naming conflicts.
  • Loading branch information
nvanbenschoten committed Aug 16, 2015
2 parents 873e817 + 08cf0ce commit bd3b9f9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,13 @@ Configurations
There are three attributes that can be changed to adjust the parallax effect of the ImageView.
Each can be accessed either through XML attributes or through Java functions.

* parallaxIntensity (float) - adjusts the strength of the parallax effect, giving control over the
* motionIntensity (float) - adjusts the strength of the parallax effect, giving control over the
perceived depth of the view.

* tiltSensitivity (float) - adjusts the sensitivity of the view towards tilting, changing how quickly
* motionTiltSensitivity (float) - adjusts the sensitivity of the view towards tilting, changing how quickly
the parallax's bounds are reached.

* scaledIntensity (boolean) - adjusts whether the ImageView's x and y axis' parallax intensities
* motionScaledIntensity (boolean) - adjusts whether the ImageView's x and y axis' parallax intensities
are scaled to the image's aspect ratio or equal to each other and to the smaller of the axis'
intensities (false by default).

Expand Down
2 changes: 1 addition & 1 deletion motion-sample/src/main/res/layout/fragment_parallax.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:id="@android:id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
parallax:tiltSensitivity="2.5"
parallax:motionTiltSensitivity="2.5"
/>

<LinearLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ public ParallaxImageView(Context context, AttributeSet attrs, int defStyle) {
final TypedArray customAttrs = context.obtainStyledAttributes(attrs, R.styleable.ParallaxImageView);

if (customAttrs != null) {
if (customAttrs.hasValue(R.styleable.ParallaxImageView_intensity)) {
setParallaxIntensity(customAttrs.getFloat(R.styleable.ParallaxImageView_intensity, mParallaxIntensity));
if (customAttrs.hasValue(R.styleable.ParallaxImageView_motionIntensity)) {
setParallaxIntensity(customAttrs.getFloat(R.styleable.ParallaxImageView_motionIntensity, mParallaxIntensity));
}

if (customAttrs.hasValue(R.styleable.ParallaxImageView_scaledIntensity)) {
setScaledIntensities(customAttrs.getBoolean(R.styleable.ParallaxImageView_scaledIntensity, mScaledIntensities));
if (customAttrs.hasValue(R.styleable.ParallaxImageView_motionScaledIntensity)) {
setScaledIntensities(customAttrs.getBoolean(R.styleable.ParallaxImageView_motionScaledIntensity, mScaledIntensities));
}

if (customAttrs.hasValue(R.styleable.ParallaxImageView_tiltSensitivity)) {
setTiltSensitivity(customAttrs.getFloat(R.styleable.ParallaxImageView_tiltSensitivity,
if (customAttrs.hasValue(R.styleable.ParallaxImageView_motionTiltSensitivity)) {
setTiltSensitivity(customAttrs.getFloat(R.styleable.ParallaxImageView_motionTiltSensitivity,
mSensorInterpreter.getTiltSensitivity()));
}

Expand Down
6 changes: 3 additions & 3 deletions motion/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ParallaxImageView">
<attr name="intensity" format="float"/>
<attr name="tiltSensitivity" format="float"/>
<attr name="scaledIntensity" format="boolean"/>
<attr name="motionIntensity" format="float"/>
<attr name="motionTiltSensitivity" format="float"/>
<attr name="motionScaledIntensity" format="boolean"/>
</declare-styleable>
</resources>

0 comments on commit bd3b9f9

Please sign in to comment.