- Fixed unproper layout size on many pottential devices

This commit is contained in:
SerpentSpirale 2021-01-11 18:24:58 +01:00
parent a2e383c5e5
commit 6464def409

View file

@ -737,7 +737,7 @@ public class PojavLoginActivity extends BaseActivity
new InvalidateTokenTask(PojavLoginActivity.this).execute(selectedAccName); new InvalidateTokenTask(PojavLoginActivity.this).execute(selectedAccName);
accountListLayout.removeViewsInLayout(0,1); accountListLayout.removeViewsInLayout(0,1);
//Resize the window //Resize the window
accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int)Math.min((yScreen*0.8), 200 + accountListLayout.getChildCount()*150)); accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int) Math.min((yScreen*0.8), (73 + accountListLayout.getChildCount()*55)*(PojavLoginActivity.this.getResources().getDisplayMetrics().densityDpi/160f) ));
} }
}); });
builder2.setNegativeButton(android.R.string.cancel, null); builder2.setNegativeButton(android.R.string.cancel, null);
@ -747,7 +747,8 @@ public class PojavLoginActivity extends BaseActivity
} }
accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int)Math.min((yScreen*0.8), 200 + accountListLayout.getChildCount()*150)); //The value 73 and 55 are dp numbers, converted into px in order to resize the layout.
accountDialog.getWindow().setLayout((int)(xScreen*0.4),(int)Math.min((yScreen*0.8), (73 + accountListLayout.getChildCount()*56)*(PojavLoginActivity.this.getResources().getDisplayMetrics().densityDpi/160f) ));
accountDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); accountDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
accountDialog.show(); accountDialog.show();
} }