Giter Club home page Giter Club logo

keyboardheightprovider's People

Contributors

zhangxq avatar

Stargazers

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

Watchers

 avatar

keyboardheightprovider's Issues

Activity leak

Similarly to issue #4, activity leaks if the class is destroyed before the runnable is consumed.

Memory leak

HeightProvider.java

The following code leaks the activity:

public HeightProvider init() {
    if (!isShowing()) {
        final View view = mActivity.getWindow().getDecorView();
        // 延迟加载popupwindow,如果不加延迟就会报错
        view.post(new Runnable() {
            @Override
            public void run() {
                showAtLocation(view, Gravity.NO_GRAVITY, 0, 0);
            }
        });
    }
    return this;
}

Calling dismiss() before terminating the activity should fix it.

Activity返回后报错

E/WindowManager: android.view.WindowLeaked: Activity com.example.schoolairdrop.ui.activity.ChatActivity has leaked window android.widget.PopupWindow$PopupViewContainer{1557c1fd V.E..... ......ID 0,0-0,926} that was originally added here
at android.view.ViewRootImpl.(ViewRootImpl.java:379)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:260)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:74)
at android.widget.PopupWindow.invokePopup(PopupWindow.java:1122)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:938)
at android.widget.PopupWindow.showAtLocation(PopupWindow.java:902)
at com.example.schoolairdrop.ui.utils.HeightProvider$1.run(HeightProvider.java:47)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5318)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:922)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:717)

public HeightProvider init() {
if (!isShowing()) {
final View view = mActivity.getWindow().getDecorView();
// Delay loading popupwindow, if not, error will be reported
view.post(new Runnable() {
@OverRide
public void run() {
showAtLocation(view, Gravity.NO_GRAVITY, 0, 0);//错误出在这里…
}
});
}
return this;
}

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.