diff --git a/build.gradle b/build.gradle index e69de29..669a59a 100644 --- a/build.gradle +++ b/build.gradle @@ -0,0 +1,21 @@ +buildscript { + repositories { + mavenCentral() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.0.0-alpha5' + } +} + +allprojects { + repositories { + mavenCentral() + } +} + +ext { + compileSdkVersion = 23 + buildToolsVersion = "23.0.0" + + compatibility_JavaVersion = JavaVersion.VERSION_1_7 +} \ No newline at end of file diff --git a/library/build.gradle b/library/build.gradle index 59ee737..586bad6 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -1,15 +1,6 @@ -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.android.tools.build:gradle:0.8.+' - } -} - -apply plugin: 'android-library' +apply plugin: 'com.android.library' android { - compileSdkVersion 19 - buildToolsVersion = '19.0.1' + compileSdkVersion rootProject.ext.compileSdkVersion + buildToolsVersion rootProject.ext.buildToolsVersion } \ No newline at end of file diff --git a/library/project.properties b/library/project.properties index a2de03e..8e4bc5f 100644 --- a/library/project.properties +++ b/library/project.properties @@ -8,5 +8,5 @@ # project structure. # Project target. -target=android-8 +target=android-19 android.library=true diff --git a/library/src/main/java/com/tjerkw/slideexpandable/library/ActionSlideExpandableListView.java b/library/src/main/java/com/tjerkw/slideexpandable/library/ActionSlideExpandableListView.java index ace9f5b..001ed8e 100644 --- a/library/src/main/java/com/tjerkw/slideexpandable/library/ActionSlideExpandableListView.java +++ b/library/src/main/java/com/tjerkw/slideexpandable/library/ActionSlideExpandableListView.java @@ -1,7 +1,9 @@ package com.tjerkw.slideexpandable.library; import android.content.Context; +import android.os.Build; import android.util.AttributeSet; +import android.view.KeyEvent; import android.view.View; import android.view.ViewGroup; import android.widget.ListAdapter; @@ -37,6 +39,23 @@ public void setItemActionListener(OnActionClickListener listener, int ... button this.buttonIds = buttonIds; } + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + if(keyCode == KeyEvent.KEYCODE_DPAD_CENTER || keyCode == KeyEvent.KEYCODE_ENTER) { + SlideExpandableListAdapter adapter = (SlideExpandableListAdapter)getAdapter(); + View item = getSelectedView(); + if(item != null) { + // found by monkey + adapter.getExpandToggleButton(item).performClick(); + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + item.setActivated(true); + } + } + return true; + } + return super.onKeyDown(keyCode, event); + } + /** * Interface for callback to be invoked whenever an action is clicked in * the expandle area of the list item. diff --git a/library/src/main/java/com/tjerkw/slideexpandable/library/ExpandCollapseAnimation.java b/library/src/main/java/com/tjerkw/slideexpandable/library/ExpandCollapseAnimation.java index 7ebc8fb..bde20bc 100644 --- a/library/src/main/java/com/tjerkw/slideexpandable/library/ExpandCollapseAnimation.java +++ b/library/src/main/java/com/tjerkw/slideexpandable/library/ExpandCollapseAnimation.java @@ -1,6 +1,5 @@ package com.tjerkw.slideexpandable.library; -import android.util.Log; import android.view.View; import android.view.animation.Animation; import android.view.animation.Transformation; @@ -45,7 +44,6 @@ public ExpandCollapseAnimation(View view, int type) { @Override protected void applyTransformation(float interpolatedTime, Transformation t) { - super.applyTransformation(interpolatedTime, t); if (interpolatedTime < 1.0f) { if(mType == EXPAND) { @@ -53,7 +51,7 @@ protected void applyTransformation(float interpolatedTime, Transformation t) { } else { mLayoutParams.bottomMargin = - (int) (mEndHeight * interpolatedTime); } - Log.d("ExpandCollapseAnimation", "anim height " + mLayoutParams.bottomMargin); + //Log.d("ExpandCollapseAnimation", "anim height " + mLayoutParams.bottomMargin); mAnimatedView.requestLayout(); } else { if(mType == EXPAND) { diff --git a/sample/build.gradle b/sample/build.gradle index 0293e55..8744cd5 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -3,17 +3,17 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:0.8.+' + classpath 'com.android.tools.build:gradle:2.0.0-alpha5' } } -apply plugin: 'android-library' +apply plugin: 'com.android.library' dependencies { compile project(':library') } android { - compileSdkVersion 19 - buildToolsVersion = '19.0.1' + compileSdkVersion 22 + buildToolsVersion = '22.0.1' } \ No newline at end of file