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

您好,问一下Fragmentation是否可以支持PreferenceActivity和PreferenceFragment的侧滑返回,谢谢! #758

Closed
renzihua opened this issue Jan 28, 2018 · 3 comments · Fixed by #770
Labels

Comments

@renzihua
Copy link

您好,非常感谢您的软件给我们带来的方便,我在使用中有以下体验建议,请查看。
建议1:Fragmentation是否可以支持PreferenceActivity和PreferenceFragment的侧滑返回,由于部分部分页面使用了侧滑功能,部分页面不能侧滑导致用户使用体验不好。

建议2:如果Fragment启动方式为根据父Fragment的ID启动,点击悬浮球会导致异常退出。
我的启动方式:
FragmentTransaction ft = fragment.beginTransaction();
ft.add(R.id.ymy_fmly_eventedit, fmEventNewOrEdit).addToBackStack(null);
ft.commit();
错误:
E/InputEventReceiver: Exception dispatching input event.
E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
E/MessageQueue-JNI: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at me.yokeyword.fragmentation.debug.DebugStackDelegate.addDebugFragmentRecord(DebugStackDelegate.java:203)
at me.yokeyword.fragmentation.debug.DebugStackDelegate.getFragmentRecords(DebugStackDelegate.java:154)
at me.yokeyword.fragmentation.debug.DebugStackDelegate.showFragmentStackHierarchyView(DebugStackDelegate.java:102)
at me.yokeyword.fragmentation.debug.DebugStackDelegate$1.onClick(DebugStackDelegate.java:68)
at android.view.View.performClick(View.java:5215)
at me.yokeyword.fragmentation.debug.DebugStackDelegate$StackViewTouchListener.onTouch(DebugStackDelegate.java:257)
at android.view.View.dispatchTouchEvent(View.java:9308)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2403)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1737)
at android.app.Activity.dispatchTouchEvent(Activity.java:2874)
at me.yokeyword.fragmentation.SupportActivity.dispatchTouchEvent(SupportActivity.java:59)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
at com.android.tools.profiler.support.event.WindowProfilerCallback.dispatchTouchEvent(WindowProfilerCallback.java:69)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2364)
at android.view.View.dispatchPointerEvent(View.java:9536)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4281)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4144)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3683)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3736)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3702)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3828)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3710)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3885)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3683)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3736)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3702)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3710)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3683)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5973)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5947)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5908)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6079)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:195)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:141)
at android.app.ActivityThread.main(ActivityThread.java:5653)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:746)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ffricheng.ffapp, PID: 16313
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
at me.yokeyword.fragmentation.debug.DebugStackDelegate.addDebugFragmentRecord(DebugStackDelegate.java:203)
at me.yokeyword.fragmentation.debug.DebugStackDelegate.getFragmentRecords(DebugStackDelegate.java:154)
at me.yokeyword.fragmentation.debug.DebugStackDelegate.showFragmentStackHierarchyView(DebugStackDelegate.java:102)
at me.yokeyword.fragmentation.debug.DebugStackDelegate$1.onClick(DebugStackDelegate.java:68)
at android.view.View.performClick(View.java:5215)
at me.yokeyword.fragmentation.debug.DebugStackDelegate$StackViewTouchListener.onTouch(DebugStackDelegate.java:257)
at android.view.View.dispatchTouchEvent(View.java:9308)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2556)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2255)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2403)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1737)
at android.app.Activity.dispatchTouchEvent(Activity.java:2874)
at me.yokeyword.fragmentation.SupportActivity.dispatchTouchEvent(SupportActivity.java:59)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:71)
at com.android.tools.profiler.support.event.WindowProfilerCallback.dispatchTouchEvent(WindowProfilerCallback.java:69)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2364)
at android.view.View.dispatchPointerEvent(View.java:9536)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4281)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4144)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3683)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3736)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3702)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3828)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3710)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3885)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3683)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3736)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3702)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3710)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3683)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5973)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5947)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5908)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6079)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:195)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:323)
at android.os.Looper.loop(Looper.java:141)
at android.app.ActivityThread.main(ActivityThread.java:5653)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:746)
at c

@YoKeyword
Copy link
Owner

感谢你的建议

第一个建议: Fragmentation可以通过实现+委托来构建自己的Support类,你可以构建自己的SupportPreferenceActivity(参考SupportActivity的实现) ,然后再构建自己的SwipeBackPreferenceActivity(参考SwipeBackActivity的实现)
Fragment类似,当然还有一种方案是,把PreferenceFragment作为孩子放到SwipeBackFragment
(下个大版本,可能会考虑在库中添加对PreferenceActivity/Fragment的支持)

第二个问题,我后面会排查修复 :)

@renzihua
Copy link
Author

好的,非常感谢!

@YoKeyword
Copy link
Owner

v1.2.6,已修复悬浮球问题

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

Successfully merging a pull request may close this issue.

2 participants