mirror of
https://github.com/dgis/emu48android
synced 2024-12-27 09:58:46 +01:00
- 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:
parent
f38b2149c4
commit
7a9f7abb56
7 changed files with 36 additions and 21 deletions
|
@ -54,6 +54,12 @@ NOT WORKING YET
|
||||||
|
|
||||||
CHANGES
|
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)
|
Version 1.5 (2019-07-11)
|
||||||
|
|
||||||
- Add the Ir printer simulator based on the Christoph Giesselink's HP82240B Printer Simulator for Windows.
|
- Add the Ir printer simulator based on the Christoph Giesselink's HP82240B Printer Simulator for Windows.
|
||||||
|
|
|
@ -72,16 +72,20 @@ android {
|
||||||
path "CMakeLists.txt"
|
path "CMakeLists.txt"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility = '1.8'
|
||||||
|
targetCompatibility = '1.8'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
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.constraintlayout:constraintlayout:2.0.0-beta2'
|
||||||
implementation 'androidx.preference:preference:1.0.0'
|
implementation 'androidx.preference:preference:1.1.0-rc01'
|
||||||
implementation 'com.google.android.material:material:1.1.0-alpha07'
|
implementation 'com.google.android.material:material:1.1.0-alpha08'
|
||||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
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:runner:1.3.0-alpha01'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01'
|
||||||
implementation 'androidx.viewpager:viewpager:1.0.0'
|
implementation 'androidx.viewpager:viewpager:1.0.0'
|
||||||
|
|
|
@ -51,6 +51,7 @@ public class PanAndScaleView extends View {
|
||||||
protected boolean preventToScroll = false;
|
protected boolean preventToScroll = false;
|
||||||
protected boolean hasScrolled = false;
|
protected boolean hasScrolled = false;
|
||||||
protected PointF panPrevious = new PointF(0f, 0f);
|
protected PointF panPrevious = new PointF(0f, 0f);
|
||||||
|
protected boolean preventPinchZoom = false;
|
||||||
|
|
||||||
protected RectF rectScaleView = new RectF();
|
protected RectF rectScaleView = new RectF();
|
||||||
protected RectF rectScaleImage = new RectF();
|
protected RectF rectScaleImage = new RectF();
|
||||||
|
@ -241,6 +242,10 @@ public class PanAndScaleView extends View {
|
||||||
this.enablePanAndScale = enablePanAndScale;
|
this.enablePanAndScale = enablePanAndScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAllowPinchZoom(boolean allowPinchZoom) {
|
||||||
|
this.preventPinchZoom = !allowPinchZoom;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setVirtualSize(float width, float height) {
|
public void setVirtualSize(float width, float height) {
|
||||||
virtualSizeWidth = width;
|
virtualSizeWidth = width;
|
||||||
|
@ -274,7 +279,7 @@ public class PanAndScaleView extends View {
|
||||||
@Override
|
@Override
|
||||||
public boolean onScale(ScaleGestureDetector detector) {
|
public boolean onScale(ScaleGestureDetector detector) {
|
||||||
if(debug) Log.d(TAG, "onScale()");
|
if(debug) Log.d(TAG, "onScale()");
|
||||||
if(fillBounds)
|
if(fillBounds || preventPinchZoom)
|
||||||
return false;
|
return false;
|
||||||
float scaleFactorPreviousX = viewScaleFactorX;
|
float scaleFactorPreviousX = viewScaleFactorX;
|
||||||
float scaleFactorPreviousY = viewScaleFactorY;
|
float scaleFactorPreviousY = viewScaleFactorY;
|
||||||
|
|
|
@ -76,7 +76,6 @@ import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -90,7 +89,6 @@ import java.util.regex.Pattern;
|
||||||
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener {
|
||||||
|
|
||||||
private static final String TAG = "MainActivity";
|
private static final String TAG = "MainActivity";
|
||||||
public static MainActivity mainActivity;
|
|
||||||
private SharedPreferences sharedPreferences;
|
private SharedPreferences sharedPreferences;
|
||||||
private NavigationView navigationView;
|
private NavigationView navigationView;
|
||||||
private DrawerLayout drawer;
|
private DrawerLayout drawer;
|
||||||
|
@ -138,6 +136,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
final Toolbar toolbar = findViewById(R.id.toolbar);
|
final Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
setSupportActionBar(toolbar);
|
setSupportActionBar(toolbar);
|
||||||
|
toolbar.setVisibility(View.GONE);
|
||||||
|
|
||||||
drawer = findViewById(R.id.drawer_layout);
|
drawer = findViewById(R.id.drawer_layout);
|
||||||
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
|
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 = findViewById(R.id.nav_view);
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
navigationView.setNavigationItemSelectedListener(this);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
|
||||||
mainActivity = this;
|
|
||||||
|
|
||||||
|
|
||||||
ViewGroup mainScreenContainer = findViewById(R.id.main_screen_container);
|
ViewGroup mainScreenContainer = findViewById(R.id.main_screen_container);
|
||||||
mainScreenView = new MainScreenView(this);
|
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());
|
mainScreenView.setStatusBarColor(getWindow().getStatusBarColor());
|
||||||
}
|
mainScreenView.setLayoutParams(new ViewGroup.LayoutParams(
|
||||||
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
toolbar.setVisibility(View.GONE);
|
ViewGroup.LayoutParams.MATCH_PARENT));
|
||||||
mainScreenContainer.addView(mainScreenView, 0);
|
mainScreenContainer.addView(mainScreenView, 0);
|
||||||
|
|
||||||
imageButtonMenu = findViewById(R.id.button_menu);
|
imageButtonMenu = findViewById(R.id.button_menu);
|
||||||
|
@ -1480,7 +1475,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||||
int isDynamicValue = isDynamic ? 1 : 0;
|
int isDynamicValue = isDynamic ? 1 : 0;
|
||||||
if(key == null) {
|
if(key == null) {
|
||||||
String[] settingKeys = {
|
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_hide_bar", "settings_hide_button_menu", "settings_sound_volume", "settings_haptic_feedback",
|
||||||
"settings_background_kml_color", "settings_background_fallback_color",
|
"settings_background_kml_color", "settings_background_fallback_color",
|
||||||
"settings_printer_model", "settings_printer_prevent_line_wrap", "settings_macro",
|
"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);
|
mainScreenView.setAutoLayout(autoLayoutMode, isDynamic);
|
||||||
break;
|
break;
|
||||||
|
case "settings_allow_pinch_zoom":
|
||||||
|
mainScreenView.setAllowPinchZoom(sharedPreferences.getBoolean("settings_allow_pinch_zoom", true));
|
||||||
|
break;
|
||||||
case "settings_hide_bar":
|
case "settings_hide_bar":
|
||||||
case "settings_hide_bar_status":
|
case "settings_hide_bar_status":
|
||||||
case "settings_hide_bar_nav":
|
case "settings_hide_bar_nav":
|
||||||
|
|
|
@ -101,6 +101,8 @@
|
||||||
<string name="settings_rotation_title">Rotation</string>
|
<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_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_status">Hide the status bar</string>
|
||||||
<string name="settings_hide_bar_nav">Hide the navigation bar</string>
|
<string name="settings_hide_bar_nav">Hide the navigation bar</string>
|
||||||
<string name="settings_hide_button_menu">Hide the button menu</string>
|
<string name="settings_hide_button_menu">Hide the button menu</string>
|
||||||
|
|
|
@ -44,6 +44,10 @@
|
||||||
android:entryValues="@array/settings_rotation_value"
|
android:entryValues="@array/settings_rotation_value"
|
||||||
android:defaultValue="0"
|
android:defaultValue="0"
|
||||||
/>
|
/>
|
||||||
|
<SwitchPreference
|
||||||
|
android:key="settings_allow_pinch_zoom"
|
||||||
|
android:title="@string/settings_allow_pinch_zoom_title"
|
||||||
|
android:defaultValue="true" />
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:key="settings_hide_bar_status"
|
android:key="settings_hide_bar_status"
|
||||||
android:title="@string/settings_hide_bar_status"
|
android:title="@string/settings_hide_bar_status"
|
||||||
|
@ -56,10 +60,6 @@
|
||||||
android:key="settings_hide_button_menu"
|
android:key="settings_hide_button_menu"
|
||||||
android:title="@string/settings_hide_button_menu"
|
android:title="@string/settings_hide_button_menu"
|
||||||
android:defaultValue="false" />
|
android:defaultValue="false" />
|
||||||
<!--<SwitchPreference-->
|
|
||||||
<!--android:key="settings_allow_sound"-->
|
|
||||||
<!--android:title="@string/settings_allow_sound_title"-->
|
|
||||||
<!--android:defaultValue="true" />-->
|
|
||||||
<SeekBarPreference
|
<SeekBarPreference
|
||||||
android:key="settings_sound_volume"
|
android:key="settings_sound_volume"
|
||||||
android:title="@string/settings_sound_volume_title"
|
android:title="@string/settings_sound_volume_title"
|
||||||
|
|
|
@ -7,7 +7,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
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
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|
Loading…
Reference in a new issue