0

Galaxy S8 and Note 8 devices have the new Soft Key Bar which can be both hidden and visible state chosen by the user. The problem is that I need to modify the Ui based on the size of the Key Bar. I am able to calculate the size of the bar based on the solution suggested here. It calculates the size perfectly, but it calculates the same size also when the keyboard is hidden, which means the state of the keyboard is not related to this information. Is there flag based on which could be identified this visibility?

X-HuMan
  • 1,488
  • 1
  • 17
  • 37

1 Answers1

0

You could easy check it with setting setOnSystemUiVisibilityChangeListener on you content view :

View contentView = findViewById(android.R.id.content);
contentView.setOnSystemUiVisibilityChangeListener
            (visibility -> updateHeight(contentView.getHeight()));

So contentView.getHeight() will return you real height with/without Soft Key Bar

If you want to check it when is your activity is creating - just call

contentView.post(() -> updateHeight(mContentView.getHeight()));