chrome: greatly improve soft-keyboard visibility & layout handling
Some checks failed
CI / Rustfmt + Clippy (push) Has been cancelled
CI / Check (android) (push) Has been cancelled
CI / Test (Linux) (push) Has been cancelled
CI / Test (macOS) (push) Has been cancelled
CI / Test (Windows) (push) Has been cancelled
CI / rpm/deb (aarch64) (push) Has been cancelled
CI / rpm/deb (x86_64) (push) Has been cancelled
CI / macOS dmg (aarch64) (push) Has been cancelled
CI / macOS dmg (x86_64) (push) Has been cancelled
CI / Windows Installer (aarch64) (push) Has been cancelled
CI / Windows Installer (x86_64) (push) Has been cancelled
CI / Upload Artifacts to Server (push) Has been cancelled
Some checks failed
CI / Rustfmt + Clippy (push) Has been cancelled
CI / Check (android) (push) Has been cancelled
CI / Test (Linux) (push) Has been cancelled
CI / Test (macOS) (push) Has been cancelled
CI / Test (Windows) (push) Has been cancelled
CI / rpm/deb (aarch64) (push) Has been cancelled
CI / rpm/deb (x86_64) (push) Has been cancelled
CI / macOS dmg (aarch64) (push) Has been cancelled
CI / macOS dmg (x86_64) (push) Has been cancelled
CI / Windows Installer (aarch64) (push) Has been cancelled
CI / Windows Installer (x86_64) (push) Has been cancelled
CI / Upload Artifacts to Server (push) Has been cancelled
This reworks how we detect and respond to the on-screen keyboard so inputs don’t get buried and the UI doesn’t “jump”. - Add SoftKeyboardAnim + AnimState FSM for smooth IME open/close animation - Centralize logic in keyboard_visibility() with clear edge states - Animate keyboard height via animate_value_with_time instead of layer transforms - Add ChromeOptions::KeyboardVisibility flag when focused input would be occluded - Add SidebarOptions::Compact to collapse sidebar while typing - Hide mobile toolbar when keyboard is open (columns app) - Use .stick_to_bottom(true) in reply + profile editors; remove old spacer hack - Virtual keyboard toggle moved to F1 in Debug builds - Introduce SoftKeyboardContext::platform(ctx) helper - Cleanup dead/commented code and wire up soft_kb_anim_state in Chrome Result: inputs stay visible, open/close is smooth, and UI adjusts gracefully when typing. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -644,10 +644,20 @@ fn render_damus_mobile(
|
||||
|
||||
let active_col = app.columns_mut(app_ctx.i18n, app_ctx.accounts).selected as usize;
|
||||
let mut app_action: Option<AppAction> = None;
|
||||
// don't show toolbar if soft keyboard is open
|
||||
let skb_rect = app_ctx.soft_keyboard_rect(
|
||||
ui.ctx().screen_rect(),
|
||||
notedeck::SoftKeyboardContext::platform(ui.ctx()),
|
||||
);
|
||||
let toolbar_height = if skb_rect.is_none() {
|
||||
Damus::toolbar_height()
|
||||
} else {
|
||||
0.0
|
||||
};
|
||||
|
||||
StripBuilder::new(ui)
|
||||
.size(Size::remainder()) // top cell
|
||||
.size(Size::exact(Damus::toolbar_height())) // bottom cell
|
||||
.size(Size::exact(toolbar_height)) // bottom cell
|
||||
.vertical(|mut strip| {
|
||||
strip.cell(|ui| {
|
||||
let rect = ui.available_rect_before_wrap();
|
||||
@@ -678,17 +688,22 @@ fn render_damus_mobile(
|
||||
hovering_post_button(ui, app, app_ctx, rect);
|
||||
});
|
||||
|
||||
strip.cell(|ui| {
|
||||
strip.cell(|ui| 'brk: {
|
||||
if toolbar_height <= 0.0 {
|
||||
break 'brk;
|
||||
}
|
||||
|
||||
let unseen_notif = unseen_notification(
|
||||
app,
|
||||
app_ctx.ndb,
|
||||
app_ctx.accounts.get_selected_account().key.pubkey,
|
||||
);
|
||||
|
||||
let resp = toolbar(ui, unseen_notif);
|
||||
|
||||
if let Some(action) = resp {
|
||||
action.process(app, app_ctx);
|
||||
if skb_rect.is_none() {
|
||||
let resp = toolbar(ui, unseen_notif);
|
||||
if let Some(action) = resp {
|
||||
action.process(app, app_ctx);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -55,6 +55,7 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
pub fn show(&mut self, ui: &mut egui::Ui) -> PostResponse {
|
||||
ScrollArea::vertical()
|
||||
.id_salt(self.scroll_id)
|
||||
.stick_to_bottom(true)
|
||||
.show(ui, |ui| self.show_internal(ui))
|
||||
.inner
|
||||
}
|
||||
@@ -121,7 +122,7 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
// large and things start breaking. I think this is an ok
|
||||
// solution but there could be a better one.
|
||||
//
|
||||
ui.add_space(500.0);
|
||||
//ui.add_space(500.0);
|
||||
|
||||
post_response
|
||||
})
|
||||
|
||||
@@ -37,6 +37,7 @@ impl<'a> EditProfileView<'a> {
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui) -> bool {
|
||||
ScrollArea::vertical()
|
||||
.id_salt(EditProfileView::scroll_id())
|
||||
.stick_to_bottom(true)
|
||||
.show(ui, |ui| {
|
||||
banner(ui, self.state.banner(), 188.0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user