diff --git a/App/build.gradle b/App/build.gradle index 4f7e483..3366e67 100644 --- a/App/build.gradle +++ b/App/build.gradle @@ -6,7 +6,7 @@ android { minSdkVersion 23 versionCode 1200 versionName "1.2.0" - targetSdk 34 + ndk { //noinspection ChromeOsAbiSupport abiFilters "arm64-v8a" @@ -34,10 +34,12 @@ android { } ext { // https://maven.mozilla.org/?prefix=maven2/org/mozilla/geckoview/ - geckoviewVersion = "131.0.20240923135042" + geckoviewVersion = "129.0.20240819150008" // Newer versions have issues :( } dependencies { + implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + //noinspection GradleDependency implementation "org.mozilla.geckoview:geckoview:${geckoviewVersion}" //noinspection GradleDependency implementation 'androidx.datastore:datastore-preferences-rxjava3:1.0.0' diff --git a/App/proguard-rules.pro b/App/proguard-rules.pro index 2e1063b..bd7da94 100644 --- a/App/proguard-rules.pro +++ b/App/proguard-rules.pro @@ -15,3 +15,4 @@ #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} +-keep class androidx.lifecycle.** { *; } diff --git a/App/src/main/AndroidManifest.xml b/App/src/main/AndroidManifest.xml index 5a3fd6a..87d020e 100644 --- a/App/src/main/AndroidManifest.xml +++ b/App/src/main/AndroidManifest.xml @@ -48,7 +48,7 @@ android:documentLaunchMode="intoExisting" android:theme="@style/ThemeOverlay.Browser"> - + @@ -101,7 +101,7 @@ android:resizeableActivity="true" android:theme="@style/ThemeOverlay.Browser"> - + diff --git a/App/src/main/java/com/threethan/browser/browser/BrowserActivity.java b/App/src/main/java/com/threethan/browser/browser/BrowserActivity.java index 0bb2bc4..cad986a 100644 --- a/App/src/main/java/com/threethan/browser/browser/BrowserActivity.java +++ b/App/src/main/java/com/threethan/browser/browser/BrowserActivity.java @@ -36,6 +36,7 @@ public class BrowserActivity extends BoundActivity { protected final BookmarkManager bookmarkManager = new BookmarkManager(this); private boolean isEphemeral; private boolean isTab; + private boolean isTopBarHidden; private final String DEFAULT_URL = "https://www.google.com/"; @Override public void onCreate(Bundle savedInstanceState) { @@ -76,6 +77,10 @@ public void onCreate(Bundle savedInstanceState) { if (tabId == null) tabId = BrowserService.TAB_PREFIX+"ext::"+currentUrl; Log.v("Lightning Browser", "... with url " + currentUrl + (isTab ? ", is a tab":", not a tab") + ", assigned id "+tabId); + if (!isTab) { + isTopBarHidden = true; + hideTopBar(); + } // Back/Forward Buttons back = findViewById(R.id.back); @@ -132,6 +137,13 @@ public void onCreate(Bundle savedInstanceState) { bookmarkManager.removeBookmark(currentUrl); }); + // Hide top bar + View hideBar = findViewById(R.id.hideBar); + hideBar.setOnClickListener(v -> { + isTopBarHidden = true; + hideTopBar(); + }); + // Edit URL View urlLayout = findViewById(R.id.urlLayout); EditText urlEdit = findViewById(R.id.urlEdit); @@ -203,6 +215,7 @@ public void stopLoading() { public void showTopBar() { findViewById(R.id.topBar).setVisibility(View.VISIBLE); findViewById(R.id.topBarEdit).setVisibility(View.GONE); + isTopBarHidden = false; } public void hideTopBar() { findViewById(R.id.topBar).setVisibility(View.GONE); @@ -238,7 +251,9 @@ private void updateUrl(String url) { @Override public void onBackPressed() { - if (findViewById(R.id.topBarEdit).getVisibility() == View.VISIBLE) + if (isTopBarHidden) { + showTopBar(); + } else if (findViewById(R.id.topBarEdit).getVisibility() == View.VISIBLE) findViewById(R.id.cancel).callOnClick(); else { if (w.canGoBack()) { diff --git a/App/src/main/java/com/threethan/browser/browser/GeckoView/Delegate/CustomNavigationDelegate.java b/App/src/main/java/com/threethan/browser/browser/GeckoView/Delegate/CustomNavigationDelegate.java index f43a7b5..700ea55 100644 --- a/App/src/main/java/com/threethan/browser/browser/GeckoView/Delegate/CustomNavigationDelegate.java +++ b/App/src/main/java/com/threethan/browser/browser/GeckoView/Delegate/CustomNavigationDelegate.java @@ -30,10 +30,10 @@ public void onCanGoBack(@NonNull GeckoSession session, boolean canGoBack) { public void onCanGoForward(@NonNull GeckoSession session, boolean canGoForward) { this.canGoForward = canGoForward; } + @Override - public void onLocationChange(@NonNull GeckoSession session, @Nullable String url, - @NonNull List perms) { - GeckoSession.NavigationDelegate.super.onLocationChange(session, url, perms); + public void onLocationChange(@NonNull GeckoSession session, @Nullable String url, @NonNull List perms, @NonNull Boolean hasUserGesture) { + GeckoSession.NavigationDelegate.super.onLocationChange(session, url, perms, hasUserGesture); if (url != null && !url.isEmpty() && !url.equals("about:blank")) { currentUrl = url; diff --git a/App/src/main/java/com/threethan/browser/browser/GeckoView/Delegate/ExtensionPromptDelegate.java b/App/src/main/java/com/threethan/browser/browser/GeckoView/Delegate/ExtensionPromptDelegate.java index 911d880..19ad5cc 100644 --- a/App/src/main/java/com/threethan/browser/browser/GeckoView/Delegate/ExtensionPromptDelegate.java +++ b/App/src/main/java/com/threethan/browser/browser/GeckoView/Delegate/ExtensionPromptDelegate.java @@ -26,6 +26,7 @@ public class ExtensionPromptDelegate implements WebExtensionController.PromptDelegate { final static String EXTENSIONS_URL = "https://addons.mozilla.org/firefox/extensions/"; + /** @noinspection deprecation*/ @Nullable @Override public GeckoResult onInstallPrompt(@NonNull WebExtension extension) { @@ -39,7 +40,6 @@ public void showList() { final AlertDialog dialog = Dialog.build(activity, R.layout.dialog_webextensions); assert dialog != null; - dialog.hide(); dialog.findViewById(R.id.getMoreButton).setOnClickListener(view -> { if (activity instanceof BrowserActivity) { @@ -47,6 +47,7 @@ public void showList() { dialog.dismiss(); } }); + View dismiss = dialog.findViewById(R.id.dismissButton); dismiss.setOnClickListener(view -> dialog.dismiss()); @@ -108,15 +109,13 @@ public View getView(final int position, View view, @NonNull final ViewGroup pare value.removeIf(webExtension -> webExtension.id.equals("fixes@internal.ext")); } adapter.addAll(value); + dialog.show(); ListView lv = dialog.findViewById(R.id.listView); lv.setAdapter(adapter); return null; }); - - - } } diff --git a/App/src/main/res/drawable/web_up.xml b/App/src/main/res/drawable/web_up.xml new file mode 100644 index 0000000..3119aef --- /dev/null +++ b/App/src/main/res/drawable/web_up.xml @@ -0,0 +1,5 @@ + + + diff --git a/App/src/main/res/layout/activity_browser.xml b/App/src/main/res/layout/activity_browser.xml index 707e6d7..aab1c86 100644 --- a/App/src/main/res/layout/activity_browser.xml +++ b/App/src/main/res/layout/activity_browser.xml @@ -168,6 +168,19 @@ android:visibility="gone" tools:ignore="UnusedAttribute" /> + + @@ -35,6 +33,7 @@ + android:text="@string/extension_prompt_hint"> + + \ No newline at end of file diff --git a/App/src/main/res/values-zh-rCN/strings.xml b/App/src/main/res/values-zh-rCN/strings.xml index 94be40e..a109915 100644 --- a/App/src/main/res/values-zh-rCN/strings.xml +++ b/App/src/main/res/values-zh-rCN/strings.xml @@ -51,6 +51,7 @@ 前进 刷新页面 退出选项卡 + 隐藏顶部栏 将页面添加到芸签 从标签中删除芸签 关闭 diff --git a/App/src/main/res/values/strings.xml b/App/src/main/res/values/strings.xml index ac6df3d..b900f36 100644 --- a/App/src/main/res/values/strings.xml +++ b/App/src/main/res/values/strings.xml @@ -62,6 +62,7 @@ Navigate Forward Refresh this Page Minimize Tab + Hide Top Bar Add Page to Bookmarks Remove Bookmark Cancel diff --git a/README.md b/README.md index 3dd3137..58e8580 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A powerful Gecko-based browser for Android TV and VR. *(Previously part of [LightningLauncher](https://github.com/threethan/LightningLauncher))* ## Features -- Dynamic cursor that allows for easy nagivation with an Android TV remote control +- Dynamic cursor that allows for easy navigation with an Android TV remote control - Uses GeckoView (Firefox's core) for a modern browser even on outdated devices - Full support for Firefox extensions - Minimal, dynamic UI for easy navigation on screens big or small