1.修复BottomSheetDialogFragment的展示底部导航栏颜色不统一现象。
2.优化阅读界面的加载pdf方法
This commit is contained in:
parent
a19d095346
commit
18190d15af
@ -79,31 +79,24 @@ class PdfViewActivity : BaseActivity(), OnLoadCompleteListener, OnPageChangeList
|
||||
appStore.isEyeCareMode = !appStore.isEyeCareMode
|
||||
toggleEyeCareMode(appStore.isEyeCareMode)
|
||||
}
|
||||
binding.viewModelBtn.setOnClickListener {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadPdf() {
|
||||
logDebug("loadPdf ->${pdfDocument.lastReadPage} ${pdfDocument.readingProgress}")
|
||||
// 使用传递的文件路径加载PDF
|
||||
val file = File(pdfDocument.filePath)
|
||||
if (file.exists()) {
|
||||
//需要密码展示对话框。
|
||||
if (pdfDocument.isPassword) {
|
||||
showPasswordDialog(file)
|
||||
return
|
||||
}
|
||||
// 无密码PDF正常加载
|
||||
binding.pdfview.fromFile(file).defaultPage(pdfDocument.lastReadPage) // 从上次阅读页码开始
|
||||
.enableDoubletap(true)// 是否允许双击缩放
|
||||
.onLoad(this)//加载
|
||||
.enableAnnotationRendering(true) // 是否渲染注释(如评论、颜色、表单等)
|
||||
.onError(this)//错误
|
||||
.onTap(this)//点击
|
||||
.onPageChange(this)//页面改变
|
||||
.scrollHandle(CustomScrollHandle(this))//自定义的页数展示,并且可快速拖动
|
||||
.load()
|
||||
} else {
|
||||
if (!file.exists()) {
|
||||
showToast(getString(R.string.file_not) + ": ${pdfDocument.fileName}")
|
||||
finish()
|
||||
return
|
||||
}
|
||||
if (pdfDocument.isPassword) {
|
||||
showPasswordDialog(file)
|
||||
} else {
|
||||
loadPdfInternal(file, null) // 无密码
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,15 +157,23 @@ class PdfViewActivity : BaseActivity(), OnLoadCompleteListener, OnPageChangeList
|
||||
}
|
||||
|
||||
private fun tryLoadPdfWithPassword(file: File, password: String) {
|
||||
binding.pdfview.fromFile(file).password(password) // 使用输入的密码
|
||||
.defaultPage(pdfDocument.lastReadPage) // 从上次阅读页码开始
|
||||
.enableDoubletap(true)// 是否允许双击缩放
|
||||
.onLoad(this)//加载
|
||||
.onTap(this)//单击
|
||||
.enableAnnotationRendering(true) // 是否渲染注释(如评论、颜色、表单等)
|
||||
.onError(this)//错误
|
||||
.onPageChange(this)//页面改变
|
||||
.scrollHandle(CustomScrollHandle(this))//自定义的页数展示,并且可快速拖动
|
||||
loadPdfInternal(file, password) // 传入密码
|
||||
}
|
||||
|
||||
private fun loadPdfInternal(file: File, password: String?) {
|
||||
binding.pdfview.fromFile(file)
|
||||
.apply {
|
||||
password?.let { password(it) } // 只有在有密码时才调用
|
||||
defaultPage(pdfDocument.lastReadPage) // 从上次阅读页码开始
|
||||
enableDoubletap(true) // 是否允许双击缩放
|
||||
enableAnnotationRendering(true) // 是否渲染注释
|
||||
onLoad(this@PdfViewActivity) // 加载回调
|
||||
onError(this@PdfViewActivity) // 错误回调
|
||||
onTap(this@PdfViewActivity) // 单击回调
|
||||
onPageChange(this@PdfViewActivity) // 页面改变回调
|
||||
scrollHandle(CustomScrollHandle(this@PdfViewActivity)) // 自定义的页数展示
|
||||
pageFling(true)//逐页滑动
|
||||
}
|
||||
.load()
|
||||
}
|
||||
|
||||
|
||||
@ -31,6 +31,11 @@ class ListMoreDialogFragment(val filePath: String) : BottomSheetDialogFragment()
|
||||
private lateinit var pdfDocument: PdfDocumentEntity
|
||||
private var isFavorite: Boolean = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setStyle(STYLE_NORMAL, R.style.CustomBottomSheetDialogTheme)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
@ -41,7 +46,7 @@ class ListMoreDialogFragment(val filePath: String) : BottomSheetDialogFragment()
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
dialog?.window?.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
|
||||
?.setBackgroundResource(R.drawable.dr_rounded_corner_12_bg_white)
|
||||
?.setBackgroundResource(R.drawable.dr_rc_top_12_bg_white)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
@ -60,6 +65,10 @@ class ListMoreDialogFragment(val filePath: String) : BottomSheetDialogFragment()
|
||||
viewModel.getPDFDocument(filePath)
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
private fun initUi() {
|
||||
binding.tvFileName.text = pdfDocument.fileName
|
||||
binding.tvFileSize.text = pdfDocument.fileSize.toFormatFileSize()
|
||||
@ -105,19 +114,29 @@ class ListMoreDialogFragment(val filePath: String) : BottomSheetDialogFragment()
|
||||
val result = printPdfFile(requireActivity(), Uri.fromFile(File(pdfDocument.filePath)))
|
||||
when (result) {
|
||||
PrintResult.DeviceNotSupported -> {
|
||||
Toast.makeText(context, R.string.device_does_not_support_printing, Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(
|
||||
context,
|
||||
R.string.device_does_not_support_printing,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
|
||||
is PrintResult.Error -> {
|
||||
Toast.makeText(context, R.string.pdf_cannot_print_error, Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(context, R.string.pdf_cannot_print_error, Toast.LENGTH_LONG)
|
||||
.show()
|
||||
}
|
||||
|
||||
PrintResult.MalformedPdf -> {
|
||||
Toast.makeText(context, R.string.cannot_print_malformed_pdf, Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(context, R.string.cannot_print_malformed_pdf, Toast.LENGTH_LONG)
|
||||
.show()
|
||||
}
|
||||
|
||||
PrintResult.PasswordRequired -> {
|
||||
Toast.makeText(context, R.string.pdf_cant_print_password_protected, Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(
|
||||
context,
|
||||
R.string.pdf_cant_print_password_protected,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
|
||||
PrintResult.Success -> {
|
||||
|
||||
@ -8,6 +8,7 @@ import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.view.Gravity
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
@ -19,8 +20,9 @@ import com.all.pdfreader.pro.app.R
|
||||
import com.all.pdfreader.pro.app.databinding.DialogPermissionBinding
|
||||
import com.all.pdfreader.pro.app.sp.AppStore
|
||||
import com.all.pdfreader.pro.app.util.StoragePermissionHelper
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
|
||||
class PermissionDialogFragment : DialogFragment() {
|
||||
class PermissionDialogFragment : BottomSheetDialogFragment() {
|
||||
|
||||
private lateinit var binding: DialogPermissionBinding
|
||||
|
||||
@ -34,13 +36,26 @@ class PermissionDialogFragment : DialogFragment() {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val dialog = Dialog(requireContext(), R.style.BottomSheetDialogStyle)
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setStyle(STYLE_NORMAL, R.style.CustomBottomSheetDialogTheme)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View? {
|
||||
binding = DialogPermissionBinding.inflate(layoutInflater)
|
||||
dialog.setContentView(binding.root)
|
||||
AppStore(requireActivity()).isShowPermissionsDialogPrompt = true
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
dialog?.window?.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
|
||||
?.setBackgroundResource(R.drawable.dr_rc_top_12_bg_white)
|
||||
// 设置对话框在底部显示并左右铺满
|
||||
dialog.window?.let { window ->
|
||||
dialog?.window?.let { window ->
|
||||
window.setLayout(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT
|
||||
@ -48,9 +63,13 @@ class PermissionDialogFragment : DialogFragment() {
|
||||
window.setGravity(Gravity.BOTTOM)
|
||||
window.setBackgroundDrawable(Color.TRANSPARENT.toDrawable())
|
||||
}
|
||||
dialog?.setCancelable(false)
|
||||
dialog?.setCanceledOnTouchOutside(false)
|
||||
}
|
||||
|
||||
dialog.setCancelable(false)
|
||||
dialog.setCanceledOnTouchOutside(false)
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
AppStore(requireActivity()).isShowPermissionsDialogPrompt = true
|
||||
|
||||
binding.prDesc.text =
|
||||
getString(R.string.permission_required_desc_1, getString(R.string.app_name))
|
||||
@ -68,7 +87,6 @@ class PermissionDialogFragment : DialogFragment() {
|
||||
dismiss()
|
||||
(activity as? CloseCallback)?.onClose()
|
||||
}
|
||||
return dialog
|
||||
}
|
||||
|
||||
private fun checkPermissions(): Boolean {
|
||||
|
||||
@ -24,6 +24,11 @@ class SortDialogFragment(
|
||||
private lateinit var selectedField: SortField
|
||||
private lateinit var selectedDirection: SortDirection
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setStyle(STYLE_NORMAL, R.style.CustomBottomSheetDialogTheme)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
@ -34,7 +39,7 @@ class SortDialogFragment(
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
dialog?.window?.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
|
||||
?.setBackgroundResource(R.drawable.dr_rounded_corner_12_bg_white)
|
||||
?.setBackgroundResource(R.drawable.dr_rc_top_12_bg_white)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
|
||||
@ -0,0 +1,187 @@
|
||||
package com.all.pdfreader.pro.app.ui.dialog
|
||||
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import com.all.pdfreader.pro.app.R
|
||||
import com.all.pdfreader.pro.app.databinding.DialogListMoreBinding
|
||||
import com.all.pdfreader.pro.app.databinding.DialogViewModelBinding
|
||||
import com.all.pdfreader.pro.app.model.PrintResult
|
||||
import com.all.pdfreader.pro.app.room.entity.PdfDocumentEntity
|
||||
import com.all.pdfreader.pro.app.util.AppUtils.dpToPx
|
||||
import com.all.pdfreader.pro.app.util.AppUtils.printPdfFile
|
||||
import com.all.pdfreader.pro.app.util.AppUtils.setClickWithAnimation
|
||||
import com.all.pdfreader.pro.app.util.AppUtils.shareFile
|
||||
import com.all.pdfreader.pro.app.util.FileUtils.toFormatFileSize
|
||||
import com.all.pdfreader.pro.app.util.FileUtils.toSlashDate
|
||||
import com.all.pdfreader.pro.app.viewmodel.PdfViewModel
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.load.resource.bitmap.CenterCrop
|
||||
import com.bumptech.glide.load.resource.bitmap.RoundedCorners
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import java.io.File
|
||||
|
||||
class ViewModelDialogFragment(val filePath: String) : BottomSheetDialogFragment() {
|
||||
|
||||
private lateinit var binding: DialogViewModelBinding
|
||||
private val viewModel: PdfViewModel by activityViewModels()
|
||||
private lateinit var pdfDocument: PdfDocumentEntity
|
||||
private var isFavorite: Boolean = false
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
/**
|
||||
* 让 BottomSheetDialogFragment 覆盖底部导航栏
|
||||
* 原理:
|
||||
* 1.自定义样式,并继承自 @style/Theme.Design.BottomSheetDialog
|
||||
* 2.xml布局设置fitsSystemWindows
|
||||
*/
|
||||
setStyle(STYLE_NORMAL, R.style.CustomBottomSheetDialogTheme)
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
binding = DialogViewModelBinding.inflate(layoutInflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
dialog?.window?.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
|
||||
?.setBackgroundResource(R.drawable.dr_rc_top_12_bg_white)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
viewModel.pdfDocument.observe(this) { document ->
|
||||
document?.let {
|
||||
pdfDocument = it
|
||||
isFavorite = pdfDocument.isFavorite
|
||||
initUi()
|
||||
setupOnClick()
|
||||
} ?: run {
|
||||
showToast(getString(R.string.file_not))
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
viewModel.getPDFDocument(filePath)
|
||||
}
|
||||
|
||||
private fun initUi() {
|
||||
binding.tvFileName.text = pdfDocument.fileName
|
||||
binding.tvFileSize.text = pdfDocument.fileSize.toFormatFileSize()
|
||||
binding.tvFileDate.text = pdfDocument.lastModified.toSlashDate()
|
||||
if (pdfDocument.isPassword) {
|
||||
binding.lockLayout.visibility = View.VISIBLE
|
||||
binding.tvFileImg.visibility = View.GONE
|
||||
} else {
|
||||
binding.lockLayout.visibility = View.GONE
|
||||
binding.tvFileImg.visibility = View.VISIBLE
|
||||
Glide.with(binding.root).load(pdfDocument.thumbnailPath)
|
||||
.transform(CenterCrop(), RoundedCorners(8.dpToPx(binding.root.context)))
|
||||
.into(binding.tvFileImg)
|
||||
}
|
||||
updateCollectUi(isFavorite)
|
||||
updatePasswordUi(pdfDocument.isPassword)
|
||||
}
|
||||
|
||||
private fun setupOnClick() {
|
||||
binding.collectBtn.setClickWithAnimation(duration = 250) {
|
||||
isFavorite = !isFavorite
|
||||
updateCollectUi(isFavorite)
|
||||
viewModel.saveCollectState(pdfDocument.filePath, isFavorite)
|
||||
dismiss()
|
||||
}
|
||||
binding.renameFileBtn.setOnClickListener {
|
||||
RenameDialogFragment().show(parentFragmentManager, "ListMoreDialogFragment")
|
||||
dismiss()
|
||||
}
|
||||
binding.deleteFileBtn.setOnClickListener {
|
||||
DeleteDialogFragment().show(parentFragmentManager, "DeleteDialogFragment")
|
||||
dismiss()
|
||||
}
|
||||
binding.detailsBtn.setOnClickListener {
|
||||
FileDetailsDialogFragment().show(parentFragmentManager, "FileDetailsDialogFragment")
|
||||
dismiss()
|
||||
}
|
||||
binding.shareBtn.setOnClickListener {
|
||||
shareFile(requireActivity(), File(pdfDocument.filePath))
|
||||
dismiss()
|
||||
}
|
||||
binding.printBtn.setOnClickListener {
|
||||
val result = printPdfFile(requireActivity(), Uri.fromFile(File(pdfDocument.filePath)))
|
||||
when (result) {
|
||||
PrintResult.DeviceNotSupported -> {
|
||||
Toast.makeText(
|
||||
context,
|
||||
R.string.device_does_not_support_printing,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
|
||||
is PrintResult.Error -> {
|
||||
Toast.makeText(context, R.string.pdf_cannot_print_error, Toast.LENGTH_LONG)
|
||||
.show()
|
||||
}
|
||||
|
||||
PrintResult.MalformedPdf -> {
|
||||
Toast.makeText(context, R.string.cannot_print_malformed_pdf, Toast.LENGTH_LONG)
|
||||
.show()
|
||||
}
|
||||
|
||||
PrintResult.PasswordRequired -> {
|
||||
Toast.makeText(
|
||||
context,
|
||||
R.string.pdf_cant_print_password_protected,
|
||||
Toast.LENGTH_LONG
|
||||
).show()
|
||||
}
|
||||
|
||||
PrintResult.Success -> {
|
||||
|
||||
}
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
binding.duplicateFileBtn.setOnClickListener {
|
||||
viewModel.duplicateFile(requireActivity(), pdfDocument.filePath)
|
||||
dismiss()
|
||||
}
|
||||
binding.setPasswordBtn.setOnClickListener {
|
||||
if (pdfDocument.isPassword) {
|
||||
PdfRemovePasswordDialog().show(parentFragmentManager, "PdfRemovePasswordDialog")
|
||||
} else {
|
||||
PdfSetPasswordDialog().show(parentFragmentManager, "PdfSetPasswordDialog")
|
||||
}
|
||||
dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateCollectUi(b: Boolean) {
|
||||
if (b) {
|
||||
binding.collectIv.setImageResource(R.drawable.collected)
|
||||
} else {
|
||||
binding.collectIv.setImageResource(R.drawable.collect)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePasswordUi(b: Boolean) {
|
||||
if (b) {
|
||||
binding.passwordIv.setImageResource(R.drawable.unlock)
|
||||
binding.passwordTv.text = getString(R.string.remove_password)
|
||||
} else {
|
||||
binding.passwordIv.setImageResource(R.drawable.lock)
|
||||
binding.passwordTv.text = getString(R.string.set_password)
|
||||
}
|
||||
}
|
||||
|
||||
private fun showToast(message: String) {
|
||||
Toast.makeText(requireActivity(), message, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
12
app/src/main/res/drawable/add_bookmarks.xml
Normal file
12
app/src/main/res/drawable/add_bookmarks.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#636366"
|
||||
android:pathData="M34.5,511.3c0,-79.5 -0.3,-159.4 0,-238.9 0.3,-42.7 8.5,-84 27.3,-122.5 32.4,-66.9 87.7,-105.1 159.1,-118.8 33.8,-6.5 108.9,-8.2 143.7,-8.5 102.4,-1 233.1,-0.7 335.5,-0.3 44,0.3 88.1,1 130.4,15 85.7,28.3 135.2,88.4 152.2,175.4 4.8,23.9 6.5,48.5 6.5,73 0.7,155 0.3,309.9 0,464.9 0,42.7 -8.2,84 -26.6,122.9 -32.4,67.9 -88.1,106.2 -160.4,120.8 -23.6,4.8 -47.8,7.2 -71.7,7.5 -125.3,0.7 -319.1,0.3 -444.8,0 -43.7,0 -86,-8.2 -125.6,-27.6 -67.9,-33.5 -105.5,-89.8 -119.5,-162.5 -4.4,-23.9 -6.1,-48.5 -6.5,-73 -0.3,-75.8 0,-151.6 0.3,-227.3zM518.1,367.3c-3.1,2.7 -5.8,5.1 -8.5,7.2 -29,26.6 -58,53.2 -87,80.2 -15.7,14.7 -33.8,20.5 -55,15.4 -27.3,-6.5 -43.7,-29 -43.7,-59.1L323.9,104.8v-14c-16,2 -70.3,2.7 -84.3,5.5 -65.2,11.6 -110.6,47.1 -127.3,112.6 -6.1,24.9 -9.2,51.2 -9.6,76.8 -0.7,150.9 -0.7,301.4 0,452.3 0,21.5 2.4,43.3 6.5,64.5 11.3,58 43.3,100.4 101.4,117.8 24.6,7.5 50.9,11.6 76.1,11.9 125.6,1.4 319.1,0.7 444.8,0.3 17.7,0 35.5,-1.4 52.9,-4.4 65.2,-11.3 110.6,-46.8 127.3,-112.3 6.5,-25.3 9.2,-51.9 9.6,-77.8 1,-150.5 0.7,-300.7 0,-451.2 0,-24.9 -2.7,-50.5 -8.5,-74.8 -19.8,-83.3 -116.4,-119.8 -201,-118.8L711.7,411.6c0,36.5 -26.3,62.1 -61.1,60.1 -16,-1 -28.7,-9.2 -40.3,-19.8 -30.7,-28 -61.4,-56 -92.2,-84.7zM642,92.5h-247.8v294.9c28.7,-26.3 55.6,-51.5 82.9,-76.5 24.6,-22.5 56.7,-22.9 81.6,0 19.8,18.1 39.3,36.2 58.7,54.3 7.9,7.2 15.4,14 24.6,22.2L642,92.5z" />
|
||||
<path
|
||||
android:fillColor="#636366"
|
||||
android:pathData="M795.3,661.2h-58.7c0,-19.5 0,-39.3 -0.3,-58.7 0,-6.8 -1.7,-14.3 -4.8,-20.1 -7.2,-14 -22.9,-20.1 -38.2,-16.4 -14.3,3.4 -25.6,17.7 -25.6,34.1 -0.3,20.5 0,41 0,61.4 -19.5,0 -39.3,0 -58.7,0.3 -6.8,0 -14.3,1.7 -20.1,4.8 -14,7.2 -20.1,22.9 -16.4,38.2 3.4,14.3 17.7,25.6 34.1,25.6 20.5,0.3 41,0 61.4,0v58c0,22.2 14.3,37.9 34.1,38.2 20.1,0.3 34.5,-15 34.5,-37.5V730.5h58.4c22.2,0 37.9,-14.3 38.2,-34.1 0,-20.5 -15.4,-34.8 -37.9,-35.2z" />
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/dr_rc_top_12_bg_white.xml
Normal file
9
app/src/main/res/drawable/dr_rc_top_12_bg_white.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="12dp"
|
||||
android:topRightRadius="12dp" />
|
||||
<solid android:color="@color/white" />
|
||||
|
||||
</shape>
|
||||
@ -1,6 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector android:height="25.0dip" android:width="25.0dip" android:viewportWidth="24.0" android:viewportHeight="25.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#00000000" android:pathData="M3.047,12.953C2.984,12.781 2.984,12.595 3.047,12.423C4.293,8.968 7.831,6.476 12,6.476C16.168,6.476 19.704,8.966 20.953,12.419C21.016,12.591 21.016,12.776 20.953,12.948C19.707,16.404 16.17,18.896 12,18.896C7.832,18.896 4.296,16.406 3.047,12.953Z" android:strokeColor="#ff636366" android:strokeWidth="1.8" android:strokeLineCap="round" android:strokeLineJoin="round" />
|
||||
<path android:fillColor="#00000000" android:pathData="M14.696,12.686C14.696,13.401 14.412,14.087 13.907,14.592C13.401,15.098 12.715,15.382 12,15.382C11.285,15.382 10.6,15.098 10.094,14.592C9.589,14.087 9.305,13.401 9.305,12.686C9.305,11.971 9.589,11.285 10.094,10.78C10.6,10.274 11.285,9.99 12,9.99C12.715,9.99 13.401,10.274 13.907,10.78C14.412,11.285 14.696,11.971 14.696,12.686Z" android:strokeColor="#ff636366" android:strokeWidth="1.8" android:strokeLineCap="round" android:strokeLineJoin="round" />
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="25.0dip"
|
||||
android:height="25.0dip"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="25.0">
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M3.047,12.953C2.984,12.781 2.984,12.595 3.047,12.423C4.293,8.968 7.831,6.476 12,6.476C16.168,6.476 19.704,8.966 20.953,12.419C21.016,12.591 21.016,12.776 20.953,12.948C19.707,16.404 16.17,18.896 12,18.896C7.832,18.896 4.296,16.406 3.047,12.953Z"
|
||||
android:strokeWidth="1.8"
|
||||
android:strokeColor="#ff636366"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
<path
|
||||
android:fillColor="#00000000"
|
||||
android:pathData="M14.696,12.686C14.696,13.401 14.412,14.087 13.907,14.592C13.401,15.098 12.715,15.382 12,15.382C11.285,15.382 10.6,15.098 10.094,14.592C9.589,14.087 9.305,13.401 9.305,12.686C9.305,11.971 9.589,11.285 10.094,10.78C10.6,10.274 11.285,9.99 12,9.99C12.715,9.99 13.401,10.274 13.907,10.78C14.412,11.285 14.696,11.971 14.696,12.686Z"
|
||||
android:strokeWidth="1.8"
|
||||
android:strokeColor="#ff636366"
|
||||
android:strokeLineCap="round"
|
||||
android:strokeLineJoin="round" />
|
||||
</vector>
|
||||
12
app/src/main/res/drawable/pdf_view_mode.xml
Normal file
12
app/src/main/res/drawable/pdf_view_mode.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="1024"
|
||||
android:viewportHeight="1024">
|
||||
<path
|
||||
android:fillColor="#636366"
|
||||
android:pathData="M512,928a32,32 0,0 1,-32 -32V192a32,32 0,1 1,64 0v704a32,32 0,0 1,-32 32z" />
|
||||
<path
|
||||
android:fillColor="#636366"
|
||||
android:pathData="M918.6,967.1H105.4C47.2,967.1 0,918.7 0,859V165C0,105.3 47.2,56.8 105.4,56.8h264c58.4,0 110.4,29.4 142.6,74.4A175.5,175.5 0,0 1,654.6 56.9h264c58.2,0 105.4,48.4 105.4,108.1V858.9c0,59.8 -47.2,108.2 -105.4,108.2zM105.4,126.9c-20.5,0 -37.1,17.1 -37.1,38.1V858.9c0,21.1 16.6,38.1 37.1,38.1h813.1c20.5,0 37.1,-17 37.1,-38.1V165.1a37.6,37.6 0,0 0,-37.1 -38.1h-263.9c-59.8,0 -108.5,49.9 -108.5,111.2A34.6,34.6 0,0 1,512 273.2a34.6,34.6 0,0 1,-34.1 -35c0,-61.4 -48.6,-111.2 -108.5,-111.2H105.4z" />
|
||||
</vector>
|
||||
@ -67,10 +67,34 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="64dp"
|
||||
android:layout_height="56dp"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/viewModelBtn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_horizontal|bottom"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/pdf_view_mode" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
android:text="@string/view_model"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/eyeCareOverlayBtn"
|
||||
android:layout_width="0dp"
|
||||
@ -81,8 +105,8 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/eyeProtectIv"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/eye_protect" />
|
||||
|
||||
<TextView
|
||||
@ -92,10 +116,11 @@
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
android:text="@string/eye_protect"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bookmarksBtn"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
@ -103,18 +128,18 @@
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:src="@drawable/add_bookmarks" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="4dp"
|
||||
android:fontFamily="@font/poppins_regular"
|
||||
android:text="@string/home"
|
||||
android:text="@string/bookmarks"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="14sp" />
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fitsSystemWindows="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/dr_rounded_corner_12_bg_white"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
20
app/src/main/res/layout/dialog_view_model.xml
Normal file
20
app/src/main/res/layout/dialog_view_model.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="10dp"
|
||||
android:gravity="center">
|
||||
|
||||
<View
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="4dp"
|
||||
android:background="@drawable/dr_dialog_indicator_bg" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@ -96,4 +96,5 @@
|
||||
<string name="duplicate_created_successfully">Duplicate file created successfully</string>
|
||||
<string name="duplicate_created_failed">Duplicate file created failed</string>
|
||||
<string name="processing">Processing…</string>
|
||||
<string name="view_model">View Model</string>
|
||||
</resources>
|
||||
@ -17,4 +17,18 @@
|
||||
<item name="android:windowIsTranslucent">true</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomBottomSheetDialogTheme" parent="@style/Theme.Design.BottomSheetDialog">
|
||||
<!-- 关键属性:取消浮动效果 -->
|
||||
<item name="android:windowIsFloating">false</item>
|
||||
<!-- 设置导航栏颜色 -->
|
||||
<item name="android:navigationBarColor">@color/white</item>
|
||||
<!-- 指定自定义的 bottomSheetStyle -->
|
||||
<item name="bottomSheetStyle">@style/CustomBottomSheetStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="CustomBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
|
||||
<!-- 设置背景透明以延伸内容 -->
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
Loading…
Reference in New Issue
Block a user