Reader PR

This commit is contained in:
CrepeTF 2021-01-06 03:06:14 -05:00 committed by Jobobby04
parent 4b91013750
commit 653ae10caf
7 changed files with 203 additions and 41 deletions

View File

@ -13,7 +13,6 @@ import android.os.Build
import android.os.Bundle
import android.view.KeyEvent
import android.view.Menu
import android.view.MenuItem
import android.view.MotionEvent
import android.view.View
import android.view.WindowManager
@ -305,16 +304,16 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
* Called when an item of the options menu was clicked. Used to handle clicks on our menu
* entries.
*/
override fun onOptionsItemSelected(item: MenuItem): Boolean {
/*override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
/*R.id.action_bookmark -> {
R.id.action_bookmark -> {
presenter.bookmarkCurrentChapter(true)
invalidateOptionsMenu()
}
R.id.action_remove_bookmark -> {
presenter.bookmarkCurrentChapter(false)
invalidateOptionsMenu()
}*/
}
R.id.action_settings -> ReaderSettingsSheet(this).show()
R.id.action_custom_filter -> {
val sheet = ReaderColorFilterSheet(this)
@ -329,7 +328,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
}
}
return super.onOptionsItemSelected(item)
}
}*/
/**
* Called when the user clicks the back key or the button on the toolbar. The call is
@ -403,7 +402,27 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
}
)
/* SY --> binding.leftChapter.setOnClickListener {
// Extra menu buttons
binding.filterButton.clicks()
.onEach {
ReaderColorFilterSheet(this).show()
}
.launchIn(scope)
binding.actionSettings.clicks()
.onEach {
ReaderSettingsSheet(this).show()
}
.launchIn(scope)
binding.webviewButton.clicks()
.onEach {
openMangaInBrowser()
}
.launchIn(scope)
// Extra menu buttons
binding.leftChapter.setOnClickListener {
if (viewer != null) {
if (viewer is R2LPagerViewer) {
loadNextChapter()
@ -420,7 +439,7 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
loadNextChapter()
}
}
} SY <-- */
}
// --> EH
binding.expandEhButton.clicks()
@ -830,8 +849,16 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
// Set bottom page number
binding.pageNumber.text = "${page.number}/${pages.size}"
binding.pageText.text = "${page.number}/${pages.size}"
// Set seekbar progress
// binding.pageText.text = "${page.number}/${pages.size}"
// Set seekbar page number
if (viewer !is R2LPagerViewer) {
binding.leftPageText.text = "${page.number}"
binding.rightPageText.text = "${pages.size}"
} else {
binding.rightPageText.text = "${page.number}"
binding.leftPageText.text = "${pages.size}"
}
binding.pageSeekbar.max = pages.lastIndex
binding.pageSeekbar.progress = page.index

View File

@ -111,7 +111,7 @@ class ReaderChapterSheet(private val activity: ReaderActivity) : BottomSheetDial
refreshList()
initialized = true
}
binding.pageText.text = activity.binding.pageText.text
binding.pageText.text = activity.binding.pageNumber.text
binding.pageSeekbar.max = activity.binding.pageSeekbar.max
binding.pageSeekbar.progress = activity.binding.pageSeekbar.progress
super.show()

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="15dp" />
<solid android:color="?attr/colorPrimary" />
</shape>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:topLeftRadius="10dp"
android:topRightRadius="10dp" />
<solid android:color="?attr/colorPrimary" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="1000dp" />
<solid android:color="?attr/colorPrimary" />
</shape>

View File

@ -155,38 +155,150 @@
<LinearLayout
android:id="@+id/reader_menu_bottom"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_gravity="bottom"
android:background="?attr/colorPrimary"
android:clickable="true"
android:focusable="true">
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="bottom">
<ImageButton
android:id="@+id/chapters_button"
android:layout_width="wrap_content"
<LinearLayout
android:id="@+id/reader_nav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/action_next_chapter"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
android:tint="?attr/colorOnPrimary"
app:srcCompat="@drawable/ic_format_list_numbered_24dp" />
<eu.kanade.tachiyomi.ui.reader.ReaderSeekBar
android:id="@+id/page_seekbar"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:maxHeight="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize"/>
<TextView
android:id="@+id/page_text"
android:layout_width="100dp"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:layout_marginBottom="16dp"
android:layout_gravity="bottom"
android:gravity="center"
android:textColor="?attr/colorOnPrimary"
android:textSize="15sp"
tools:text="100 / 105" />
android:orientation="horizontal"
android:clickable="true"
android:focusable="true">
<ImageButton
android:id="@+id/left_chapter"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="50dp"
android:layout_gravity="center"
android:background="@drawable/chapter_nav"
android:contentDescription="@string/action_previous_chapter"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
app:srcCompat="@drawable/ic_arrow_back_24dp"
android:tint="?attr/colorOnPrimary" />
<LinearLayout
android:id="@+id/reader_seekbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:background="@drawable/chapter_nav">
<TextView
android:id="@+id/left_page_text"
android:layout_width="32dp"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="15sp"
android:textColor="?attr/colorOnPrimary"
tools:text="1" />
<eu.kanade.tachiyomi.ui.reader.ReaderSeekBar
android:id="@+id/page_seekbar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:maxHeight="?attr/actionBarSize"
android:minHeight="?attr/actionBarSize" />
<TextView
android:id="@+id/right_page_text"
android:layout_width="32dp"
android:layout_height="match_parent"
android:gravity="center"
android:textSize="15sp"
android:textColor="?attr/colorOnPrimary"
tools:text="15" />
</LinearLayout>
<ImageButton
android:id="@+id/right_chapter"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="50dp"
android:layout_marginStart="8dp"
android:layout_gravity="center"
android:background="@drawable/chapter_nav"
android:contentDescription="@string/action_next_chapter"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
app:srcCompat="@drawable/ic_arrow_forward_24dp"
android:tint="?attr/colorOnPrimary" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_gravity="bottom"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:background="@drawable/reader_menu_bottom"
android:clickable="true">
<ImageButton
android:id="@+id/chapters_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/action_next_chapter"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
android:tint="?attr/colorOnPrimary"
app:layout_constraintEnd_toStartOf="@id/filter_button"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_format_list_numbered_24dp" />
<ImageButton
android:id="@+id/filter_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/custom_filter"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
android:tint="?attr/colorOnPrimary"
app:layout_constraintEnd_toStartOf="@id/webview_button"
app:layout_constraintStart_toEndOf="@id/chapters_button"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_brightness_4_24dp"/>
<ImageButton
android:id="@+id/webview_button"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/action_web_view"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
android:tint="?attr/colorOnPrimary"
app:layout_constraintEnd_toStartOf="@id/action_settings"
app:layout_constraintStart_toEndOf="@id/filter_button"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_public_24dp"/>
<ImageButton
android:id="@+id/action_settings"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/action_settings"
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
android:tint="?attr/colorOnPrimary"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/webview_button"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_settings_24dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>
</FrameLayout>

View File

@ -14,7 +14,7 @@
android:icon="@drawable/ic_bookmark_24dp"
android:title="@string/action_remove_bookmark"
app:iconTint="?attr/colorOnPrimary"
app:showAsAction="ifRoom" />-->
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_custom_filter"
@ -28,6 +28,6 @@
android:icon="@drawable/ic_settings_24dp"
android:title="@string/label_settings"
app:iconTint="?attr/colorOnPrimary"
app:showAsAction="ifRoom" />
app:showAsAction="ifRoom" />-->
</menu>