mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-02-16 20:00:36 +01:00
Revert "adding a page counter at the pdf viewer"
This reverts commit db7d806c6fd6cb56133ab8395b10f2fd7f15958f.
This commit is contained in:
parent
bda0325c25
commit
089f352818
@ -8,10 +8,9 @@ import android.print.PrintAttributes
|
||||
import android.print.PrintManager
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.viewpager2.widget.MarginPageTransformer
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.REAL_FILE_PATH
|
||||
import com.simplemobiletools.commons.helpers.isPiePlus
|
||||
@ -59,6 +58,7 @@ class PDFViewerActivity : SimpleActivity() {
|
||||
}
|
||||
|
||||
private fun setupMenu() {
|
||||
(pdf_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
|
||||
pdf_viewer_toolbar.menu.apply {
|
||||
findItem(R.id.menu_print).isVisible = realFilePath.isNotEmpty()
|
||||
findItem(R.id.menu_print).setOnMenuItemClickListener {
|
||||
@ -71,29 +71,20 @@ class PDFViewerActivity : SimpleActivity() {
|
||||
finish()
|
||||
}
|
||||
|
||||
setupViewOffsets()
|
||||
val primaryColor = getProperPrimaryColor()
|
||||
page_counter.background?.applyColorFilter(primaryColor)
|
||||
page_counter.setTextColor(primaryColor.getContrastColor())
|
||||
}
|
||||
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
setupViewOffsets()
|
||||
}
|
||||
|
||||
private fun setupViewOffsets() {
|
||||
val pageCounterMargin = resources.getDimension(R.dimen.normal_margin).toInt()
|
||||
(pdf_viewer_appbar.layoutParams as ConstraintLayout.LayoutParams).topMargin = statusBarHeight
|
||||
if (!portrait && navigationBarOnSide && navigationBarWidth > 0) {
|
||||
pdf_viewer_appbar.setPadding(0, 0, navigationBarWidth, 0)
|
||||
} else {
|
||||
pdf_viewer_appbar.setPadding(0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
(page_counter.layoutParams as ConstraintLayout.LayoutParams).apply {
|
||||
rightMargin = navigationBarWidth + pageCounterMargin
|
||||
bottomMargin = navigationBarHeight + pageCounterMargin
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||
super.onConfigurationChanged(newConfig)
|
||||
(pdf_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
|
||||
if (!portrait && navigationBarOnSide && navigationBarWidth > 0) {
|
||||
pdf_viewer_appbar.setPadding(0, 0, navigationBarWidth, 0)
|
||||
} else {
|
||||
pdf_viewer_appbar.setPadding(0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
@ -120,15 +111,6 @@ class PDFViewerActivity : SimpleActivity() {
|
||||
return
|
||||
}
|
||||
|
||||
pdf_viewer.registerOnPageChangeCallback(object : OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
updatePageCounter(position)
|
||||
}
|
||||
})
|
||||
|
||||
updatePageCounter(0)
|
||||
page_counter.beVisible()
|
||||
|
||||
showSystemUI(true)
|
||||
|
||||
val filename = getFilenameFromUri(uri)
|
||||
@ -137,10 +119,6 @@ class PDFViewerActivity : SimpleActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun updatePageCounter(position: Int) {
|
||||
page_counter.text = "${position + 1} / ${pdf_viewer.adapter?.itemCount}"
|
||||
}
|
||||
|
||||
private fun printText() {
|
||||
val adapter = PdfDocumentAdapter(this, realFilePath)
|
||||
|
||||
@ -160,7 +138,6 @@ class PDFViewerActivity : SimpleActivity() {
|
||||
showSystemUI(true)
|
||||
}
|
||||
|
||||
page_counter.animate().alpha(newAlpha).start()
|
||||
top_shadow.animate().alpha(newAlpha).start()
|
||||
pdf_viewer_appbar.animate().alpha(newAlpha).withStartAction {
|
||||
if (newAlpha == 1f) {
|
||||
|
@ -1,10 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/pdf_viewer_wrapper"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
@ -16,28 +15,18 @@
|
||||
android:id="@+id/top_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/top_shadow_height"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@drawable/gradient_background_flipped"
|
||||
android:contentDescription="@null"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/page_counter"
|
||||
style="@style/ColoredButtonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
tools:text="1/3" />
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<com.google.android.material.appbar.AppBarLayout
|
||||
android:id="@+id/pdf_viewer_appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:background="@android:color/transparent"
|
||||
android:elevation="0dp"
|
||||
app:elevation="0dp"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:elevation="0dp">
|
||||
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/pdf_viewer_toolbar"
|
||||
@ -47,4 +36,4 @@
|
||||
app:navigationIcon="@drawable/ic_arrow_left_vector" />
|
||||
|
||||
</com.google.android.material.appbar.AppBarLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</RelativeLayout>
|
||||
|
Loading…
x
Reference in New Issue
Block a user