diff --git a/app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.java b/app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.java deleted file mode 100644 index dfbfbb641..000000000 --- a/app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.java +++ /dev/null @@ -1,4 +0,0 @@ -package io.legado.app.ui.readbook.config; - -public class PaddingConfigDialog { -} diff --git a/app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.kt b/app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.kt new file mode 100644 index 000000000..f8405012e --- /dev/null +++ b/app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.kt @@ -0,0 +1,41 @@ +package io.legado.app.ui.readbook.config + +import android.os.Bundle +import android.util.DisplayMetrics +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import androidx.fragment.app.DialogFragment +import io.legado.app.R +import io.legado.app.ui.readbook.Help + +class PaddingConfigDialog : DialogFragment() { + + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle? + ): View? { + return super.onCreateView(inflater, container, savedInstanceState) + } + + override fun onStart() { + super.onStart() + val dm = DisplayMetrics() + activity?.windowManager?.defaultDisplay?.getMetrics(dm) + dialog?.window?.let { + it.setBackgroundDrawableResource(R.color.transparent) + it.decorView.setPadding(0, 0, 0, 0) + val attr = it.attributes + attr.dimAmount = 0.0f + it.attributes = attr + it.setLayout((dm.widthPixels * 0.9).toInt(), ViewGroup.LayoutParams.WRAP_CONTENT) + Help.upSystemUiVisibility(it) + } + } + + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + super.onViewCreated(view, savedInstanceState) + } + +}