pull/457/head 3.20.102719
gedoor 4 years ago
parent 8ad703dc3b
commit 26d267d534
  1. 3
      app/src/main/java/io/legado/app/service/AudioPlayService.kt
  2. 3
      app/src/main/java/io/legado/app/service/BaseReadAloudService.kt
  3. 3
      app/src/main/java/io/legado/app/service/CacheBookService.kt
  4. 3
      app/src/main/java/io/legado/app/service/DownloadService.kt
  5. 3
      app/src/main/java/io/legado/app/ui/book/changesource/ChangeSourceViewModel.kt
  6. 11
      app/src/main/java/io/legado/app/ui/widget/text/BadgeView.kt

@ -12,6 +12,7 @@ import android.media.MediaPlayer
import android.net.Uri
import android.os.Build
import android.os.Handler
import android.os.Looper
import android.support.v4.media.session.MediaSessionCompat
import android.support.v4.media.session.PlaybackStateCompat
import androidx.core.app.NotificationCompat
@ -50,7 +51,7 @@ class AudioPlayService : BaseService(),
var timeMinute: Int = 0
}
private val handler = Handler()
private val handler = Handler(Looper.getMainLooper())
private lateinit var audioManager: AudioManager
private var mFocusRequest: AudioFocusRequest? = null
private var title: String = ""

@ -9,6 +9,7 @@ import android.graphics.BitmapFactory
import android.media.AudioFocusRequest
import android.media.AudioManager
import android.os.Handler
import android.os.Looper
import android.support.v4.media.session.MediaSessionCompat
import android.support.v4.media.session.PlaybackStateCompat
import androidx.annotation.CallSuper
@ -40,7 +41,7 @@ abstract class BaseReadAloudService : BaseService(),
}
}
internal val handler = Handler()
internal val handler = Handler(Looper.getMainLooper())
private lateinit var audioManager: AudioManager
private var mFocusRequest: AudioFocusRequest? = null
private var broadcastReceiver: BroadcastReceiver? = null

@ -2,6 +2,7 @@ package io.legado.app.service
import android.content.Intent
import android.os.Handler
import android.os.Looper
import androidx.core.app.NotificationCompat
import io.legado.app.App
import io.legado.app.R
@ -32,7 +33,7 @@ class CacheBookService : BaseService() {
private var searchPool =
Executors.newFixedThreadPool(threadCount).asCoroutineDispatcher()
private var tasks = CompositeCoroutine()
private val handler = Handler()
private val handler = Handler(Looper.getMainLooper())
private var runnable: Runnable = Runnable { upDownload() }
private val bookMap = ConcurrentHashMap<String, Book>()
private val webBookMap = ConcurrentHashMap<String, WebBook>()

@ -8,6 +8,7 @@ import android.content.IntentFilter
import android.net.Uri
import android.os.Build
import android.os.Handler
import android.os.Looper
import androidx.core.app.NotificationCompat
import androidx.core.content.FileProvider
import androidx.core.os.bundleOf
@ -28,7 +29,7 @@ class DownloadService : BaseService() {
private val downloads = hashMapOf<Long, String>()
private val completeDownloads = hashSetOf<Long>()
private val handler = Handler()
private val handler = Handler(Looper.getMainLooper())
private val runnable = Runnable {
checkDownloadState()
}

@ -3,6 +3,7 @@ package io.legado.app.ui.book.changesource
import android.app.Application
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import androidx.lifecycle.MutableLiveData
import io.legado.app.App
import io.legado.app.R
@ -27,7 +28,7 @@ import kotlin.math.min
class ChangeSourceViewModel(application: Application) : BaseViewModel(application) {
private val threadCount = AppConfig.threadCount
private var searchPool: ExecutorCoroutineDispatcher? = null
val handler = Handler()
val handler = Handler(Looper.getMainLooper())
val searchStateData = MutableLiveData<Boolean>()
val searchBooksLiveData = MutableLiveData<List<SearchBook>>()
var name: String = ""

@ -12,7 +12,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.FrameLayout.LayoutParams
import android.widget.TabWidget
import androidx.appcompat.widget.AppCompatTextView
import io.legado.app.R
import io.legado.app.lib.theme.accentColor
@ -186,16 +185,6 @@ class BadgeView @JvmOverloads constructor(
incrementBadgeCount(-decrement)
}
/**
* Attach the BadgeView to the TabWidget
* @param target the TabWidget to attach the BadgeView
* @param tabIndex index of the tab
*/
fun setTargetView(target: TabWidget, tabIndex: Int) {
val tabView = target.getChildTabViewAt(tabIndex)
setTargetView(tabView)
}
/**
* Attach the BadgeView to the target view
* @param target the view to attach the BadgeView

Loading…
Cancel
Save