{"id":20447201,"url":"https://github.com/stfalcon-studio/swipeable-button","last_synced_at":"2025-04-13T01:07:18.804Z","repository":{"id":77717508,"uuid":"142435058","full_name":"stfalcon-studio/swipeable-button","owner":"stfalcon-studio","description":"Android Swipeable button like in iOS unlock screen. Made by Stfalcon","archived":false,"fork":false,"pushed_at":"2019-07-02T09:58:39.000Z","size":4355,"stargazers_count":87,"open_issues_count":7,"forks_count":8,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-10T18:06:45.784Z","etag":null,"topics":["custom-button","swipe","swipebutton"],"latest_commit_sha":null,"homepage":"https://stfalcon.com","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/stfalcon-studio.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-26T12:01:22.000Z","updated_at":"2025-02-23T07:40:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"2b8d91bc-749b-4b95-9e3b-f09b45be7923","html_url":"https://github.com/stfalcon-studio/swipeable-button","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2Fswipeable-button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2Fswipeable-button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2Fswipeable-button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stfalcon-studio%2Fswipeable-button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stfalcon-studio","download_url":"https://codeload.github.com/stfalcon-studio/swipeable-button/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650744,"owners_count":21139680,"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":["custom-button","swipe","swipebutton"],"created_at":"2024-11-15T10:25:03.466Z","updated_at":"2025-04-13T01:07:18.792Z","avatar_url":"https://github.com/stfalcon-studio.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swipeable-button\n\u003cimg src=\"images/swipe_new.gif\" width=\"240\" height=\"420\" /\u003e\n\n## Who we are\nNeed iOS and Android apps, MVP development or prototyping? Contact us via info@stfalcon.com. We develop software since 2009, and we're known experts in this field. Check out our [portfolio](https://stfalcon.com/en/portfolio) and see more libraries from [stfalcon-studio](https://stfalcon-studio.github.io/).\n\n## Download\nDownload via Gradle:\n```compile 'com.github.stfalcon:swipeable-button:0.1.0'```\n\n## Usage\nJust put this code into your layout:\n```\n\u003ccom.stfalcon.swipeablebutton.SwipeableButton\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"/\u003e\n```\n\nYou can use many attributes for more flexibility and convenience of use. Here's the full list:\n- isChecked - Initial state. Boolean. False by default\n- isEnabled - Is button enabled. Boolean. True by default\n- textChecked - Text for checked state\n- textUnchecked - Text for unchecked state\n- textColorChecked - Text color when button is checked\n- textColorUnchecked - Text color when button is unchecked\n- textSize - Text size\n- thresholdStart - Value in range [0..1] indicates how much user needs to swipe to change status from unchecked to checked. 0.5 by default\n- thresholdEnd - Value in range [0..1] indicates how much user needs to swipe to change status from checked to unchecked. 0.5 by default\n- checkedBackground - Button background drawable for checked state.\n- uncheckedBackground - Button background drawable for unchecked state.\n- checkedToggleBackground - Toggle background drawable when button is checked.\n- uncheckedToggleBackground - Toggle background drawable when button is unchecked.\n- checkedIcon - Toggle icon drawable when button is checked\n- uncheckedIcon - Toggle icon drawable when button is unchecked\n\nFor example:\n```\n\u003ccom.stfalcon.swipeablebutton.SwipeableButton\n    android:id=\"@+id/customSwipeButton2\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"wrap_content\"\n    android:layout_marginBottom=\"64dp\"\n    android:layout_marginLeft=\"16dp\"\n    android:layout_marginRight=\"16dp\"\n    app:checkedBackground=\"@drawable/shape_sample_scrolling_view_checked\"\n    app:checkedIcon=\"@drawable/ic_visible\"\n    app:checkedToggleBackground=\"@drawable/shape_sample_checked_toggle\"\n    app:durationAnimation=\"250\"\n    app:isClickToSwipeEnable=\"false\"\n    app:thresholdEnd=\"0.3\"\n    app:thresholdStart=\"0.7\"\n    app:textChecked=\"@string/checked_state_text\"\n    app:textColorChecked=\"@color/checkedTextColor\"\n    app:textColorUnChecked=\"@color/uncheckedTextColor\"\n    app:textSize=\"8sp\"\n    app:textUnchecked=\"@string/unchecked_state_text\"\n    app:uncheckedBackground=\"@drawable/shape_sample_scrolling_view_unchecked\"\n    app:uncheckedIcon=\"@drawable/ic_usvisible\"\n    app:uncheckedToggleBackground=\"@drawable/shape_sample_unchecked_toggle\" /\u003e\n```\nAlso you can set them programmatically:\n```\nswipeableButton.isChecked = true\nswipeableButton.isEnable = true\nswipeableButton.checkedText = \"Checked text\"\nswipeableButton.uncheckedText = \"Unchecked text\"\nswipeableButton.textSize = resources.getDimensionPixelSize(R.dimen.default_text_size).toFloat()\nswipeableButton.swipeProgressToFinish = 0.1\nswipeableButton.swipeProgressToStart = 0.3\nswipeableButton.checkedTextColor = ContextCompat.getColor(this,R.color.checkedTextColor)\nswipeableButton.uncheckedTextColor = ContextCompat.getColor(this,R.color.uncheckedTextColor)\nswipeableButton.checkedBackground = ContextCompat.getDrawable(this, R.drawable.shape_sample_scrolling_view_checked)\nswipeableButton.uncheckedBackground = ContextCompat.getDrawable(this, R.drawable.shape_sample_scrolling_view_unchecked)\nswipeableButton.checkedToggleBackground = ContextCompat.getDrawable(this, R.drawable.shape_sample_checked_toggle)\nswipeableButton.uncheckedToggleBackground = ContextCompat.getDrawable(this, R.drawable.shape_sample_unchecked_toggle)\nswipeableButton.checkedIcon = ContextCompat.getDrawable(this, R.drawable.ic_done_black)\nswipeableButton.uncheckedIcon = ContextCompat.getDrawable(this, R.drawable.ic_pause_black)\n```\nIf you want to change the state programmatically with animation you should use `setSwipeButtonState` method:\n```\nanimateBtn.setOnClickListener {\n   swipeButton.setSwipeButtonState(!swipeableButton.isChecked)\n}\n```\nIf you want to get event from swipable-button you need to add next listeners:\n - `onSwipedListener`\n - `onSwipedOnListener`\n - `onSwipedOffListener`\n\nLet's take look a small sample:\n```\ncustomSwipeButton.onSwipedListener = {\n   Log.d(TAG, \"onSwiped\")\n}\ncustomSwipeButton.onSwipedOnListener = {\n   Log.d(TAG, \"onSwipedOn\")\n}\ncustomSwipeButton.onSwipedOffListener = {\n   Log.d(TAG, \"onSwipedOff\")\n}\n```\n## License\n```\nCopyright 2018 stfalcon.com\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%2Fstfalcon-studio%2Fswipeable-button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstfalcon-studio%2Fswipeable-button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstfalcon-studio%2Fswipeable-button/lists"}