diff --git a/ReadMe.txt b/ReadMe.txt index b584265..4dc595c 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -54,6 +54,12 @@ NOT WORKING YET CHANGES +Version 1.6 (2019-07-XX) + +- Add option to prevent the pinch zoom. +- Prevent the white bottom bar when both options "Hide the status/navigations bar" and "Hide the menu button" are set (Github Fix: #6). + + Version 1.5 (2019-07-11) - Add the Ir printer simulator based on the Christoph Giesselink's HP82240B Printer Simulator for Windows. diff --git a/app/build.gradle b/app/build.gradle index 49b4fdb..8e93dd6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,16 +72,20 @@ android { path "CMakeLists.txt" } } + compileOptions { + sourceCompatibility = '1.8' + targetCompatibility = '1.8' + } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - implementation 'androidx.appcompat:appcompat:1.1.0-beta01' + implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2' - implementation 'androidx.preference:preference:1.0.0' - implementation 'com.google.android.material:material:1.1.0-alpha07' + implementation 'androidx.preference:preference:1.1.0-rc01' + implementation 'com.google.android.material:material:1.1.0-alpha08' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13-beta-3' androidTestImplementation 'androidx.test:runner:1.3.0-alpha01' androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01' implementation 'androidx.viewpager:viewpager:1.0.0' diff --git a/app/src/main/java/org/emulator/calculator/PanAndScaleView.java b/app/src/main/java/org/emulator/calculator/PanAndScaleView.java index d17e090..cd86808 100644 --- a/app/src/main/java/org/emulator/calculator/PanAndScaleView.java +++ b/app/src/main/java/org/emulator/calculator/PanAndScaleView.java @@ -51,6 +51,7 @@ public class PanAndScaleView extends View { protected boolean preventToScroll = false; protected boolean hasScrolled = false; protected PointF panPrevious = new PointF(0f, 0f); + protected boolean preventPinchZoom = false; protected RectF rectScaleView = new RectF(); protected RectF rectScaleImage = new RectF(); @@ -241,6 +242,10 @@ public class PanAndScaleView extends View { this.enablePanAndScale = enablePanAndScale; } + public void setAllowPinchZoom(boolean allowPinchZoom) { + this.preventPinchZoom = !allowPinchZoom; + } + public void setVirtualSize(float width, float height) { virtualSizeWidth = width; @@ -274,7 +279,7 @@ public class PanAndScaleView extends View { @Override public boolean onScale(ScaleGestureDetector detector) { if(debug) Log.d(TAG, "onScale()"); - if(fillBounds) + if(fillBounds || preventPinchZoom) return false; float scaleFactorPreviousX = viewScaleFactorX; float scaleFactorPreviousY = viewScaleFactorY; diff --git a/app/src/main/java/org/emulator/forty/eight/MainActivity.java b/app/src/main/java/org/emulator/forty/eight/MainActivity.java index c431248..6b5040d 100644 --- a/app/src/main/java/org/emulator/forty/eight/MainActivity.java +++ b/app/src/main/java/org/emulator/forty/eight/MainActivity.java @@ -76,7 +76,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.Date; -import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.LinkedList; @@ -90,7 +89,6 @@ import java.util.regex.Pattern; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private static final String TAG = "MainActivity"; - public static MainActivity mainActivity; private SharedPreferences sharedPreferences; private NavigationView navigationView; private DrawerLayout drawer; @@ -138,6 +136,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On setContentView(R.layout.activity_main); final Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); + toolbar.setVisibility(View.GONE); drawer = findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); @@ -147,19 +146,15 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On navigationView = findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); - - sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); - mainActivity = this; - ViewGroup mainScreenContainer = findViewById(R.id.main_screen_container); mainScreenView = new MainScreenView(this); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) mainScreenView.setStatusBarColor(getWindow().getStatusBarColor()); - } - - toolbar.setVisibility(View.GONE); + mainScreenView.setLayoutParams(new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT)); mainScreenContainer.addView(mainScreenView, 0); imageButtonMenu = findViewById(R.id.button_menu); @@ -1480,7 +1475,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On int isDynamicValue = isDynamic ? 1 : 0; if(key == null) { String[] settingKeys = { - "settings_realspeed", "settings_grayscale", "settings_rotation", "settings_auto_layout", + "settings_realspeed", "settings_grayscale", "settings_rotation", "settings_auto_layout", "settings_allow_pinch_zoom", "settings_hide_bar", "settings_hide_button_menu", "settings_sound_volume", "settings_haptic_feedback", "settings_background_kml_color", "settings_background_fallback_color", "settings_printer_model", "settings_printer_prevent_line_wrap", "settings_macro", @@ -1515,6 +1510,9 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On } mainScreenView.setAutoLayout(autoLayoutMode, isDynamic); break; + case "settings_allow_pinch_zoom": + mainScreenView.setAllowPinchZoom(sharedPreferences.getBoolean("settings_allow_pinch_zoom", true)); + break; case "settings_hide_bar": case "settings_hide_bar_status": case "settings_hide_bar_nav": diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 05047c6..fc4fa1f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -101,6 +101,8 @@ Rotation Allow to rotate, or force Portrait or Landscape orientation + Allow to pinch to zoom + Hide the status bar Hide the navigation bar Hide the button menu diff --git a/app/src/main/res/xml/pref_general.xml b/app/src/main/res/xml/pref_general.xml index a5a4b5c..99d900d 100644 --- a/app/src/main/res/xml/pref_general.xml +++ b/app/src/main/res/xml/pref_general.xml @@ -44,6 +44,10 @@ android:entryValues="@array/settings_rotation_value" android:defaultValue="0" /> + - - - -