Back button menu icon scaling according to DP, this partially fixes issue #85

Fixed a touch issue in edit mode
Some cleanup...
This commit is contained in:
Matteo Hausner 2014-01-16 20:48:30 +01:00
parent 1b8322aa92
commit 050f30a274
3 changed files with 15 additions and 8 deletions

View File

@ -40,7 +40,8 @@ public class EditVJoyActivity extends Activity {
void createPopup() {
popUp = new PopupWindow(this);
params = new LayoutParams(80, 80);
int p = GL2JNIActivity.getPixelsFromDp(60, this);
params = new LayoutParams(p, p);
LinearLayout hlay = new LinearLayout(this);

View File

@ -11,6 +11,7 @@ import com.reicast.emulator.GL2JNIView.EmuThread;
import android.content.SharedPreferences;
import android.annotation.TargetApi;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
@ -46,6 +47,10 @@ public class GL2JNIActivity extends Activity {
int map[][];
public static int getPixelsFromDp(float dps, Context context) {
return (int) (dps * context.getResources().getDisplayMetrics().density + 0.5f);
}
View addbut(int x, OnClickListener ocl) {
ImageButton but = new ImageButton(this);
@ -63,8 +68,8 @@ public class GL2JNIActivity extends Activity {
// LinearLayout layout = new LinearLayout(this);
// tv = new TextView(this);
params = new LayoutParams(80, 80);
int p = getPixelsFromDp(60, this);
params = new LayoutParams(p, p);
// layout.setOrientation(LinearLayout.VERTICAL);
// tv.setText("Hi this is a sample text for popup window");

View File

@ -461,7 +461,7 @@ class GL2JNIView extends GLSurfaceView
if(vjoy[j][4]==-3)
{
if (editVjoyMode) {
selectedVjoyElement = 5;Log.w("selcted", "anal"); // Analog
selectedVjoyElement = 5; // Analog
resetEditMode();
} else {
vjoy[j+1][0]=x-vjoy[j+1][2]/2;
@ -534,15 +534,16 @@ class GL2JNIView extends GLSurfaceView
{
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
selectedVjoyElement = -1;
reset_analog();
anal_id=-1;
rv=0xFFFF;
rt[0]=0;
lt[0]=0;
lt_id=-1;
rt_id=-1;
for(int j=0;j<vjoy.length;j++)
vjoy[j][5]=0;
lt_id=-1;
rt_id=-1;
for(int j=0;j<vjoy.length;j++)
vjoy[j][5]=0;
break;
case MotionEvent.ACTION_POINTER_UP: