Commit 6f9599b7 authored by Edward Wang's avatar Edward Wang
Browse files

Blind fix at SlidingMenu

parent d989110c
......@@ -28,15 +28,6 @@
-->
<property file="ant.properties" />
<!-- if sdk.dir was not set from one of the property file, then
get it from the ANDROID_HOME env var.
This must be done before we load project.properties since
the proguard config can use sdk.dir -->
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
<isset property="env.ANDROID_HOME" />
</condition>
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
......@@ -48,6 +39,14 @@
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<property environment="env" />
<condition property="sdk.dir" value="${env.ANDROID_SDK}" >
<and>
<not><isset property="${env.ANDROID_SDK}"/></not>
<not><isset property="sdk.dir"/></not>
</and>
</condition>
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="selected_view" type="id"/>
</resources>
\ No newline at end of file
package com.slidingmenu.lib;
import android.graphics.Canvas;
import android.view.animation.Interpolator;
import com.slidingmenu.lib.SlidingMenu.CanvasTransformer;
public class CanvasTranformerBuilder {
private CanvasTransformer mTrans;
private static Interpolator lin = new Interpolator() {
public float getInterpolation(float t) {
return t;
}
};
private void initTransformer() {
if (mTrans == null)
mTrans = new CanvasTransformer() {
public void transformCanvas(Canvas canvas, float percentOpen) { }
};
}
public CanvasTransformer zoom(final int openedX, final int closedX,
final int openedY, final int closedY,
final int px, final int py) {
return zoom(openedX, closedX, openedY, closedY, px, py, lin);
}
public CanvasTransformer zoom(final int openedX, final int closedX,
final int openedY, final int closedY,
final int px, final int py, final Interpolator interp) {
initTransformer();
mTrans = new CanvasTransformer() {
public void transformCanvas(Canvas canvas, float percentOpen) {
mTrans.transformCanvas(canvas, percentOpen);
float f = interp.getInterpolation(percentOpen);
canvas.scale((openedX - closedX) * f + closedX,
(openedY - closedY) * f + closedY, px, py);
}
};
return mTrans;
}
public CanvasTransformer rotate(final int openedDeg, final int closedDeg,
final int px, final int py) {
return rotate(openedDeg, closedDeg, px, py, lin);
}
public CanvasTransformer rotate(final int openedDeg, final int closedDeg,
final int px, final int py, final Interpolator interp) {
initTransformer();
mTrans = new CanvasTransformer() {
public void transformCanvas(Canvas canvas, float percentOpen) {
mTrans.transformCanvas(canvas, percentOpen);
float f = interp.getInterpolation(percentOpen);
canvas.rotate((openedDeg - closedDeg) * f + closedDeg,
px, py);
}
};
return mTrans;
}
public CanvasTransformer translate(final int openedX, final int closedX,
final int openedY, final int closedY) {
return translate(openedX, closedX, openedY, closedY, lin);
}
public CanvasTransformer translate(final int openedX, final int closedX,
final int openedY, final int closedY, final Interpolator interp) {
initTransformer();
mTrans = new CanvasTransformer() {
public void transformCanvas(Canvas canvas, float percentOpen) {
mTrans.transformCanvas(canvas, percentOpen);
float f = interp.getInterpolation(percentOpen);
canvas.translate((openedX - closedX) * f + closedX,
(openedY - closedY) * f + closedY);
}
};
return mTrans;
}
public CanvasTransformer concatTransformer(final CanvasTransformer t) {
initTransformer();
mTrans = new CanvasTransformer() {
public void transformCanvas(Canvas canvas, float percentOpen) {
mTrans.transformCanvas(canvas, percentOpen);
t.transformCanvas(canvas, percentOpen);
}
};
return mTrans;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment