Skip to content

Commit

Permalink
#72 fix back button behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
plateaukao committed Jan 7, 2022
1 parent 974308c commit 6ceff7e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ open class BrowserActivity : ComponentActivity(), BrowserController, OnClickList
R.id.omnibox_back -> if (ninjaWebView.canGoBack()) {
ninjaWebView.goBack()
} else {
removeAlbum(currentAlbumController!!)
NinjaToast.show(this, getString(R.string.no_previous_page))
}
R.id.toolbar_forward -> if (ninjaWebView.canGoForward()) {
ninjaWebView.goForward()
Expand Down Expand Up @@ -944,7 +944,7 @@ open class BrowserActivity : ComponentActivity(), BrowserController, OnClickList
"03" -> if (ninjaWebView.canGoBack()) {
ninjaWebView.goBack()
} else {
removeAlbum(currentAlbumController!!)
NinjaToast.show(this, getString(R.string.no_previous_page))
}
"04" -> ninjaWebView.jumpToTop()
"05" -> ninjaWebView.pageDownWithNoAnimation()
Expand Down
10 changes: 0 additions & 10 deletions app/src/main/java/de/baumann/browser/view/NinjaWebView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,6 @@ class NinjaWebView : WebView, AlbumController, KoinComponent {
requestFocusNodeHref(click)
}

private fun prepareRecord(): Boolean {
val title = title
val url = url
return !(title == null || title.isEmpty()
|| url == null || url.isEmpty()
|| url.startsWith(BrowserUnit.URL_SCHEME_ABOUT)
|| url.startsWith(BrowserUnit.URL_SCHEME_MAIL_TO)
|| url.startsWith(BrowserUnit.URL_SCHEME_INTENT))
}

fun jumpToTop() {
scrollTo(0, 0)
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -335,4 +335,5 @@
<string name="setting_summary_dark_mode">支援黑暗模式</string>
<string name="hie_touch_area_when_input">輸入時隱藏點擊區域</string>
<string name="switch_touch_area_action">點擊翻頁功能互換</string>
<string name="no_previous_page">沒有前一頁</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -467,4 +467,5 @@
<string name="setting_summary_dark_mode">Support dark mode</string>
<string name="hie_touch_area_when_input">hide touch area when typing</string>
<string name="switch_touch_area_action">switch touch area action</string>
<string name="no_previous_page">no previous page!</string>
</resources>

0 comments on commit 6ceff7e

Please sign in to comment.