- Prevent the white bottom bar when both options "Hide the status/navigations bar" and "Hide the menu button" are set (Github Fix: #9).

- Add option to prevent the pinch zoom.
This commit is contained in:
dgis 2019-07-13 16:29:34 +02:00
parent f38b2149c4
commit 7a9f7abb56
7 changed files with 36 additions and 21 deletions

View file

@ -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.

View file

@ -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'

View file

@ -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;

View file

@ -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":

View file

@ -101,6 +101,8 @@
<string name="settings_rotation_title">Rotation</string>
<string name="settings_rotation_summary">Allow to rotate, or force Portrait or Landscape orientation</string>
<string name="settings_allow_pinch_zoom_title">Allow to pinch to zoom</string>
<string name="settings_hide_bar_status">Hide the status bar</string>
<string name="settings_hide_bar_nav">Hide the navigation bar</string>
<string name="settings_hide_button_menu">Hide the button menu</string>

View file

@ -44,6 +44,10 @@
android:entryValues="@array/settings_rotation_value"
android:defaultValue="0"
/>
<SwitchPreference
android:key="settings_allow_pinch_zoom"
android:title="@string/settings_allow_pinch_zoom_title"
android:defaultValue="true" />
<SwitchPreference
android:key="settings_hide_bar_status"
android:title="@string/settings_hide_bar_status"
@ -56,10 +60,6 @@
android:key="settings_hide_button_menu"
android:title="@string/settings_hide_button_menu"
android:defaultValue="false" />
<!--<SwitchPreference-->
<!--android:key="settings_allow_sound"-->
<!--android:title="@string/settings_allow_sound_title"-->
<!--android:defaultValue="true" />-->
<SeekBarPreference
android:key="settings_sound_volume"
android:title="@string/settings_sound_volume_title"

View file

@ -7,7 +7,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.android.tools.build:gradle:3.4.2'
// NOTE: Do not place your application dependencies here; they belong