Merge pull request #582 from afischerdev/app-ui-update

Add portrait mode to app
This commit is contained in:
afischerdev 2023-07-10 10:56:38 +02:00 committed by GitHub
commit 94e29852d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 6 deletions

View file

@ -35,7 +35,7 @@
android:name=".BInstallerActivity" android:name=".BInstallerActivity"
android:exported="true" android:exported="true"
android:launchMode="singleTask" android:launchMode="singleTask"
android:screenOrientation="landscape" /> android:screenOrientation="locked" />
<activity <activity
android:name=".BImportActivity" android:name=".BImportActivity"
android:exported="true" android:exported="true"

View file

@ -83,8 +83,6 @@ public class BInstallerActivity extends AppCompatActivity {
boolean running = isDownloadRunning(DownloadWorker.class); boolean running = isDownloadRunning(DownloadWorker.class);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setContentView(R.layout.activity_binstaller); setContentView(R.layout.activity_binstaller);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {

View file

@ -63,7 +63,8 @@ public class BInstallerView extends View {
if (currentScale() * ratio >= 1) { if (currentScale() * ratio >= 1) {
mat.postScale(ratio, ratio, focusX, focusY); mat.postScale(ratio, ratio, focusX, focusY);
fitBounds(); fitBounds();
tilesVisible = currentScale() >= SCALE_GRID_VISIBLE; boolean landscape = getWidth() > getHeight();
tilesVisible = currentScale() >= (landscape ? SCALE_GRID_VISIBLE: SCALE_GRID_VISIBLE-1);
invalidate(); invalidate();
} }
@ -149,7 +150,9 @@ public class BInstallerView extends View {
viewscale = Math.max(scaleX, scaleY); viewscale = Math.max(scaleX, scaleY);
mat.postScale(viewscale, viewscale); mat.preScale(viewscale, viewscale, bmp.getWidth() /2f, 0);
setRatio(1f, bmp.getWidth() /2f, bmp.getHeight() /2f);
tilesVisible = false; tilesVisible = false;
} }
@ -285,7 +288,7 @@ public class BInstallerView extends View {
@Override @Override
public boolean onDoubleTap(MotionEvent e) { public boolean onDoubleTap(MotionEvent e) {
if (!tilesVisible) { if (!tilesVisible) {
setScale(5, e.getX(), e.getY()); setScale(4, e.getX(), e.getY());
} else { } else {
setScale(1, e.getX(), e.getY()); setScale(1, e.getX(), e.getY());
} }