Created
February 3, 2024 01:08
-
-
Save 1nikolas/dff206fa7bf41a51c7049b62e63dd0a9 to your computer and use it in GitHub Desktop.
Revisions
-
1nikolas created this gist
Feb 3, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.google.android.gms.cast.framework.media.ImageHints; import com.google.android.gms.cast.framework.media.uicontroller.UIMediaController; import com.google.android.gms.cast.framework.media.widget.MiniControllerFragment; public class CustomMiniControllerFragment extends MiniControllerFragment { @NonNull @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle bundle) { View view = super.onCreateView(inflater, container, bundle); UIMediaController controller = getUIMediaController(); if (controller == null) { return view; } ImageView imageView = view.findViewById(com.google.android.gms.cast.framework.R.id.icon_view); controller.bindImageViewToImageOfCurrentItem(imageView, new ImageHints(2, getResources().getDimensionPixelSize(com.google.android.gms.cast.framework.R.dimen.cast_mini_controller_icon_width), getResources().getDimensionPixelSize(com.google.android.gms.cast.framework.R.dimen.cast_mini_controller_icon_height)), com.google.android.gms.cast.framework.R.drawable.cast_album_art_placeholder); imageView.setVisibility(View.VISIBLE); return view; } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ ... <fragment android:id="@+id/castMiniController" class="com.your.package.CustomMiniControllerFragment" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone" app:castControlButtons="@array/cast_mini_controller_control_buttons" <!-- your 3 buttons defined in arrays.xml --> app:castShowImageThumbnail="false" <!-- make sure to set this to false! The image is going to me manually set to visible inside the class --> tools:ignore="FragmentTagUsage" /> ...