Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProgressBar under BlurView gets a weird square while animating #156

Open
dxshindeo opened this issue Oct 6, 2021 · 2 comments
Open

ProgressBar under BlurView gets a weird square while animating #156

dxshindeo opened this issue Oct 6, 2021 · 2 comments

Comments

@dxshindeo
Copy link

  1. Library version

1.6.6

  1. Device and OS version

Android 10 (Huawei P20 Pro)

  1. Detailed steps to reproduce the issue

Simply put a progressbar under the blurView and after first cycle a sorta cut-out square will show up around the progressbar

progressbar_issue

  1. XML layout and code for BlurView setup
    <include
        android:id="@+id/progressbarForm"
        layout="@layout/block_progressbar_primary"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="1.0" />

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/fragmentNavigation"
        android:name="asd.fragments.NavigationFragment"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:translationZ="100dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        tools:layout="@layout/fragment_navigation" />
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/wrapperNavigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent">

    <asd.components.blurview.BlurView
        android:id="@+id/blurView"
        android:layout_width="match_parent"
        android:layout_height="60dp"
        app:blurOverlayColor="@color/white20percent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <androidx.constraintlayout.widget.ConstraintLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <LinearLayout
                android:id="@+id/navigation"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:baselineAligned="false"
                android:gravity="center"
                android:orientation="horizontal"
                android:weightSum="4"
                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintStart_toStartOf="parent"
                app:layout_constraintTop_toTopOf="parent">

               ...

            </LinearLayout>

        </androidx.constraintlayout.widget.ConstraintLayout>

    </asd.components.blurview.BlurView>

</androidx.constraintlayout.widget.ConstraintLayout>
    private void setupBlurView() {
        float radius = 10f;

        View decorView = requireActivity().getWindow().getDecorView();
        //ViewGroup you want to start blur from. Choose root as close to BlurView in hierarchy as possible.
        ViewGroup rootView = (ViewGroup) decorView.findViewById(android.R.id.content);

        //Set drawable to draw in the beginning of each blurred frame (Optional).
        //Can be used in case your layout has a lot of transparent space and your content
        //gets kinda lost after after blur is applied.
        Drawable windowBackground = decorView.getBackground();

        binding.blurView.setupWith(rootView)
                .setFrameClearDrawable(windowBackground)
                .setBlurAlgorithm(new RenderScriptBlur(requireContext()))
                .setBlurRadius(radius)
                .setBlurAutoUpdate(true)
                .setHasFixedTransformationMatrix(true); // Or false if it's in a scrolling container or might be animated
    }
@Dimezis
Copy link
Owner

Dimezis commented Oct 6, 2021

What's the type of this progress bar?
Default, custom, material? Post your progressbarForm

@dxshindeo
Copy link
Author

Sorry, forgot to mention:

<?xml version="1.0" encoding="utf-8"?>
<ProgressBar xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:indeterminate="true"
    android:indeterminateTint="@color/pink"
    android:indeterminateTintMode="src_in"
    android:progressTint="@color/pink" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants