{"id":13605387,"url":"https://github.com/Chrisvin/FlipTabs","last_synced_at":"2025-04-12T05:32:50.872Z","repository":{"id":143507381,"uuid":"219338435","full_name":"Chrisvin/FlipTabs","owner":"Chrisvin","description":"Android Flip Tabs Library","archived":false,"fork":false,"pushed_at":"2020-09-24T23:32:13.000Z","size":1508,"stargazers_count":161,"open_issues_count":1,"forks_count":14,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-19T02:42:48.984Z","etag":null,"topics":["android","android-library","flip","fliptab","fliptabs","library","tab","tabs"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Chrisvin.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-11-03T17:27:18.000Z","updated_at":"2024-12-17T16:58:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"eaa88278-0ee9-4f52-9ac3-7df874a29caa","html_url":"https://github.com/Chrisvin/FlipTabs","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chrisvin%2FFlipTabs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chrisvin%2FFlipTabs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chrisvin%2FFlipTabs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Chrisvin%2FFlipTabs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Chrisvin","download_url":"https://codeload.github.com/Chrisvin/FlipTabs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248524204,"owners_count":21118609,"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","flip","fliptab","fliptabs","library","tab","tabs"],"created_at":"2024-08-01T19:00:58.177Z","updated_at":"2025-04-12T05:32:50.542Z","avatar_url":"https://github.com/Chrisvin.png","language":"Kotlin","funding_links":[],"categories":["Kotlin"],"sub_categories":[],"readme":"# FlipTabs\n \n [![License: MIT](https://img.shields.io/badge/License-MIT-silver.svg)](https://opensource.org/licenses/MIT) [![](https://jitpack.io/v/Chrisvin/FlipTabs.svg)](https://jitpack.io/#Chrisvin/FlipTabs) [![API](https://img.shields.io/badge/API-19%2B-blue.svg?style=flat)](https://android-arsenal.com/api?level=19)[![Android Weekly](https://img.shields.io/badge/Android%20Weekly-%23387-2CA3E6.svg?style=flat)](http://androidweekly.net/issues/issue-387)\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"FlipTabs-Demo.gif\"/\u003e\u003c/p\u003e\n\nFlipTabs is a lightweight library that contains a 2-tab view that switches using flip animation. ([Source of Inspiration](https://dribbble.com/shots/7419072-Segmented-Control))\n\n## Getting started\n### Setting up the dependency\n1. Add the JitPack repository to your root build.gradle at the end of repositories:\n```\nallprojects {\n\trepositories {\n\t\t...\n\t\tmaven { url 'https://jitpack.io' }\n\t}\n}\n```\n2. Add the FlipTabs dependency in the build.gradle:\n```\nimplementation 'com.github.Chrisvin:FlipTabs:v1.5'\n```\n\n### Demo app\nTo run the demo project, clone the repository and run it via Android Studio.\n\u003c/br\u003e(OR)\n\u003c/br\u003eDownload the demo apk from [releases](https://github.com/Chrisvin/FlipTabs/releases).\n\n## Usage\n### Adding directly in layout.xml\n```\n\u003ccom.jem.fliptabs.FlipTab\n  ...\n  app:leftTabText=\"Photos\"\n  app:rightTabText=\"Videos\"\n  app:startingTab=\"right\" //or \"left\"\n  app:removeDefaultPadding=\"false\" // `FlipTab` has a default padding of 16dp on all sides to ensure space for the flipping animation\n  app:overallColor=\"#9966EE\"\n  app:textColor=\"#FF0000\" //will be ignored if overallColor is defined\n  app:highlightColor=\"#FF0000\" //will be ignored if overallColor is defined\n  app:borderWidth=\"4dp\" // Default border width is 2dp\n  app:flipAnimationDuration=\"400\"\n  app:wobbleReturnAnimationDuration=\"200\"\n  app:wobbleAngle=\"3\" /\u003e\n```\n\u003cb\u003eNote:\u003c/b\u003e Disabling the default padding (using `app:removeDefaultPadding=\"true\"`) means that you (the dev) need to ensure that there is enough space around the FlipTab so as to not clip the flipping animation.\n### Adding/Modifying programmatically\n```kotlin\nval flipTab = FlipTab(this)\nflipTab.setLeftTabText(\"Photo\")\nflipTab.setRightTabText(\"Video\")\n\n//Sets color for both text, background \u0026 border\nflipTab.setOverallColor(Color.BLUE)\n//Sets color only bg \u0026 border\nflipTab.setHighlightColor(Color.GREEN)\n//Sets color only for text\nflipTab.setTextColor(Color.GREEN)\n\n//Time taken for selected tab to flip\nflipTab.setFlipAnimationDuration(500)\n//Time taken for tabs to revert to original state after wobble\nflipTab.setWobbleReturnAnimationDuration(250)\n//NOTE: totalAnimationDuration = flipAnimationDuration + wobbleReturnAnimationDuration\n\n//Set angle upto which the tabs wobble\nflipTab.setWobbleAngle(3f)\n//Set width of the border in px\nfliptab.setBorderWidth(12f)\n\n//Modify properties of the textviews used in FlipTab\nfliptab.getTextViews().forEach {\n    it.setTypeface(it.typeface, Typeface.ITALIC)\n}\n//Or modify a specific textview\nfliptab.getSelectedTextView().apply {\n    setTypeface(typeface, Typeface.BOLD)\n}\n// Similarly, fliptab.getLeftTextView() \u0026 fliptab.getRightTextView() can be used\n\n//Flip the tab (left -\u003e right \u0026 vice versa)\nflipTab.flipTabs()\n//Selects the left tab (if left tab isn't already selected)\nflipTab.selectLeftTab(withAnimation = true)\n//Selects the right tab (if right tab isn't already selected)\nflipTab.selectRightTab(withAnimation = false)\n//(Does flip animation when selecting if withAnimation is true, else skips animation)\n\nfliptab.setTabSelectedListener(object: FlipTab.TabSelectedListener {\n    override fun onTabSelected(isLeftTab: Boolean, tabTextValue: String) {\n        textSwitcher.setText(String.format(stringTemplate, tabTextValue))\n        Toast.makeText(this@MainActivity, (if (isLeftTab) \"Left\" else \"Right\") + \" tab selected\", Toast.LENGTH_SHORT).show()\n    }\n    override fun onTabReselected(isLeftTab: Boolean, tabTextValue: String) {\n        Toast.makeText(this@MainActivity, (if (isLeftTab) \"Left\" else \"Right\") + \" tab reselected\", Toast.LENGTH_SHORT).show()\n    }\n})\n```\n\n## Todo\n- [ ] Current library overcomes view clipping by setting the parent layout's clipChildren \u0026 clipToPadding as false. Find a better alternative to overcome view clipping.\n- [ ] Current library changes drawable and applies scaleX on the entire selected tab in the middle of the flip animation. Find a better alternative, such as applying scaleX only on the text instead of the whole view.\n- [ ] Explore possibilities for multi tab design.\n\n## Bugs and Feedback\nFor bugs, questions and discussions please use the [Github Issues](https://github.com/Chrisvin/FlipTabs/issues).\n\n## License\n```\nMIT License\n\nCopyright (c) 2019 Jem\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChrisvin%2FFlipTabs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FChrisvin%2FFlipTabs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FChrisvin%2FFlipTabs/lists"}