File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
app/src/main/java/it/niedermann/owncloud/notes/edit Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 2020
2121import androidx .annotation .NonNull ;
2222import androidx .annotation .Nullable ;
23+ import androidx .core .graphics .Insets ;
24+ import androidx .core .view .ViewCompat ;
25+ import androidx .core .view .WindowCompat ;
26+ import androidx .core .view .WindowInsetsCompat ;
2327import androidx .fragment .app .Fragment ;
2428import androidx .preference .PreferenceManager ;
2529
30+ import com .nextcloud .android .common .ui .util .extensions .AppCompatActivityExtensionsKt ;
2631import com .nextcloud .android .sso .exceptions .NextcloudFilesAppAccountNotFoundException ;
2732import com .nextcloud .android .sso .exceptions .NoCurrentAccountSelectedException ;
2833import com .nextcloud .android .sso .helper .SingleAccountHelper ;
@@ -101,6 +106,26 @@ protected void onCreate(final Bundle savedInstanceState) {
101106
102107 setSupportActionBar (binding .toolbar );
103108 binding .toolbar .setOnClickListener ((v ) -> fragment .showEditTitleDialog ());
109+ setImeInsets ();
110+ }
111+
112+ private void setImeInsets () {
113+ ViewCompat .setOnApplyWindowInsetsListener (this .getWindow ().getDecorView (), (v , insets ) -> {
114+ Insets imeInsets = insets .getInsets (WindowInsetsCompat .Type .ime ());
115+ Insets navBarInsets = insets .getInsets (WindowInsetsCompat .Type .navigationBars ());
116+
117+ // Apply bottom padding when keyboard is shown
118+ int bottomPadding = Math .max (imeInsets .bottom , navBarInsets .bottom );
119+
120+ v .setPadding (
121+ v .getPaddingLeft (),
122+ v .getPaddingTop (),
123+ v .getPaddingRight (),
124+ bottomPadding
125+ );
126+
127+ return insets ;
128+ });
104129 }
105130
106131 @ Override
You can’t perform that action at this time.
0 commit comments