Skip to content
This repository has been archived by the owner on Nov 22, 2017. It is now read-only.

NineOlds dependency switched to support lib #62 #83

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.1'
classpath 'com.android.tools.build:gradle:1.5.0'
}
}

Expand Down
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
4 changes: 2 additions & 2 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_BUILD_TOOLS_VERSION=23.0.2
ANDROID_COMPILE_SDK_VERSION=23
ANDROID_TARGET_SDK_VERSION=20
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,8 @@
package com.github.pedrovgs.sample.activity;

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

import com.github.pedrovgs.sample.DraggablePanelApplication;

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

@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