mirror of
https://github.com/Benexl/FastAnime.git
synced 2025-12-30 14:40:39 -08:00
renamed app to anixstream
This commit is contained in:
3
anixstream/View/SearchScreen/components/__init__.py
Normal file
3
anixstream/View/SearchScreen/components/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .filters import Filters
|
||||
from .pagination import SearchResultsPagination
|
||||
from .trending_sidebar import TrendingAnimeSideBar
|
||||
27
anixstream/View/SearchScreen/components/filters.kv
Normal file
27
anixstream/View/SearchScreen/components/filters.kv
Normal file
@@ -0,0 +1,27 @@
|
||||
<FilterDropDown>:
|
||||
MDDropDownItemText:
|
||||
text: root.text
|
||||
|
||||
<FilterLabel@MDLabel>:
|
||||
adaptive_width:True
|
||||
|
||||
<Filters>:
|
||||
adaptive_height:True
|
||||
spacing:"10dp"
|
||||
size_hint_x:.95
|
||||
pos_hint:{"center_x":.5}
|
||||
padding:"10dp"
|
||||
md_bg_color:self.theme_cls.surfaceContainerLowColor
|
||||
|
||||
FilterLabel:
|
||||
text:"Sort By"
|
||||
FilterDropDown:
|
||||
id:sort_filter
|
||||
text:root.filters["sort"]
|
||||
on_release: root.open_filter_menu(self,"sort")
|
||||
FilterLabel:
|
||||
text:"Status"
|
||||
FilterDropDown:
|
||||
id:status_filter
|
||||
text:root.filters["status"]
|
||||
on_release: root.open_filter_menu(self,"status")
|
||||
83
anixstream/View/SearchScreen/components/filters.py
Normal file
83
anixstream/View/SearchScreen/components/filters.py
Normal file
@@ -0,0 +1,83 @@
|
||||
from kivy.properties import StringProperty, DictProperty
|
||||
|
||||
from kivymd.uix.boxlayout import MDBoxLayout
|
||||
from kivymd.uix.dropdownitem import MDDropDownItem
|
||||
from kivymd.uix.menu import MDDropdownMenu
|
||||
|
||||
|
||||
class FilterDropDown(MDDropDownItem):
|
||||
text: str = StringProperty()
|
||||
|
||||
|
||||
class Filters(MDBoxLayout):
|
||||
filters: dict = DictProperty({"sort": "SEARCH_MATCH", "status": "FINISHED"})
|
||||
|
||||
def open_filter_menu(self, menu_item, filter_name):
|
||||
items = []
|
||||
match filter_name:
|
||||
case "sort":
|
||||
items = [
|
||||
"ID",
|
||||
"ID_DESC",
|
||||
"TITLE_ROMANJI",
|
||||
"TITLE_ROMANJI_DESC",
|
||||
"TITLE_ENGLISH",
|
||||
"TITLE_ENGLISH_DESC",
|
||||
"TITLE_NATIVE",
|
||||
"TITLE_NATIVE_DESC",
|
||||
"TYPE",
|
||||
"TYPE_DESC",
|
||||
"FORMAT",
|
||||
"FORMAT_DESC",
|
||||
"START_DATE",
|
||||
"START_DATE_DESC",
|
||||
"END_DATE",
|
||||
"END_DATE_DESC",
|
||||
"SCORE",
|
||||
"SCORE_DESC",
|
||||
"TRENDING",
|
||||
"TRENDING_DESC",
|
||||
"EPISODES",
|
||||
"EPISODES_DESC",
|
||||
"DURATION",
|
||||
"DURATION_DESC",
|
||||
"STATUS",
|
||||
"STATUS_DESC",
|
||||
"UPDATED_AT",
|
||||
"UPDATED_AT_DESC",
|
||||
"SEARCH_MATCH",
|
||||
"POPULARITY",
|
||||
"POPULARITY_DESC",
|
||||
"FAVOURITES",
|
||||
"FAVOURITES_DESC",
|
||||
]
|
||||
case "status":
|
||||
items = [
|
||||
"FINISHED",
|
||||
"RELEASING",
|
||||
"NOT_YET_RELEASED",
|
||||
"CANCELLED",
|
||||
"HIATUS",
|
||||
]
|
||||
case _:
|
||||
items = []
|
||||
if items:
|
||||
menu_items = [
|
||||
{
|
||||
"text": f"{item}",
|
||||
"on_release": lambda filter_value=f"{item}": self.filter_menu_callback(
|
||||
filter_name, filter_value
|
||||
),
|
||||
}
|
||||
for item in items
|
||||
]
|
||||
MDDropdownMenu(caller=menu_item, items=menu_items).open()
|
||||
|
||||
def filter_menu_callback(self, filter_name, filter_value):
|
||||
match filter_name:
|
||||
case "sort":
|
||||
self.ids.sort_filter.text = filter_value
|
||||
self.filters["sort"] = filter_value
|
||||
case "status":
|
||||
self.ids.status_filter.text = filter_value
|
||||
self.filters["status"] = filter_value
|
||||
21
anixstream/View/SearchScreen/components/pagination.kv
Normal file
21
anixstream/View/SearchScreen/components/pagination.kv
Normal file
@@ -0,0 +1,21 @@
|
||||
<PaginationLabel@MDLabel>:
|
||||
max_lines:0
|
||||
shorten:False
|
||||
adaptive_height:True
|
||||
font_style: "Label"
|
||||
pos_hint:{"center_y":.5}
|
||||
halign:"center"
|
||||
role: "medium"
|
||||
|
||||
<SearchResultsPagination>:
|
||||
md_bg_color:self.theme_cls.surfaceContainerLowColor
|
||||
radius:8
|
||||
adaptive_height:True
|
||||
MDIconButton:
|
||||
icon:"arrow-left"
|
||||
on_release:root.search_view.previous_page()
|
||||
PaginationLabel:
|
||||
text:"Page {} of {}".format(root.current_page,root.total_pages)
|
||||
MDIconButton:
|
||||
icon:"arrow-right"
|
||||
on_release:root.search_view.next_page()
|
||||
9
anixstream/View/SearchScreen/components/pagination.py
Normal file
9
anixstream/View/SearchScreen/components/pagination.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from kivy.properties import ObjectProperty, NumericProperty
|
||||
|
||||
from kivymd.uix.boxlayout import MDBoxLayout
|
||||
|
||||
|
||||
class SearchResultsPagination(MDBoxLayout):
|
||||
current_page = NumericProperty()
|
||||
total_pages = NumericProperty()
|
||||
search_view = ObjectProperty()
|
||||
@@ -0,0 +1,6 @@
|
||||
<TrendingAnimeSideBar>:
|
||||
orientation: 'vertical'
|
||||
adaptive_height:True
|
||||
md_bg_color:self.theme_cls.surfaceContainerLowColor
|
||||
pos_hint: {'center_x': 0.5}
|
||||
padding:"25dp","25dp","25dp","200dp"
|
||||
@@ -0,0 +1,5 @@
|
||||
from kivymd.uix.boxlayout import MDBoxLayout
|
||||
|
||||
|
||||
class TrendingAnimeSideBar(MDBoxLayout):
|
||||
pass
|
||||
Reference in New Issue
Block a user