Skip to content

Commit

Permalink
Updated with requests from Nathan
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickDattilio committed Aug 16, 2015
1 parent d89b677 commit 08cf0ce
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ mBackground.unregisterSensorManager();
Configurations
--------------

There are four attributes that can be changed to adjust the parallax effect of the ImageView.
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:mtn_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_mtn_intensity)) {
setParallaxIntensity(customAttrs.getFloat(R.styleable.ParallaxImageView_mtn_intensity, mParallaxIntensity));
if (customAttrs.hasValue(R.styleable.ParallaxImageView_motionIntensity)) {
setParallaxIntensity(customAttrs.getFloat(R.styleable.ParallaxImageView_motionIntensity, mParallaxIntensity));
}

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

if (customAttrs.hasValue(R.styleable.ParallaxImageView_mtn_tiltSensitivity)) {
setTiltSensitivity(customAttrs.getFloat(R.styleable.ParallaxImageView_mtn_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="mtn_intensity" format="float"/>
<attr name="mtn_tiltSensitivity" format="float"/>
<attr name="mtn_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 08cf0ce

Please sign in to comment.