{"id":13639332,"url":"https://github.com/polyak01/IconSwitch","last_synced_at":"2025-04-19T22:32:16.462Z","repository":{"id":118737901,"uuid":"86771222","full_name":"polyak01/IconSwitch","owner":"polyak01","description":"🍭 Custom Android Switch widget","archived":false,"fork":false,"pushed_at":"2019-01-23T10:21:30.000Z","size":1142,"stargazers_count":900,"open_issues_count":7,"forks_count":118,"subscribers_count":23,"default_branch":"master","last_synced_at":"2024-08-03T01:14:27.860Z","etag":null,"topics":["android","android-library","custom-view","java","options","selector","switch","view","widget"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/polyak01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2017-03-31T02:51:29.000Z","updated_at":"2024-08-02T07:53:19.000Z","dependencies_parsed_at":"2023-05-06T16:06:48.290Z","dependency_job_id":null,"html_url":"https://github.com/polyak01/IconSwitch","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/polyak01%2FIconSwitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyak01%2FIconSwitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyak01%2FIconSwitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/polyak01%2FIconSwitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/polyak01","download_url":"https://codeload.github.com/polyak01/IconSwitch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223810357,"owners_count":17206748,"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","custom-view","java","options","selector","switch","view","widget"],"created_at":"2024-08-02T01:00:59.684Z","updated_at":"2024-11-09T09:30:51.099Z","avatar_url":"https://github.com/polyak01.png","language":"Java","readme":"# IconSwitch\n\nThe library is a custom Switch widget inspired by this [dribbble shot](https://dribbble.com/shots/2978168-Map-to-list-view). \n\n![GifSample](https://github.com/polyak01/IconSwitch/blob/master/data/3J8gYHy.gif)\n\n## Gradle \nAdd this into your dependencies block.\n```\ncompile 'com.polyak:icon-switch:1.0.0'\n```\n## Sample\nPlease see the [sample app](sample/src/main) for a library usage example.\n\n## Wiki\n#### Usage:\nSimply add an IconSwitch to your view hieararchy. Either programatically or using xml:\n```xml\n\u003ccom.polyak.iconswitch.IconSwitch\n  android:id=\"@+id/icon_switch\"\n  android:layout_width=\"wrap_content\"\n  android:layout_height=\"wrap_content\"\n  app:isw_icon_left=\"@drawable/ic_format_list_bulleted_white_18dp\"\n  app:isw_icon_right=\"@drawable/ic_location_on_white_18dp\" /\u003e\n```\n\n### API\n#### General\nSize of the widget is controlled by the attribute:\n```xml\n\u003ccom.polyak.iconswitch.IconSwitch\n  android:isw_icon_size=\"@dimen/your_size\" /\u003e\n```\nDefault selection can be set using:\n```xml\n\u003ccom.polyak.iconswitch.IconSwitch\n  android:isw_default_selection=\"left|right\" /\u003e\n```\nTo control the current state or get information about it, use:\n```java\niconSwitch.setChecked();\niconSwitch.getChecked();\niconSwitch.toggle();\n```\n\n#### Color\nTo customize colors of the widget, you can use the following self-explanatory attributes:\n```xml\n\u003ccom.polyak.iconswitch.IconSwitch\n  app:isw_background_color=\"#fff\"\n  app:isw_thumb_color_left=\"#fff\"\n  app:isw_thumb_color_right=\"#fff\"\n  app:isw_inactive_tint_icon_left=\"#fff\"\n  app:isw_inactive_tint_icon_right=\"#fff\"\n  app:isw_active_tint_icon_left=\"#fff\"\n  app:isw_active_tint_icon_right=\"#fff\" /\u003e\n```\nor setter-methods:\n```java\niconSwitch.setBackgroundColor(color);\niconSwitch.setThumbColorLeft(color);\niconSwitch.setThumbColorRight(color);\niconSwitch.setActiveTintIconLeft(color);\niconSwitch.setInactiveTintIconLeft(color);\niconSwitch.setActiveTintIconRight(color);\niconSwitch.setInactiveTintIconRight(color);\n```\n\n#### Callback\nTo listen for the check changed events use:\n```java\niconSwitch.setCheckedChangeListener(listener);\n\npublic interface CheckedChangeListener {\n  void onCheckChanged(Checked current);\n}\n\nenum Checked { LEFT, RIGHT }\n```\n\n## License\n```\nCopyright 2017 Yaroslav Polyakov\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\nhttp://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","funding_links":[],"categories":["SwitchButton"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyak01%2FIconSwitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpolyak01%2FIconSwitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpolyak01%2FIconSwitch/lists"}