From 4f25216ce8d0816f7dce65952ee74573386c8f90 Mon Sep 17 00:00:00 2001 From: mmk2410 Date: Mon, 1 Jun 2015 11:36:48 +0200 Subject: [PATCH] Version 2.2.7: Better tablet recognization --- app/build.gradle | 6 +++--- .../de/marcelkapfer/morseconverter/MainActivity.java | 11 +++++++---- app/src/main/res/values-de/strings.xml | 2 +- app/src/main/res/values/strings.xml | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fa3db30..f23aec7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,10 +6,10 @@ android { defaultConfig { applicationId "de.marcelkapfer.morseconverter" - minSdkVersion 11 + minSdkVersion 15 targetSdkVersion 22 - versionCode 226 - versionName "2.2.6<" + versionCode 227 + versionName "2.2.7" } buildTypes { release { diff --git a/app/src/main/java/de/marcelkapfer/morseconverter/MainActivity.java b/app/src/main/java/de/marcelkapfer/morseconverter/MainActivity.java index b51c7f1..7fa011e 100644 --- a/app/src/main/java/de/marcelkapfer/morseconverter/MainActivity.java +++ b/app/src/main/java/de/marcelkapfer/morseconverter/MainActivity.java @@ -25,10 +25,13 @@ import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; import android.content.res.Resources; +import android.graphics.Point; import android.net.Uri; import android.os.Bundle; import android.support.v7.widget.CardView; +import android.util.DisplayMetrics; import android.view.Display; import android.view.Surface; import android.view.View; @@ -102,12 +105,12 @@ public class MainActivity extends MaterialNavigationDrawer implements BillingPro this.disableLearningPattern(); //Doesn't open the drawer always when the app starts setBackPattern(MaterialNavigationDrawer.BACKPATTERN_BACK_TO_FIRST); - Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay(); + // Enables shadow only on devices with landscape. Necessary because of the list views + DisplayMetrics metrics = new DisplayMetrics(); + getWindowManager().getDefaultDisplay().getMetrics(metrics); - if(display.getRotation() == Surface.ROTATION_90 || - display.getRotation() == Surface.ROTATION_270){ + if(metrics.widthPixels < metrics.heightPixels){ enableToolbarElevation(); - } mDrawerToggle = new MaterialActionBarDrawerToggle(this, null, null, 0, 0){ diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index fa9ee16..bb99cb6 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -38,7 +38,7 @@ Wenn Du einen Fehler gefunden hast, schreibe mir bitte ein E-Mail an marcelmichaelkapfer@yahoo.co.nz Du kannst eine ausführliche Anleitung auf marcel-kapfer.de/writtenmorse/index.html#howto_android finden. Wenn Du auf einen fehlenden Code aufmerksam geworden bist, dann schreibe eine E-Mail an marcelmichaelkapfer@yahoo.co.nz. - 2.2.6 \n29. Mai 2015 + 2.2.7 \n01. Juni 2015 Fehler Kontakt Entwickler diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 21ba9e0..bcc2f7d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -43,7 +43,7 @@ How to Missing Code - 2.2.6 \n29 May 2015 + 2.2.7 \n01 June 2015 Marcel Michael Kapfer marcel-kapfer.de/writtenmorse marcelmichaelkapfer@yahoo.co.nz