{"id":13641685,"url":"https://github.com/Telenav/ExpandablePager","last_synced_at":"2025-04-20T11:31:48.204Z","repository":{"id":107114794,"uuid":"52882670","full_name":"Telenav/ExpandablePager","owner":"Telenav","description":"ViewPager that slides vertically.","archived":true,"fork":false,"pushed_at":"2016-03-22T10:53:29.000Z","size":13369,"stargazers_count":714,"open_issues_count":0,"forks_count":92,"subscribers_count":30,"default_branch":"master","last_synced_at":"2024-08-03T01:24:27.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Telenav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2016-03-01T14:26:30.000Z","updated_at":"2024-02-22T11:49:08.000Z","dependencies_parsed_at":"2024-01-14T11:07:34.198Z","dependency_job_id":"e6317420-bc94-4743-94da-89e11dfe08fb","html_url":"https://github.com/Telenav/ExpandablePager","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/Telenav%2FExpandablePager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telenav%2FExpandablePager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telenav%2FExpandablePager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Telenav%2FExpandablePager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Telenav","download_url":"https://codeload.github.com/Telenav/ExpandablePager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223827545,"owners_count":17209804,"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":[],"created_at":"2024-08-02T01:01:23.051Z","updated_at":"2024-11-09T12:30:47.269Z","avatar_url":"https://github.com/Telenav.png","language":"Java","funding_links":[],"categories":["ViewPager","Libs"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"readme":"[ ![Download](https://api.bintray.com/packages/dimatim/maven/ExpandablePager/images/download.svg) ](https://bintray.com/dimatim/maven/ExpandablePager/_latestVersion)\n[![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-ExpandablePager-blue.svg?style=flat)](http://android-arsenal.com/details/1/3278)\n\n# ExpandablePager\nLayout that contains a ViewPager and can slide vertically between 2 states (expanded and collapsed).\n\n![alt tag](https://github.com/Telenav/ExpandablePager/blob/master/gif/expandablepager.gif?token=AMYIVqqzN85dOdOY4DOfk2wC-i8R7RxNks5W1HArwA%3D%3D \"Demo\")\n#Requirements\nAndroid 4.0+ (Ice Cream Sandwich and later)\n#Setup\n###Step 1\nAdd the following line to the ```dependencies``` section of your ```build.gradle``` file\n```gradle\ncompile 'com.telenav.expandablepager:expandablepager:0.2.1'\n```\n###Step 2\nExtend desired adapter:\n- ExpandablePagerAdapter (don't forget to override `instantiateItem`)\n```java\npublic class MyAdapter extends ExpandablePagerAdapter\u003cBook\u003e {\n    \n    ...\n\n    @Override\n    public Object instantiateItem(ViewGroup container, int position) {\n        final ViewGroup rootView = (ViewGroup) LayoutInflater.from(container.getContext()).inflate(R.layout.page, container, false); //inflate view\n\n        ...\n\n        return attach(container, rootView, position); //don't forget to return the result of attach()\n    }\n}\n```\n- ExpandableFragmentPagerAdapter\n- ExpandableFragmentStatePagerAdapter\n\n###Step 3\nAdd ExpandablePager to a layout\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\nRelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    xmlns:app=\"http://schemas.android.com/apk/res-auto\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\u003e\n\n    \u003ccom.telenav.expandablepager.ExpandablePager\n        android:id=\"@+id/container\"\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"match_parent\"\n        android:layout_gravity=\"bottom\"\n        android:layout_alignParentBottom=\"true\" /\u003e //pin the pager to the bootom of the screen using layout_gravity or layout_alignParentBottom\n\u003c/RelativeLayout\u003e\n```\n###Step 4\nCreate and pass your adapter to the ExpandablePager\n```java \n    MyAdapter adapter = new MyAdapter(myData);\n    ExpandablePager pager = (ExpandablePager) findViewById(R.id.container);\n    pager.setAdapter(adapter);\n```\n###Step 5 (optional)\n* Set collapsed height \u0026 animation duration via xml\n```xml \n    app:animation_duration=\"200\"\n    app:collapsed_height=\"@dimen/header_height\"\n```\nor programmatically\n```java \n    pager.setAnimationDuration(duration);\n    pager.setCollapsedHeight((int) getResources().getDimension(R.dimen.header_height));\n```\n* Set display mode (MODE_REGULAR or MODE_FIXED)\n```java \n    pager.setMode(ExpandablePager.MODE_REGULAR);\n```\n#Extras\nChange pager state (supported states are STATE_COLLAPSED, STATE_EXPANDED, and STATE_HIDDEN) \n```java  \n    pager.setState(ExpandablePager.STATE_COLLAPSED)\n```\nAnimate pager state change\n```java  \n    pager.animateToState(ExpandablePager.STATE_COLLAPSED)\n```\nSet current item\n```java  \n    pager.setCurrentItem(index, false);\n```\nSet listeners\n```java\n    pager.setOnSliderStateChangeListener(new OnSliderStateChangeListener() {\n\n        @Override\n        public void onStateChanged(View page, int index, int state) {\n            ...\n        }\n\n        @Override\n        public void onPageChanged(View page, int index, int state) {\n            ...\n        }\n    });\n    \n    pager.setOnItemSelectedListener(new OnItemSelectedListener() {\n        @Override\n        public void onItemSelected(List\u003c?\u003e items, int index) {\n            ...\n        }\n    });\n```\n\n#Sample\nFor a more detailed example check the [demoapp](https://github.com/Telenav/ExpandablePager/tree/master/demoapp) module.\n\n#License\n[Apache License, Version 2.0](https://github.com/Telenav/ExpandablePager/blob/master/LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTelenav%2FExpandablePager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTelenav%2FExpandablePager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTelenav%2FExpandablePager/lists"}