android-ripple-background icon indicating copy to clipboard operation
android-ripple-background copied to clipboard

Doesn't work in BottomSheetDialogFragment

Open bytesizedwizard opened this issue 6 years ago • 0 comments

Tried to make it work inside a BottomSheetDialogFragment. But nothing happens when the bottom sheet is displayed.

Here is my code -

public class CountActionListDialogFragment extends BottomSheetDialogFragment {

    @SuppressLint("RestrictedApi")
    @Override
    public void setupDialog(@NonNull final Dialog dialog, int style) {
        super.setupDialog(dialog, style);
        View contentView = View.inflate(getContext(), R.layout.count_bottom_sheet, null);
        dialog.setContentView(contentView);
        try {
            final RippleBackground rippleBackground= Objects.requireNonNull(getActivity()).findViewById(R.id.rippleAnimation);
            rippleBackground.startRippleAnimation();
            ImageView imageView=Objects.requireNonNull(getActivity()).findViewById(R.id.centerImage);
            imageView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    rippleBackground.startRippleAnimation();
                }
            });
        } catch (NullPointerException ignored) { }
    }

}

And bottom_sheet.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    <com.skyfishjy.library.RippleBackground
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="400dp"
        android:id="@+id/rippleAnimation"
        app:rb_color="@color/colorAccent"
        app:rb_radius="32dp"
        app:rb_rippleAmount="4"
        app:rb_duration="3000"
        app:rb_scale="6">
        <ImageView
            android:layout_width="64dp"
            android:layout_height="64dp"
            android:layout_centerInParent="true"
            android:id="@+id/centerImage"
            android:src="@drawable/ic_check_circle_green_24dp" />
    </com.skyfishjy.library.RippleBackground>

</LinearLayout>

Might be similar to #32

Thanks in advance!

bytesizedwizard avatar Jan 23 '20 12:01 bytesizedwizard