Merge pull request #791 from Bnyro/master

layout improvements
This commit is contained in:
Bnyro 2022-07-15 10:37:04 +02:00 committed by GitHub
commit 45b85b8dfb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 55 deletions

View File

@ -892,7 +892,7 @@ class PlayerFragment : Fragment() {
} }
if (response.hls != null) { if (response.hls != null) {
binding.relPlayerVlc.setOnClickListener { binding.relPlayerOpen.setOnClickListener {
// start an intent with video as mimetype using the hls stream // start an intent with video as mimetype using the hls stream
val uri: Uri = Uri.parse(response.hls) val uri: Uri = Uri.parse(response.hls)
val intent = Intent() val intent = Intent()
@ -904,7 +904,11 @@ class PlayerFragment : Fragment() {
intent.putExtra("artist", uploader) intent.putExtra("artist", uploader)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent) try {
startActivity(intent)
} catch (e: Exception) {
Toast.makeText(context, R.string.no_player_found, Toast.LENGTH_SHORT).show()
}
} }
} }
if (relatedStreamsEnabled) { if (relatedStreamsEnabled) {

View File

@ -72,7 +72,6 @@ class SubscriptionsFragment : Fragment() {
var loadedSubbedChannels = false var loadedSubbedChannels = false
binding.toggleSubs.setOnClickListener { binding.toggleSubs.setOnClickListener {
binding.toggle.animate().rotationBy(180F).setDuration(100).start()
if (!binding.subChannels.isVisible) { if (!binding.subChannels.isVisible) {
if (!loadedSubbedChannels) { if (!loadedSubbedChannels) {
binding.subChannels.layoutManager = LinearLayoutManager(context) binding.subChannels.layoutManager = LinearLayoutManager(context)

View File

@ -16,7 +16,6 @@ import com.github.libretube.R
import com.github.libretube.WEBSITE_URL import com.github.libretube.WEBSITE_URL
import com.github.libretube.activities.SettingsActivity import com.github.libretube.activities.SettingsActivity
import com.github.libretube.databinding.FragmentAboutBinding import com.github.libretube.databinding.FragmentAboutBinding
import com.github.libretube.util.ThemeHelper.getThemeColor
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
@ -94,10 +93,6 @@ class AboutFragment : Fragment() {
val snackBar = Snackbar val snackBar = Snackbar
.make(binding.root, text, Snackbar.LENGTH_LONG) .make(binding.root, text, Snackbar.LENGTH_LONG)
// set snackBar color
snackBar.setBackgroundTint(getThemeColor(requireContext(), R.attr.colorSurface))
snackBar.setTextColor(getThemeColor(requireContext(), R.attr.colorPrimary))
// prevent the text from being partially hidden // prevent the text from being partially hidden
snackBar.setTextMaxLines(3) snackBar.setTextMaxLines(3)

View File

@ -185,7 +185,7 @@
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/relPlayer_vlc" android:id="@+id/relPlayer_open"
style="@style/PlayerActionsLayout"> style="@style/PlayerActionsLayout">
<ImageView <ImageView
@ -265,7 +265,7 @@
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:text="" android:text=""
android:textSize="15dp" /> android:textSize="15sp" />
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
@ -301,7 +301,7 @@
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
app:cardCornerRadius="18dp"> app:cardCornerRadius="18dp">
<androidx.constraintlayout.widget.ConstraintLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="8dp" android:layout_margin="8dp"
@ -309,25 +309,22 @@
<TextView <TextView
android:id="@+id/commentsToggle_textView" android:id="@+id/commentsToggle_textView"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_weight="1"
android:text="@string/comments" android:text="@string/comments"
android:textSize="17sp" android:textSize="17sp" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView <ImageView
android:id="@+id/commentsToggle_imageView" android:id="@+id/commentsToggle_imageView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="3dp" android:layout_marginEnd="3dp"
android:src="@drawable/ic_arrow_up_down" android:src="@drawable/ic_arrow_up_down" />
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout> </LinearLayout>
</com.google.android.material.card.MaterialCardView> </com.google.android.material.card.MaterialCardView>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -53,53 +54,57 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical"> android:orientation="vertical">
<RelativeLayout <com.google.android.material.card.MaterialCardView
android:id="@+id/toggle_subs" android:id="@+id/toggle_subs"
style="@style/Widget.Material3.CardView.Elevated"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="12dp" android:layout_marginStart="16dp"
android:visibility="gone"> android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_marginBottom="16dp"
android:visibility="gone"
app:cardCornerRadius="18dp">
<TextView <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/subscriptions" />
<ImageView
android:id="@+id/toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/ic_arrow_down" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/sub_channels"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" android:layout_margin="8dp">
android:visibility="gone" />
</RelativeLayout>
<RelativeLayout <TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_weight="1"
android:text="@string/subscriptions"
android:textSize="17sp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="3dp"
android:src="@drawable/ic_arrow_up_down" />
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/sub_channels"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:descendantFocusability="blocksDescendants"> android:nestedScrollingEnabled="false"
android:visibility="gone" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/sub_feed" android:id="@+id/sub_feed"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:nestedScrollingEnabled="false" /> android:nestedScrollingEnabled="false" />
</RelativeLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</com.github.libretube.views.CustomSwipeToRefresh> </com.github.libretube.views.CustomSwipeToRefresh>

View File

@ -241,4 +241,5 @@
<string name="autoRotatePlayer_summary">Automatically switch to player fullscreen when the device gets turned.</string> <string name="autoRotatePlayer_summary">Automatically switch to player fullscreen when the device gets turned.</string>
<string name="pure_theme">Pure theme</string> <string name="pure_theme">Pure theme</string>
<string name="pure_theme_summary">Pure white/black theme</string> <string name="pure_theme_summary">Pure white/black theme</string>
<string name="no_player_found">No external player found. Please make sure you have one installed.</string>
</resources> </resources>