diff options
Diffstat (limited to 'org.fox.epube')
3 files changed, 81 insertions, 4 deletions
diff --git a/org.fox.epube/src/main/AndroidManifest.xml b/org.fox.epube/src/main/AndroidManifest.xml index 45bc158..a482b2c 100644 --- a/org.fox.epube/src/main/AndroidManifest.xml +++ b/org.fox.epube/src/main/AndroidManifest.xml @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
package="org.fox.epube">
<uses-permission android:name="android.permission.INTERNET"/>
@@ -12,16 +13,23 @@ android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
- android:theme="@style/AppTheme">
+ android:theme="@style/AppTheme"
+ tools:ignore="GoogleAppIndexingWarning">
+
<activity
- android:name=".MainActivity"
- android:configChanges="orientation|screenSize">
+ android:name=".LaunchActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
+
+ <activity
+ android:name=".MainActivity"
+ android:theme="@style/AppTheme"
+ android:configChanges="orientation|screenSize">
+ </activity>
</application>
</manifest>
\ No newline at end of file diff --git a/org.fox.epube/src/main/java/org/fox/epube/LaunchActivity.java b/org.fox.epube/src/main/java/org/fox/epube/LaunchActivity.java new file mode 100644 index 0000000..220cd6a --- /dev/null +++ b/org.fox.epube/src/main/java/org/fox/epube/LaunchActivity.java @@ -0,0 +1,25 @@ +package org.fox.epube; + +import android.app.Activity; +import android.content.Intent; +import android.os.Bundle; + +public class LaunchActivity extends Activity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // https://code.google.com/p/android/issues/detail?id=26658 + if (!isTaskRoot()) { + finish(); + return; + } + + Intent main = new Intent(LaunchActivity.this, MainActivity.class); + startActivity(main); + + finish(); + } + +} diff --git a/org.fox.epube/src/main/java/org/fox/epube/MainActivity.java b/org.fox.epube/src/main/java/org/fox/epube/MainActivity.java index 9756f1a..575a982 100644 --- a/org.fox.epube/src/main/java/org/fox/epube/MainActivity.java +++ b/org.fox.epube/src/main/java/org/fox/epube/MainActivity.java @@ -24,6 +24,8 @@ public class MainActivity extends AppCompatActivity { private final String TAG = this.getClass().getSimpleName();
private final String BASE_URL = "https://fakecake.org/books";
+ public enum AppPage { PAGE_LIBRARY, PAGE_FAVORITES, PAGE_OFFLINE, PAGE_READER }
+
private ProgressBar m_loadingBar;
private WebView m_web;
private Menu m_menu;
@@ -185,7 +187,29 @@ public class MainActivity extends AppCompatActivity { }
}
- public enum AppPage { PAGE_LIBRARY, PAGE_FAVORITES, PAGE_OFFLINE, PAGE_READER }
+ private void toggleSystemUI() {
+ View decorView = getWindow().getDecorView();
+
+ if ((decorView.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_IMMERSIVE) == View.SYSTEM_UI_FLAG_IMMERSIVE ) {
+ hideSystemUI(false);
+ } else {
+ hideSystemUI(true);
+ }
+ }
+
+ public void hideSystemUI(boolean hide) {
+ View decorView = getWindow().getDecorView();
+
+ if (hide) {
+ decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
+ | View.SYSTEM_UI_FLAG_FULLSCREEN
+ | View.SYSTEM_UI_FLAG_IMMERSIVE);
+ } else {
+ decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
+ }
+ }
class WebAppInterface {
private Context m_context;
@@ -230,6 +254,26 @@ public class MainActivity extends AppCompatActivity { }
@JavascriptInterface
+ public void hideSystemUI(final boolean hide) {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ MainActivity.this.hideSystemUI(hide);
+ }
+ });
+ }
+
+ @JavascriptInterface
+ public void toggleSystemUI() {
+ runOnUiThread(new Runnable() {
+ @Override
+ public void run() {
+ MainActivity.this.toggleSystemUI();
+ }
+ });
+ }
+
+ @JavascriptInterface
public void showActionBar(final boolean show) {
runOnUiThread(new Runnable() {
@Override
|