Android-SpinKit icon indicating copy to clipboard operation
Android-SpinKit copied to clipboard

Full of Bug

Open Ankit0080 opened this issue 4 years ago • 2 comments

<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/white" android:layout_margin="@dimen/dp_10" app:cardBackgroundColor="@color/white" app:cardCornerRadius="@dimen/dp_10" app:cardElevation="@dimen/dp_5" app:cardUseCompatPadding="true" app:contentPadding="@dimen/dp_5" android:layout_height="wrap_content">

<com.github.ybq.android.spinkit.SpinKitView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/spin_kit"
    style="@style/SpinKitView.FadingCircle"
    android:layout_width="@dimen/dp_35"
    android:indeterminate="false"
    android:layout_height="@dimen/dp_35"
    android:layout_centerInParent="true"
    android:layout_gravity="center"
    app:SpinKit_Color="@color/sky_lue"
    android:padding="10dp"/>

</androidx.cardview.widget.CardView>

public void dialogShow (Context context, String msg) { progressDialog = new Dialog(context); progressDialog.setCancelable(false); progressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); Display display = ((Activity) context).getWindowManager().getDefaultDisplay(); int screenWidth = display.getWidth(); progressDialog.setContentView(R.layout.dialog_custom_progress); SpinkKitView progressBar = (SpinKitView) findViewById(R.id.spin_kit); progressDialog.show(); progressDialog.getWindow().setLayout((int) (screenWidth / 1.1), LinearLayout.LayoutParams.WRAP_CONTENT); }

public void dialogHide(){
    progressDialog.dismiss();

// if (progressDialog!=null){ // progressDialog.dismiss(); // } }

The spin kit never stops spinning it rotates infinitely. Is there any way to stop this

Ankit0080 avatar Feb 19 '21 17:02 Ankit0080

You have to hide spinkit right after your data has loaded call this if you want to hide it: progressBar.visibility = View.INVISIBLE

call this to show it again: progressBar.visibility = View.VISIBLE

Bobby-Anggunawan avatar Mar 27 '21 14:03 Bobby-Anggunawan

@Bobby-Anggunawan not working i have already tried your code this library is causing memory leak and the same issue is happening again, this time null Pointer exception is thrown

public void dialogShow (Context context, String msg) { progressDialog = new Dialog(context); progressDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); Display display = ((AppCompatActivity) context).getWindowManager().getDefaultDisplay(); int screenWidth = display.getWidth(); progressDialog.setContentView(R.layout.dialog_custom_progress); progressBar = (SpinKitView) findViewById(R.id.spin_kit); progressBar.setVisibility(View.VISIBLE); progressDialog.show(); progressDialog.setCancelable(false); progressDialog.getWindow().setLayout((int) (screenWidth / 1.1), LinearLayout.LayoutParams.WRAP_CONTENT); }

public void dialogHide(){
    if (progressDialog.isShowing()) {
        progressBar.setVisibility(View.INVISIBLE);
        progressDialog.hide();
    }
}

<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" android:background="@color/white" android:layout_margin="@dimen/dp_10" app:cardBackgroundColor="@color/white" app:cardCornerRadius="@dimen/dp_10" app:cardElevation="@dimen/dp_5" app:cardUseCompatPadding="true" app:contentPadding="@dimen/dp_5" android:layout_height="wrap_content">

<com.github.ybq.android.spinkit.SpinKitView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/spin_kit"
    style="@style/SpinKitView.FadingCircle"
    android:layout_width="wrap_content"
    android:indeterminate="true"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:layout_gravity="center"
    app:SpinKit_Color="@color/sky_lue"
    android:background="?selectableItemBackgroundBorderless"
    android:padding="10dp"/>

</androidx.cardview.widget.CardView>

Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.github.ybq.android.spinkit.SpinKitView.setVisibility(int)' on a null object reference

what the hell is wrong with this library.?

Ankit0080 avatar Mar 29 '21 07:03 Ankit0080