Skip to content

Commit

Permalink
remove synchronized annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
plateaukao committed Jan 4, 2022
1 parent e54b493 commit 974308c
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ open class BrowserActivity : ComponentActivity(), BrowserController, OnClickList
return false
}

@Synchronized
override fun showAlbum(controller: AlbumController) {
if (currentAlbumController != null) {
if (currentAlbumController == controller) {
Expand Down Expand Up @@ -1057,7 +1056,6 @@ open class BrowserActivity : ComponentActivity(), BrowserController, OnClickList

private var preloadedWebView: NinjaWebView? = null

@Synchronized
private fun addAlbum(
title: String = "",
url: String? = config.favoriteUrl,
Expand Down Expand Up @@ -1129,7 +1127,6 @@ open class BrowserActivity : ComponentActivity(), BrowserController, OnClickList
)
}

@Synchronized
private fun updateAlbum(url: String?) {
if (url == null) return
(currentAlbumController as NinjaWebView).loadUrl(url)
Expand All @@ -1149,7 +1146,6 @@ open class BrowserActivity : ComponentActivity(), BrowserController, OnClickList
}
}

@Synchronized
override fun removeAlbum(controller: AlbumController) {
updateSavedAlbumInfo()

Expand Down
3 changes: 0 additions & 3 deletions app/src/main/java/de/baumann/browser/browser/AdBlock.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class AdBlock(private val context: Context): KoinComponent {
return config.adSites.any { url.contains(it, true) }
}

@Synchronized
fun addDomain(domain: String?) {
with(RecordDb(context)) {
open(true)
Expand All @@ -53,7 +52,6 @@ class AdBlock(private val context: Context): KoinComponent {
whitelist.add(domain)
}

@Synchronized
fun removeDomain(domain: String?) {
with(RecordDb(context)) {
open(true)
Expand All @@ -63,7 +61,6 @@ class AdBlock(private val context: Context): KoinComponent {
whitelist.remove(domain)
}

@Synchronized
fun clearDomains() {
with(RecordDb(context)) {
open(true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package de.baumann.browser.browser

import kotlin.jvm.Synchronized
import de.baumann.browser.view.NinjaWebView
import java.util.*

Expand All @@ -10,13 +9,10 @@ class BrowserContainer {
return list[index]
}

@Synchronized
fun add(controller: AlbumController) = list.add(controller)

@Synchronized
fun add(controller: AlbumController, index: Int) = list.add(index, controller)

@Synchronized
fun remove(controller: AlbumController) {
(controller as NinjaWebView).destroy()
list.remove(controller)
Expand All @@ -28,7 +24,6 @@ class BrowserContainer {

fun size(): Int = list.size

@Synchronized
fun clear() {
for (albumController in list) {
(albumController as NinjaWebView).destroy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ class NinjaWebViewClient(
}

override fun shouldInterceptRequest(view: WebView, url: String): WebResourceResponse? {
if (hasAdBlock && !white && adBlock.isAd(url)) {
if (hasAdBlock && !white && adBlock.isAd(url)) {
return adTxtResponse
}
if (!sp.getBoolean(context.getString(R.string.sp_cookies), true)) {
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/java/de/baumann/browser/view/NinjaWebView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ class NinjaWebView : WebView, AlbumController, KoinComponent {

override fun keepPlaying(): Boolean = keepPlaying

@Synchronized
override fun activate() {
requestFocus()
isForeground = true
Expand All @@ -313,14 +312,12 @@ class NinjaWebView : WebView, AlbumController, KoinComponent {
}
}

@Synchronized
override fun deactivate() {
clearFocus()
isForeground = false
album.deactivate()
}

@Synchronized
fun update(progress: Int) {
if (isForeground) {
browserController?.updateProgress(progress)
Expand All @@ -335,14 +332,12 @@ class NinjaWebView : WebView, AlbumController, KoinComponent {
}
}

@Synchronized
fun update(title: String?) {
album.albumTitle = title ?: ""
// so that title on bottom bar can be updated
browserController?.updateTitle(album.albumTitle)
}

@Synchronized
override fun destroy() {
stopLoading()
onPause()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MenuDialog(
binding.buttonSplitScreen.setOnClickListener { dialog.dismissWithAction(toggleSplitScreenAction) }
binding.buttonFontSize.setOnClickListener { dialog.dismissWithAction(fontSizeAction) }
binding.buttonCloseTab.setOnClickListener { dialog.dismissWithAction(closeTabAction) }
binding.buttonQuit.setOnClickListener { dialog.dismissWithAction { (context as Activity).finish() } }
binding.buttonQuit.setOnClickListener { dialog.dismissWithAction { (context as Activity).finishAndRemoveTask() } }
binding.buttonBold.setOnClickListener { dialog.dismissWithAction { config.boldFontStyle = !config.boldFontStyle } }
binding.buttonWhiteBackground.setOnClickListener { dialog.dismissWithAction { config.whiteBackground = !config.whiteBackground} }
binding.buttonReader.setOnClickListener { dialog.dismissWithAction { ninjaWebView.toggleReaderMode() } }
Expand Down

0 comments on commit 974308c

Please sign in to comment.