mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
options have been moved from ZLAndroidApplication to ZLAndroidLibrary
This commit is contained in:
parent
93c3e335dd
commit
858197ede0
8 changed files with 56 additions and 61 deletions
|
@ -36,7 +36,7 @@ import org.geometerplus.zlibrary.core.xml.ZLStringMap;
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextRegion;
|
import org.geometerplus.zlibrary.text.view.ZLTextRegion;
|
||||||
import org.geometerplus.zlibrary.text.view.ZLTextWord;
|
import org.geometerplus.zlibrary.text.view.ZLTextWord;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
|
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidLibrary;
|
||||||
|
|
||||||
import org.geometerplus.android.util.UIUtil;
|
import org.geometerplus.android.util.UIUtil;
|
||||||
import org.geometerplus.android.util.PackageUtil;
|
import org.geometerplus.android.util.PackageUtil;
|
||||||
|
@ -191,8 +191,8 @@ public abstract class DictionaryUtil {
|
||||||
final int minHeight = Math.min(200, screenHeight * 2 / 3);
|
final int minHeight = Math.min(200, screenHeight * 2 / 3);
|
||||||
intent.putExtra(ColorDict3.HEIGHT, Math.max(minHeight, Math.min(maxHeight, space)));
|
intent.putExtra(ColorDict3.HEIGHT, Math.max(minHeight, Math.min(maxHeight, space)));
|
||||||
intent.putExtra(ColorDict3.GRAVITY, showAtBottom ? Gravity.BOTTOM : Gravity.TOP);
|
intent.putExtra(ColorDict3.GRAVITY, showAtBottom ? Gravity.BOTTOM : Gravity.TOP);
|
||||||
final ZLAndroidApplication application = (ZLAndroidApplication)activity.getApplication();
|
final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLAndroidLibrary.Instance();
|
||||||
intent.putExtra(ColorDict3.FULLSCREEN, !application.ShowStatusBarOption.getValue());
|
intent.putExtra(ColorDict3.FULLSCREEN, !zlibrary.ShowStatusBarOption.getValue());
|
||||||
}
|
}
|
||||||
activity.startActivity(intent);
|
activity.startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import org.geometerplus.zlibrary.text.hyphenation.ZLTextHyphenator;
|
||||||
import org.geometerplus.zlibrary.ui.android.R;
|
import org.geometerplus.zlibrary.ui.android.R;
|
||||||
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidActivity;
|
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidActivity;
|
||||||
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
|
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
|
||||||
|
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidLibrary;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.fbreader.ActionCode;
|
import org.geometerplus.fbreader.fbreader.ActionCode;
|
||||||
import org.geometerplus.fbreader.fbreader.FBReaderApp;
|
import org.geometerplus.fbreader.fbreader.FBReaderApp;
|
||||||
|
@ -101,9 +102,9 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
final ZLAndroidApplication application = (ZLAndroidApplication)getApplication();
|
final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLAndroidLibrary.Instance();
|
||||||
myFullScreenFlag =
|
myFullScreenFlag =
|
||||||
application.ShowStatusBarOption.getValue() ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
zlibrary.ShowStatusBarOption.getValue() ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
getWindow().setFlags(
|
getWindow().setFlags(
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN, myFullScreenFlag
|
WindowManager.LayoutParams.FLAG_FULLSCREEN, myFullScreenFlag
|
||||||
);
|
);
|
||||||
|
@ -144,9 +145,9 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPrepareOptionsMenu(Menu menu) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
final ZLAndroidApplication application = (ZLAndroidApplication)getApplication();
|
final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLAndroidLibrary.Instance();
|
||||||
if (!application.ShowStatusBarOption.getValue() &&
|
if (!zlibrary.ShowStatusBarOption.getValue() &&
|
||||||
application.ShowStatusBarWhenMenuIsActiveOption.getValue()) {
|
zlibrary.ShowStatusBarWhenMenuIsActiveOption.getValue()) {
|
||||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||||
}
|
}
|
||||||
return super.onPrepareOptionsMenu(menu);
|
return super.onPrepareOptionsMenu(menu);
|
||||||
|
@ -155,9 +156,9 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onOptionsMenuClosed(Menu menu) {
|
public void onOptionsMenuClosed(Menu menu) {
|
||||||
super.onOptionsMenuClosed(menu);
|
super.onOptionsMenuClosed(menu);
|
||||||
final ZLAndroidApplication application = (ZLAndroidApplication)getApplication();
|
final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLAndroidLibrary.Instance();
|
||||||
if (!application.ShowStatusBarOption.getValue() &&
|
if (!zlibrary.ShowStatusBarOption.getValue() &&
|
||||||
application.ShowStatusBarWhenMenuIsActiveOption.getValue()) {
|
zlibrary.ShowStatusBarWhenMenuIsActiveOption.getValue()) {
|
||||||
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,10 +204,10 @@ public final class FBReader extends ZLAndroidActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
final ZLAndroidApplication application = (ZLAndroidApplication)getApplication();
|
final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLAndroidLibrary.Instance();
|
||||||
|
|
||||||
final int fullScreenFlag =
|
final int fullScreenFlag =
|
||||||
application.ShowStatusBarOption.getValue() ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
zlibrary.ShowStatusBarOption.getValue() ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN;
|
||||||
if (fullScreenFlag != myFullScreenFlag) {
|
if (fullScreenFlag != myFullScreenFlag) {
|
||||||
finish();
|
finish();
|
||||||
startActivity(new Intent(this, getClass()));
|
startActivity(new Intent(this, getClass()));
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.geometerplus.zlibrary.core.image.*;
|
||||||
import org.geometerplus.zlibrary.core.util.MimeType;
|
import org.geometerplus.zlibrary.core.util.MimeType;
|
||||||
import org.geometerplus.zlibrary.core.util.ZLColor;
|
import org.geometerplus.zlibrary.core.util.ZLColor;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
|
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidLibrary;
|
||||||
import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageData;
|
import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageData;
|
||||||
import org.geometerplus.zlibrary.ui.android.util.ZLAndroidColorUtil;
|
import org.geometerplus.zlibrary.ui.android.util.ZLAndroidColorUtil;
|
||||||
|
|
||||||
|
@ -46,8 +46,8 @@ public class ImageViewActivity extends Activity {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
final ZLAndroidApplication application = (ZLAndroidApplication)getApplication();
|
final ZLAndroidLibrary library = (ZLAndroidLibrary)ZLAndroidLibrary.Instance();
|
||||||
final boolean showStatusBar = application.ShowStatusBarOption.getValue();
|
final boolean showStatusBar = library.ShowStatusBarOption.getValue();
|
||||||
getWindow().setFlags(
|
getWindow().setFlags(
|
||||||
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
WindowManager.LayoutParams.FLAG_FULLSCREEN,
|
||||||
showStatusBar ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN
|
showStatusBar ? 0 : WindowManager.LayoutParams.FLAG_FULLSCREEN
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.text.view.style.*;
|
import org.geometerplus.zlibrary.text.view.style.*;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
|
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidLibrary;
|
||||||
import org.geometerplus.zlibrary.ui.android.view.AndroidFontUtil;
|
import org.geometerplus.zlibrary.ui.android.view.AndroidFontUtil;
|
||||||
|
|
||||||
import org.geometerplus.fbreader.fbreader.*;
|
import org.geometerplus.fbreader.fbreader.*;
|
||||||
|
@ -46,7 +46,7 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void init(Intent intent) {
|
protected void init(Intent intent) {
|
||||||
final FBReaderApp fbReader = (FBReaderApp)FBReaderApp.Instance();
|
final FBReaderApp fbReader = (FBReaderApp)FBReaderApp.Instance();
|
||||||
final ZLAndroidApplication androidApp = (ZLAndroidApplication)getApplication();
|
final ZLAndroidLibrary androidLibrary = (ZLAndroidLibrary)ZLAndroidLibrary.Instance();
|
||||||
final ColorProfile profile = fbReader.getColorProfile();
|
final ColorProfile profile = fbReader.getColorProfile();
|
||||||
|
|
||||||
final Screen directoriesScreen = createPreferenceScreen("directories");
|
final Screen directoriesScreen = createPreferenceScreen("directories");
|
||||||
|
@ -58,10 +58,10 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
||||||
|
|
||||||
final ZLPreferenceSet statusBarPreferences = new ZLPreferenceSet();
|
final ZLPreferenceSet statusBarPreferences = new ZLPreferenceSet();
|
||||||
final Screen appearanceScreen = createPreferenceScreen("appearance");
|
final Screen appearanceScreen = createPreferenceScreen("appearance");
|
||||||
appearanceScreen.addOption(androidApp.AutoOrientationOption, "autoOrientation");
|
appearanceScreen.addOption(androidLibrary.AutoOrientationOption, "autoOrientation");
|
||||||
appearanceScreen.addPreference(
|
appearanceScreen.addPreference(
|
||||||
new ZLBooleanPreference(
|
new ZLBooleanPreference(
|
||||||
this, androidApp.ShowStatusBarOption, appearanceScreen.Resource, "showStatusBar"
|
this, androidLibrary.ShowStatusBarOption, appearanceScreen.Resource, "showStatusBar"
|
||||||
) {
|
) {
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
|
@ -72,12 +72,12 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
||||||
);
|
);
|
||||||
statusBarPreferences.add(
|
statusBarPreferences.add(
|
||||||
appearanceScreen.addOption(
|
appearanceScreen.addOption(
|
||||||
androidApp.ShowStatusBarWhenMenuIsActiveOption,
|
androidLibrary.ShowStatusBarWhenMenuIsActiveOption,
|
||||||
"showStatusBarWhenMenuIsActive"
|
"showStatusBarWhenMenuIsActive"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
statusBarPreferences.setEnabled(!androidApp.ShowStatusBarOption.getValue());
|
statusBarPreferences.setEnabled(!androidLibrary.ShowStatusBarOption.getValue());
|
||||||
appearanceScreen.addOption(androidApp.DisableButtonLightsOption, "disableButtonLights");
|
appearanceScreen.addOption(androidLibrary.DisableButtonLightsOption, "disableButtonLights");
|
||||||
|
|
||||||
final Screen textScreen = createPreferenceScreen("text");
|
final Screen textScreen = createPreferenceScreen("text");
|
||||||
final ZLTextStyleCollection collection = ZLTextStyleCollection.Instance();
|
final ZLTextStyleCollection collection = ZLTextStyleCollection.Instance();
|
||||||
|
@ -311,20 +311,20 @@ public class PreferenceActivity extends ZLPreferenceActivity {
|
||||||
public void onAccept() {
|
public void onAccept() {
|
||||||
super.onAccept();
|
super.onAccept();
|
||||||
if (!isChecked()) {
|
if (!isChecked()) {
|
||||||
androidApp.ScreenBrightnessLevelOption.setValue(0);
|
androidLibrary.ScreenBrightnessLevelOption.setValue(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
displayScreen.addPreference(new BatteryLevelToTurnScreenOffPreference(
|
displayScreen.addPreference(new BatteryLevelToTurnScreenOffPreference(
|
||||||
this,
|
this,
|
||||||
androidApp.BatteryLevelToTurnScreenOffOption,
|
androidLibrary.BatteryLevelToTurnScreenOffOption,
|
||||||
displayScreen.Resource,
|
displayScreen.Resource,
|
||||||
"dontTurnScreenOff"
|
"dontTurnScreenOff"
|
||||||
));
|
));
|
||||||
/*
|
/*
|
||||||
displayScreen.addPreference(new ZLBooleanPreference(
|
displayScreen.addPreference(new ZLBooleanPreference(
|
||||||
this,
|
this,
|
||||||
androidApp.DontTurnScreenOffDuringChargingOption,
|
androidLibrary.DontTurnScreenOffDuringChargingOption,
|
||||||
displayScreen.Resource,
|
displayScreen.Resource,
|
||||||
"dontTurnScreenOffDuringCharging"
|
"dontTurnScreenOffDuringCharging"
|
||||||
));
|
));
|
||||||
|
|
|
@ -32,7 +32,6 @@ import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
import org.geometerplus.zlibrary.core.view.ZLViewWidget;
|
import org.geometerplus.zlibrary.core.view.ZLViewWidget;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidLibrary;
|
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidLibrary;
|
||||||
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
|
|
||||||
|
|
||||||
import org.geometerplus.android.util.UIUtil;
|
import org.geometerplus.android.util.UIUtil;
|
||||||
|
|
||||||
|
@ -106,11 +105,8 @@ public final class ZLAndroidApplicationWindow extends ZLApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRotate() {
|
public boolean canRotate() {
|
||||||
final Activity activity =
|
final ZLAndroidLibrary zlibrary = (ZLAndroidLibrary)ZLAndroidLibrary.Instance();
|
||||||
((ZLAndroidLibrary)ZLAndroidLibrary.Instance()).getActivity();
|
return zlibrary.AutoOrientationOption.getValue();
|
||||||
return
|
|
||||||
activity != null &&
|
|
||||||
!((ZLAndroidApplication)activity.getApplication()).AutoOrientationOption.getValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() {
|
public void close() {
|
||||||
|
|
|
@ -63,7 +63,7 @@ public abstract class ZLAndroidActivity extends Activity {
|
||||||
final WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
final WindowManager.LayoutParams attrs = getWindow().getAttributes();
|
||||||
attrs.screenBrightness = percent / 100.0f;
|
attrs.screenBrightness = percent / 100.0f;
|
||||||
getWindow().setAttributes(attrs);
|
getWindow().setAttributes(attrs);
|
||||||
((ZLAndroidApplication)getApplication()).ScreenBrightnessLevelOption.setValue(percent);
|
getLibrary().ScreenBrightnessLevelOption.setValue(percent);
|
||||||
}
|
}
|
||||||
|
|
||||||
final int getScreenBrightness() {
|
final int getScreenBrightness() {
|
||||||
|
@ -97,8 +97,7 @@ public abstract class ZLAndroidActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
final ZLAndroidApplication androidApplication = (ZLAndroidApplication)getApplication();
|
if (getLibrary().DisableButtonLightsOption.getValue()) {
|
||||||
if (androidApplication.DisableButtonLightsOption.getValue()) {
|
|
||||||
disableButtonLight();
|
disableButtonLight();
|
||||||
}
|
}
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
|
@ -107,6 +106,7 @@ public abstract class ZLAndroidActivity extends Activity {
|
||||||
getLibrary().setActivity(this);
|
getLibrary().setActivity(this);
|
||||||
|
|
||||||
final ZLFile fileToOpen = fileFromIntent(getIntent());
|
final ZLFile fileToOpen = fileFromIntent(getIntent());
|
||||||
|
final ZLAndroidApplication androidApplication = (ZLAndroidApplication)getApplication();
|
||||||
if (androidApplication.myMainWindow == null) {
|
if (androidApplication.myMainWindow == null) {
|
||||||
final ZLApplication application = createApplication(fileToOpen);
|
final ZLApplication application = createApplication(fileToOpen);
|
||||||
androidApplication.myMainWindow = new ZLAndroidApplicationWindow(application);
|
androidApplication.myMainWindow = new ZLAndroidApplicationWindow(application);
|
||||||
|
@ -121,7 +121,7 @@ public abstract class ZLAndroidActivity extends Activity {
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
|
|
||||||
if (((ZLAndroidApplication)getApplication()).AutoOrientationOption.getValue()) {
|
if (getLibrary().AutoOrientationOption.getValue()) {
|
||||||
setAutoRotationMode();
|
setAutoRotationMode();
|
||||||
} else {
|
} else {
|
||||||
switch (myOrientation) {
|
switch (myOrientation) {
|
||||||
|
@ -181,14 +181,13 @@ public abstract class ZLAndroidActivity extends Activity {
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
final ZLAndroidApplication application = (ZLAndroidApplication)getApplication();
|
|
||||||
switchWakeLock(
|
switchWakeLock(
|
||||||
application.BatteryLevelToTurnScreenOffOption.getValue() <
|
getLibrary().BatteryLevelToTurnScreenOffOption.getValue() <
|
||||||
ZLApplication.Instance().getBatteryLevel()
|
ZLApplication.Instance().getBatteryLevel()
|
||||||
);
|
);
|
||||||
myStartTimer = true;
|
myStartTimer = true;
|
||||||
final int brightnessLevel =
|
final int brightnessLevel =
|
||||||
application.ScreenBrightnessLevelOption.getValue();
|
getLibrary().ScreenBrightnessLevelOption.getValue();
|
||||||
if (brightnessLevel != 0) {
|
if (brightnessLevel != 0) {
|
||||||
setScreenBrightness(brightnessLevel);
|
setScreenBrightness(brightnessLevel);
|
||||||
} else {
|
} else {
|
||||||
|
@ -238,8 +237,7 @@ public abstract class ZLAndroidActivity extends Activity {
|
||||||
private int myChangeCounter;
|
private int myChangeCounter;
|
||||||
private int myOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
private int myOrientation = ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
|
||||||
private void setAutoRotationMode() {
|
private void setAutoRotationMode() {
|
||||||
final ZLAndroidApplication application = (ZLAndroidApplication)getApplication();
|
myOrientation = getLibrary().AutoOrientationOption.getValue() ?
|
||||||
myOrientation = application.AutoOrientationOption.getValue() ?
|
|
||||||
ActivityInfo.SCREEN_ORIENTATION_SENSOR : ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
|
ActivityInfo.SCREEN_ORIENTATION_SENSOR : ActivityInfo.SCREEN_ORIENTATION_NOSENSOR;
|
||||||
setRequestedOrientation(myOrientation);
|
setRequestedOrientation(myOrientation);
|
||||||
myChangeCounter = 0;
|
myChangeCounter = 0;
|
||||||
|
@ -297,7 +295,7 @@ public abstract class ZLAndroidActivity extends Activity {
|
||||||
final ZLAndroidApplication application = (ZLAndroidApplication)getApplication();
|
final ZLAndroidApplication application = (ZLAndroidApplication)getApplication();
|
||||||
application.myMainWindow.setBatteryLevel(level);
|
application.myMainWindow.setBatteryLevel(level);
|
||||||
switchWakeLock(
|
switchWakeLock(
|
||||||
application.BatteryLevelToTurnScreenOffOption.getValue() < level
|
getLibrary().BatteryLevelToTurnScreenOffOption.getValue() < level
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -20,32 +20,13 @@
|
||||||
package org.geometerplus.zlibrary.ui.android.library;
|
package org.geometerplus.zlibrary.ui.android.library;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.os.Build;
|
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
|
|
||||||
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
|
|
||||||
import org.geometerplus.zlibrary.core.sqliteconfig.ZLSQLiteConfig;
|
import org.geometerplus.zlibrary.core.sqliteconfig.ZLSQLiteConfig;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.application.ZLAndroidApplicationWindow;
|
import org.geometerplus.zlibrary.ui.android.application.ZLAndroidApplicationWindow;
|
||||||
import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageManager;
|
import org.geometerplus.zlibrary.ui.android.image.ZLAndroidImageManager;
|
||||||
|
|
||||||
public class ZLAndroidApplication extends Application {
|
public class ZLAndroidApplication extends Application {
|
||||||
public final ZLBooleanOption AutoOrientationOption = new ZLBooleanOption("LookNFeel", "AutoOrientation", false);
|
|
||||||
public final ZLBooleanOption ShowStatusBarOption = new ZLBooleanOption("LookNFeel", "ShowStatusBar", hasNoHardwareMenuButton());
|
|
||||||
public final ZLBooleanOption ShowStatusBarWhenMenuIsActiveOption = new ZLBooleanOption("LookNFeel", "ShowStatusBarWithMenu", true);
|
|
||||||
public final ZLIntegerRangeOption BatteryLevelToTurnScreenOffOption = new ZLIntegerRangeOption("LookNFeel", "BatteryLevelToTurnScreenOff", 0, 100, 50);
|
|
||||||
public final ZLBooleanOption DontTurnScreenOffDuringChargingOption = new ZLBooleanOption("LookNFeel", "DontTurnScreenOffDuringCharging", true);
|
|
||||||
public final ZLIntegerRangeOption ScreenBrightnessLevelOption = new ZLIntegerRangeOption("LookNFeel", "ScreenBrightnessLevel", 0, 100, 0);
|
|
||||||
public final ZLBooleanOption DisableButtonLightsOption = new ZLBooleanOption("LookNFeel", "DisableButtonLights", true);
|
|
||||||
|
|
||||||
private boolean hasNoHardwareMenuButton() {
|
|
||||||
return
|
|
||||||
// Eken M001
|
|
||||||
(Build.DISPLAY != null && Build.DISPLAY.contains("simenxie")) ||
|
|
||||||
// PanDigital
|
|
||||||
"PD_Novel".equals(Build.MODEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ZLAndroidApplicationWindow myMainWindow;
|
public ZLAndroidApplicationWindow myMainWindow;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.util.*;
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.res.AssetFileDescriptor;
|
import android.content.res.AssetFileDescriptor;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
@ -32,11 +33,29 @@ import android.util.DisplayMetrics;
|
||||||
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
import org.geometerplus.zlibrary.core.library.ZLibrary;
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLFile;
|
||||||
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
import org.geometerplus.zlibrary.core.filesystem.ZLResourceFile;
|
||||||
|
import org.geometerplus.zlibrary.core.options.ZLBooleanOption;
|
||||||
|
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.ui.android.R;
|
import org.geometerplus.zlibrary.ui.android.R;
|
||||||
import org.geometerplus.zlibrary.ui.android.view.ZLAndroidWidget;
|
import org.geometerplus.zlibrary.ui.android.view.ZLAndroidWidget;
|
||||||
|
|
||||||
public final class ZLAndroidLibrary extends ZLibrary {
|
public final class ZLAndroidLibrary extends ZLibrary {
|
||||||
|
public final ZLBooleanOption AutoOrientationOption = new ZLBooleanOption("LookNFeel", "AutoOrientation", false);
|
||||||
|
public final ZLBooleanOption ShowStatusBarOption = new ZLBooleanOption("LookNFeel", "ShowStatusBar", hasNoHardwareMenuButton());
|
||||||
|
public final ZLBooleanOption ShowStatusBarWhenMenuIsActiveOption = new ZLBooleanOption("LookNFeel", "ShowStatusBarWithMenu", true);
|
||||||
|
public final ZLIntegerRangeOption BatteryLevelToTurnScreenOffOption = new ZLIntegerRangeOption("LookNFeel", "BatteryLevelToTurnScreenOff", 0, 100, 50);
|
||||||
|
public final ZLBooleanOption DontTurnScreenOffDuringChargingOption = new ZLBooleanOption("LookNFeel", "DontTurnScreenOffDuringCharging", true);
|
||||||
|
public final ZLIntegerRangeOption ScreenBrightnessLevelOption = new ZLIntegerRangeOption("LookNFeel", "ScreenBrightnessLevel", 0, 100, 0);
|
||||||
|
public final ZLBooleanOption DisableButtonLightsOption = new ZLBooleanOption("LookNFeel", "DisableButtonLights", true);
|
||||||
|
|
||||||
|
private static boolean hasNoHardwareMenuButton() {
|
||||||
|
return
|
||||||
|
// Eken M001
|
||||||
|
(Build.DISPLAY != null && Build.DISPLAY.contains("simenxie")) ||
|
||||||
|
// PanDigital
|
||||||
|
"PD_Novel".equals(Build.MODEL);
|
||||||
|
}
|
||||||
|
|
||||||
private ZLAndroidActivity myActivity;
|
private ZLAndroidActivity myActivity;
|
||||||
private final Application myApplication;
|
private final Application myApplication;
|
||||||
private ZLAndroidWidget myWidget;
|
private ZLAndroidWidget myWidget;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue