google / hover Goto Github PK
View Code? Open in Web Editor NEWA floating menu library for Android.
License: Apache License 2.0
A floating menu library for Android.
License: Apache License 2.0
Hi @matthew-carroll, As you can see from the video a strange thing happens. The one with the image is messager it does not go beyond the spaces provided to it the behavior is correct. In the case of when I use Google hover, something strange happens, it goes out of space but you do not know where and it does not come back anymore, you can not take it anymore. The instance is not released, as you can see when I try to call another from within app.
Link:
https://drive.google.com/file/d/17ipKg4q-I8WnO_Z0cGscWKeNzcR32wdS/view?usp=drivesdk
Hello, I'm trying to use a hover with Expo.io and the application stuck before loading the Expo published app.
MainActivity.java
`import io.mattcarroll.hover.overlay.OverlayPermission;
public class MainActivity extends DetachActivity {`
...
`private static final int REQUEST_CODE_HOVER_PERMISSION = 1000;
private boolean mPermissionsRequested = false;
protected void onCreate(Bundle expBundle) {
super.onCreate(expBundle);
setContentView(R.layout.activity_main);
findViewById(R.id.button_launch_menu).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
DemoHoverMenuService.showFloatingMenu(getApplication().getApplicationContext());
}
});
// On Android M and above we need to ask the user for permission to display the Hover
// menu within the "alert window" layer. Use OverlayPermission to check for the permission
// and to request it.
if (!mPermissionsRequested && !OverlayPermission.hasRuntimePermissionToDrawOverlay(this)) {
@SuppressWarnings("NewApi")
Intent myIntent = OverlayPermission.createIntentToRequestOverlayPermission(this);
startActivityForResult(myIntent, REQUEST_CODE_HOVER_PERMISSION);
}
}`
...
When I remove it the app loads fine but if I apply that my app stuck's and the hover works fine.
I'm new with Android Studio and Detached App, can you help me? THANKS!!!
How to set position of hover programmatically from java at the time of starting of service?
Hi
I have built this library from the source from here, without any modifications, and the Hover Menu elevation seems not to work.
I found a line in the code that, if I'm not wrong, is supposed to set the elevation to the menu, but it doesn't seem to work.
This is how the Hover Menu looks like:
I'm using a device with Android 7.1.1 so the elevation should be properly set/viewed.
I hope you can fix it. Thanks in advance.
Is it possible to use CoordinatorLayout inside content Im passing to HoverView?
As of now it is giving me an error that I should use Theme.AppCompat.
I tried setting without success
@Override
protected Context getContextForHoverMenu() {
return new ContextThemeWrapper(this, R.style.AppTheme);
}
Rotate the device when a Hover menu is expanded. Notice that the menu tabs do not update their position on orientation change. This results either in off-screen tabs when going to portrait, or middle of screen tabs when going to landscape.
How to close hover menu on button click inside the hover menu. Please reply............
Hi @matthew-carroll , is there a way to change the color of the background?
A lighter background?
Or with a custom color?
it would be exetremly useful and pretty if there was two method for creating hover menu
first one is already there
second one would be something like ramotion's circlemenu for specific situations where there's no need for a full screen menu
the circle menu is currently not supporting overlay and can only be used in an activity so if you can implement something like that to use in overlay and service mode that would be so nice
i already appreciate your hard work and i'm going to implement this beautiful library into one of my big projects
regards
Currently Hover displays a full screen View even when nothing is visible. This ever present overlay leads to conflicts with runtime permission dialogs because Android won't allow runtime permissions to be granted when covered by an overlay.
Hover should be altered to collapse the overlay area when collapsed and closed. This way no overlap needs to occur with the permission dialogs and no conflict will arise.
how can I cancel the closing of the bubble at the bottom?
How can i fix the issue below:
java.lang.RuntimeException: Cannot obtain HoverThemeManager before calling init().
How to keep hover active when app is closed ?
Steps to reproduce:
Hard drag hover view to the bottom of the screen and hover view will disappear.
After that, if you try to launch hover menu, it will not be visible anywhere on the screen. One would have to clear app data to get it back
As the title, it disappears without being retrievable, although the left and right sides of the screen work very well, thank you. Sorry about my English.
Video description:
https://youtu.be/fuzfx4zt9f4
I'm useing kitchensink sample to make something like facebook messenger, so when Cloud notification recived i fire
DemoHoverMenuService.showFloatingMenu(getBaseContext(),user_id);
and there will be
private HoverMenu createHoverMenu() {
try {
mDemoHoverMenu = new DemoHoverMenuFactory().createDemoMenuFromCode(uid, getContextForHoverMenu(), Bus.getInstance());
}
}
but its like nothing hapen i think the menu being created again instead of update it with the new id tap. so how this should be done
BS: Tons of thank for making this
Hello sir, I want to know how to modify the size of the hover tab. I personally think that the default tab_size is small.
Thank you in advance.
I've uploaded a sample app that displays the issue here.
Changing content and notifying the listeners causes the collapsed menu to move to the top of the screen and become unresponsive.
I've a fix for this issue which I'll submit for PR.
Supposing I want to edit text in an editText View in floating menu. I press back button and I want to close the keyboard, not the whole menu. How to achieve that? I would like to change boolean dispatchKeyEventPreIme(KeyEvent event)
behaviour to close the keyboard only.
When a hover menu is launched with expand instead of collapse, the hover bubble icon doesn't show above the window
launch menu and drag to X to close it
repeat this a few times
then crash
03-30 19:40:49.267 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/WindowDragWatcher: ACTION_MOVE. motionX: 721.19806, motionY: 1896.4106
03-30 19:40:49.267 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: Setting collapsed position - x: 583, y: 1686
03-30 19:40:49.284 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/WindowDragWatcher: ACTION_MOVE. motionX: 718.56714, motionY: 1914.4631
03-30 19:40:49.285 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: Setting collapsed position - x: 580, y: 1704
03-30 19:40:49.291 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: Menu released at - x: 580.56714, y: 1704.4631
03-30 19:40:49.291 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: stopDragMode()
03-30 19:40:49.292 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: Hover menu dropped in exit region. Requesting exit.
03-30 19:40:49.292 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuService: Menu exit requested.
03-30 19:40:49.365 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuService: onDestroy()
03-30 19:40:49.999 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuService: onCreate()
03-30 19:40:50.000 375-1058/? D/audio_hw_primary: out_set_parameters: enter: usecase(1: low-latency-playback) kvpairs: routing=2
03-30 19:40:50.001 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/CollapsedMenuAnchor: setAnchorAt() - side: 2, normalized Y: 0.49870017
03-30 19:40:50.001 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: init()
03-30 19:40:50.005 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: setAdapter()
03-30 19:40:50.006 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: Setting tab ID to: 48
03-30 19:40:50.006 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: Adding first tab: 0
03-30 19:40:50.010 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuService: onStartCommand() - showing Hover menu.
03-30 19:40:50.018 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: animateActiveTabToAnchorPosition()
03-30 19:40:50.018 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuView: Active tab location - left: 0.0, top: 0.0
03-30 19:40:50.018 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/HoverMenuWindowSidePuller: Pulling to side. Anchor - side: 2, normalized Y: 0.49870017
03-30 19:40:50.018 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/CollapsedMenuAnchor: Creating a new anchor position on the RIGHT side at a normalized vertical position: 0.49870017
03-30 19:40:50.019 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/CollapsedMenuAnchor: Anchoring bounds with height: 0
03-30 19:40:50.019 21848-21848/io.mattcarroll.hoverdemonon_fullscreen D/AndroidRuntime: Shutting down VM
beginning of crash
03-30 19:40:50.020 21848-21848/io.mattcarroll.hoverdemonon_fullscreen E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.mattcarroll.hoverdemonon_fullscreen, PID: 21848
java.lang.NullPointerException: Attempt to read from field 'int android.graphics.Rect.right' on a null object reference
at io.mattcarroll.hover.defaulthovermenu.CollapsedMenuAnchor.anchor(CollapsedMenuAnchor.java:165)
at io.mattcarroll.hover.defaulthovermenu.MagnetPositioner.pullToAnchor(MagnetPositioner.java:76)
at io.mattcarroll.hover.defaulthovermenu.HoverMenuView.animateActiveTabToAnchorPosition(HoverMenuView.java:944)
at io.mattcarroll.hover.defaulthovermenu.HoverMenuView.access$2200(HoverMenuView.java:65)
at io.mattcarroll.hover.defaulthovermenu.HoverMenuView$10.run(HoverMenuView.java:400)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
03-30 19:40:50.021 937-1841/? W/ActivityManager: Force finishing activity io.mattcarroll.hoverdemonon_fullscreen/.MainActivity
if i use edittext in content layout it is not adjusting when keyboard open, which is not usable at all in a chat head particulary. I tried to edit WindowViewController with
params.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN
with and without FLAG_NOT_FOCUSABLE ..... with TYPE_PHONE and TYPE_SYSTEM_ALERT
on addView and showView
and in the content custom view
but nothing worked
can you please suggest what should i do
and thanks
I succeeded in having my menu pop up, and having navigator content appear. However, my NavigatorContent appears behind the tinted overlay, instead of on top of it at the same level as the tab. Any reason why this might occur? I am using a HoverMenuView within an activity, and create the HoverMenuView programmatically, adding it to the end of my android.R.id.content
ViewGroup from my Activity.
Hi @matthew-carroll, Is there any way to even cover the status bar, as seen in image 2?
When the floating menu is running, other apps can not request permissions. When I request permissions on my another app, the permission dialog came up. No matter I choose deny or allow. The infamous "Screen overlay detected" appeared.
09-04 15:32:42.129 8157-8157/io.mattcarroll.hover.hoverdemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.mattcarroll.hover.hoverdemo, PID: 8157
java.lang.NullPointerException: Attempt to read from field 'io.mattcarroll.hover.HoverMenu$SectionId io.mattcarroll.hover.HoverView.mSelectedSectionId' on a null object reference
at io.mattcarroll.hover.HoverViewStateExpanded.onTabSelected(HoverViewStateExpanded.java:516)
at io.mattcarroll.hover.HoverViewStateExpanded.access$300(HoverViewStateExpanded.java:39)
at io.mattcarroll.hover.HoverViewStateExpanded$2.onClick(HoverViewStateExpanded.java:152)
at android.view.View.performClick(View.java:4909)
at android.view.View$PerformClick.run(View.java:20390)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5869)
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:1020)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:815)
Please test it on RTL language only one tab will be showen, others will stay hidded and you can see it for seconds at the time you close or open the menu after hours of trying it turns out that the animation cuz other views to be hidden if i commented it and just used setVisibility(VISIBLE) it will work.
Pluse there is large space around each tab how to reduse it please
Hello, I would like to click on a menu list after the jump to a new page, I began to want to use viewpager but get less than FragmenManager, how to achieve my needs
Data is dynamic
the flaoting hoverview is still present even if we stopped the activity. or perform hover.close method. force closing the app only clears the area. how to deal with it?
If mycustomHoverMenu removes a selected Section from mSections
(the ArrayList<Section>
) while it is expanded, then calling notifyMenuChanged()
causes a crash. To demonstrate, change 1 to 0 on line 123 of MutatingSectionsHoverMenuService.java of the hoverdemo-helloworld app. And manually expand the FAB after starting the "Launch Changing Sections".
removeTab(0);
That change just targets the currently selected section/tab for removal instead of a non-selected section. If I collapse the hoverView first, I can avoid the crash, but then I've seen the FAB ends up invisible (still referring to the removed section if it is at the end of the list), or sometimes crash after manually clicking the FAB, but I wonder if there's a better/safer procedure to removing sections.
I realize this is unsupported. But just in case there's a community using this cool library, I thought I'd post this question. And hopefully, my workaround shortly.
The crash details:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: org.codecanon.hover.hoverdemo.helloworld, PID: 27913
java.lang.ArrayIndexOutOfBoundsException: length=10; index=-1
at java.util.ArrayList.get(ArrayList.java:439)
at io.mattcarroll.hover.hoverdemo.helloworld.MutatingSectionsHoverMenuService$MutatingHoverMenu.getSection(MutatingSectionsHoverMenuService.java:179)
at io.mattcarroll.hover.HoverViewStateExpanded.removeSection(HoverViewStateExpanded.java:492)
at io.mattcarroll.hover.HoverViewStateExpanded.removeSections(HoverViewStateExpanded.java:466)
at io.mattcarroll.hover.HoverViewStateExpanded.access$600(HoverViewStateExpanded.java:39)
at io.mattcarroll.hover.HoverViewStateExpanded$6.onRemoved(HoverViewStateExpanded.java:327)
at android.support.v7.util.BatchingListUpdateCallback.dispatchLastEvent(BatchingListUpdateCallback.java:62)
at android.support.v7.util.DiffUtil$DiffResult.dispatchUpdatesTo(DiffUtil.java:729)
at io.mattcarroll.hover.HoverMenu.notifyMenuChanged(HoverMenu.java:76)
at io.mattcarroll.hover.hoverdemo.helloworld.MutatingSectionsHoverMenuService$MutatingHoverMenu.removeTab(MutatingSectionsHoverMenuService.java:224)
at io.mattcarroll.hover.hoverdemo.helloworld.MutatingSectionsHoverMenuService$MutatingHoverMenu.access$100(MutatingSectionsHoverMenuService.java:59)
at io.mattcarroll.hover.hoverdemo.helloworld.MutatingSectionsHoverMenuService$MutatingHoverMenu$10.run(MutatingSectionsHoverMenuService.java:123)
at io.mattcarroll.hover.hoverdemo.helloworld.MutatingSectionsHoverMenuService$MutatingHoverMenu$12.run(MutatingSectionsHoverMenuService.java:142)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6718)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
1. Hover Menu
We are transitioning our app to AndroidX and I think because we have forked and are using it as a project instead of a library, hover is having issues.
Would you accept a PR that moves hover over to use AndroidX?
When adding this library to my android project, gradle finishes the building and syncing tasks, but when I go to use the library, no classes are actually available. My IDE can see the packages and the R class, but everything else is missing. Any reason why this might occur?
Currently Hover does not provide the support to close a single active section. If only a single section exists, then dismiss the Hover when the section is closed.
How to change onTap?
I get the following error when compiling the project:
Error:Could not find com.android.tools.build:gradle:3.0.0-alpha4.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha4/gradle-3.0.0-alpha4.jar
Required by:
project :
E/AndroidRuntime: FATAL EXCEPTION: main
Process: io.mattcarroll.hover.hoverdemo, PID: 15843
java.lang.IllegalArgumentException: View=io.mattcarroll.hover.defaulthovermenu.HoverMenuView{42e09eb0 V.E..... ......ID 0,0-1080,1845} not attached to window manager
at android.view.WindowManagerGlobal.findViewLocked(WindowManagerGlobal.java:389)
at android.view.WindowManagerGlobal.updateViewLayout(WindowManagerGlobal.java:304)
at android.view.WindowManagerImpl.updateViewLayout(WindowManagerImpl.java:74)
at io.mattcarroll.hover.defaulthovermenu.window.WindowViewController.makeTouchable(WindowViewController.java:93)
at io.mattcarroll.hover.defaulthovermenu.window.WindowHoverMenu$1.onExpanded(WindowHoverMenu.java:69)
at io.mattcarroll.hover.defaulthovermenu.HoverMenuView$11.run(HoverMenuView.java:445)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5335)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
any contact info of creator?
The Section does not implement the equals method
whats problem?
java.lang.RuntimeException: Cannot obtain HoverThemeManager before calling init().
FATAL EXCEPTION: main Process: com.izigaaps.myapplication, PID: 29811 java.lang.RuntimeException: Unable to start service com.izigaaps.myapplication.DemoHoverMenuService@41d70530 with Intent { cmp=com.izigaaps.myapplication/.DemoHoverMenuService }: java.lang.RuntimeException: Cannot obtain HoverThemeManager before calling init(). at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2883) at android.app.ActivityThread.access$2100(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5421) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:979) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:795) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: Cannot obtain HoverThemeManager before calling init(). at com.izigaaps.myapplication.theming.HoverThemeManager.getInstance(HoverThemeManager.java:19) at com.izigaaps.myapplication.DemoHoverMenuFactory.createDemoMenuFromCode(DemoHoverMenuFactory.java:49) at com.izigaaps.myapplication.DemoHoverMenuService.createHoverMenu(DemoHoverMenuService.java:51) at com.izigaaps.myapplication.DemoHoverMenuService.onHoverMenuLaunched(DemoHoverMenuService.java:45) at io.mattcarroll.hover.window.HoverMenuService.initHoverMenu(HoverMenuService.java:118) at io.mattcarroll.hover.window.HoverMenuService.onStartCommand(HoverMenuService.java:88) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2866) at android.app.ActivityThread.access$2100(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:136) at android.app.ActivityThread.main(ActivityThread.java:5421) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:979) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:795) at dalvik.system.NativeStart.main(Native Method)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.