Merge pull request #5801 from TacoTheDank/fragmentContainerView

This commit is contained in:
ByteHamster 2022-04-01 21:36:11 +02:00 committed by GitHub
commit ef28ff0662
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 231 additions and 230 deletions

View File

@ -18,7 +18,6 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.Toast;
import androidx.annotation.NonNull;
@ -29,6 +28,7 @@ import androidx.appcompat.widget.Toolbar;
import androidx.core.content.ContextCompat;
import androidx.drawerlayout.widget.DrawerLayout;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentContainerView;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.recyclerview.widget.RecyclerView;
@ -248,7 +248,7 @@ public class MainActivity extends CastEnabledActivity {
public void setPlayerVisible(boolean visible) {
getBottomSheet().setLocked(!visible);
FrameLayout mainView = findViewById(R.id.main_view);
FragmentContainerView mainView = findViewById(R.id.main_view);
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mainView.getLayoutParams();
params.setMargins(0, 0, 0, visible ? (int) getResources().getDimension(R.dimen.external_player_height) : 0);
mainView.setLayoutParams(params);

View File

@ -8,7 +8,7 @@
android:orientation="horizontal"
tools:viewBindingIgnore="true">
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/navDrawerFragment"
android:layout_width="300dp"
android:layout_height="match_parent"
@ -25,7 +25,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -33,7 +33,7 @@
android:foreground="?android:windowContentOverlay"
tools:background="@android:color/holo_red_dark" />
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/audioplayerFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"

View File

@ -1,29 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
android:layout_alignParentTop="true"
app:navigationContentDescription="@string/toolbar_back_button_content_description"
app:navigationIcon="?homeAsUpIndicator"
android:id="@+id/toolbar"/>
app:navigationIcon="?homeAsUpIndicator" />
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/playerFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="?attr/background_elevated"
tools:layout_height="@dimen/external_player_height"
android:elevation="8dp"/>
android:elevation="8dp"
tools:layout_height="@dimen/external_player_height" />
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/pager"
@ -39,30 +39,30 @@
android:layout_width="match_parent"
android:layout_height="8dp"
android:layout_alignBottom="@id/pager"
android:importantForAccessibility="no"
app:srcCompat="@drawable/bg_gradient"
app:tint="?android:attr/windowBackground"
android:importantForAccessibility="no"/>
app:tint="?android:attr/windowBackground" />
<androidx.cardview.widget.CardView
android:id="@+id/cardViewSeek"
android:alpha="0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_alignBottom="@+id/pager"
android:layout_centerHorizontal="true"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:layout_marginBottom="12dp"
app:cardCornerRadius="8dp"
android:alpha="0"
app:cardBackgroundColor="?attr/seek_background"
app:cardCornerRadius="8dp"
app:cardElevation="0dp"
tools:alpha="1">
<TextView
android:id="@+id/txtvSeek"
android:gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingLeft="24dp"
android:paddingTop="4dp"
android:paddingRight="24dp"
@ -85,44 +85,44 @@
android:id="@+id/sbPosition"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="500"
tools:progress="100"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:clickable="true"/>
android:clickable="true"
android:max="500"
tools:progress="100" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_marginTop="4dp">
android:paddingLeft="8dp"
android:paddingRight="8dp">
<TextView
android:id="@+id/txtvPosition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="16dp"
android:layout_alignParentLeft="true"
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"/>
android:textSize="@dimen/text_size_micro" />
<TextView
android:id="@+id/txtvLength"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_marginRight="16dp"
android:layout_alignParentRight="true"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
android:background="?android:attr/selectableItemBackground"
android:text="@string/position_default_label"
android:textColor="?android:attr/textColorSecondary"
android:textSize="@dimen/text_size_micro"
android:background="?android:attr/selectableItemBackground"/>
android:textSize="@dimen/text_size_micro" />
</RelativeLayout>
@ -136,138 +136,139 @@
android:id="@+id/butPlay"
android:layout_width="@dimen/audioplayer_playercontrols_length_big"
android:layout_height="@dimen/audioplayer_playercontrols_length_big"
android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin"
android:layout_marginStart="@dimen/audioplayer_playercontrols_margin"
android:layout_marginRight="@dimen/audioplayer_playercontrols_margin"
android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin"
android:padding="8dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/audioplayer_playercontrols_margin"
android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin"
android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin"
android:layout_marginRight="@dimen/audioplayer_playercontrols_margin"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/pause_label"
app:srcCompat="@drawable/ic_play_48dp"
android:padding="8dp"
android:scaleType="fitCenter"
tools:srcCompat="@drawable/ic_play_48dp"/>
app:srcCompat="@drawable/ic_play_48dp"
tools:srcCompat="@drawable/ic_play_48dp" />
<de.danoeh.antennapod.ui.common.CircularProgressBar
android:layout_width="@dimen/audioplayer_playercontrols_length_big"
android:layout_height="@dimen/audioplayer_playercontrols_length_big"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
app:foregroundColor="?attr/action_icon_color"/>
android:layout_marginStart="16dp"
android:layout_marginLeft="16dp"
android:layout_marginEnd="16dp"
android:layout_marginRight="16dp"
app:foregroundColor="?attr/action_icon_color" />
<ProgressBar
style="?android:attr/progressBarStyle"
android:id="@+id/progLoading"
android:layout_width="@dimen/audioplayer_playercontrols_length_big"
android:layout_height="@dimen/audioplayer_playercontrols_length_big"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:id="@+id/progLoading"
android:visibility="gone"/>
android:visibility="gone"
style="?android:attr/progressBarStyle" />
<ImageButton
android:id="@+id/butRev"
android:layout_width="@dimen/audioplayer_playercontrols_length"
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_toLeftOf="@id/butPlay"
android:layout_toStartOf="@id/butPlay"
android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin"
android:layout_marginStart="@dimen/audioplayer_playercontrols_margin"
android:layout_centerVertical="true"
android:layout_marginStart="@dimen/audioplayer_playercontrols_margin"
android:layout_marginLeft="@dimen/audioplayer_playercontrols_margin"
android:layout_toStartOf="@id/butPlay"
android:layout_toLeftOf="@id/butPlay"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/rewind_label"
app:srcCompat="@drawable/ic_fast_rewind"
android:scaleType="fitCenter"
tools:srcCompat="@drawable/ic_fast_rewind"/>
app:srcCompat="@drawable/ic_fast_rewind"
tools:srcCompat="@drawable/ic_fast_rewind" />
<TextView
android:id="@+id/txtvRev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/butRev"
android:layout_alignLeft="@id/butRev"
android:layout_alignStart="@id/butRev"
android:layout_alignRight="@id/butRev"
android:layout_alignLeft="@id/butRev"
android:layout_alignEnd="@id/butRev"
android:layout_alignRight="@id/butRev"
android:clickable="false"
android:gravity="center"
android:text="30"
android:textSize="12sp"
android:textColor="?android:attr/textColorSecondary"
android:clickable="false"/>
android:textSize="12sp" />
<de.danoeh.antennapod.ui.common.PlaybackSpeedIndicatorView
android:id="@+id/butPlaybackSpeed"
android:layout_width="@dimen/audioplayer_playercontrols_length"
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_toLeftOf="@id/butRev"
android:layout_toStartOf="@id/butRev"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/butRev"
android:layout_toLeftOf="@id/butRev"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/playback_speed"
tools:srcCompat="@drawable/ic_playback_speed"
app:foregroundColor="?attr/action_icon_color"/>
app:foregroundColor="?attr/action_icon_color"
tools:srcCompat="@drawable/ic_playback_speed" />
<TextView
android:id="@+id/txtvPlaybackSpeed"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/butPlaybackSpeed"
android:layout_alignLeft="@id/butPlaybackSpeed"
android:layout_alignStart="@id/butPlaybackSpeed"
android:layout_alignRight="@id/butPlaybackSpeed"
android:layout_alignLeft="@id/butPlaybackSpeed"
android:layout_alignEnd="@id/butPlaybackSpeed"
android:layout_alignRight="@id/butPlaybackSpeed"
android:clickable="false"
android:gravity="center"
android:text="1.00"
android:textSize="12sp"
android:textColor="?android:attr/textColorSecondary"
android:clickable="false"/>
android:textSize="12sp" />
<ImageButton
android:id="@+id/butFF"
android:layout_width="@dimen/audioplayer_playercontrols_length"
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_toRightOf="@id/butPlay"
android:layout_toEndOf="@id/butPlay"
android:layout_marginRight="@dimen/audioplayer_playercontrols_margin"
android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/audioplayer_playercontrols_margin"
android:layout_marginRight="@dimen/audioplayer_playercontrols_margin"
android:layout_toEndOf="@id/butPlay"
android:layout_toRightOf="@id/butPlay"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/fast_forward_label"
app:srcCompat="@drawable/ic_fast_forward"
android:scaleType="fitCenter"
tools:srcCompat="@drawable/ic_fast_forward"/>
app:srcCompat="@drawable/ic_fast_forward"
tools:srcCompat="@drawable/ic_fast_forward" />
<TextView
android:id="@+id/txtvFF"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/butFF"
android:layout_alignLeft="@id/butFF"
android:layout_alignStart="@id/butFF"
android:layout_alignRight="@id/butFF"
android:layout_alignLeft="@id/butFF"
android:layout_alignEnd="@id/butFF"
android:layout_alignRight="@id/butFF"
android:clickable="false"
android:gravity="center"
android:text="30"
android:textSize="12sp"
android:textColor="?android:attr/textColorSecondary"
android:clickable="false"/>
android:textSize="12sp" />
<ImageButton
android:id="@+id/butSkip"
android:layout_width="@dimen/audioplayer_playercontrols_length"
android:layout_height="@dimen/audioplayer_playercontrols_length"
android:layout_toRightOf="@id/butFF"
android:layout_toEndOf="@id/butFF"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/butFF"
android:layout_toRightOf="@id/butFF"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/skip_episode_label"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_skip_48dp"
android:contentDescription="@string/skip_episode_label"
tools:srcCompat="@drawable/ic_skip_48dp"/>
tools:srcCompat="@drawable/ic_skip_48dp" />
</RelativeLayout>
</LinearLayout>

View File

@ -17,7 +17,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/main_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -25,7 +25,7 @@
android:foreground="?android:windowContentOverlay"
tools:background="@android:color/holo_red_dark" />
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/audioplayerFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -36,7 +36,7 @@
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<FrameLayout
<androidx.fragment.app.FragmentContainerView
android:id="@+id/navDrawerFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"