mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-10 12:47:26 +01:00
Initial adoption of bottom reader menus from TachiyomiSY
Co-authored-by: Jobobby04 <jobobby04@users.noreply.github.com> Co-authored-by: CrepeTF <CrepeTF@users.noreply.github.com>
This commit is contained in:
parent
ace1db21d1
commit
89837e4ced
@ -239,18 +239,6 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
presenter.bookmarkCurrentChapter(false)
|
presenter.bookmarkCurrentChapter(false)
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
R.id.action_settings -> ReaderSettingsSheet(this).show()
|
|
||||||
R.id.action_custom_filter -> {
|
|
||||||
val sheet = ReaderColorFilterSheet(this)
|
|
||||||
// Remove dimmed backdrop so changes can be previewed
|
|
||||||
.apply { window?.setDimAmount(0f) }
|
|
||||||
|
|
||||||
// Hide toolbars while sheet is open for better preview
|
|
||||||
sheet.setOnDismissListener { setMenuVisibility(true) }
|
|
||||||
setMenuVisibility(false)
|
|
||||||
|
|
||||||
sheet.show()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return super.onOptionsItemSelected(item)
|
return super.onOptionsItemSelected(item)
|
||||||
}
|
}
|
||||||
@ -356,6 +344,21 @@ class ReaderActivity : BaseRxActivity<ReaderActivityBinding, ReaderPresenter>()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.actionCustomFilter.setOnClickListener {
|
||||||
|
val sheet = ReaderColorFilterSheet(this)
|
||||||
|
// Remove dimmed backdrop so changes can be previewed
|
||||||
|
.apply { window?.setDimAmount(0f) }
|
||||||
|
|
||||||
|
// Hide toolbars while sheet is open for better preview
|
||||||
|
sheet.setOnDismissListener { setMenuVisibility(true) }
|
||||||
|
setMenuVisibility(false)
|
||||||
|
|
||||||
|
sheet.show()
|
||||||
|
}
|
||||||
|
binding.actionSettings.setOnClickListener {
|
||||||
|
ReaderSettingsSheet(this).show()
|
||||||
|
}
|
||||||
|
|
||||||
// Set initial visibility
|
// Set initial visibility
|
||||||
setMenuVisibility(menuVisible)
|
setMenuVisibility(menuVisible)
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="@android:color/black"
|
|
||||||
android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z" />
|
|
||||||
</vector>
|
|
@ -1,9 +0,0 @@
|
|||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24">
|
|
||||||
<path
|
|
||||||
android:fillColor="@android:color/black"
|
|
||||||
android:pathData="M6,6h2v12L6,18zM9.5,12l8.5,6L18,6z" />
|
|
||||||
</vector>
|
|
6
app/src/main/res/drawable/reader_seekbar_background.xml
Normal file
6
app/src/main/res/drawable/reader_seekbar_background.xml
Normal 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>
|
@ -60,61 +60,123 @@
|
|||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/reader_menu_bottom"
|
android:id="@+id/reader_menu_bottom"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="?attr/colorPrimary"
|
android:orientation="vertical">
|
||||||
android:descendantFocusability="blocksDescendants"
|
|
||||||
android:gravity="center"
|
|
||||||
android:layoutDirection="ltr"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageButton
|
<LinearLayout
|
||||||
android:id="@+id/left_chapter"
|
android:id="@+id/reader_nav"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:layout_gravity="bottom"
|
||||||
android:contentDescription="@string/action_previous_chapter"
|
android:layout_marginStart="8dp"
|
||||||
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
|
android:layout_marginEnd="8dp"
|
||||||
app:srcCompat="@drawable/ic_skip_previous_24dp"
|
android:layout_marginBottom="16dp"
|
||||||
app:tint="?attr/colorOnPrimary" />
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/left_page_text"
|
|
||||||
android:layout_width="32dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:textSize="15sp"
|
android:orientation="horizontal">
|
||||||
tools:text="1" />
|
|
||||||
|
|
||||||
<!--
|
<ImageButton
|
||||||
Wonky way of setting height due to issues with horizontally centering the thumb in Android 5.
|
android:id="@+id/left_chapter"
|
||||||
See https://stackoverflow.com/questions/15701767/android-thumb-is-not-centered-in-seekbar
|
android:layout_width="40dp"
|
||||||
-->
|
android:layout_height="40dp"
|
||||||
<eu.kanade.tachiyomi.ui.reader.ReaderSeekBar
|
android:layout_gravity="center"
|
||||||
android:id="@+id/page_seekbar"
|
android:layout_marginStart="50dp"
|
||||||
android:layout_width="0dp"
|
android:layout_marginEnd="8dp"
|
||||||
android:layout_height="wrap_content"
|
android:background="@drawable/reader_seekbar_background"
|
||||||
android:layout_weight="1"
|
android:contentDescription="@string/action_previous_chapter"
|
||||||
android:maxHeight="?attr/actionBarSize"
|
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
|
||||||
android:minHeight="?attr/actionBarSize" />
|
app:srcCompat="@drawable/ic_arrow_back_24dp"
|
||||||
|
app:tint="?attr/colorOnPrimary" />
|
||||||
|
|
||||||
<TextView
|
<LinearLayout
|
||||||
android:id="@+id/right_page_text"
|
android:id="@+id/reader_seekbar"
|
||||||
android:layout_width="32dp"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:background="@drawable/reader_seekbar_background"
|
||||||
android:textSize="15sp"
|
android:paddingStart="10dp"
|
||||||
tools:text="15" />
|
android:paddingEnd="10dp">
|
||||||
|
|
||||||
<ImageButton
|
<TextView
|
||||||
android:id="@+id/right_chapter"
|
android:id="@+id/left_page_text"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="32dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
android:gravity="center"
|
||||||
android:contentDescription="@string/action_next_chapter"
|
android:textColor="?attr/colorOnPrimary"
|
||||||
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
|
android:textSize="15sp"
|
||||||
app:srcCompat="@drawable/ic_skip_next_24dp"
|
tools:text="1" />
|
||||||
app:tint="?attr/colorOnPrimary" />
|
|
||||||
|
<!--
|
||||||
|
Wonky way of setting height due to issues with horizontally centering the thumb in Android 5.
|
||||||
|
See https://stackoverflow.com/questions/15701767/android-thumb-is-not-centered-in-seekbar
|
||||||
|
-->
|
||||||
|
<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:textColor="?attr/colorOnPrimary"
|
||||||
|
android:textSize="15sp"
|
||||||
|
tools:text="15" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<!-- android:background="?selectableItemBackgroundBorderless"-->
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/right_chapter"
|
||||||
|
android:layout_width="40dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:background="@drawable/reader_seekbar_background"
|
||||||
|
android:contentDescription="@string/action_next_chapter"
|
||||||
|
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
|
||||||
|
app:srcCompat="@drawable/ic_arrow_forward_24dp"
|
||||||
|
app:tint="?attr/colorOnPrimary" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:background="?attr/colorPrimary">
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/action_custom_filter"
|
||||||
|
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"
|
||||||
|
app:layout_constraintEnd_toStartOf="@id/action_settings"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/ic_brightness_4_24dp"
|
||||||
|
app:tint="?attr/colorOnPrimary" />
|
||||||
|
|
||||||
|
<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"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/action_custom_filter"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:srcCompat="@drawable/ic_settings_24dp"
|
||||||
|
app:tint="?attr/colorOnPrimary" />
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -16,18 +16,4 @@
|
|||||||
app:iconTint="?attr/colorOnPrimary"
|
app:iconTint="?attr/colorOnPrimary"
|
||||||
app:showAsAction="ifRoom" />
|
app:showAsAction="ifRoom" />
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_custom_filter"
|
|
||||||
android:icon="@drawable/ic_brightness_4_24dp"
|
|
||||||
android:title="@string/custom_filter"
|
|
||||||
app:iconTint="?attr/colorOnPrimary"
|
|
||||||
app:showAsAction="ifRoom" />
|
|
||||||
|
|
||||||
<item
|
|
||||||
android:id="@+id/action_settings"
|
|
||||||
android:icon="@drawable/ic_settings_24dp"
|
|
||||||
android:title="@string/label_settings"
|
|
||||||
app:iconTint="?attr/colorOnPrimary"
|
|
||||||
app:showAsAction="ifRoom" />
|
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
Loading…
Reference in New Issue
Block a user