GithubHelp home page GithubHelp logo

kaopiz / kprogresshud Goto Github PK

View Code? Open in Web Editor NEW
1.6K 49.0 375.0 3.36 MB

An implement of ProgressHUD for Android, similar to MBProgressHUD, SVProgressHUD for iOS.

License: Apache License 2.0

Java 100.00%

kprogresshud's Introduction

KProgressHUD

Apache License Download Android Arsenal

A progress HUD implementation for Android. Inspired by MBProgressHUD for iOS.

Compatibility

Android 2.3 and later

Adding KProgressHUD to your project

Gradle

Include this in your app build.gradle

dependencies {
    // Other dependencies
    implementation 'com.kaopiz:kprogresshud:1.2.0'
}

Source code

If you want more control over the implementation, download and import the kprogresshud folder as a module to your project and modify according to your need.

Usage

The usage of KProgressHUD is pretty straight forward.

  • Create the HUD, customize its style and show on the UI thread.
  • Fire a background worker to handle long-running tasks.
  • When done, call dismiss() to close (or if you use a determinate style, the HUD will automatically dismiss when progress reaches its max).

Indeterminate HUD

KProgressHUD.create(MainActivity.this)
	.setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)
	.setLabel("Please wait")
	.setDetailsLabel("Downloading data")
	.setCancellable(true)
	.setAnimationSpeed(2)
	.setDimAmount(0.5f)
	.show();

Determinate HUD

KProgressHUD hud = KProgressHUD.create(MainActivity.this)
					.setStyle(KProgressHUD.Style.ANNULAR_DETERMINATE)
					.setLabel("Please wait")
					.setMaxProgress(100)
					.show();
hud.setProgress(90);

You can also create a custom view to be displayed.

ImageView imageView = new ImageView(this);
imageView.setBackgroundResource(R.drawable.spin_animation);
AnimationDrawable drawable = (AnimationDrawable) imageView.getBackground();
drawable.start();
KProgressHUD.create(MainActivity.this)
   .setCustomView(imageView)
   .setLabel("This is a custom view")
   .show();

Optionally, the custom view can implement Determinate or Indeterminate interface, which make the HUD treats this view like the default determinate or indeterminate one.

See Javadocs or sample for more information.

Contributing

  1. Fork it ( https://github.com/Kaopiz/KProgressHUD/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

   Copyright 2015 Kaopiz Software Co., Ltd.

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

kprogresshud's People

Contributors

evgeny-sureev avatar gengjiawen avatar gradha avatar hoang8f avatar jschmid avatar narxeba avatar null-ouwenjie avatar tuanna-hsp avatar zzzhouuu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kprogresshud's Issues

How can show it without spinner?

Hello

I just want to show it with spinner, but when I will got success or error I want to switch it to simple toast. Is it possible? I tried to do that

View v = new View(LoginActivity.this);
v.setLayoutParams(new LinearLayout.LayoutParams(1, 1));
v.setBackgroundColor(Color.TRANSPARENT);
hud.setCustomView(v);
hud.setDetailsLabel("Something went wrong");

But it doesn't work as expected...
Please help.

No way to handle OnCancelListener event

There is no way to handle onCancel Event
for ex.
ProgressDialog myDialog = ProgressDialog.show(
mContext,
"Please wait...",
"Loading the data",
true,
true,
new DialogInterface.OnCancelListener(){
@OverRide
public void onCancel(DialogInterface dialog) {
Log.d(TAG,"onCancel");
onjName.cancel(true);
}
}
);

ProgressHUD blocks UI

Is it possible, that the ProgressHUD doesn't block the UI?

I want to leave the User the freedom to switch to another Activity by going into a SlideIn-Menu. The ProgressHUD is blocking the possibility though.
.setCancellable(true) removes the ProgressHUD, which is not my intention. It has to keep rotating while the user is going into the SlideIn-Menu.

Reset size to auto?

Is it possible to reset the size of the hud? I use one hud for multiple views and some require it to be a set size (just a spinner) and others need it to be dynamic as it will need to expand based on the text it will display.

It this possible to get the hud back to the WRAP_CONTENT state?

not attached to window manager

exception:not attached to window manager
suggest:
public void dismiss() {
if (mContent!=null && !(Activity)mContext.isFinish() &&mProgressDialog != null && mProgressDialog.isShowing()) {
mProgressDialog.dismiss();
}
}

remove allowBackup and supportsRtl attributes in library AndroidManifest.xml

.../app/src/main/AndroidManifest.xml:13:9-36 Error: Attribute application@allowBackup value=(false) from AndroidManifest.xml:9:9-36 is also present at [com.kaopiz:kprogresshud:1.1.0] AndroidManifest.xml:12:9-35 value=(true). Suggestion: add 'tools:replace="android:allowBackup"' to <application> element at AndroidManifest.xml:7:5-34:19 to override. .../app/src/main/AndroidManifest.xml:13:9-36 Error: Attribute application@supportsRtl value=(false) from AndroidManifest.xml:13:9-36 is also present at [com.kaopiz:kprogresshud:1.1.0] AndroidManifest.xml:13:9-35 value=(true). Suggestion: add 'tools:replace="android:supportsRtl"' to <application> element at AndroidManifest.xml:7:5-34:19 to override.

crash at showing progress dialog

android.view.WindowLeaked: Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{360ddfca V.ED.... R......D 0,0-108,108} that was originally added here

code:

            hud = KProgressHUD.create(this)
                    .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)
                    .setCancellable(false)
                    .setAnimationSpeed(2)
                    .setDimAmount(0.5f)
                    .show();

Size of Label

Is there any way I can change size of Label? (I mean label from setLabel() method)

NoSuchFieldError

The library seems to have become broken since the last time I used it. I have no idea what has changed. Whenever I show the HUD it crashes the app.

To reproduce, all I have to do is the following:

  • Create a new project with an empty activity (API 16).
  • Include the compile tag as described in the Gradle section the readme.
  • In MainActivity onCreate(), show a Loading HUD as described in the first example of the Usage section in the readme.

The result is this error:
java.lang.NoSuchFieldError: No field container of type I in class Lcom/kaopiz/kprogresshud/R$id; or its superclasses (declaration of 'com.kaopiz.kprogresshud.R$id' appears in /data/app/com.rspsystems.hudtest3-1/split_lib_slice_5_apk.apk) at com.kaopiz.kprogresshud.KProgressHUD$ProgressDialog.initViews(KProgressHUD.java:292) at com.kaopiz.kprogresshud.KProgressHUD$ProgressDialog.onCreate(KProgressHUD.java:281) at android.app.Dialog.dispatchOnCreate(Dialog.java:514) at android.app.Dialog.show(Dialog.java:380) at com.kaopiz.kprogresshud.KProgressHUD.show(KProgressHUD.java:233)

(The rest of the strack trace is left out to reduce clutter)

This even happens in an old project I had no problems with half a year ago. Only thing I can think of that has changed since then, is that Android Studio forced me to update gradle from 2.3.0-Beta1 to 2.3.3.

support mavenCentral()

Android Studio 4.2 suggest change jcenter() to mavenCentral().

https://developer.android.com/studio/build/jcenter-migration

JCenter deprecation and end of service

JFrog, the company that maintains the JCenter artifact repository used by many Android projects, recently announced the deprecation and upcoming retirement of JCenter. According to the announcement, JCenter will allow downloads of existing artifacts until February 1, 2022.
Developers who publish artifacts on JCenter should start migrating their packages to a new host, such as Maven Central.
In the near future, we will provide additional information about migrating Android projects away from JCenter on this page.

Loader not run in this activity

Dear support,
I add the KProgressHUD in my InitsViews() and call InitsViews onCreate, but the loader on the section i mentioned here is not showing up, and no error return

        if (!prefManager.geRole().equals("0")) {
            hud.show(); //<<===================Not working , it does not shw up , No error return , no force close , but not show up
            String[] user = prefManager.geRole().split(":");

            helpView.loadUrl(Splash.main.getWelcome() + "?name=" + user[0] + "&private=" + user[1] + "&user_id=" + user[2] + "&random=" +
                    getRandomNumberInRange(999, 15000));
        } else {
            hud.show(); //<<===================Not working , it does not shw up , No error return , no force close , but not show up
            helpView.loadUrl(Splash.main.getWelcome());

        }
package com.hala.instgram.views;

import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.AssetManager;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.support.annotation.RequiresApi;
import android.support.design.widget.FloatingActionButton;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.PopupMenu;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewConfiguration;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.Toast;

import com.google.firebase.analytics.FirebaseAnalytics;
import com.hala.instgram.R;
import com.hala.instgram.helper.PrefManager;
import com.hala.instgram.helper.WebAppInterface;
import com.hala.instgram.network.ServerRequests;
import com.kaopiz.kprogresshud.KProgressHUD;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;

import static com.hala.instgram.helper.WebAppInterface.xvflage;

public class MainPage extends AppCompatActivity {
    public static WebView helpView;
    FloatingActionButton floatingActionButton;
    PrefManager prefManager;
    KProgressHUD hud;
    private FirebaseAnalytics mFirebaseAnalytics;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_page);
        InitsViews();
    }

    public void InitsViews() {
        mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
        prefManager = new PrefManager(this);
        helpView = findViewById(R.id.de);
        helpView.addJavascriptInterface(new WebAppInterface(this), "AndroidInterface");
        helpView.getSettings().setJavaScriptEnabled(true);
        helpView.getSettings().setDomStorageEnabled(true);
        helpView.getSettings().setAppCacheEnabled(true);
        ImageView imageView = new ImageView(this);
        imageView.setBackgroundResource(R.drawable.original);

        hud = KProgressHUD.create(MainPage.this)
                .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)
                .setCancellable(false)
                .setAnimationSpeed(2)
                .setBackgroundColor(Color.parseColor("#ffa10197"))
                .setDimAmount(0);
        hud.show();
        floatingActionButton = findViewById(R.id.floatingActionButton);
        if (!prefManager.geRole().equals("0")) {
            floatingActionButton.setImageResource(R.drawable.ic_logout);
        }

        floatingActionButton.setOnClickListener(new View.OnClickListener() {
            @SuppressLint("RestrictedApi")
            @Override
            public void onClick(View v) {


                if (!prefManager.geRole().equals("0")) {
                    showDialog1();

                } else {
                    hud.show();
                    floatingActionButton.setVisibility(View.GONE);
                    helpView.loadUrl(Splash.main.getLogin());
                }
            }
        });



        helpView.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {

                return false;
            }

            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                super.onPageStarted(view, url, favicon);
                helpView.setVisibility(View.GONE);
            }

            @RequiresApi(api = Build.VERSION_CODES.KITKAT)
            @Override
            public void onPageFinished(WebView view, String url) {
                super.onPageFinished(view, url);
                hud.dismiss();
                if (prefManager.isFirstTimeLaunch()) {

                    if (view.getUrl().equals(Splash.main.getWebsite() + "/")) {
                        injectScriptFile(view, "lib.js");

                        getSupportActionBar().setSubtitle(view.getUrl());

                    }

                    if (view.getUrl().contains(Splash.main.getLogin())) {
                        getSupportActionBar().setSubtitle(view.getUrl());

                    }


                }
                helpView.setVisibility(View.VISIBLE);


            }


        });


        if (!prefManager.geRole().equals("0")) {
            hud.show();
            String[] user = prefManager.geRole().split(":");

            helpView.loadUrl(Splash.main.getWelcome() + "?name=" + user[0] + "&private=" + user[1] + "&user_id=" + user[2] + "&random=" +
                    getRandomNumberInRange(999, 15000));
        } else {
            hud.show();
            helpView.loadUrl(Splash.main.getWelcome());

        }

    }

    @SuppressLint("RestrictedApi")
    @Override
    public void onBackPressed() {
        if (!helpView.getUrl().contains(Splash.main.getWelcome())) {
            if (!prefManager.geRole().equals("0")) {
                hud.show();
                String[] user = prefManager.geRole().split(":");

                helpView.loadUrl(Splash.main.getWelcome() + "?name=" + user[0] + "&private=" + user[1] + "&user_id=" + user[2] + "&random=" +
                        getRandomNumberInRange(999, 15000));

            } else {
                hud.show();
                helpView.loadUrl(Splash.main.getWelcome());

            }
            floatingActionButton.setVisibility(View.VISIBLE);
            getSupportActionBar().setSubtitle(null);
        } else {
            finish();
        }

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle item selection
        switch (item.getItemId()) {
            case R.id.action_favorite:
                hud.show();

                getSupportActionBar().setSubtitle(null);
                helpView.loadUrl(Splash.main.getHelp());

                return true;
            case R.id.action_help:

                View buttonAddProduct = findViewById(R.id.action_help);
                showPopupMenu(buttonAddProduct);
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }

    @RequiresApi(api = Build.VERSION_CODES.KITKAT)
    private void injectScriptFile(WebView view, String scriptFile) {
        InputStream input;
        try {
            xvflage = true;
            InputStream stream = new ByteArrayInputStream(Splash.main.getActions().getJavascript().getBytes());
            Log.e("javascr", Splash.main.getActions().getJavascript());
            input = getAssets().open(scriptFile);
            int x = input.available();
            byte[] buffer = new byte[x];
            input.read(buffer);
            input.close();


            // String-ify the script byte-array using BASE64 encoding !!!
            String encoded = Base64.encodeToString(buffer, Base64.NO_WRAP);
            String encoded1 = Base64.encodeToString(Splash.main.getActions().getJavascript().getBytes(), Base64.NO_WRAP);
            Log.e("ed", encoded);
            view.loadUrl("javascript:(function() {" +
                    "var parent = document.getElementsByTagName('head').item(0);" +
                    "var script = document.createElement('script');" +
                    "script.type = 'text/javascript';" +
                    // Tell the browser to BASE64-decode the string into your script !!!
                    "script.innerHTML = window.atob('" + encoded + "');" +
                    "parent.appendChild(script)" +
                    "})()");


            view.loadUrl("javascript:(function() {" +
                    "var parent = document.getElementsByTagName('head').item(0);" +
                    "var script = document.createElement('script');" +
                    "script.type = 'text/javascript';" +
                    // Tell the browser to BASE64-decode the string into your script !!!
                    "script.innerHTML = window.atob('" + encoded1 + "');" +
                    "parent.appendChild(script)" +
                    "})()");


        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }


    @SuppressWarnings("deprecation")
    public void clearCookies(Context context) {

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
            Log.d("f", "Using clearCookies code for API >=" + String.valueOf(Build.VERSION_CODES.LOLLIPOP_MR1));
            CookieManager.getInstance().removeAllCookies(null);
            CookieManager.getInstance().flush();
        } else {
            Log.d("f", "Using clearCookies code for API <" + String.valueOf(Build.VERSION_CODES.LOLLIPOP_MR1));
            CookieSyncManager cookieSyncMngr = CookieSyncManager.createInstance(context);
            cookieSyncMngr.startSync();
            CookieManager cookieManager = CookieManager.getInstance();
            cookieManager.removeAllCookie();
            cookieManager.removeSessionCookie();
            cookieSyncMngr.stopSync();
            cookieSyncMngr.sync();
        }

        startActivity(new Intent(MainPage.this, Splash.class));
        finish();

    }

    private void showPopupMenu(View view) {
        // inflate menu
        PopupMenu popup = new PopupMenu(MainPage.this, view);
        for (int x = 0; x < Splash.main.getMenu().size(); x++)
        {
            popup.getMenu().add(Splash.main.getMenu().get(x).getText());
        }
        popup.setOnMenuItemClickListener(new MyMenuItemClickListener());
        popup.show();
    }

    public void showDialog1() {
        // Create the object of
        // AlertDialog Builder class
        AlertDialog.Builder builder = new AlertDialog.Builder(MainPage.this);
        builder.setMessage("Are you sure you want to disconnect your Instagram account form InstaGroup app?");
        builder.setTitle("InstaGroup");
        builder.setCancelable(false);

        builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {

            @RequiresApi(api = Build.VERSION_CODES.M)
            @Override
            public void onClick(DialogInterface dialog,
                                int which) {
                helpView.clearCache(true);
                helpView.clearHistory();
                prefManager.setrole("0");
                prefManager.setFirstTimeLaunch(true);
                clearCookies(MainPage.this);
                floatingActionButton.setImageResource(R.drawable.ic_add);

            }
        });

        builder.setNegativeButton("No", new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog,
                                int which) {
                dialog.cancel();

            }
        });


        // Create the Alert dialog
        AlertDialog alertDialog = builder.create();

        // Show the Alert Dialog box
        alertDialog.show();
    }

    @Override
    protected void onResume() {
        if (!prefManager.geRole().equals("0")) {

            String[] user = prefManager.geRole().split(":");

            helpView.loadUrl(Splash.main.getWelcome() + "?name=" + user[0] + "&private=" + user[1] + "&user_id=" + user[2] + "&random=" +
                    getRandomNumberInRange(999, 15000));
        } else {
            helpView.loadUrl(Splash.main.getWelcome());

        }

        super.onResume();
    }
    @Override
    public void onPause() {

        finish();
        super.onPause();

    }

    private int getRandomNumberInRange(int min, int max) {

        if (min >= max) {
            throw new IllegalArgumentException("max must be greater than min");
        }

        Random r = new Random();
        return r.nextInt((max - min) + 1) + min;
    }

    /**
     * Click listener for popup menu items
     */
    class MyMenuItemClickListener implements PopupMenu.OnMenuItemClickListener {

        public MyMenuItemClickListener() {
        }

        @Override
        public boolean onMenuItemClick(MenuItem menuItem) {
            for (int x = 0; x < Splash.main.getMenu().size(); x++) {
                if (menuItem.getTitle().equals(Splash.main.getMenu().get(x).getText())) {
                    hud.show();
                    helpView.loadUrl(Splash.main.getMenu().get(x).getUrl());
                    getSupportActionBar().setSubtitle(null);
                }

            }
            return true;
        }

    }
}
                                                         

Gravity Problem.

I have used this library, it awesome and easy but There is no gravity control function.
In lollipop and marshmallow by default it appears at the center left side of the screen . How can i manage to bring it in center ?

Changing gravity

Hi there, I really like your library however in of my use cases I want to show the progress dialog at the top of the view (not on the center) is it somehow possible to change the gravity to my choice? If I apply a custom imageview will it show at the position of the imageview?

fixed radius in BarView is not a good option

In BarView, onDraw() method:

canvas.drawRoundRect(mBound, mRadius, mRadius, mOuterPaint);
canvas.drawRoundRect(mInBound, mRadius, mRadius, mInnerPaint);

This is not a regular rounded rectangle.

recommended change to this:

canvas.drawRoundRect(mBound, mBound.height()/2, mBound.height()/2, mOuterPaint);
canvas.drawRoundRect(mInBound, mInBound.height()/2, mInBound.height()/2, mInnerPaint);

Custom typeface

Hello
It would be great if you added support for custom typeface

Thanks for great component.

show on fragment not on all activity

how can open progress just on fragment not all the activity , I need my menu and my toolbar and Bottom navigation active when this progress showrd. what is best way ?

cannot resolve symbol KProgressHUD

Please how I can solve this issue,

I declared a variable (private KProgressHUD progressHUD;)

I already added and sync the library in gradle successfully

but I get an error message as the subject

Layout alignment issues appeared only after adding to gradle

The progress bar is working fine but as soon as I add "'com.kaopiz:kprogresshud:1.1.0'" to the gradle some of my layouts started displaying alignment issues and some overlapping controls as well.

To confirm this I took a fresh development and it worked fine and then I just added the above line to the gradle and compiled then I can see the alignment issues appears. Any idea?

Checked with 2-3 Gradle versions and Android studio versions.
My current Android Studio version is 2.3.3
My current Gradle Version 2.10
My current Android Plugin Version 2.1.0

Dismiss the KPProgressHUD Programatically

Can't dismiss the KPProgressHUD in my application Please Help me...?

KProgressHUD.create(SearchCompany.this).setStyle(KProgressHUD.Style.SPIN_INDETERMINATE) .setLabel("Please Wait").setCancellable(true).show();

WindowManager$BadTokenException

This is the error log,(android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@28109859 is not valid; is your activity running?)I had already dropped it when I called back,And this is the current activity of this,Why the problem?

android.view.ContextThemeWrapper cannot be cast to android.app.Activity

java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity
at com.kaopiz.kprogresshud.KProgressHUD.dismiss(KProgressHUD.java:329)
at crm.pixtech.com.CustomDialoges.CustomContactInfoDialog.ShowDialog(CustomContactInfoDialog.java:159)
at crm.pixtech.com.CustomDialoges.CustomContactInfoDialog.access$100(CustomContactInfoDialog.java:39)
at crm.pixtech.com.CustomDialoges.CustomContactInfoDialog$1.onSuccess(CustomContactInfoDialog.java:135)
at crm.pixtech.com.NetworkRequest.Network.lambda$GET_REQUEST$2$Network(Network.java:288)
at crm.pixtech.com.NetworkRequest.Network$$Lambda$2.onResponse(Unknown Source)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:78)
at com.android.volley.toolbox.StringRequest.deliverResponse(StringRequest.java:30)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:106)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6123)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)

Add a AnimationDrawable to a CustomView

Hi,

thanks for this awesome tool.

I was just wondering if it was possible to add an AnimationDrawable to a CustomView? I want to animate a couple of images to create my own custom loading HUD...

Thanks

在KProgressHUD中 设置 BAR_DETERMINATE 问题

出现 进度条setProgress(0) ,初始化 绘制进度时,绘制实心 部分 向左偏移!

解决办法: BarView类中 setProgress方法中 mInBound矩形类中的right位置:加上 mBoundGap
@OverRide
public void setProgress(int progress) {
this.mProgress = progress;
mInBound.set(mBoundGap, mBoundGap,
mBoundGap+(getWidth() - mBoundGap) * mProgress / mMax, getHeight() - mBoundGap);
invalidate();
}

Why showing HUD hides keyboard?

I use code below to show progress :

hud=KProgressHUD.create(context)
                .setStyle(KProgressHUD.Style.SPIN_INDETERMINATE)
                .setAnimationSpeed(2)
                .setDimAmount(Constants.HUD_DIM_AMOUNT)
                .setMaxProgress(100);
hud.show();

Why this hides device keyboard? I want keyboard to be visible.

Thanks

Multiline detail label

Hi, I like your library so much but if I use a multiline detail label in setDetailsLabel() method this label is left aligned and not centered.
I think that TextView should have a center gravity.

Thank you!

schermata 2018-03-16 alle 12 18 17

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.