Skip to content

Commit

Permalink
NineOlds dependency switched to support lib pedrovgs#62
Browse files Browse the repository at this point in the history
  • Loading branch information
zedoref committed Jan 12, 2016
1 parent a928244 commit 7fea2c7
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
3 changes: 1 addition & 2 deletions draggablepanel/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ apply plugin: 'com.android.library'
apply plugin: 'checkstyle'

dependencies {
compile 'com.android.support:support-v4:20.0.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.android.support:support-v4:23.1.1'
}

android {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import android.widget.RelativeLayout;
import com.github.pedrovgs.transformer.Transformer;
import com.github.pedrovgs.transformer.TransformerFactory;
import com.nineoldandroids.view.ViewHelper;

/**
* Class created to extends a ViewGroup and simulate the YoutubeLayoutComponent
Expand Down Expand Up @@ -161,7 +160,7 @@ public void slideHorizontally(float slideOffset, float drawerPosition, int width
minimize();
}
setTouchEnabled(slideOffset <= MIN_SLIDE_OFFSET);
ViewHelper.setX(this, width - Math.abs(drawerPosition));
ViewCompat.setX(this, width - Math.abs(drawerPosition));
}

/**
Expand Down Expand Up @@ -431,8 +430,8 @@ private MotionEvent cloneMotionEventWithAction(MotionEvent event, int action) {
else if (isDragViewAtTop()) {
dragView.layout(left, top, right, transformer.getOriginalHeight());
secondView.layout(left, transformer.getOriginalHeight(), right, bottom);
ViewHelper.setY(dragView, top);
ViewHelper.setY(secondView, transformer.getOriginalHeight());
ViewCompat.setY(dragView, top);
ViewCompat.setY(secondView, transformer.getOriginalHeight());
} else {
secondView.layout(left, transformer.getOriginalHeight(), right, bottom);
}
Expand Down Expand Up @@ -494,7 +493,7 @@ void changeDragViewPosition() {
* Modify secondView position to be always below dragged view.
*/
void changeSecondViewPosition() {
ViewHelper.setY(secondView, dragView.getBottom());
ViewCompat.setY(secondView, dragView.getBottom());
}

/**
Expand All @@ -520,7 +519,7 @@ void changeBackgroundAlpha() {
* Modify the second view alpha based on dragged view vertical position.
*/
void changeSecondViewAlpha() {
ViewHelper.setAlpha(secondView, 1 - getVerticalDragOffset());
ViewCompat.setAlpha(secondView, 1 - getVerticalDragOffset());
}

/**
Expand All @@ -533,16 +532,16 @@ void changeDragViewViewAlpha() {
if (alpha == 0) {
alpha = 1;
}
ViewHelper.setAlpha(dragView, alpha);
ViewCompat.setAlpha(dragView, alpha);
}
}

/**
* Restore view alpha to 1
*/
void restoreAlpha() {
if (enableHorizontalAlphaEffect && ViewHelper.getAlpha(dragView) < 1) {
ViewHelper.setAlpha(dragView, 1);
if (enableHorizontalAlphaEffect && ViewCompat.getAlpha(dragView) < 1) {
ViewCompat.setAlpha(dragView, 1);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
*/
package com.github.pedrovgs.transformer;

import android.support.v4.view.ViewCompat;
import android.view.View;
import com.nineoldandroids.view.ViewHelper;


/**
* Transformer extension created to scale the view instead of resize it as the other
* implementation does. This implementation is based on Nineoldanroids library to scale
* the view.
* implementation does. This implementation is based on support.v4 library
*
* @author Pedro Vicente Gómez Sánchez
*/
Expand All @@ -32,23 +32,23 @@ class ScaleTransformer extends Transformer {
}

/**
* Uses Nineoldandroids to change the scale.
* Uses support.v4 to change the scale.
*
* @param verticalDragOffset used to calculate the new scale.
*/
@Override public void updateScale(float verticalDragOffset) {
ViewHelper.setScaleX(getView(), 1 - verticalDragOffset / getXScaleFactor());
ViewHelper.setScaleY(getView(), 1 - verticalDragOffset / getYScaleFactor());
ViewCompat.setScaleX(getView(), 1 - verticalDragOffset / getXScaleFactor());
ViewCompat.setScaleY(getView(), 1 - verticalDragOffset / getYScaleFactor());
}

/**
* Uses Nineoldandroids to change the position of the view.
* Uses support.v4 to change the position of the view.
*
* @param verticalDragOffset used to calculate the new position.
*/
@Override public void updatePosition(float verticalDragOffset) {
ViewHelper.setPivotX(getView(), getView().getWidth() - getMarginRight());
ViewHelper.setPivotY(getView(), getView().getHeight() - getMarginBottom());
ViewCompat.setPivotX(getView(), getView().getWidth() - getMarginRight());
ViewCompat.setPivotY(getView(), getView().getHeight() - getMarginBottom());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
package com.github.pedrovgs.transformer;

import android.support.v4.view.ViewCompat;
import android.view.View;
import android.widget.RelativeLayout;
import com.nineoldandroids.view.ViewHelper;

/**
* Abstract class created to be implemented by different classes are going to change the size of a
Expand Down Expand Up @@ -136,7 +136,7 @@ public boolean isViewAtTop() {

public boolean isAboveTheMiddle() {
int parentHeight = parent.getHeight();
float viewYPosition = ViewHelper.getY(view) + (view.getHeight() * 0.5f);
float viewYPosition = ViewCompat.getY(view) + (view.getHeight() * 0.5f);
return viewYPosition < (parentHeight * 0.5);
}

Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=pedrovgs
POM_DEVELOPER_NAME=Pedro Vicente Gómez Sánchez

ANDROID_BUILD_TOOLS_VERSION=20.0.0
ANDROID_COMPILE_SDK_VERSION=20
ANDROID_TARGET_SDK_VERSION=20
ANDROID_BUILD_TOOLS_VERSION=23.0.2
ANDROID_COMPILE_SDK_VERSION=23
ANDROID_TARGET_SDK_VERSION=19
ANDROID_MIN_SDK=8
2 changes: 1 addition & 1 deletion sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies {
compile 'com.squareup.dagger:dagger:1.1.0'
compile 'com.github.pedrovgs:renderers:1.0.9'
compile 'com.google.android.gms:play-services:4.1.32'
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile "com.android.support:appcompat-v7:23.1.1"
compile files('libs/YouTubeAndroidPlayerApi.jar')
}

Expand Down
2 changes: 1 addition & 1 deletion sample/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<!-- Application -->

<style name="AppTheme" parent="@style/Theme.Sherlock.Light"/>
<style name="AppTheme" parent="@style/Theme.AppCompat.Light"/>

<style name="image_view">
<item name="android:scaleType">centerCrop</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
package com.github.pedrovgs.sample.activity;

import android.os.Bundle;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AppCompatActivity;

import com.github.pedrovgs.sample.DraggablePanelApplication;

/**
Expand All @@ -26,7 +28,7 @@
*
* @author Pedro Vicente Gómez Sánchez.
*/
public class DIFragmentActivity extends SherlockFragmentActivity {
public class DIFragmentActivity extends FragmentActivity {

@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.ViewCompat;
import android.support.v4.widget.DrawerLayout;
import android.util.TypedValue;
import android.view.Gravity;
Expand All @@ -38,7 +39,6 @@
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import com.nineoldandroids.view.ViewHelper;
import com.pedrogomez.renderers.RendererAdapter;
import com.squareup.picasso.Picasso;
import javax.inject.Inject;
Expand Down Expand Up @@ -306,7 +306,7 @@ private void configNavigationDrawer() {

@Override public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, slideOffset);
draggablePanel.slideHorizontally(slideOffset, ViewHelper.getX(drawerView),
draggablePanel.slideHorizontally(slideOffset, ViewCompat.getX(drawerView),
drawerView.getWidth());
}
};
Expand Down

0 comments on commit 7fea2c7

Please sign in to comment.