{"id":13396080,"url":"https://github.com/google/hover","last_synced_at":"2025-03-13T22:31:42.633Z","repository":{"id":39617129,"uuid":"47948132","full_name":"google/hover","owner":"google","description":"A floating menu library for Android.","archived":true,"fork":false,"pushed_at":"2021-06-02T13:05:52.000Z","size":2036,"stargazers_count":2641,"open_issues_count":33,"forks_count":282,"subscribers_count":74,"default_branch":"master","last_synced_at":"2025-01-07T16:08:14.128Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/google.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-12-14T02:43:42.000Z","updated_at":"2024-12-26T10:24:24.000Z","dependencies_parsed_at":"2022-07-13T10:30:36.030Z","dependency_job_id":null,"html_url":"https://github.com/google/hover","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fhover","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fhover/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fhover/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/google%2Fhover/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/google","download_url":"https://codeload.github.com/google/hover/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243493857,"owners_count":20299727,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-30T18:00:39.281Z","updated_at":"2025-03-13T22:31:42.030Z","avatar_url":"https://github.com/google.png","language":"Java","readme":"Hover\n=====\nHover is a floating menu implementation for Android.\n\nGoals\n-----\nThe goals of Hover are to:\n\n1. Provide an easy-to-use, out-of-the-box floating menu implementation for Android developers, and\n\n1. Provide common tools for Android developers to create their own floating menu.\n\nBeta Notice\n-------\nHover is still under heavy development. There is still a lot of code cleanup to do, so expect breaking API changes over time.\n\nThat said, Hover should be in a usable state at this time.\n\n0.9.8 Major Breaking Changes\n-------\nVersion 0.9.8 introduces major breaking changes to Hover. This refactor was done to simplify the code\nstructure to make it easier to fix existing bugs and further extend behavior.\n\n0.9.8 also introduces a number of bug fixes, behavior improvements, and Android O alterations:\n#### Feature Updates:\n - Added Android O support for application overlay.\n - Added support for HoverMenuService as foreground Service (important for Android O).\n - Added acceptance criteria as hover.feature file.\n - Added Checkstyle support (no git hooks yet).\n - Added many Hello World demos to show Hover versatility.\n - Added ability to switch out HoverMenus at any time.\n - Much more robust support for adding/removing/changing menu content in HoverView.\n    \n#### Hover Code Alterations:\n - Moved Hover implementation from 'defaultmenu' package to 'hover' package.\n - Can now instantiate a HoverView directly (no Builder required).\n - Replaced HoverMenuAdapter interface with HoverMenu base class.\n - Added HoverMenuView XML attributes for initial dock position.\n - Added 'Closed' menu state (in addition to 'Collapsed' and 'Expanded')\n - Clients can now provide initial dock when constructing HoverMenuView.\n - Hover collapsed position now saved with menu ID to avoid clobbering multiple menus saved state.\n - HoverView is now based on state pattern.\n\nThere is still code to clean, but hopefully no further refactor of this scale will be necessary.\n\nDemo Hover Menu\n---------------\nA demo app (called Kitchen Sink) is included with the Hover repo. Here are some screenshots of the demo in action.\n\n\u003cimg src=\"https://raw.githubusercontent.com/matthew-carroll/hover/gh-pages/images/screenrecords/hover-demo-screenrecord.gif\" width=\"270\" /\u003e ![Demo Hover Menu - Launching](https://raw.githubusercontent.com/matthew-carroll/hover/gh-pages/images/screenshots/hover-demo-homescreen.png) ![Demo Hover Menu - Launching](https://raw.githubusercontent.com/matthew-carroll/hover/gh-pages/images/screenshots/hover-demo-menu-intro.png) \n\n![Demo Hover Menu - Launching](https://raw.githubusercontent.com/matthew-carroll/hover/gh-pages/images/screenshots/hover-demo-menu-theming.png) ![Demo Hover Menu - Launching](https://raw.githubusercontent.com/matthew-carroll/hover/gh-pages/images/screenshots/hover-demo-menu-menulist.png) ![Demo Hover Menu - Launching](https://raw.githubusercontent.com/matthew-carroll/hover/gh-pages/images/screenshots/hover-demo-menu-placeholder.png)\n\nGetting Started\n---------------\n### Subclass HoverMenuService\nTo get started with Hover, create a subclass of `HoverMenuService` to host your Hover menu. Implement `onHoverMenuLaunched(Intent, HoverView)` to take control of your `HoverView`. You'll want to set it's `HoverMenu`, and also start it in the `collapsed` or `expanded` state:\n\n```java\npublic class MyHoverMenuService extends HoverMenuService {\n\n    @Override\n    protected void onHoverMenuLaunched(@NonNull Intent intent, @NonNull HoverView hoverView) {\n        // Configure and start your HoverView.\n        HoverMenu menu = ...;\n        hoverView.setMenu(menu);\n        hoverView.collapse();\n    }\n    \n}\n```\n\n### Implement A HoverMenu\nA `HoverMenu` is the content that appears within a `HoverView`. A `HoverMenu` is divided into an ordered list of `Section`s.  Each `Section` has a tab as well as `Content` that appear in your `HoverView`.\n\n```java\npublic class MyHoverMenu extends HoverMenu {\n \n    private Context mContext;\n    private Section mSection;\n \n    private SingleSectionHoverMenu(@NonNull Context context) {\n        mContext = context;\n \n        mSection = new Section(\n                new SectionId(\"1\"),\n                createTabView(),\n                createScreen()\n        );\n    }\n \n    private View createTabView() {\n        ImageView imageView = new ImageView(mContext);\n        imageView.setImageResource(R.drawable.tab_background);\n        imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);\n        return imageView;\n    }\n \n    private Content createScreen() {\n        return new MyContent(mContext, \"Screen 1\");\n    }\n \n    @Override\n    public String getId() {\n        return \"singlesectionmenu\";\n    }\n \n    @Override\n    public int getSectionCount() {\n        return 1;\n    }\n \n    @Nullable\n    @Override\n    public Section getSection(int index) {\n        if (0 == index) {\n            return mSection;\n        } else {\n            return null;\n        }\n    }\n \n    @Nullable\n    @Override\n    public Section getSection(@NonNull SectionId sectionId) {\n        if (sectionId.equals(mSection.getId())) {\n            return mSection;\n        } else {\n            return null;\n        }\n    }\n \n    @NonNull\n    @Override\n    public List\u003cSection\u003e getSections() {\n        return Collections.singletonList(mSection);\n    }\n \n}\n```\n\n### Working Directly With A HoverView\nIf you want to create your own Hover `Service` from scratch, or if you want to experiment with a `HoverView` directly, you can instantiate one yourself.\n\n```java\n// Create a HoverView to display in a Window:\nHoverView hoverView = HoverView.createForWindow(\n        context,\n        new WindowViewController(\n            (WindowManager) getSystemService(Context.WINDOW_SERVICE)\n        )\n);\nhoverView.setOnExitListener(onExitListener);\nhoverView.addToWindow();\nhoverView.setMenu(...);\nhoverView.collapse();\n \n// Create a HoverView to display in a View hierarchy:\nHoverView hoverView = HoverView.createForView(context);\nviewGroup.addView(hoverView);\nhoverView.setOnExitListener(onExitListener);\nhoverView.setMenu(...);\nhoverView.collapse();\n \n// Create a HoverView in XML:\n\u003cio.mattcarroll.hover.HoverView\n    xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:hover=\"http://schemas.android.com/apk/res-auto\"\n    android:id=\"@+id/hovermenu\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    hover:dockSide=\"right\"\n    hover:dockPosition=\"70%\"\n    /\u003e\n```\n\nDownload\n--------\nHover is available through jCenter:\n\n```groovy\nimplementation 'io.mattcarroll.hover:hover:0.9.8'\n```\n\nIssues\n------\nWhen Hover is used within a Window, there is always a fullscreen View - even when nothing is visible.  This is done to dramatically simplify the layout logic. However, this causes problems when apps request runtime permissions because the Android OS complains that an overlay is visible.\n\nThere is no built-in solution for this problem at this time. You should take care to destroy your Hover `Service` when the `HoverView` is closed. You may also want to inform the users of your app that issues with runtime permission dialogs might occur, and that those users should exit your Hover menu if problems occur.\n\nDisclaimer\n--------\nThis is not an official Google product.\n\nLicense\n=======\n\n    Copyright (C) 2016 Nest Labs\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n    \n","funding_links":[],"categories":["Index `(light-weight pages)`","表单","Index"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fhover","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogle%2Fhover","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogle%2Fhover/lists"}