Fix touchable area for close button

This commit is contained in:
Victor Shcherb 2012-09-09 17:40:14 +02:00
parent 8a608c94ad
commit 71797021f4
11 changed files with 5 additions and 43 deletions

View file

@ -90,7 +90,9 @@ public class OsmExtractionUI implements IMapLocationListener {
if(!(e instanceof ThreadDeath)){
ExceptionHandler.handle("Error in thread " + t.getName(), e); //$NON-NLS-1$
}
defaultHandler.uncaughtException(t, e);
if(defaultHandler != null){
defaultHandler.uncaughtException(t, e);
}
}
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

After

Width:  |  Height:  |  Size: 989 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 B

After

Width:  |  Height:  |  Size: 792 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -4,6 +4,7 @@
android:background="@drawable/tab_menu_item_small">
<ImageView
android:src="@drawable/expandable_category_unpushed"
android:id="@+id/explist_indicator"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -36,42 +36,4 @@ public class AndroidUtils {
});
}
/**
* @param closeButton expand area of which element
* @param left multiplier of width to add to left, 1 does nothing
* @param top multiplier of height to add to top, 1 does nothing
* @param right multiplier of width to add to right, 1 does nothing
* @param bottom multiplier of height to add to bottom, 1 does nothing
*/
public static void expandClickableArea(final View closeButton,
final int left, final int top, final int right, final int bottom) {
closeButton.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
v.post(new Runnable() {
@Override
public void run() {
closeButton.performClick();
}
});
return true;
}
});
// increase touch area for the button
final View parent = (View) closeButton.getParent();
parent.post(new Runnable() {
// Post in the parent's message queue to make sure the parent
// lays out its children before we call getHitRect()
@Override
public void run() {
Rect r = new Rect();
closeButton.getHitRect(r);
r.left -= r.width() * left;
r.top -= r.height() * top;
r.right += r.width() * right;
r.bottom += r.height() * bottom;
parent.setTouchDelegate(new TouchDelegate(r, closeButton));
}
});
}
}

View file

@ -4,7 +4,6 @@ import java.io.File;
import java.text.MessageFormat;
import java.util.Random;
import net.osmand.AndroidUtils;
import net.osmand.Version;
import net.osmand.access.AccessibleAlertBuilder;
import net.osmand.plus.OsmandApplication;
@ -223,8 +222,6 @@ public class MainMenuActivity extends Activity {
}
}
});
AndroidUtils.expandClickableArea(closeButton, 1,1,3,3);
View searchButton = window.findViewById(R.id.SearchButton);
searchButton.setOnClickListener(new OnClickListener() {
@Override

View file

@ -353,7 +353,7 @@ public class EditingPOIActivity implements DialogProvider {
}
});
}
v.invalidate();
layout.requestLayout();
}
});