Using appbar for reader, removing tablayout in main activity xml
and a pill in the reader chapters sheet
This commit is contained in:
parent
732b7c3414
commit
b38b74d95d
@ -314,8 +314,8 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
setSupportActionBar(toolbar)
|
setSupportActionBar(toolbar)
|
||||||
val primaryColor = ColorUtils.setAlphaComponent(getResourceColor(R.attr.colorSecondary),
|
val primaryColor = ColorUtils.setAlphaComponent(getResourceColor(R.attr.colorSecondary),
|
||||||
200)
|
200)
|
||||||
toolbar.setBackgroundColor(primaryColor)
|
appbar.setBackgroundColor(primaryColor)
|
||||||
window.statusBarColor = primaryColor
|
window.statusBarColor = Color.TRANSPARENT
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||||
toolbar.setNavigationOnClickListener {
|
toolbar.setNavigationOnClickListener {
|
||||||
onBackPressed()
|
onBackPressed()
|
||||||
@ -384,7 +384,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
toolbar.startAnimation(toolbarAnimation)
|
appbar.startAnimation(toolbarAnimation)
|
||||||
}
|
}
|
||||||
BottomSheetBehavior.from(chapters_bottom_sheet).state = BottomSheetBehavior.STATE_COLLAPSED
|
BottomSheetBehavior.from(chapters_bottom_sheet).state = BottomSheetBehavior.STATE_COLLAPSED
|
||||||
}
|
}
|
||||||
@ -398,7 +398,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
reader_menu.visibility = View.GONE
|
reader_menu.visibility = View.GONE
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
toolbar.startAnimation(toolbarAnimation)
|
appbar.startAnimation(toolbarAnimation)
|
||||||
BottomSheetBehavior.from(chapters_bottom_sheet).isHideable = true
|
BottomSheetBehavior.from(chapters_bottom_sheet).isHideable = true
|
||||||
BottomSheetBehavior.from(chapters_bottom_sheet).state = BottomSheetBehavior.STATE_HIDDEN
|
BottomSheetBehavior.from(chapters_bottom_sheet).state = BottomSheetBehavior.STATE_HIDDEN
|
||||||
} else
|
} else
|
||||||
@ -658,7 +658,7 @@ class ReaderActivity : BaseRxActivity<ReaderPresenter>(),
|
|||||||
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
toolbar.startAnimation(toolbarAnimation)
|
appbar.startAnimation(toolbarAnimation)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (menuStickyVisible && !menuVisible) {
|
if (menuStickyVisible && !menuVisible) {
|
||||||
|
@ -67,6 +67,7 @@ class ReaderChapterSheet @JvmOverloads constructor(context: Context, attrs: Attr
|
|||||||
}
|
}
|
||||||
sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
|
sheetBehavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
|
||||||
override fun onSlide(bottomSheet: View, progress: Float) {
|
override fun onSlide(bottomSheet: View, progress: Float) {
|
||||||
|
pill.alpha = (1 - max(0f, progress)) * 0.25f
|
||||||
val trueProgress = max(progress, 0f)
|
val trueProgress = max(progress, 0f)
|
||||||
backgroundTintList =
|
backgroundTintList =
|
||||||
ColorStateList.valueOf(lerpColor(primary, fullPrimary, trueProgress))
|
ColorStateList.valueOf(lerpColor(primary, fullPrimary, trueProgress))
|
||||||
|
@ -24,9 +24,9 @@
|
|||||||
android:id="@+id/appbar"
|
android:id="@+id/appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:theme="?attr/actionBarTheme"
|
|
||||||
android:background="?attr/colorSecondary"
|
android:background="?attr/colorSecondary"
|
||||||
android:stateListAnimator="@null"
|
android:stateListAnimator="@null"
|
||||||
|
android:theme="?attr/actionBarTheme"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
@ -59,22 +59,6 @@
|
|||||||
tools:text="Title Text" />
|
tools:text="Title Text" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</eu.kanade.tachiyomi.ui.base.CenteredToolbar>
|
</eu.kanade.tachiyomi.ui.base.CenteredToolbar>
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
|
||||||
android:id="@+id/tabs"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?colorPrimary"
|
|
||||||
android:theme="@style/Theme.ActionBar.Tab"
|
|
||||||
app:tabGravity="center"
|
|
||||||
app:tabIndicatorColor="?attr/actionBarTintColor"
|
|
||||||
app:tabInlineLabel="true"
|
|
||||||
app:tabMinWidth="75dp"
|
|
||||||
app:tabMode="auto"
|
|
||||||
app:tabRippleColor="@color/rippleColor"
|
|
||||||
app:tabTextColor="?attr/actionBarTintColor" />
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
|
@ -41,12 +41,24 @@
|
|||||||
android:background="@android:color/transparent"
|
android:background="@android:color/transparent"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:id="@+id/appbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="?attr/actionBarTheme"
|
||||||
|
android:background="?attr/colorSecondary"
|
||||||
|
android:stateListAnimator="@null"
|
||||||
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize"
|
||||||
android:background="?colorSecondary" />
|
android:background="@android:color/transparent" />
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<include layout="@layout/reader_chapters_sheet"/>
|
<include layout="@layout/reader_chapters_sheet"/>
|
||||||
|
|
||||||
|
@ -11,51 +11,73 @@
|
|||||||
app:behavior_peekHeight="?attr/actionBarSize"
|
app:behavior_peekHeight="?attr/actionBarSize"
|
||||||
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior">
|
||||||
|
|
||||||
<LinearLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/title_layout"
|
android:id="@+id/topbar_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="wrap_content">
|
||||||
android:layout_gravity="top"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<ImageButton
|
<ImageView
|
||||||
android:id="@+id/chapters_button"
|
android:id="@+id/pill"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:alpha="0.25"
|
||||||
|
android:contentDescription="@string/drag_handle"
|
||||||
|
android:src="@drawable/draggable_pill"
|
||||||
android:tint="?actionBarTintColor"
|
android:tint="?actionBarTintColor"
|
||||||
android:tooltipText="@string/view_chapters"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:background="?selectableItemBackgroundBorderless"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
android:contentDescription="@string/next"
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
|
|
||||||
app:srcCompat="@drawable/ic_format_list_numbered_24dp" />
|
|
||||||
|
|
||||||
<!--
|
<LinearLayout
|
||||||
Wonky way of setting height due to issues with horizontally centering the thumb in Android 5.
|
android:id="@+id/seekbar_layout"
|
||||||
See https://stackoverflow.com/questions/15701767/android-thumb-is-not-centered-in-seekbar
|
android:layout_width="match_parent"
|
||||||
-->
|
android:layout_height="?attr/actionBarSize"
|
||||||
<eu.kanade.tachiyomi.ui.reader.ReaderSeekBar
|
android:layout_gravity="top"
|
||||||
android:id="@+id/page_seekbar"
|
android:orientation="horizontal"
|
||||||
android:layout_width="0dp"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
android:layout_height="match_parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
android:layout_weight="1"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
/>
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
<TextView
|
<ImageButton
|
||||||
android:id="@+id/page_text"
|
android:id="@+id/chapters_button"
|
||||||
android:layout_width="100dp"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:tint="?actionBarTintColor"
|
android:background="?selectableItemBackgroundBorderless"
|
||||||
android:gravity="center"
|
android:contentDescription="@string/next"
|
||||||
android:textSize="15sp"
|
android:padding="@dimen/material_layout_keylines_screen_edge_margin"
|
||||||
tools:text="100 / 105" />
|
android:tint="?actionBarTintColor"
|
||||||
</LinearLayout>
|
android:tooltipText="@string/view_chapters"
|
||||||
|
app:srcCompat="@drawable/ic_format_list_numbered_24dp" />
|
||||||
|
|
||||||
|
<!--
|
||||||
|
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="match_parent"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/page_text"
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textColor="?actionBarTintColor"
|
||||||
|
tools:text="100 / 105" />
|
||||||
|
</LinearLayout>
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/chapter_recycler"
|
android:id="@+id/chapter_recycler"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?android:attr/colorBackground"
|
|
||||||
android:alpha="0"
|
android:alpha="0"
|
||||||
|
android:background="?android:attr/colorBackground"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
tools:listitem="@layout/reader_chapter_item"/>
|
tools:listitem="@layout/reader_chapter_item" />
|
||||||
</eu.kanade.tachiyomi.ui.reader.ReaderChapterSheet>
|
</eu.kanade.tachiyomi.ui.reader.ReaderChapterSheet>
|
Loading…
Reference in New Issue
Block a user