package com.nozomi.autohidescrollview.view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.widget.ListView;

public class BounceListView extends ListView {
	private static final int MAX_Y_OVERSCROLL_DISTANCE = 200;

	private Context mContext;
	private int mMaxYOverscrollDistance;

	public BounceListView(Context context) {
		super(context);
		mContext = context;
		initBounceListView();
	}

	public BounceListView(Context context, AttributeSet attrs) {
		super(context, attrs);
		mContext = context;
		initBounceListView();
	}

	public BounceListView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		mContext = context;
		initBounceListView();
	}

	private void initBounceListView() {
		// get the density of the screen and do some maths with it on the max
		// overscroll distance
		// variable so that you get similar behaviors no matter what the screen
		// size

		final DisplayMetrics metrics = mContext.getResources()
				.getDisplayMetrics();
		final float density = metrics.density;

		mMaxYOverscrollDistance = (int) (density * MAX_Y_OVERSCROLL_DISTANCE);
	}

	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		// TODO Auto-generated method stub
		int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2,
				MeasureSpec.AT_MOST);

		super.onMeasure(widthMeasureSpec, expandSpec);
	}

}
@@ -112,45 +112,8 @@
 t;%0D%0A
-import android.util.DisplayMetrics;%0D%0A
 impo
@@ -194,137 +194,8 @@
 w %7B%0D
-%0A%09private static final int MAX_Y_OVERSCROLL_DISTANCE = 200;%0D%0A%0D%0A%09private Context mContext;%0D%0A%09private int mMaxYOverscrollDistance;%0D
 %0A%0D%0A%09
@@ -259,54 +259,8 @@
 );%0D%0A
-%09%09mContext = context;%0D%0A%09%09initBounceListView();
 %0D%0A%09%7D
@@ -356,54 +356,8 @@
 );%0D%0A
-%09%09mContext = context;%0D%0A%09%09initBounceListView();
 %0D%0A%09%7D
@@ -477,488 +477,8 @@
 );%0D%0A
-%09%09mContext = context;%0D%0A%09%09initBounceListView();%0D%0A%09%7D%0D%0A%0D%0A%09private void initBounceListView() %7B%0D%0A%09%09// get the density of the screen and do some maths with it on the max%0D%0A%09%09// overscroll distance%0D%0A%09%09// variable so that you get similar behaviors no matter what the screen%0D%0A%09%09// size%0D%0A%0D%0A%09%09final DisplayMetrics metrics = mContext.getResources()%0D%0A%09%09%09%09.getDisplayMetrics();%0D%0A%09%09final float density = metrics.density;%0D%0A%0D%0A%09%09mMaxYOverscrollDistance = (int) (density * MAX_Y_OVERSCROLL_DISTANCE);
 %0D%0A%09%7D
@@ -571,46 +571,8 @@
  %7B%0D%0A
-%09%09// TODO Auto-generated method stub%0D%0A
 %09%09in

remove useless code