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

Full of Bug #78

Open
Ankit0080 opened this issue Feb 19, 2021 · 2 comments
Open

Full of Bug #78

Ankit0080 opened this issue Feb 19, 2021 · 2 comments

Comments

@Ankit0080
Copy link

<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

@Bobby-Anggunawan
Copy link

Bobby-Anggunawan commented Mar 27, 2021

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

@Ankit0080
Copy link
Author

Ankit0080 commented Mar 29, 2021

@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.?

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