fix #1
This commit is contained in:
parent
29cf7d21ff
commit
f1f11d99d8
|
|
@ -1,13 +1,13 @@
|
|||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 18
|
||||
compileSdkVersion 20
|
||||
buildToolsVersion "20.0.0"
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.daimajia.swipedemo"
|
||||
minSdkVersion 18
|
||||
targetSdkVersion 18
|
||||
minSdkVersion 8
|
||||
targetSdkVersion 20
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
|
@ -25,4 +25,5 @@ dependencies {
|
|||
compile 'com.nineoldandroids:library:2.4.0'
|
||||
compile 'com.daimajia.easing:library:1.0.0@aar'
|
||||
compile 'com.daimajia.androidanimations:library:1.1.2@aar'
|
||||
compile 'com.nineoldandroids:library:2.4.0'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import android.view.View;
|
|||
import android.widget.Toast;
|
||||
|
||||
import com.daimajia.swipe.SwipeLayout;
|
||||
import com.nineoldandroids.view.ViewHelper;
|
||||
|
||||
public class MyActivity extends Activity {
|
||||
|
||||
|
|
@ -23,7 +24,8 @@ public class MyActivity extends Activity {
|
|||
SwipeLayout swipeLayout = (SwipeLayout)findViewById(R.id.godfather);
|
||||
swipeLayout.setDragEdge(SwipeLayout.DragEdge.Bottom);
|
||||
|
||||
//
|
||||
//sample1
|
||||
|
||||
sample1 = (SwipeLayout)findViewById(R.id.sample1);
|
||||
sample1.setShowMode(SwipeLayout.ShowMode.LayDown);
|
||||
sample1.setDragEdge(SwipeLayout.DragEdge.Left);
|
||||
|
|
@ -34,6 +36,8 @@ public class MyActivity extends Activity {
|
|||
}
|
||||
});
|
||||
|
||||
//sample2
|
||||
|
||||
sample2 = (SwipeLayout)findViewById(R.id.sample2);
|
||||
sample2.setShowMode(SwipeLayout.ShowMode.LayDown);
|
||||
sample2.setShowMode(SwipeLayout.ShowMode.PullOut);
|
||||
|
|
@ -57,12 +61,6 @@ public class MyActivity extends Activity {
|
|||
Toast.makeText(MyActivity.this, "Magnifier", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
// sample2.addRevealListener(new int[]{R.id.magnifier, R.id.star, R.id.trash}, new SwipeLayout.OnRevealListener() {
|
||||
// @Override
|
||||
// public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) {
|
||||
// child.setScaleX(fraction);
|
||||
// }
|
||||
// });
|
||||
|
||||
sample2.findViewById(R.id.click).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
@ -71,6 +69,7 @@ public class MyActivity extends Activity {
|
|||
}
|
||||
});
|
||||
|
||||
//sample3
|
||||
|
||||
sample3 = (SwipeLayout)findViewById(R.id.sample3);
|
||||
sample3.setDragEdge(SwipeLayout.DragEdge.Top);
|
||||
|
|
@ -79,9 +78,9 @@ public class MyActivity extends Activity {
|
|||
public void onReveal(View child, SwipeLayout.DragEdge edge, float fraction, int distance) {
|
||||
View star = child.findViewById(R.id.star);
|
||||
float d = child.getHeight() / 2 - star.getHeight() / 2;
|
||||
star.setTranslationY(d * fraction);
|
||||
star.setScaleX(fraction+0.6f);
|
||||
star.setScaleY(fraction+0.6f);
|
||||
ViewHelper.setTranslationY(star, d * fraction);
|
||||
ViewHelper.setScaleX(star, fraction + 0.6f);
|
||||
ViewHelper.setScaleY(star, fraction + 0.6f);
|
||||
int c = (Integer)evaluate(fraction, Color.parseColor("#dddddd"), Color.parseColor("#4C535B"));
|
||||
child.setBackgroundColor(c);
|
||||
}
|
||||
|
|
@ -93,39 +92,6 @@ public class MyActivity extends Activity {
|
|||
}
|
||||
});
|
||||
|
||||
// final int[] res = new int[]{R.id.changeLeft, R.id.changeRight, R.id.changeTop, R.id.changeBottom};
|
||||
// final SwipeLayout.DragEdge[] edges = new SwipeLayout.DragEdge[]{SwipeLayout.DragEdge.Left, SwipeLayout.DragEdge.Right, SwipeLayout.DragEdge.Top, SwipeLayout.DragEdge.Bottom};
|
||||
// final SwipeLayout[] layouts = new SwipeLayout[]{sample1,sample2,sample3};
|
||||
// for(int i = 0; i < res.length; i++){
|
||||
// findViewById(res[i]).setTag(edges[i]);
|
||||
// findViewById(res[i]).setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// for (SwipeLayout l : layouts) {
|
||||
// l.setDragEdge((SwipeLayout.DragEdge) v.getTag());
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
// findViewById(R.id.pullout).setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// for (SwipeLayout l : layouts) {
|
||||
// l.setShowMode(SwipeLayout.ShowMode.PullOut);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// findViewById(R.id.laydown).setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// for(SwipeLayout l : layouts){
|
||||
// l.setShowMode(SwipeLayout.ShowMode.LayDown);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -151,6 +117,9 @@ public class MyActivity extends Activity {
|
|||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
/*
|
||||
Color transition method.
|
||||
*/
|
||||
public Object evaluate(float fraction, Object startValue, Object endValue) {
|
||||
int startInt = (Integer) startValue;
|
||||
int startA = (startInt >> 24) & 0xff;
|
||||
|
|
|
|||
|
|
@ -1,77 +1,20 @@
|
|||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp"
|
||||
tools:context=".MyActivity">
|
||||
android:orientation="vertical"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="10dp">
|
||||
|
||||
<include android:id="@+id/sample1" layout="@layout/sample1"
|
||||
android:layout_width="match_parent" android:layout_height="80dp"/>
|
||||
<include android:id="@+id/sample1" layout="@layout/sample1"
|
||||
android:layout_width="match_parent" android:layout_height="80dp"/>
|
||||
|
||||
|
||||
<include android:id="@+id/sample2" layout="@layout/sample2"
|
||||
android:layout_width="match_parent" android:layout_height="80dp"
|
||||
android:layout_marginTop="20dp"/>
|
||||
<include android:id="@+id/sample2" layout="@layout/sample2"
|
||||
android:layout_width="match_parent" android:layout_height="80dp"
|
||||
android:layout_marginTop="20dp"/>
|
||||
|
||||
<include android:id="@+id/sample3" layout="@layout/sample3"
|
||||
android:layout_width="match_parent" android:layout_height="80dp"
|
||||
android:layout_marginTop="20dp"/>
|
||||
<include android:id="@+id/sample3" layout="@layout/sample3"
|
||||
android:layout_width="match_parent" android:layout_height="80dp"
|
||||
android:layout_marginTop="20dp"/>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="invisible"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:weightSum="4"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/changeLeft"
|
||||
android:text="Left"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:id="@+id/changeRight"
|
||||
android:text="Right"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:id="@+id/changeTop"
|
||||
android:text="Top"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:id="@+id/changeBottom"
|
||||
android:text="Bottom"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="invisible"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:weightSum="2"
|
||||
android:layout_height="wrap_content">
|
||||
<Button
|
||||
android:id="@+id/pullout"
|
||||
android:text="PullOut"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
<Button
|
||||
android:id="@+id/laydown"
|
||||
android:text="LayDown"
|
||||
android:layout_weight="1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
|
||||
<style name="AppTheme" parent="android:style/Theme.Holo.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
</style>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ android {
|
|||
defaultConfig {
|
||||
applicationId "com.daimajia.swipelayout"
|
||||
minSdkVersion 8
|
||||
targetSdkVersion 19
|
||||
targetSdkVersion 20
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
}
|
||||
|
|
@ -21,6 +21,6 @@ android {
|
|||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:19.+'
|
||||
compile 'com.android.support:appcompat-v7:20.+'
|
||||
}
|
||||
apply from: './gradle-mvn-push.gradle'
|
||||
|
|
@ -104,10 +104,6 @@ afterEvaluate { project ->
|
|||
}
|
||||
}
|
||||
|
||||
task jar(type: Jar) {
|
||||
from android.sourceSets.main.java
|
||||
}
|
||||
|
||||
task androidJavadocs(type: Javadoc) {
|
||||
source = android.sourceSets.main.java.srcDirs
|
||||
classpath += project.files(android.getBootClasspath() .join(File.pathSeparator))
|
||||
|
|
@ -127,6 +123,5 @@ afterEvaluate { project ->
|
|||
archives androidSourcesJar
|
||||
archives androidJavadocsJar
|
||||
archives apklib
|
||||
archives jar
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue