Added horizontal scrolling for long movie titles, a refresh key, and fixed the network issues so that network requests are sent once every 20 seconds by default to not stress out the server.

This commit is contained in:
2023-08-08 10:50:06 -06:00
parent 7f3dd18478
commit 514fd2244a
12 changed files with 337 additions and 205 deletions
+6 -7
View File
@@ -219,9 +219,8 @@ impl HorizontallyScrollableText {
}
pub fn scroll_left_or_reset(&self, width: usize, is_current_selection: bool, can_scroll: bool) {
if can_scroll {
if is_current_selection && self.text.len() >= width && *self.offset.borrow() < self.text.len()
{
if can_scroll && is_current_selection && self.text.len() >= width {
if *self.offset.borrow() < self.text.len() {
self.scroll_left();
} else {
self.reset_offset();
@@ -563,19 +562,19 @@ mod tests {
horizontally_scrollable_text.scroll_left_or_reset(width, false, true);
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 0);
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 1);
horizontally_scrollable_text.scroll_left_or_reset(width, true, false);
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 0);
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 1);
horizontally_scrollable_text.scroll_left_or_reset(width, true, true);
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 1);
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 2);
horizontally_scrollable_text.scroll_left_or_reset(test_text.len(), false, true);
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 0);
assert_eq!(*horizontally_scrollable_text.offset.borrow(), 2);
}
#[test]
+2 -2
View File
@@ -36,7 +36,7 @@ pub struct RootFolder {
pub struct Movie {
#[derivative(Default(value = "Number::from(0)"))]
pub id: Number,
pub title: String,
pub title: HorizontallyScrollableText,
pub original_language: Language,
#[derivative(Default(value = "Number::from(0)"))]
pub size_on_disk: Number,
@@ -84,7 +84,7 @@ pub struct CollectionMovie {
#[serde(rename_all = "camelCase")]
pub struct Collection {
#[serde(default)]
pub title: String,
pub title: HorizontallyScrollableText,
pub root_folder_path: Option<String>,
pub search_on_add: bool,
pub overview: Option<String>,