add portrait mode to app

This commit is contained in:
afischerdev 2023-07-07 18:32:11 +02:00
parent 79aa07ae84
commit 9b2a2b2b0a
3 changed files with 7 additions and 6 deletions

View file

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

View file

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

View file

@ -63,7 +63,8 @@ public class BInstallerView extends View {
if (currentScale() * ratio >= 1) {
mat.postScale(ratio, ratio, focusX, focusY);
fitBounds();
tilesVisible = currentScale() >= SCALE_GRID_VISIBLE;
boolean landscape = getWidth() > getHeight();
tilesVisible = currentScale() >= (landscape ? SCALE_GRID_VISIBLE: SCALE_GRID_VISIBLE-1);
invalidate();
}
@ -149,7 +150,9 @@ public class BInstallerView extends View {
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;
}
@ -285,7 +288,7 @@ public class BInstallerView extends View {
@Override
public boolean onDoubleTap(MotionEvent e) {
if (!tilesVisible) {
setScale(5, e.getX(), e.getY());
setScale(4, e.getX(), e.getY());
} else {
setScale(1, e.getX(), e.getY());
}