mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
kivy: make tabs one third of screen width and fix tabs scrolling
This commit is contained in:
parent
f7ffdfc2b1
commit
9b44635e3c
2 changed files with 9 additions and 3 deletions
|
@ -244,6 +244,7 @@
|
||||||
<TabbedPanelStrip>:
|
<TabbedPanelStrip>:
|
||||||
on_parent:
|
on_parent:
|
||||||
if self.parent: self.parent.bar_width = 0
|
if self.parent: self.parent.bar_width = 0
|
||||||
|
if self.parent: self.parent.scroll_x = 0.5
|
||||||
|
|
||||||
|
|
||||||
<TabbedCarousel>
|
<TabbedCarousel>
|
||||||
|
@ -297,6 +298,7 @@
|
||||||
TabbedCarousel:
|
TabbedCarousel:
|
||||||
id: panel
|
id: panel
|
||||||
tab_height: '48dp'
|
tab_height: '48dp'
|
||||||
|
tab_width: panel.width/3
|
||||||
default_tab: history_tab
|
default_tab: history_tab
|
||||||
strip_border: 0, 0, 0, 0
|
strip_border: 0, 0, 0, 0
|
||||||
InvoicesScreen:
|
InvoicesScreen:
|
||||||
|
|
|
@ -471,14 +471,18 @@ class TabbedCarousel(Factory.TabbedPanel):
|
||||||
return
|
return
|
||||||
idx = self.tab_list.index(value)
|
idx = self.tab_list.index(value)
|
||||||
n = len(self.tab_list)
|
n = len(self.tab_list)
|
||||||
|
if idx in [0, 1]:
|
||||||
|
scroll_x = 1
|
||||||
|
elif idx in [n-1, n-2]:
|
||||||
|
scroll_x = 0
|
||||||
|
else:
|
||||||
scroll_x = 1. * (n - idx - 1) / (n - 1)
|
scroll_x = 1. * (n - idx - 1) / (n - 1)
|
||||||
|
|
||||||
mation = Factory.Animation(scroll_x=scroll_x, d=.25)
|
mation = Factory.Animation(scroll_x=scroll_x, d=.25)
|
||||||
mation.cancel_all(scrlv)
|
mation.cancel_all(scrlv)
|
||||||
mation.start(scrlv)
|
mation.start(scrlv)
|
||||||
|
|
||||||
def on_current_tab(self, instance, value):
|
def on_current_tab(self, instance, value):
|
||||||
if value.text == 'default_tab':
|
|
||||||
return
|
|
||||||
self.animate_tab_to_center(value)
|
self.animate_tab_to_center(value)
|
||||||
|
|
||||||
def on_index(self, instance, value):
|
def on_index(self, instance, value):
|
||||||
|
|
Loading…
Add table
Reference in a new issue