Skip to content

Commit

Permalink
Fix audio controller fragment (#458)
Browse files Browse the repository at this point in the history
Closes #456 (but not #457)
  • Loading branch information
shivammaindola authored Jun 22, 2020
1 parent e22eea8 commit 811896b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import androidx.appcompat.app.AppCompatActivity;
import android.view.MenuItem;
import android.view.View;
import android.widget.FrameLayout;

import com.google.android.gms.cast.framework.CastContext;
import com.google.android.gms.cast.framework.CastState;
Expand Down Expand Up @@ -595,6 +596,9 @@ protected void onResume() {

if (mCastContext.getCastState() != CastState.CONNECTED) {
setUpAudioServiceBind();
} else {
getAudioController().getView().setVisibility(View.GONE);
getFrameLayout().setVisibility(View.VISIBLE);
}
}

Expand Down Expand Up @@ -629,7 +633,12 @@ private AudioControllerFragment getAudioController() {
return (AudioControllerFragment) getSupportFragmentManager().findFragmentById(R.id.audio_controller_fragment);
}

private FrameLayout getFrameLayout() {
return (FrameLayout) findViewById(R.id.controller);
}

private void showAudioControls() {
getFrameLayout().setVisibility(View.VISIBLE);
getSupportFragmentManager().beginTransaction()
.show(getAudioController())
.commit();
Expand Down
7 changes: 4 additions & 3 deletions src/main/res/layout/activity_server_files.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@
~ along with Amahi. If not, see <http ://www.gnu.org/licenses/>.
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
android:id="@+id/controller"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
android:layout_alignParentBottom="true"
android:visibility="gone">

<fragment
android:id="@+id/audio_controller_fragment"
Expand Down Expand Up @@ -59,12 +60,12 @@

<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fab_upload"
android:contentDescription="@string/upload"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="25dp"
android:layout_marginEnd="25dp"
android:contentDescription="@string/upload"
android:src="@drawable/ic_add" />

</androidx.coordinatorlayout.widget.CoordinatorLayout>
Expand Down

0 comments on commit 811896b

Please sign in to comment.