android: update to latest winit/egui/android-activity
so we can start fixing this shit Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -94,11 +94,11 @@ pub fn render_note_preview(
|
||||
*/
|
||||
};
|
||||
|
||||
egui::Frame::none()
|
||||
egui::Frame::new()
|
||||
.fill(ui.visuals().noninteractive().weak_bg_fill)
|
||||
.inner_margin(egui::Margin::same(8.0))
|
||||
.outer_margin(egui::Margin::symmetric(0.0, 8.0))
|
||||
.rounding(egui::Rounding::same(10.0))
|
||||
.inner_margin(egui::Margin::same(8))
|
||||
.outer_margin(egui::Margin::symmetric(0, 8))
|
||||
.rounding(egui::Rounding::same(10))
|
||||
.stroke(egui::Stroke::new(
|
||||
1.0,
|
||||
ui.visuals().noninteractive().bg_stroke.color,
|
||||
|
||||
@@ -16,30 +16,22 @@ impl NoteContextSelection {
|
||||
pub fn process(&self, ui: &mut egui::Ui, note: &Note<'_>) {
|
||||
match self {
|
||||
NoteContextSelection::CopyText => {
|
||||
ui.output_mut(|w| {
|
||||
w.copied_text = note.content().to_string();
|
||||
});
|
||||
ui.ctx().copy_text(note.content().to_string());
|
||||
}
|
||||
NoteContextSelection::CopyPubkey => {
|
||||
ui.output_mut(|w| {
|
||||
if let Some(bech) = Pubkey::new(*note.pubkey()).to_bech() {
|
||||
w.copied_text = bech;
|
||||
}
|
||||
});
|
||||
if let Some(bech) = Pubkey::new(*note.pubkey()).to_bech() {
|
||||
ui.ctx().copy_text(bech);
|
||||
}
|
||||
}
|
||||
NoteContextSelection::CopyNoteId => {
|
||||
ui.output_mut(|w| {
|
||||
if let Some(bech) = NoteId::new(*note.id()).to_bech() {
|
||||
w.copied_text = bech;
|
||||
}
|
||||
});
|
||||
}
|
||||
NoteContextSelection::CopyNoteJSON => {
|
||||
ui.output_mut(|w| match note.json() {
|
||||
Ok(json) => w.copied_text = json,
|
||||
Err(err) => error!("error copying note json: {err}"),
|
||||
});
|
||||
if let Some(bech) = NoteId::new(*note.id()).to_bech() {
|
||||
ui.ctx().copy_text(bech);
|
||||
}
|
||||
}
|
||||
NoteContextSelection::CopyNoteJSON => match note.json() {
|
||||
Ok(json) => ui.ctx().copy_text(json),
|
||||
Err(err) => error!("error copying note json: {err}"),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,8 +189,8 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
||||
.response
|
||||
}
|
||||
|
||||
pub fn expand_size() -> f32 {
|
||||
5.0
|
||||
pub fn expand_size() -> i8 {
|
||||
5
|
||||
}
|
||||
|
||||
fn pfp(
|
||||
@@ -223,8 +223,8 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
||||
let (rect, size, resp) = ui::anim::hover_expand(
|
||||
ui,
|
||||
egui::Id::new((profile_key, note_key)),
|
||||
pfp_size,
|
||||
ui::NoteView::expand_size(),
|
||||
pfp_size as f32,
|
||||
ui::NoteView::expand_size() as f32,
|
||||
anim_speed,
|
||||
);
|
||||
|
||||
@@ -246,6 +246,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
||||
|
||||
resp
|
||||
}
|
||||
|
||||
None => {
|
||||
// This has to match the expand size from the above case to
|
||||
// prevent bounciness
|
||||
@@ -255,7 +256,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
||||
ui.put(
|
||||
rect,
|
||||
ui::ProfilePic::new(self.note_context.img_cache, ui::ProfilePic::no_pfp_url())
|
||||
.size(pfp_size),
|
||||
.size(pfp_size as f32),
|
||||
)
|
||||
.interact(sense)
|
||||
}
|
||||
@@ -354,7 +355,7 @@ impl<'a, 'd> NoteView<'a, 'd> {
|
||||
|
||||
let size = ui.available_size();
|
||||
ui.vertical(|ui| {
|
||||
ui.add_sized([size.x, self.options().pfp_size()], |ui: &mut egui::Ui| {
|
||||
ui.add_sized([size.x, self.options().pfp_size() as f32], |ui: &mut egui::Ui| {
|
||||
ui.horizontal_centered(|ui| {
|
||||
NoteView::note_header(
|
||||
ui,
|
||||
|
||||
@@ -67,7 +67,7 @@ impl NoteOptions {
|
||||
options
|
||||
}
|
||||
|
||||
pub fn pfp_size(&self) -> f32 {
|
||||
pub fn pfp_size(&self) -> i8 {
|
||||
if self.has_small_pfp() {
|
||||
ProfilePic::small_size()
|
||||
} else if self.has_medium_pfp() {
|
||||
|
||||
@@ -283,12 +283,12 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
self.id_source.unwrap_or_else(|| egui::Id::new("post"))
|
||||
}
|
||||
|
||||
pub fn outer_margin() -> f32 {
|
||||
16.0
|
||||
pub fn outer_margin() -> i8 {
|
||||
16
|
||||
}
|
||||
|
||||
pub fn inner_margin() -> f32 {
|
||||
12.0
|
||||
pub fn inner_margin() -> i8 {
|
||||
12
|
||||
}
|
||||
|
||||
pub fn ui(&mut self, txn: &nostrdb::Transaction, ui: &mut egui::Ui) -> PostResponse {
|
||||
@@ -308,9 +308,9 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
|
||||
if focused {
|
||||
frame = frame.shadow(egui::epaint::Shadow {
|
||||
offset: egui::vec2(0.0, 0.0),
|
||||
blur: 8.0,
|
||||
spread: 0.0,
|
||||
offset: [0, 0],
|
||||
blur: 8,
|
||||
spread: 0,
|
||||
color: stroke.color,
|
||||
});
|
||||
}
|
||||
@@ -327,8 +327,7 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
context_selection = Frame::none()
|
||||
.show(ui, |ui| {
|
||||
ui.vertical(|ui| {
|
||||
let set_width = avail_size.x * 0.8;
|
||||
ui.set_max_width(set_width);
|
||||
ui.set_max_width(avail_size.x * 0.8);
|
||||
let resp = render_note_preview(
|
||||
ui,
|
||||
self.note_context,
|
||||
@@ -346,8 +345,8 @@ impl<'a, 'd> PostView<'a, 'd> {
|
||||
});
|
||||
}
|
||||
|
||||
Frame::none()
|
||||
.inner_margin(Margin::symmetric(0.0, 8.0))
|
||||
Frame::new()
|
||||
.inner_margin(Margin::symmetric(0, 8))
|
||||
.show(ui, |ui| {
|
||||
ScrollArea::horizontal().show(ui, |ui| {
|
||||
ui.with_layout(Layout::left_to_right(egui::Align::Min), |ui| {
|
||||
|
||||
@@ -54,13 +54,12 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
|
||||
// This is the offset of the post view's pfp. We use this
|
||||
// to indent things so that the reply line is aligned
|
||||
let pfp_offset = ui::PostView::outer_margin()
|
||||
let pfp_offset: i8 = ui::PostView::outer_margin()
|
||||
+ ui::PostView::inner_margin()
|
||||
+ ui::ProfilePic::small_size() / 2.0;
|
||||
+ ui::ProfilePic::small_size() / 2;
|
||||
|
||||
let note_offset = pfp_offset
|
||||
- ui::ProfilePic::medium_size() / 2.0
|
||||
- ui::NoteView::expand_size() / 2.0;
|
||||
let note_offset: i8 =
|
||||
pfp_offset - ui::ProfilePic::medium_size() / 2 - ui::NoteView::expand_size() / 2;
|
||||
|
||||
let selection = egui::Frame::none()
|
||||
.outer_margin(egui::Margin::same(note_offset))
|
||||
@@ -103,14 +102,14 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
// Position the line right above the poster's profile pic in
|
||||
// the post box. Use the PostView's margin values to
|
||||
// determine this offset.
|
||||
rect.min.x = avail_rect.min.x + pfp_offset;
|
||||
rect.min.x = avail_rect.min.x + pfp_offset as f32;
|
||||
|
||||
// honestly don't know what the fuck I'm doing here. just trying
|
||||
// to get the line under the profile picture
|
||||
rect.min.y = avail_rect.min.y
|
||||
+ (ui::ProfilePic::medium_size() / 2.0
|
||||
+ ui::ProfilePic::medium_size()
|
||||
+ ui::NoteView::expand_size() * 2.0)
|
||||
+ (ui::ProfilePic::medium_size() as f32 / 2.0
|
||||
+ ui::ProfilePic::medium_size() as f32
|
||||
+ ui::NoteView::expand_size() as f32 * 2.0)
|
||||
+ 1.0;
|
||||
|
||||
// For some reason we need to nudge the reply line's height a
|
||||
@@ -125,7 +124,7 @@ impl<'a, 'd> PostReplyView<'a, 'd> {
|
||||
3.0
|
||||
};
|
||||
|
||||
rect.max.y = rect_before_post.max.y + ui::PostView::outer_margin() + nudge;
|
||||
rect.max.y = rect_before_post.max.y + ui::PostView::outer_margin() as f32 + nudge;
|
||||
|
||||
ui.painter().vline(
|
||||
rect.left(),
|
||||
|
||||
Reference in New Issue
Block a user