Skip to content

Instantly share code, notes, and snippets.

@THEb0nny
Created October 23, 2017 08:20
Show Gist options
  • Save THEb0nny/5ab7ce69c8a11f58e1d59c143b67847a to your computer and use it in GitHub Desktop.
Save THEb0nny/5ab7ce69c8a11f58e1d59c143b67847a to your computer and use it in GitHub Desktop.
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Log.d("Orientation", "Config changed");
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE || newConfig.orientation == Configuration.ORIENTATION_PORTRAIT) {
SharedPref.orient = SharedPref.getRotateOrientation(OverlayNavRingService.context); // Вызовем метод, который скажет в какой ориентации точно
SharedPref.displayMetric(); // Нужно же новые параметры размера записать после смены ориентации
refreshNavRingView();
}
}
public void refreshNavRingView() {
Log.d("refreshNavRingView", "refreshNavRingView called");
try { Thread.sleep(2000); }
catch (InterruptedException e) { e.printStackTrace(); }
setNavRingViewState(View.VISIBLE);
try { Thread.sleep(2000); }
catch (InterruptedException e) { e.printStackTrace(); }
setNavRingViewState(View.GONE);
Log.d("refreshNavRingView", "kek");
}
private void setNavRingViewState(int state) {
Message navRingViewState = new Message();
navRingViewState.obj = state;
OverlayNavRingService.handlerNavRingView.sendMessage(navRingViewState);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment