|
|
@ -2,6 +2,8 @@ package io.legado.app.base |
|
|
|
|
|
|
|
|
|
|
|
import android.content.Context |
|
|
|
import android.content.Context |
|
|
|
import android.content.res.Configuration |
|
|
|
import android.content.res.Configuration |
|
|
|
|
|
|
|
import android.graphics.Bitmap |
|
|
|
|
|
|
|
import android.graphics.drawable.BitmapDrawable |
|
|
|
import android.os.Build |
|
|
|
import android.os.Build |
|
|
|
import android.os.Bundle |
|
|
|
import android.os.Bundle |
|
|
|
import android.util.AttributeSet |
|
|
|
import android.util.AttributeSet |
|
|
@ -10,11 +12,14 @@ import android.view.MenuItem |
|
|
|
import android.view.View |
|
|
|
import android.view.View |
|
|
|
import android.widget.FrameLayout |
|
|
|
import android.widget.FrameLayout |
|
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
|
|
|
|
|
import androidx.preference.PreferenceManager |
|
|
|
import androidx.viewbinding.ViewBinding |
|
|
|
import androidx.viewbinding.ViewBinding |
|
|
|
|
|
|
|
import com.google.android.renderscript.Toolkit |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.App |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.constant.AppConst |
|
|
|
import io.legado.app.constant.AppConst |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
import io.legado.app.constant.PreferKey |
|
|
|
|
|
|
|
import io.legado.app.constant.PreferKey.bgImageBlurring |
|
|
|
import io.legado.app.constant.Theme |
|
|
|
import io.legado.app.constant.Theme |
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
import io.legado.app.help.ThemeConfig |
|
|
|
import io.legado.app.help.ThemeConfig |
|
|
@ -174,9 +179,7 @@ abstract class BaseActivity<VB : ViewBinding>( |
|
|
|
} |
|
|
|
} |
|
|
|
if (imageBg) { |
|
|
|
if (imageBg) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
ThemeConfig.getBgImage(this)?.let { |
|
|
|
window.decorView.background = BitmapDrawable(resources, getBackgroundImage(ThemeConfig.getBgImage(this) ?: return)) |
|
|
|
window.decorView.background = it |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (e: OutOfMemoryError) { |
|
|
|
} catch (e: OutOfMemoryError) { |
|
|
|
toastOnUi(e.localizedMessage) |
|
|
|
toastOnUi(e.localizedMessage) |
|
|
|
} catch (e: Exception) { |
|
|
|
} catch (e: Exception) { |
|
|
@ -185,6 +188,15 @@ abstract class BaseActivity<VB : ViewBinding>( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun getBackgroundImage(bitmap: Bitmap): Bitmap { |
|
|
|
|
|
|
|
PreferenceManager.getDefaultSharedPreferences(this).getInt(bgImageBlurring, 0).apply { |
|
|
|
|
|
|
|
if (this != 0) { |
|
|
|
|
|
|
|
return Toolkit.blur(bitmap, this) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return bitmap |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun setupSystemBar() { |
|
|
|
private fun setupSystemBar() { |
|
|
|
if (fullScreen && !isInMultiWindow) { |
|
|
|
if (fullScreen && !isInMultiWindow) { |
|
|
|
ATH.fullScreen(this) |
|
|
|
ATH.fullScreen(this) |
|
|
|