{"id":13396293,"url":"https://github.com/gjiazhe/PanoramaImageView","last_synced_at":"2025-03-13T22:31:59.276Z","repository":{"id":37431428,"uuid":"77010989","full_name":"gjiazhe/PanoramaImageView","owner":"gjiazhe","description":"An imageView can auto scroll with device rotating.","archived":false,"fork":false,"pushed_at":"2022-07-21T17:48:22.000Z","size":2399,"stargazers_count":2169,"open_issues_count":9,"forks_count":245,"subscribers_count":42,"default_branch":"master","last_synced_at":"2024-08-31T14:46:59.234Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gjiazhe.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}},"created_at":"2016-12-21T03:06:25.000Z","updated_at":"2024-08-21T13:04:30.000Z","dependencies_parsed_at":"2022-07-21T09:02:32.256Z","dependency_job_id":null,"html_url":"https://github.com/gjiazhe/PanoramaImageView","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/gjiazhe%2FPanoramaImageView","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gjiazhe%2FPanoramaImageView/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gjiazhe%2FPanoramaImageView/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gjiazhe%2FPanoramaImageView/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gjiazhe","download_url":"https://codeload.github.com/gjiazhe/PanoramaImageView/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243494142,"owners_count":20299770,"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-07-30T18:00:44.100Z","updated_at":"2025-03-13T22:31:58.910Z","avatar_url":"https://github.com/gjiazhe.png","language":"Java","funding_links":[],"categories":["Index `(light-weight pages)`","ImageView","Index"],"sub_categories":[],"readme":"# PanoramaImageView\n\nAn imageView can auto scroll with device rotating.\n\n## ScreenShots\n\n\u003cimg src=\"screenshots/recyclerview_sample.gif\" width=\"270\"\u003e\n\u003cimg src=\"screenshots/horizontal_sample.gif\" width=\"270\"\u003e\n\u003cimg src=\"screenshots/vertical_sample.gif\" width=\"270\"\u003e\n\n\n## Include PanoramaImageView to Your Project\n\nWith gradle:\n\n```groovy\ndependencies {\n   compile 'com.gjiazhe:PanoramaImageView:1.0'\n}\n```\n\n## Use PanoramaImageView in Layout File Just Like ImageView\n\n```xml\n\u003ccom.gjiazhe.panoramaimageview.PanoramaImageView\n    android:id=\"@+id/panorama_image_view\"\n    android:layout_width=\"match_parent\"\n    android:layout_height=\"match_parent\"\n    android:src=\"@drawable/img\"\n    app:piv_enablePanoramaMode=\"true\"\n    app:piv_show_scrollbar=\"true\"\n    app:piv_invertScrollDirection=\"false\" /\u003e\n```\n## Description of Attributes\n|        Attributes         | Format  | Default |             Description             |\n| :-----------------------: | :-----: | :-----: | :---------------------------------: |\n|  piv_enablePanoramaMode   | boolean |  true   |   Enable panorama effect or not.    |\n|    piv_show_scrollbar     | boolean |  true   |       Show scrollbar or not.        |\n| piv_invertScrollDirection | boolean |  false  | Invert the scroll direction or not. |\n\nAll the attributes can also be set in java code:\n\n```java\npanoramaImageView.setEnablePanoramaMode(true);\npanoramaImageView.setEnableScrollbar(true);\npanoramaImageView.setInvertScrollDirection(false);\n```\n\n## Register the GyroscopeObserver\n\nIn Activity or Fragment using PanoramaImageView, you should __register the GyroscopeObserver in onResume()__ and __remember to unregister it in onPause()__.\n\n```java\npublic class MyActivity extends AppCompatActivity {\n  \n    private GyroscopeObserver gyroscopeObserver;\n\n    @Override\n    protected void onCreate(Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        setContentView(R.layout.activity_main);\n        // Initialize GyroscopeObserver.\n        gyroscopeObserver = new GyroscopeObserver();\n        // Set the maximum radian the device should rotate to show image's bounds.\n        // It should be set between 0 and π/2.\n        // The default value is π/9.\n      \tgyroscopeObserver.setMaxRotateRadian(Math.PI/9);\n\n        PanoramaImageView panoramaImageView = (PanoramaImageView) findViewById(R.id.panorama_image_view);\n        // Set GyroscopeObserver for PanoramaImageView.\n        panoramaImageView.setGyroscopeObserver(gyroscopeObserver);\n    }\n\n    @Override\n    protected void onResume() {\n        super.onResume();\n        // Register GyroscopeObserver.\n        gyroscopeObserver.register(this);\n    }\n\n    @Override\n    protected void onPause() {\n        super.onPause();\n        // Unregister GyroscopeObserver.\n        gyroscopeObserver.unregister();\n    }\n}\n```\n\n## Set OnPanoramaScrollListener to observe scroll state\n\nIf you want to get callback when the image scrolls, set an OnPanoramaScrollListener for PanoramaImageView.\n\n```java\npanoramaImageView.setOnPanoramaScrollListener(new PanoramaImageView.OnPanoramaScrollListener() {\n    @Override\n    public void onScrolled(PanoramaImageView view, float offsetProgress) {\n        // Do something here.\n        // The offsetProgress range from -1 to 1, indicating the image scrolls\n        // from left(top) to right(bottom).\n    }\n});\n```\n\n\n\n## License\n\n    MIT License\n\n    Copyright (c) 2016 郭佳哲\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n    \n    The above copyright notice and this permission notice shall be included in all\n    copies or substantial portions of the Software.\n    \n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n    SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgjiazhe%2FPanoramaImageView","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgjiazhe%2FPanoramaImageView","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgjiazhe%2FPanoramaImageView/lists"}