{"id":13611585,"url":"https://github.com/skydoves/Submarine","last_synced_at":"2025-04-13T04:34:59.740Z","repository":{"id":52961214,"uuid":"194277337","full_name":"skydoves/Submarine","owner":"skydoves","description":":speedboat: Floating navigation view for displaying a list of items dynamically on Android.","archived":false,"fork":false,"pushed_at":"2022-01-21T11:07:59.000Z","size":935,"stargazers_count":477,"open_issues_count":1,"forks_count":41,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-05T11:11:26.123Z","etag":null,"topics":["android","android-library","animation","dsl","kotlin","navigation","skydoves","submarine"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","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/skydoves.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null},"funding":{"github":"skydoves","custom":["https://www.paypal.me/skydoves","https://www.buymeacoffee.com/skydoves"]}},"created_at":"2019-06-28T13:20:27.000Z","updated_at":"2025-03-04T06:23:23.000Z","dependencies_parsed_at":"2022-08-30T09:11:11.842Z","dependency_job_id":null,"html_url":"https://github.com/skydoves/Submarine","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/skydoves%2FSubmarine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FSubmarine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FSubmarine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skydoves%2FSubmarine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skydoves","download_url":"https://codeload.github.com/skydoves/Submarine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665157,"owners_count":21142118,"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":["android","android-library","animation","dsl","kotlin","navigation","skydoves","submarine"],"created_at":"2024-08-01T19:01:58.238Z","updated_at":"2025-04-13T04:34:59.458Z","avatar_url":"https://github.com/skydoves.png","language":"Kotlin","funding_links":["https://github.com/sponsors/skydoves","https://www.paypal.me/skydoves","https://www.buymeacoffee.com/skydoves"],"categories":["Kotlin"],"sub_categories":[],"readme":"\n\u003ch1 align=\"center\"\u003eSubmarine\u003c/h1\u003e\u003c/br\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://android-arsenal.com/api?level=16\"\u003e\u003cimg alt=\"API\" src=\"https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/skydoves/Submarine/actions\"\u003e\u003cimg alt=\"Build Status\" src=\"https://github.com/skydoves/Submarine/workflows/Android%20CI/badge.svg\"/\u003e\u003c/a\u003e \n  \u003ca href=\"https://androidweekly.net/issues/issue-372\"\u003e\u003cimg alt=\"Android Weekly\" src=\"https://img.shields.io/badge/Android%20Weekly-%23372-orange\"/\u003e\u003c/a\u003e\n  \u003ca href=\"https://skydoves.github.io/libraries/submarine/javadoc/submarnie/com.skydoves.submarine/index.html\"\u003e\u003cimg alt=\"Javadoc\" src=\"https://img.shields.io/badge/Javadoc-Submarine-yellow.svg\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nFully customizable floating navigation view for listing items dynamically on Android.\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/24237865/60386446-c4ab9e00-9acf-11e9-8e58-02f758f9667c.gif\" width=\"32%\"/\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/24237865/60386447-c4ab9e00-9acf-11e9-872a-dfd6ca23ad4f.gif\" width=\"32%\"/\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/24237865/60612724-4e2adb00-9e04-11e9-84e4-e7633ca9b97f.gif\" width=\"32%\"/\u003e\n\u003c/p\u003e\n\n## Including in your project \n[![Maven Central](https://img.shields.io/maven-central/v/com.github.skydoves/submarine.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.github.skydoves%22%20AND%20a:%22submarine%22)\n\n### Gradle \nAdd the codes below to your **root** `build.gradle` file (not your module build.gradle file).\n```gradle\nallprojects {\n    repositories {\n        mavenCentral()\n    }\n}\n```\nAnd add the dependency below to your **module**'s `build.gradle` file.\n```gradle\ndependencies {\n    implementation \"com.github.skydoves:submarine:1.0.7\"\n}\n```\n\n## SNAPSHOT \n[![Submarine](https://img.shields.io/static/v1?label=snapshot\u0026message=submarine\u0026logo=apache%20maven\u0026color=C71A36)](https://oss.sonatype.org/content/repositories/snapshots/com/github/skydoves/submarine/) \u003cbr\u003e\nSnapshots of the current development version of submarine are available, which track [the latest versions](https://oss.sonatype.org/content/repositories/snapshots/com/github/skydoves/submarine/).\n\n```gradle\nrepositories {\n   maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }\n}\n```\n\n## Usage\nAdd following XML namespace inside your XML layout file.\n\n```gradle\nxmlns:app=\"http://schemas.android.com/apk/res-auto\"\n```\n\n### SubmarineView\nHere is how to implement like previews using `SubmarineView`.\n```gradle\n\u003ccom.skydoves.submarine.SubmarineView\n  android:id=\"@+id/submarineView\"\n  android:layout_width=\"50dp\" // this will not affect on real view size. We can set anything.\n  android:layout_height=\"50dp\" //  this will not affect real view size. We can set anything.\n  android:layout_alignParentBottom=\"true\"\n  android:layout_margin=\"20dp\"\n  android:alpha=\"0.8\"\n  app:submarine_animation=\"scale\" // floating, dipping animation style.\n  app:submarine_borderColor=\"@color/colorPrimaryDark\" // navigation's border color.\n  app:submarine_borderSize=\"1dp\" // navigation's border thickness.\n  app:submarine_circleAnchor=\"right\" // decides where to moves the circle icon.\n  app:submarine_circleBorderColor=\"@color/green\" // circle icon's border color.\n  app:submarine_circleBorderSize=\"1dp\" // circle icon's border thickness.\n  app:submarine_circleDrawable=\"@drawable/picasso\" // circle icon's image drawable.\n  app:submarine_circlePadding=\"2dp\" // circle icon's padding value.\n  app:submarine_circleSize=\"22dp\" // circle icon's size. It decides the height or width of navigation.\n  app:submarine_color=\"@android:color/black\" // navigation's background color.\n  app:submarine_duration=\"350\" // navigation spreading duration.\n  app:submarine_orientation=\"horizontal\" // navigation spreading orientation.\n/\u003e\n```\n\n### Float and Dip\nShows and makes disappear using the below methods.\n```kotlin\nsubmarineView.floats() // shows\nsubmarineView.dips() // makes disappear\n```\n\n### Navigate and Retreat\nWe can make the SubmarineView always floating (without appear, disappear actions) and navigating when we want.\n\nFirstly, add below attributes to SubmarineView on your xml file.\n```gradle\napp:submarine_autoDip=\"false\"\napp:submarine_autoNavigate=\"false\"\n```\nAnd call `floats()` method before using `navigates()` method.\n```kotlin\nsubmarineView.floats()\n```\nUnfold and fold using the below methods.\n```kotlin\nsubmarineView.navigates() // unfold\nsubmarineView.retreats() // fold\n```\n\n### SubmarineItem\nSubmarineItem is a data class for composing navigation list.\n```kotlin\nval item = SubmarineItem(ContextCompat.getDrawable(this, R.drawable.ic_edit))\nsubmarineView.addSubmarineItem(item)\n```\nWe can customize the icon drawable using `IconForm.Builder`.\n```kotlin\nval iconForm = IconForm.Builder(context)\n  .setIconSize(45)\n  .setIconTint(ContextCompat.getColor(context, R.color.colorPrimary))\n  .setIconScaleType(ImageView.ScaleType.CENTER)\n  .build()\n\n// kotlin dsl\nval iconForm = iconForm(context) {\n  iconSize = 45\n  iconColor = ContextCompat.getColor(context, R.color.colorPrimary)\n  iconScaleType = ImageView.ScaleType.CENTER\n}\n\nval item = SubmarineItem(ContextCompat.getDrawable(this, R.drawable.ic_edit), iconForm)\nsubmarineView.addSubmarineItem(item)\n```\nWe can add `SubmarineItem` list, remove and clear all items.\n```kotlin\nsubmarineView.addSubmarineItem(item) // adds a SubmarineItem item.\nsubmarineView.addSubmarineItems(itemList) // adds a SubmarineItem item list.\nsubmarineView.removeSubmarineItem(item) // removes a SubmarineItem item.\nsubmarineView.clearAllSubmarineItems() // clears all SubmarineItem items.\n```\n\n### SubmarineItemClickListener\nInterface definition for a callback to be invoked when a item is clicked.\n```kotlin\nsubmarineView.submarineItemClickListener = onItemClickListener\n\nprivate object onItemClickListener: SubmarineItemClickListener {\n  override fun onItemClick(position: Int, submarineItem: SubmarineItem) {\n    // doSomething\n  }\n}\n```\n\n### Circle Icon\nWe can customize the circle icon on the navigation. \u003cbr\u003e\nSubmarine uses [CircleImageView](https://github.com/hdodenhof/CircleImageView). So you can reference the usage of it.\n```kotlin\nsubmarineView.circleIcon.setImageDrawable(drawable) // gets circle icon and changes image drawable.\nsubmarineView.circleIcon.borderColor = ContextCompat.getColor(context, R.color.colorPrimary) // gets circle icon and changes border color.\nsubmarineView.circleIcon.borderWidth = 2 // gets circle icon and changes border width.\n```\n\n### SubmarineCircleClickListener\nInterface definition for a callback to be invoked when a circle icon is clicked.\n```kotlin\nsubmarineView.submarineCircleClickListener = onCircleIconClickListener\n\nprivate object onCircleIconClickListener: SubmarineCircleClickListener {\n  override fun onCircleClick() {\n    // doSomething\n  }\n}\n```\n\n### Orientation and Anchor\n`SubmarineOrientation` and `CircleAnchor` decide the where to spreads and where to moves.\n```gradle\napp:submarine_circleAnchor=\"right\" // left, right, top, bottom\napp:submarine_orientation=\"horizontal\" // horizontal, vertical\n```\nHorizontal and Left | Horizontal and Right | Vertical and Top | Vertical and Bottom |\n| :---------------: | :---------------: | :---------------: | :---------------: |\n![or00](https://user-images.githubusercontent.com/24237865/60387040-bc0b9580-9ad8-11e9-9f5b-8b3f634a8a91.gif)| ![or01](https://user-images.githubusercontent.com/24237865/60387041-bc0b9580-9ad8-11e9-927f-0d0758b553de.gif) | ![or03](https://user-images.githubusercontent.com/24237865/60387043-bca42c00-9ad8-11e9-82a1-3d6cd7b10931.gif)| ![or02](https://user-images.githubusercontent.com/24237865/60387042-bca42c00-9ad8-11e9-8e17-5d9d843bb99d.gif)\n\n### SubmarineAnimation\nSubmarineAnimation decides the animation of `float` and `dip` methods.\n```gradle\napp:submarine_animation=\"scale\" // scale, fade, none\n```\nSCALE | FADE\n------------ | -------------\n![or00](https://user-images.githubusercontent.com/24237865/60387040-bc0b9580-9ad8-11e9-9f5b-8b3f634a8a91.gif)| ![or05](https://user-images.githubusercontent.com/24237865/60387168-47395b00-9ada-11e9-93d1-5957b89bd677.gif)\n\n## SubmarineView Attributes\nAttributes | Type | Default | Description\n--- | --- | --- | ---\norientation | SubmarineOrientation | Horizontal | navigation's spreading orientation.\nduration | Long | 350L | navigation's spreading duration.\ncolor | Int(Color) | Color.Black | navigation's background color.\nanimation | SubmarineAnimation | None | floating, dipping animation style.\nborderSize | Dimension | 0f | navigation's border thickness.\nborderColor | Int(Color) | Color.Green | navigation's border color.\nexpandSize | Dimension | display width size - 20dp size | navigation's width or height size after expands.\nradius | Dimension | 15dp | navigation's corder radius.\nautoNavigate | Boolean | true | executes `navigate` method automatically after executing `float` method.\nautoDip | Boolean | true | executes `dip` method automatically after executing `retreat` method.\ncircleAnchor | CircleAnchor | Left | decides where to moves the circle icon.\ncircleSize | Dimension | 20dp | circle icon's size. It decides the height or width of navigation.\ncircleDrawable | Drawable | null | circle icon's image drawable.\ncircleBorderSize | Dimension | 0f | circle icon's border thickness.\ncircleBorderColor | Int(Color) | 0f | circle icon's border color.\ncirclePadding | Dimension | 0f | circle icon's padding width.\n\n## Find this library useful? :heart:\nSupport it by joining __[stargazers](https://github.com/skydoves/submarine/stargazers)__ for this repository. :star:\n\n# License\n```xml\nCopyright 2019 skydoves (Jaewoong Eum)\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskydoves%2FSubmarine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskydoves%2FSubmarine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskydoves%2FSubmarine/lists"}