Skip to content

Commit

Permalink
CATROID-1417 Bug fixed where visual placement is skipped
Browse files Browse the repository at this point in the history
  • Loading branch information
dorianpercic committed Jul 5, 2022
1 parent 24737be commit b06f6a3
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
Expand Down Expand Up @@ -149,7 +150,11 @@ public boolean onOptionsItemSelected(MenuItem item) {

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.onCreate(null);
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
int height = displayMetrics.heightPixels;
int width = displayMetrics.widthPixels;

if (isFinishing()) {
return;
Expand Down Expand Up @@ -189,13 +194,14 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {

frameLayout = findViewById(R.id.frame_container);

int screenWidth = ScreenValues.SCREEN_WIDTH;
int screenHeight = ScreenValues.SCREEN_HEIGHT;
int screenWidth = width;
int screenHeight = height;
int virtualScreenWidth = currentProject.getXmlHeader().virtualScreenWidth;
int virtualScreenHeight = currentProject.getXmlHeader().virtualScreenHeight;

float aspectRatio = (float) virtualScreenWidth / (float) virtualScreenHeight;
float screenAspectRatio = ScreenValues.getAspectRatio();
float screenAspectRatio = (float) width / (float) height;
// .getAspectRatio();

float scale;
float ratioHeight = (float) screenHeight / (float) virtualScreenHeight;
Expand Down

0 comments on commit b06f6a3

Please sign in to comment.