From af887cb0830030b9dd6127c79d6c7d03f77e9db6 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 28 Aug 2019 17:51:21 +0800 Subject: [PATCH] up --- .../readbook/config/PaddingConfigDialog.java | 4 -- .../ui/readbook/config/PaddingConfigDialog.kt | 41 +++++++++++++++++++ 2 files changed, 41 insertions(+), 4 deletions(-) delete mode 100644 app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.java create mode 100644 app/src/main/java/io/legado/app/ui/readbook/config/PaddingConfigDialog.kt 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) + } + +}