{"id":13537990,"url":"https://github.com/pakerfeldt/android-viewflow","last_synced_at":"2025-04-02T04:32:08.961Z","repository":{"id":1472751,"uuid":"1714530","full_name":"pakerfeldt/android-viewflow","owner":"pakerfeldt","description":"A horizontal view scroller library for Android","archived":true,"fork":false,"pushed_at":"2013-09-10T07:13:11.000Z","size":1062,"stargazers_count":1783,"open_issues_count":49,"forks_count":695,"subscribers_count":188,"default_branch":"master","last_synced_at":"2024-11-03T03:30:24.575Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pakerfeldt.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":"2011-05-07T06:09:24.000Z","updated_at":"2024-10-29T02:21:20.000Z","dependencies_parsed_at":"2022-07-07T12:44:32.380Z","dependency_job_id":null,"html_url":"https://github.com/pakerfeldt/android-viewflow","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/pakerfeldt%2Fandroid-viewflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakerfeldt%2Fandroid-viewflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakerfeldt%2Fandroid-viewflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pakerfeldt%2Fandroid-viewflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pakerfeldt","download_url":"https://codeload.github.com/pakerfeldt/android-viewflow/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246757527,"owners_count":20828914,"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-01T09:01:05.576Z","updated_at":"2025-04-02T04:32:04.803Z","avatar_url":"https://github.com/pakerfeldt.png","language":"Java","readme":"# View Flow for Android\n\nViewFlow is an Android UI widget providing a horizontally scrollable [ViewGroup](http://developer.android.com/reference/android/view/ViewGroup.html) with items populated from an [Adapter](http://developer.android.com/reference/android/widget/Adapter.html). Scroll down to the bottom of the page for a screen shot.\n\nThe component is a [Library Project](http://developer.android.com/guide/developing/eclipse-adt.html#libraryProject). This means that there's no need to copy-paste resources into your own project, simply add the viewflow component as a reference to any project.\n\n## When to use\nThis library might be suitable if you have an indeterminate number of views in your viewflow, if instead you have a static numbers of views you ought to look at Fragments and the ViewPager in the Compatibility Library instead.\n\n## Usage\n\n### In your layout\n\n    \u003corg.taptwo.android.widget.ViewFlow\n\t    android:id=\"@+id/viewflow\"\n\t    app:sidebuffer=\"5\"\n        /\u003e\n\nThe use of `app:sidebuffer` is optional. It defines the number of Views to buffer on each side of the currently shown View. The default sidebuffer is 3, making up a grand total of 7 (3 * 2 + 1) Views loaded at a time (at max).\nTo be able to use the more convenient `app:sidebuffer` attribute, the application namespace must be included in the same manner as the android namespace is. Please refer to the layout main.xml in the example project for a full example. Again, note that it's the application namespace and *not* the viewflow namespace that must be referred like `xmlns:app=\"http://schemas.android.com/apk/res/your.application.package.here\"`.\n\n### In your activity\n\n    ViewFlow viewFlow = (ViewFlow) findViewById(R.id.viewflow);\n    viewFlow.setAdapter(myAdapter);\n    \nSetting a different initial position (0 being default) is as easy as:\n\n    viewFlow.setAdapter(myAdapter, 8);\n    \nAlthough possible, you should not call `setSelection(...)` immediately after calling `setAdapter(myAdapter)` as that might load unnecessary views giving you a decrease in performance.\n\n### Listen on screen change events\n\nIf you need to listen to screen change events you would want to implement your own `ViewFlow.ViewSwitchListener` and pass it to the `setOnViewSwitchListener()` method.\n\n    viewFlow.setOnViewSwitchListener(new ViewSwitchListener() {\n        public void onSwitched(View v, int position) {\n            // Your code here\n        }\n    });\n\n### Listen on initialize view events\n\nIf you need a lazy View initialization you would want to implement your own `ViewFlow.ViewLazyInitializeListener` and pass it to the `setOnViewLazyInitializeListener()` method.\n\n    viewFlow.setOnViewLazyInitializeListener(new ViewLazyInitializeListener() {\n        public void onViewLazyInitialize(View view, int position) {\n            // Your code here e.g.\n            ((MyAdapter)((AbsListView)view).getAdapter()).initializeData();\n        }\n    });\n\n### Flow Indicator\nIt is also possible to add a flow view indicator to your layout. The purpose of a `FlowIndicator` is to present a visual representation of where in the item list focus is at. You may either implement a `FlowIndicator` yourself or use an implementation provided by the View Flow library. The View Flow library currently supports the following indicators:\n\n#### Circle Flow Indicator ####\nThis indicator shows a circle for each `View` in the adapter with a special circle representing the currently selected view (see screenshot below).\n\n\t\u003corg.taptwo.android.widget.CircleFlowIndicator\n\t\tandroid:padding=\"10dip\" android:layout_height=\"wrap_content\"\n\t\tandroid:layout_width=\"wrap_content\" android:id=\"@+id/viewflowindic\"\n\t\tandroid:background=\"#00000000\"/\u003e\n\nAnd then you'll need to connect your `ViewFlow` with the `FlowIndicator`:\n\n\tCircleFlowIndicator indic = (CircleFlowIndicator) findViewById(R.id.viewflowindic);\n\tviewFlow.setFlowIndicator(indic);\n\nBy default, the 'active' indicator moves smoothly from one 'inactive' indicator\nto the next, as the user scrolls. If you set the `snap` attribute to `true`, it\nwill instead jump to the next position when the flow settles at the next page.\n\nThe following attributes are supported: `activeColor`, `inactiveColor`,\n`activeType` (either fill or stroke), `inactiveType` (either fill or stroke),\n`fadeOut` (time in ms until indicator fades out, 0 = never), `radius`, `sync`\n(see above).\n\n#### Title Flow Indicator ####\nThis indicator presents the title of the previous, current and next `View` in the adapter (see screenshot below).\n\n\t\t\u003corg.taptwo.android.widget.TitleFlowIndicator\n\t\t\tandroid:id=\"@+id/viewflowindic\" android:layout_height=\"wrap_content\"\n\t\t\tandroid:layout_width=\"fill_parent\"\n\t\t\tapp:footerLineHeight=\"2dp\"\n\t\t\tapp:footerTriangleHeight=\"10dp\" app:textColor=\"#FFFFFFFF\" app:selectedColor=\"#FFFFC445\"\n\t\t\tapp:footerColor=\"#FFFFC445\" app:titlePadding=\"10dp\" app:textSize=\"11dp\" app:selectedSize=\"12dp\"\n\t\t\tandroid:layout_marginTop=\"10dip\"\n\t\t\tapp:clipPadding=\"5dp\" /\u003e\n\nAnd then you'll need to connect your `ViewFlow` with the `FlowIndicator`:\n\n\t\tTitleFlowIndicator indicator = (TitleFlowIndicator) findViewById(R.id.viewflowindic);\n\t\tindicator.setTitleProvider(myTitleProvider);\n\t\tviewFlow.setFlowIndicator(indicator);\n\n## Building a jar file\nIf you rather want a jar file instead of a including the project as an android library, run `ant jar` in the `android-viewflow/viewflow` folder, to build a jar file.\n\n## Caveats ##\nThe manifest states a min sdk version of 4, which is true. But in any case you want to support an api level \u003c 8 you will have to forward an `onConfigurationChanged` event to the `ViewFlow` from your `Activity`. I know this isn't a very nice solution, feel free to propose better ones!\n\n\t\t@Override\n\t\tpublic void onConfigurationChanged(Configuration newConfig) {\n\t\t\tsuper.onConfigurationChanged(newConfig);\n\t\t\tviewFlow.onConfigurationChanged(newConfig);\n\t\t}\n\n## Contributions\nThe following persons deserves a mention for their contributions:\n\n* Eric Taix\n* Marc Reichelt, \u003chttp://marcreichelt.blogspot.com/\u003e\n\n### Want to contribute?\n\nGitHub has some great articles on [how to get started with Git and GitHub](http://help.github.com/) and how to [fork a project](http://help.github.com/forking/).\n\nContributers are recommended to fork the app on GitHub (but don't have too). Create a feature branch, push the branch to git hub, press Pull Request and write a simple explanation.\n\nOne fix per commit. If let's say a commit closes the open issue 12. Just add `closes #12` in your commit message to close that issue automagically.\n\nIf you still feel uncomfortable contributing the project github-wise, don't hesistate to send a regular patch.\n\nAll code that is contributed must be compliant with [Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0.html).\n\n## License\nCopyright (c) 2011 [Patrik Åkerfeldt](http://about.me/pakerfeldt)\n\nLicensed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)\n\n![ViewFlow for Android](https://github.com/pakerfeldt/android-viewflow/raw/master/viewflow-example/screen.png \"ViewFlow for Android\") \u0026nbsp;\u0026nbsp; ![ViewFlow for Android](https://github.com/pakerfeldt/android-viewflow/raw/master/viewflow-example/screen2.png \"ViewFlow for Android\")\n\n\n\n","funding_links":[],"categories":["Java","Libs","etc"],"sub_categories":["\u003cA NAME=\"Widget\"\u003e\u003c/A\u003eWidget"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpakerfeldt%2Fandroid-viewflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpakerfeldt%2Fandroid-viewflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpakerfeldt%2Fandroid-viewflow/lists"}