{"id":21313821,"url":"https://github.com/akexorcist/screenorientationhelper","last_synced_at":"2025-07-12T01:30:47.419Z","repository":{"id":57716661,"uuid":"85801146","full_name":"akexorcist/ScreenOrientationHelper","owner":"akexorcist","description":"[Android] Screen orientation event listener helper for activity in Android","archived":false,"fork":false,"pushed_at":"2020-11-25T16:12:47.000Z","size":139,"stargazers_count":17,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-07T10:01:29.130Z","etag":null,"topics":["android","android-library","java"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/akexorcist.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":"2017-03-22T08:03:49.000Z","updated_at":"2022-06-19T08:12:58.000Z","dependencies_parsed_at":"2022-08-23T22:00:52.131Z","dependency_job_id":null,"html_url":"https://github.com/akexorcist/ScreenOrientationHelper","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akexorcist%2FScreenOrientationHelper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akexorcist%2FScreenOrientationHelper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akexorcist%2FScreenOrientationHelper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akexorcist%2FScreenOrientationHelper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akexorcist","download_url":"https://codeload.github.com/akexorcist/ScreenOrientationHelper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225778863,"owners_count":17522710,"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","java"],"created_at":"2024-11-21T18:08:54.109Z","updated_at":"2024-11-21T18:08:54.741Z","avatar_url":"https://github.com/akexorcist.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.akexorcist/screenorientationhelper/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.akexorcist/screenorientationhelper)\n\n# ScreenOrientationHelper\nScreen orientation event listener helper for activity\n\nUse onCofigurationChanged() doesn't works for detected screen orientation. That made configuration change doesn't works when user rotate the screen. So I build this library to solved the problem with better solution.\n\nDownload\n===============================\n\nMaven\n```\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.akexorcist\u003c/groupId\u003e\n  \u003cartifactId\u003escreenorientationhelper\u003c/artifactId\u003e\n  \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nGradle\n```\ncompile 'com.akexorcist:screenorientationhelper:1.0.0'\n```\n\nUsage\n===============================\nThis library should be implemented on base activity class that you want to detect the screen orientation\n```java\npublic class BaseActivity extends AppCompatActivity implements ScreenOrientationHelper.ScreenOrientationChangeListener {\n    private ScreenOrientationHelper helper = new ScreenOrientationHelper(this);\n\n    @Override\n    protected void onCreate(@Nullable Bundle savedInstanceState) {\n        super.onCreate(savedInstanceState);\n        helper.onCreate(savedInstanceState);\n        helper.setScreenOrientationChangeListener(this);\n    }\n\n    @Override\n    protected void onStart() {\n        super.onStart();\n        helper.onStart();\n    }\n\n    @Override\n    protected void onSaveInstanceState(Bundle outState) {\n        super.onSaveInstanceState(outState);\n        helper.onSaveInstanceState(outState);\n    }\n\n    @Override\n    protected void onRestoreInstanceState(Bundle savedInstanceState) {\n        super.onRestoreInstanceState(savedInstanceState);\n        helper.onRestoreInstanceState(savedInstanceState);\n    }\n\n    @Override\n    public void onScreenOrientationChanged(int orientation) {\n\n    }\n\n    ...\n}\n```\n\nThen extends your activity from this base class and override the onScreenOrientationChanged method\n```java\npublic class MainActivity extends BaseActivity {\n\n    ...\n\n    @Override\n    public void onScreenOrientationChanged(int orientation) {\n        // Do something when screen orientation changed\n    }\n}\n```\nDone! So easy, right?\n\n\nLicence\n===========================\nCopyright 2017 Akexorcist\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakexorcist%2Fscreenorientationhelper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakexorcist%2Fscreenorientationhelper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakexorcist%2Fscreenorientationhelper/lists"}