{"id":13463646,"url":"https://github.com/OpenSooq/Pluto","last_synced_at":"2025-03-25T09:31:05.703Z","repository":{"id":45838938,"uuid":"183791119","full_name":"OpenSooq/Pluto","owner":"OpenSooq","description":"Pluto is an Easy, lightweight and high performance slider view library for Android. You have the flexibility to customize it to any view since it based RecyclerView.","archived":false,"fork":false,"pushed_at":"2020-11-30T12:55:02.000Z","size":32517,"stargazers_count":109,"open_issues_count":8,"forks_count":16,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-17T17:57:55.199Z","etag":null,"topics":["android","image","kotlin","library","slider"],"latest_commit_sha":null,"homepage":"https://engineering.opensooq.com","language":"Kotlin","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/OpenSooq.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}},"created_at":"2019-04-27T15:37:04.000Z","updated_at":"2023-12-10T08:33:33.000Z","dependencies_parsed_at":"2022-08-31T13:43:35.145Z","dependency_job_id":null,"html_url":"https://github.com/OpenSooq/Pluto","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenSooq%2FPluto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenSooq%2FPluto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenSooq%2FPluto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpenSooq%2FPluto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpenSooq","download_url":"https://codeload.github.com/OpenSooq/Pluto/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245435076,"owners_count":20614823,"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","image","kotlin","library","slider"],"created_at":"2024-07-31T14:00:25.299Z","updated_at":"2025-03-25T09:31:00.694Z","avatar_url":"https://github.com/OpenSooq.png","language":"Kotlin","funding_links":[],"categories":["Android"],"sub_categories":[],"readme":"\u003ca href=\"https://opensooq.com/\"\u003e\n    \u003cimg src=\"https://opensooqui2.os-cdn.com/os_web/desktop/opensooq-logo.svg\" alt=\"OpenSooq logo\" title=\"OpenSooq\" align=\"right\" height=\"70\" /\u003e\n\u003c/a\u003e\n\nPluto [Android Slider View Library]\n======================\n![API](https://img.shields.io/badge/API-17%2B-green.svg?style=flat) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Pluto-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/7641)\n\n:star: Star us on GitHub — it helps!\n\n[![forthebadge](https://forthebadge.com/images/badges/built-with-love.svg)](https://forthebadge.com)\n\n##### Pluto is an Easy, lightweight  and high performance slider view library for Android!  You can customize it to any view since it based RecyclerView. The differnce of this library, we are not following the concept of images model. Pluto is not depending on any Image loading library \n\n\n\nDemo\n======================\n\u003cimg src=\"https://github.com/OpenSooq/Pluto/blob/master/demoassets/demo_1.gif\"  height=\"440\" /\u003e \u003cimg src=\"https://github.com/OpenSooq/Pluto/blob/master/demoassets/demo_2.gif\"  height=\"440\" /\u003e\n\n## Table of content\n\n* [Download](#download)\n* [Sample Project](#sample-project)\n* [Usage](#usage)\n* [Event Listeners](#event-listeners)\n* [Custom indicator](#Custom-indicator)\n- [License](#license)\n\n# Download\n\nThis library is available in **jCenter** which is the default Maven repository used in Android Studio. You can also import this library from source as a module.\n \n```groovy\ndependencies {\n    // other dependencies here\n    implementation 'com.opensooq.android:pluto:1.6'\n}\n```\n\n\n# Sample Project\nWe have a sample project demonstrating how to use the library.\n\nCheckout the demo  [here](https://github.com/OpenSooq/Pluto/tree/master/app/src/main/java/com/opensooq/plutodemo)\n\n\n\n# Usage\n#### First create your own adapter extending the ``PlutoAdapter``\n\n### Kotlin\n```kotlin\nclass YourAdapter(items: MutableList\u003cYourModel\u003e , onItemClickListener: OnItemClickListener\u003cMovie\u003e? = null)\n    : PlutoAdapter\u003cYourModel, YourViewHolder\u003e(items,onItemClickListener) {\n\n    override fun getViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {\n        return ViewHolder(parent, R.layout.item_your_layout)\n    }\n\n    class YourViewHolder(parent: ViewGroup, itemLayoutId: Int) : PlutoViewHolder\u003cYourModel\u003e(parent, itemLayoutId) {\n        private var ivPoster: ImageView = getView(R.id.iv_poster)\n        private var tvRating: TextView = getView(R.id.tv_rating)\n\n        override fun set(item: YourModel, position: Int) {\n           //  yourImageLoader.with(mContext).load(item.getPosterId()).into(ivPoster);\n            tvRating.text = item.imdbRating\n        }\n    }\n}\n```\n### Java\n\n```java\npublic class YourAdapter extends PlutoAdapter\u003cYourModel, YourViewHolder\u003e {\n\n    public YourAdapter(List\u003cYourModel\u003e items) {\n        super(items);\n    }\n\n    @Override\n    public ViewHolder getViewHolder(ViewGroup parent, int viewType) {\n        return new YourViewHolder(parent, R.layout.item_your_layout);\n    }\n\n    public static class YourViewHolder extends PlutoViewHolder\u003cYourModel\u003e {\n        ImageView ivPoster;\n        TextView tvRating;\n\n        public YourViewHolder(ViewGroup parent, int itemLayoutId) {\n            super(parent, itemLayoutId);\n            ivPoster = getView(R.id.iv_poster);\n            tvRating = getView(R.id.tv_rating);\n        }\n\n        @Override\n        public void set(YourModel item, int pos) {\n           //  yourImageLoader.with(mContext).load(item.getPosterId()).into(ivPoster);\n            tvRating.setText(item.getImdbRating());\n        }\n    }\n}\n```\n#### Then in your xml \n```XML\n\u003ccom.opensooq.pluto.PlutoView\n        android:id=\"@+id/slider_view\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"wrap_content\"\n        app:indicator_visibility=\"true\"\n        app:layout_constraintEnd_toEndOf=\"parent\"\n        app:layout_constraintStart_toStartOf=\"parent\"\n        app:layout_constraintTop_toTopOf=\"parent\"/\u003e\n``` \n### finaly attach the adapter to Pluto \n### Kotlin\n```kotlin\nval pluto = findViewById\u003cPlutoView\u003e(R.id.slider_view)\n        val yourAdapter = YourAdapter(yourModelList, object : OnItemClickListener\u003cMovie\u003e {\n            override fun onItemClicked(item: yourModel?, position: Int) {\n            }\n        })\n\n        pluto.create(adapter, lifecycle = lifecycle)//pass the lifecycle to make the slider aware of lifecycle to avoid memory leak and handling the pause/destroy/resume \n        \n```\n### Java\n```java\n  PlutoView pluto = findViewById(R.id.slider_view);\n        YourAdapter adapter = new YourAdapter(yourModelsList);\n        pluto.create(adapter,getLifecycle());  //pass the lifecycle to make the slider aware of lifecycle to avoid memory leak and handling the pause/destroy/resume    \n```\n| Method | usage |\n| ------ | ------ |\n| ``` create(PlutoAdapter adapter, long duration,Lifecycle lifecyle)``` | it is the initialization method it take your adapter and the duration of waiting between each slide and lifecycle to make slider lifecylce-aware |\n| ``` startAutoCycle() ``` | by default the value of autocycle is true, it determine to start autocycling or not  |\n| ``` stopAutoCycle() ``` | it stops the auto cycling of the view |\n| ``` moveNextPosition() ``` | if you are the auto cylce is off you can manually move next with this method  |\n| ``` movePrevPosition() ``` | if you are the auto cylce is off you can manually move to the previus item with this method |\n| ``` setIndicatorPosition(IndicatorPosition presetIndicator) ``` | to set the position of the indicator where values are ```CENTER_BOTTOM```   ```RIGHT_BOTTOM```    ```LEFT_BOTTOM``` ```CENTER_TOP``` ```RIGHT_TOP``` ```LEFT_TOP```|\n| ``` setCustomIndicator(PlutoIndicator indicator) ``` | if you want to custom the indicator use this method for custom indicators check [Custom indicators](#indicator) |\n\n# Event Listeners \n### for item click listener its the responsibility of the ```PlutoAdapter```  to handle it, \n#### Example \n### Kotlin\n```kotlin\n        val adapter = SliderAdapter(getAvenger(), object : OnItemClickListener\u003cMovie\u003e {\n            override fun onItemClicked(item: Movie?, position: Int) {\n                //handle click\n            }\n\n        })\n\t//or\n        adapter.setOnItemClickListener(object : OnItemClickListener\u003cMovie\u003e {\n            override fun onItemClicked(item: Movie?, position: Int) {\n                //handle click \n            }\n        })\n\n```\n### Java\n```java \n\n        SliderAdapter adapter = new SliderAdapter(getAvengers(), (item, position) -\u003e {\n            //handle clickhere\n        });\n        //or\n        adapter.setOnItemClickListener((item, position) -\u003e {\n            //handle click here\n        });\n```\n### you can attach listener to the ```PlutoView``` to listen for sliding event \n#### Example \n\n### Kotlin\n```kotlin\n\n        pluto.setOnSlideChangeListener(object : OnSlideChangeListener {\n            override fun onSlideChange(adapter: PlutoAdapter\u003c*, *\u003e, position: Int) {\n\n            }\n        })\n```\n### Java\n\n```java \n\n       pluto.setOnSlideChangeListener(new OnSlideChangeListener() {\n            @Override\n            public void onSlideChange(PlutoAdapter adapter, int position) {\n                \n            }\n        });\n```\n\n\n\n# Custom indicator\nAdd the following xml to your layout:\n\n```xml\n\u003ccom.opensooq.pluto.PlutoIndicator\n\t\tandroid:id=\"@+id/custom_indicator\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n/\u003e\n```\n### Customizable Properties\n\n|\t\tProperty\t\t|\t\tDescription\t\t|\n|:----------------------|:---------------------:|\n|\t\t`shape`\t\t\t|\t`oval` \u0026#124; `rect`\t\t\t|\n|\t\t`visibility`\t\t|\t`visible` \u0026#124; `invisible`\t|\n|\t`selected_drawable unselected_drawable`\t| You can use an image or custom drawable as the indicator. If you decide to use your own drawable, then the built-in drawable and the properties associated with the built-in drawable will not work. |\n|\t`selected_color` `unselected_color`   | the color of the indicator |\n|\t`selected_width` `unselected_width`   | the width of the shape     |\n|\t`selected_height` `unselected_height` | the height of the shape    |\n|`selected_padding_left` `unselected_padding_left` `selected_padding_right` `unselected_padding_right` `selected_padding_top` `unselected_padding_top` `selected_padding_bottom` `unselected_padding_bottom` | the padding of the indicator |\n\n#### Examples\n\n![Demo-1](http://ww3.sinaimg.cn/mw690/610dc034jw1eh7metysj6j201y0150jn.jpg)\n```xml\n    \u003ccom.opensooq.pluto.PlutoIndicator\n        android:id=\"@+id/custom_indicator\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        custom:selected_color=\"#555555\"\n        custom:unselected_color=\"#55555555\"\n        custom:shape=\"oval\"\n        custom:selected_padding_left=\"3dp\"\n        custom:selected_padding_right=\"3dp\"\n        custom:unselected_padding_left=\"3dp\"\n        custom:unselected_padding_right=\"3dp\"\n        custom:selected_width=\"8dp\"\n        custom:selected_height=\"8dp\"\n        custom:unselected_width=\"4dp\"\n        custom:unselected_height=\"4dp\"\n        /\u003e\n```\n\n***\n\n![Demo-2](http://ww2.sinaimg.cn/mw690/610dc034jw1eh7ml8me63j203h00z3y9.jpg)\n\t\n```xml\n    \u003ccom.opensooq.pluto.PlutoIndicator\n        android:id=\"@+id/custom_indicator\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        custom:selected_color=\"#FF5500\"\n        custom:unselected_color=\"#55333333\"\n        custom:shape=\"rect\"\n        custom:selected_padding_left=\"2dp\"\n        custom:selected_padding_right=\"2dp\"\n        custom:unselected_padding_left=\"2dp\"\n        custom:unselected_padding_right=\"2dp\"\n        custom:selected_width=\"16dp\"\n        custom:selected_height=\"3dp\"\n        custom:unselected_width=\"16dp\"\n        custom:unselected_height=\"3dp\"\n        /\u003e\n```\n\n***\n\n![Demo-3](http://ww4.sinaimg.cn/mw690/610dc034jw1eh7mp7q3fxj202900y3y9.jpg)\n```xml\n    \u003ccom.opensooq.pluto.PlutoIndicator\n        android:id=\"@+id/custom_indicator\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        custom:selected_color=\"#0095BF\"\n        custom:unselected_color=\"#55333333\"\n        custom:shape=\"rect\"\n        custom:selected_padding_left=\"2dp\"\n        custom:selected_padding_right=\"2dp\"\n        custom:unselected_padding_left=\"2dp\"\n        custom:unselected_padding_right=\"2dp\"\n        custom:selected_width=\"6dp\"\n        custom:selected_height=\"6dp\"\n        custom:unselected_width=\"6dp\"\n        custom:unselected_height=\"6dp\"\n        /\u003e\n```\n\n***\n\n![Demo-4](http://ww4.sinaimg.cn/mw690/610dc034jw1eh7n82vqk3j203401e0sh.jpg)\n```xml\n    \u003ccom.opensooq.pluto.PlutoIndicator\n        android:id=\"@+id/custom_indicator\"\n        android:layout_width=\"wrap_content\"\n        android:layout_height=\"wrap_content\"\n        android:gravity=\"center\"\n        custom:selected_color=\"#0095BF\" \n        custom:unselected_color=\"#55333333\"\n        custom:selected_drawable=\"@drawable/bird\"\n        custom:shape=\"oval\"\n        custom:selected_padding_left=\"6dp\"\n        custom:selected_padding_right=\"6dp\"\n        custom:unselected_padding_left=\"2dp\"\n        custom:unselected_padding_right=\"2dp\"\n        custom:selected_width=\"6dp\"\n        custom:selected_height=\"6dp\"\n        custom:unselected_width=\"6dp\"\n        custom:unselected_height=\"6dp\"\n        /\u003e\n```\n\n**NOTE**: Because a custom image is used for the indicator, following properties will not work: \n\n- `custom:selected_color`\n- `custom:selected_width`\n- `custom:selected_height`\n- `custom:shape`\n- `custom:color`\n- `custom:width`\n- `custom:height`\n\n### Preset Styles\n\nSource is [here](https://github.com/OpenSooq/Pluto/blob/master/pluto/src/main/res/values/styles.xml).\n\nPreset-1:\n\n![](http://ww3.sinaimg.cn/mw690/610dc034jw1ehdhc9drczj202l0160p7.jpg)\n```xml\n    \u003ccom.opensooq.pluto.PlutoIndicator\n        android:id=\"@+id/custom_indicator\"\n        style=\"@style/Pluto_Magnifier_Oval_Black\"\n        /\u003e\n```\n***\nPreset-2:\n\n![](http://ww4.sinaimg.cn/mw690/610dc034jw1ehdhc5zj9gj203a019jr5.jpg)\n```xml\n    \u003ccom.opensooq.pluto.PlutoIndicator\n        android:id=\"@+id/custom_indicator\"\n        style=\"@style/Pluto_Attractive_Rect_Blue\"\n        /\u003e\n```\n***\nPreset-3:\n\n![](http://ww2.sinaimg.cn/mw690/610dc034jw1ehdhc0hzb1j202g01aa9t.jpg)\n```xml\n    \u003ccom.opensooq.pluto.PlutoIndicator\n        android:id=\"@+id/custom_indicator\"\n        style=\"@style/Pluto_Corner_Oval_Orange\"\n        /\u003e\n```\n\n### Using the View\n\nBind it with a `PlutoView` instance.\n\n```java\npluto.setCustomIndicator(findViewById(R.id.custom_indicator));\n```\n\n\n# License\n\n```\nCopyright 2019 OpenSooq\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenSooq%2FPluto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOpenSooq%2FPluto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOpenSooq%2FPluto/lists"}