Skip to content

Commit

Permalink
Updated to fully drop support for API Versions < 8
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Farebrother committed Feb 21, 2014
1 parent 24b30b9 commit 86b6cd0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 34 deletions.
4 changes: 2 additions & 2 deletions library/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="4" />
android:minSdkVersion="8" />

<application />

</manifest>
</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,8 @@ public abstract class AbstractSlideExpandableListAdapter extends WrapperListAdap
*/
private ViewGroup parent;

private boolean froyoOrAbove;

public AbstractSlideExpandableListAdapter(ListAdapter wrapped) {
super(wrapped);
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= android.os.Build.VERSION_CODES.FROYO){
froyoOrAbove = true;
}
}

private OnItemExpandCollapseListener expandCollapseListener;
Expand Down Expand Up @@ -317,40 +311,38 @@ private void animateView(final View target, final int type) {
type
);
anim.setDuration(getAnimationDuration());
if (froyoOrAbove) {
anim.setAnimationListener(new AnimationListener() {
anim.setAnimationListener(new AnimationListener() {

@Override
public void onAnimationStart(Animation animation) {}
@Override
public void onAnimationStart(Animation animation) {}

@Override
public void onAnimationRepeat(Animation animation) {}
@Override
public void onAnimationRepeat(Animation animation) {}

@Override
public void onAnimationEnd(Animation animation) {
if (type == ExpandCollapseAnimation.EXPAND) {
if (parent instanceof ListView) {
ListView listView = (ListView) parent;
int movement = target.getBottom();

Rect r = new Rect();
boolean visible = target.getGlobalVisibleRect(r);
Rect r2 = new Rect();
listView.getGlobalVisibleRect(r2);

if (!visible) {
@Override
public void onAnimationEnd(Animation animation) {
if (type == ExpandCollapseAnimation.EXPAND) {
if (parent instanceof ListView) {
ListView listView = (ListView) parent;
int movement = target.getBottom();

Rect r = new Rect();
boolean visible = target.getGlobalVisibleRect(r);
Rect r2 = new Rect();
listView.getGlobalVisibleRect(r2);

if (!visible) {
listView.smoothScrollBy(movement, getAnimationDuration());
} else {
if (r2.bottom == r.bottom) {
listView.smoothScrollBy(movement, getAnimationDuration());
} else {
if (r2.bottom == r.bottom) {
listView.smoothScrollBy(movement, getAnimationDuration());
}
}
}
}

}
});
}

}
});
target.startAnimation(anim);
}

Expand Down

0 comments on commit 86b6cd0

Please sign in to comment.