style: various player UI improvements, fix navigation bar color

This commit is contained in:
Bnyro 2023-12-15 15:03:59 +01:00
parent 21482545eb
commit a7cbced326
6 changed files with 31 additions and 49 deletions

View File

@ -27,6 +27,7 @@ import com.github.libretube.compat.PictureInPictureCompat
import com.github.libretube.constants.IntentData
import com.github.libretube.constants.PreferenceKeys
import com.github.libretube.databinding.ActivityMainBinding
import com.github.libretube.extensions.dpToPx
import com.github.libretube.extensions.toID
import com.github.libretube.helpers.NavBarHelper
import com.github.libretube.helpers.NavigationHelper
@ -96,7 +97,7 @@ class MainActivity : BaseActivity() {
// sets the navigation bar color to the previously calculated color
window.navigationBarColor = if (binding.bottomNav.menu.size() > 0) {
SurfaceColors.getColorForElevation(this, binding.bottomNav.elevation)
ThemeHelper.getThemeColor(this, com.google.android.material.R.attr.colorSurfaceContainer)
} else {
ThemeHelper.getThemeColor(this, android.R.attr.colorBackground)
}

View File

@ -420,10 +420,6 @@ class PlayerFragment : Fragment(), OnlinePlayerOptions {
mainActivity.binding.container.isVisible = true
val mainMotionLayout = mainActivity.binding.mainMotionLayout
// add some elevation to the color to make it easier to distinguish
val surfaceColor = SurfaceColors.getColorForElevation(requireContext(), 3f)
binding.mainContainer.setBackgroundColor(surfaceColor)
binding.playerMotionLayout.addTransitionListener(object : TransitionAdapter() {
override fun onTransitionChange(
motionLayout: MotionLayout?,

View File

@ -325,7 +325,7 @@ class SubscriptionsFragment : Fragment() {
showAllAtOnce = false
)
binding.subFeed.adapter = feedAdapter
binding.toggleSubsText.text = getString(R.string.subscriptions)
binding.toggleSubs.text = getString(R.string.subscriptions)
PreferenceHelper.updateLastFeedWatchedTime()
}
@ -363,6 +363,6 @@ class SubscriptionsFragment : Fragment() {
binding.emptyFeed.isVisible = notLoaded
val subCount = subscriptions.size.toLong().formatShort()
binding.toggleSubsText.text = "${getString(R.string.subscriptions)} ($subCount)"
binding.toggleSubs.text = "${getString(R.string.subscriptions)} ($subCount)"
}
}

View File

@ -11,7 +11,7 @@
android:id="@+id/player_scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="?android:attr/colorBackground"
android:background="?colorSurfaceContainerLow"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
@ -40,8 +40,8 @@
android:id="@+id/optionsLL"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingHorizontal="2dp"
android:orientation="horizontal">
android:orientation="horizontal"
android:paddingHorizontal="2dp">
<com.google.android.material.button.MaterialButton
android:id="@+id/relPlayer_share"
@ -126,25 +126,18 @@
android:textSize="12sp" />
</LinearLayout>
<com.google.android.material.card.MaterialCardView
<com.google.android.material.button.MaterialButton
android:id="@+id/comments_toggle"
style="@style/Widget.Material3.CardView.Elevated"
style="@style/PlayerActionsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="6dp"
android:layout_marginVertical="16dp"
app:cardCornerRadius="20dp">
<androidx.appcompat.widget.AppCompatTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginVertical="10dp"
android:text="@string/comments"
android:textAlignment="viewStart"
app:drawableEndCompat="@drawable/ic_arrow_up_down" />
</com.google.android.material.card.MaterialCardView>
android:layout_marginHorizontal="20dp"
android:layout_marginVertical="10dp"
android:text="@string/comments"
android:textAlignment="viewStart"
android:textColor="?colorPrimary"
app:drawableEndCompat="@drawable/ic_arrow_up_down"
app:drawableTint="?colorPrimary" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/related_rec_view"
@ -159,7 +152,7 @@
android:id="@+id/main_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="?attr/colorSurface"
android:background="?attr/colorSurfaceContainerLow"
app:layout_constraintDimensionRatio="16:9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

View File

@ -55,29 +55,19 @@
android:animateLayoutChanges="true"
android:orientation="vertical">
<com.google.android.material.card.MaterialCardView
<com.google.android.material.button.MaterialButton
android:id="@+id/toggle_subs"
style="@style/Widget.Material3.CardView.Elevated"
style="@style/PlayerActionsButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="14dp"
android:layout_marginHorizontal="14dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="14dp"
android:layout_marginBottom="12dp"
app:cardCornerRadius="18dp"
app:cardElevation="10dp">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/toggle_subs_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:paddingHorizontal="8dp"
android:text="@string/subscriptions"
android:textAlignment="viewStart"
app:drawableEndCompat="@drawable/ic_arrow_up_down" />
</com.google.android.material.card.MaterialCardView>
android:text="@string/subscriptions"
android:textAlignment="viewStart"
android:textColor="?colorPrimary"
app:drawableEndCompat="@drawable/ic_arrow_up_down"
app:drawableTint="?colorPrimary" />
<RelativeLayout
android:id="@+id/sub_channels_container"
@ -107,7 +97,6 @@
<TextView
android:id="@+id/filterTV"
android:tooltipText="@string/tooltip_filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
@ -116,11 +105,11 @@
android:paddingHorizontal="10dp"
android:text="@string/all"
android:textSize="16sp"
android:tooltipText="@string/tooltip_filter"
app:drawableEndCompat="@drawable/ic_filter" />
<TextView
android:id="@+id/sortTV"
android:tooltipText="@string/tooltip_sort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
@ -129,6 +118,7 @@
android:paddingHorizontal="10dp"
android:text="@string/most_recent"
android:textSize="16sp"
android:tooltipText="@string/tooltip_sort"
app:drawableEndCompat="@drawable/ic_sort" />
</FrameLayout>
@ -146,14 +136,14 @@
<ImageView
android:id="@+id/edit_groups"
android:tooltipText="@string/tooltip_edit_groups"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="12dp"
android:layout_marginEnd="6dp"
android:background="?attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_edit" />
android:src="@drawable/ic_edit"
android:tooltipText="@string/tooltip_edit_groups" />
<com.google.android.material.chip.ChipGroup
android:id="@+id/channel_groups"

View File

@ -89,6 +89,8 @@
<item name="android:layout_marginStart">4dp</item>
<item name="android:layout_marginEnd">4dp</item>
<item name="iconGravity">textStart</item>
<item name="android:textColor">?colorPrimary</item>
<item name="iconTint">?colorPrimary</item>
</style>