mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
add toggle button for thumbnail view
This commit is contained in:
parent
5060380b05
commit
9d6f99abf3
2 changed files with 26 additions and 13 deletions
|
|
@ -5,8 +5,10 @@ import android.graphics.RectF
|
|||
import android.graphics.drawable.Drawable
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.viewModels
|
||||
|
|
@ -136,6 +138,28 @@ class PDFReaderActivity: AppCompatActivity(), DocumentListener {
|
|||
|
||||
thumbnailBar.setOnPageChangedListener { _, pageIndex: Int -> fragment.pageIndex = pageIndex }
|
||||
thumbnailBar.setThumbnailBarMode(ThumbnailBarMode.THUMBNAIL_BAR_MODE_FLOATING)
|
||||
|
||||
val toggleThumbnailButton = findViewById<ImageView>(R.id.toggleThumbnailButton)
|
||||
?: throw IllegalStateException(
|
||||
"Error while loading CustomFragmentActivity. The example layout " +
|
||||
"was missing the open search button with id `R.id.openThumbnailGridButton`."
|
||||
)
|
||||
|
||||
toggleThumbnailButton.apply {
|
||||
setImageDrawable(
|
||||
tintDrawable(
|
||||
drawable,
|
||||
ContextCompat.getColor(this@PDFReaderActivity, R.color.black)
|
||||
)
|
||||
)
|
||||
setOnClickListener {
|
||||
if (thumbnailBar.visibility == View.VISIBLE) {
|
||||
thumbnailBar.visibility = View.INVISIBLE
|
||||
} else {
|
||||
thumbnailBar.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initModularSearchViewAndButton() {
|
||||
|
|
@ -176,7 +200,7 @@ class PDFReaderActivity: AppCompatActivity(), DocumentListener {
|
|||
setImageDrawable(
|
||||
tintDrawable(
|
||||
drawable,
|
||||
ContextCompat.getColor(this@PDFReaderActivity, R.color.white)
|
||||
ContextCompat.getColor(this@PDFReaderActivity, R.color.black)
|
||||
)
|
||||
)
|
||||
setOnClickListener {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:background="@color/gray_B7B7B7"
|
||||
android:orientation="horizontal"
|
||||
android:splitMotionEvents="false">
|
||||
|
||||
|
|
@ -34,23 +33,13 @@
|
|||
android:id="@+id/openSearchButton"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/pspdf__ic_search" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/openOutlineButton"
|
||||
android:id="@+id/toggleThumbnailButton"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/pspdf__ic_outline" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/openThumbnailGridButton"
|
||||
android:layout_width="50dp"
|
||||
android:layout_height="50dp"
|
||||
android:background="?android:attr/selectableItemBackground"
|
||||
android:padding="12dp"
|
||||
android:src="@drawable/pspdf__ic_thumbnails" />
|
||||
</LinearLayout>
|
||||
|
|
|
|||
Loading…
Reference in a new issue