Skip to content

Commit

Permalink
fix: click on navigation up does not close SharedDecksActivity
Browse files Browse the repository at this point in the history
  • Loading branch information
Prince-kushwaha authored and mikehardy committed Dec 22, 2024
1 parent e507d1d commit fb02c90
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions AnkiDroid/src/main/java/com/ichi2/anki/SharedDecksActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import android.webkit.WebViewClient
import androidx.activity.OnBackPressedCallback
import androidx.appcompat.widget.SearchView
import androidx.appcompat.widget.Toolbar
import androidx.core.content.ContextCompat
import androidx.core.os.bundleOf
import androidx.fragment.app.commit
import com.google.android.material.snackbar.BaseTransientBottomBar.LENGTH_INDEFINITE
Expand Down Expand Up @@ -227,8 +226,6 @@ class SharedDecksActivity : AnkiActivity() {
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowHomeEnabled(true)

webviewToolbar.navigationIcon = ContextCompat.getDrawable(applicationContext, R.drawable.close_icon)

webView = findViewById(R.id.web_view)

downloadManager = getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
Expand Down Expand Up @@ -283,8 +280,12 @@ class SharedDecksActivity : AnkiActivity() {

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId == R.id.home) {
// R.id.home refers to a custom 'home' menu item defined in your app resources (res/menu/...).
shouldHistoryBeCleared = true
webView.loadUrl(resources.getString(R.string.shared_decks_url))
} else if (item.itemId == android.R.id.home) {
// android.R.id.home refers to the system-provided "up" button in the app toolbar
onBackPressedCallback.isEnabled = false
}
return super.onOptionsItemSelected(item)
}
Expand Down

0 comments on commit fb02c90

Please sign in to comment.