Changes made on search Ui with filter

This commit is contained in:
cis 2019-08-05 13:11:56 +05:30
parent 3edfc98753
commit e56f452e7d
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
2 changed files with 46 additions and 20 deletions

View File

@ -207,7 +207,6 @@ NavigationLayout:
pos_hint: {'x': .1, 'y': 0.3} pos_hint: {'x': .1, 'y': 0.3}
color: 0,0,0,1 color: 0,0,0,1
background_color: (0,0,0,0) background_color: (0,0,0,0)
on_press:app.searchQuery(self, search_input.text)
Image: Image:
source: './images/search_mail.png' source: './images/search_mail.png'
center_x: self.parent.center_x center_x: self.parent.center_x
@ -226,6 +225,18 @@ NavigationLayout:
center_x: self.parent.center_x center_x: self.parent.center_x
center_y: self.parent.center_y center_y: self.parent.center_y
size: 55, 55 size: 55, 55
BoxLayout:
id: search_bar
size_hint_y: None
height: self.minimum_height
MDIconButton:
icon: 'magnify'
MDTextField:
id: search_field
hint_text: 'Search icon'
on_text: app.searchQuery(self)
ScreenManager: ScreenManager:
id: scr_mngr id: scr_mngr
Inbox: Inbox:

View File

@ -49,6 +49,7 @@ from functools import partial
from kivy.uix.carousel import Carousel from kivy.uix.carousel import Carousel
from kivy.utils import platform from kivy.utils import platform
from kivy.uix.spinner import Spinner from kivy.uix.spinner import Spinner
from kivymd.textfields import MDTextField
class Navigatorss(MDNavigationDrawer): class Navigatorss(MDNavigationDrawer):
image_source = StringProperty('images/qidenticon_two.png') image_source = StringProperty('images/qidenticon_two.png')
@ -897,24 +898,12 @@ class NavigateApp(App):
return f_name[0][:14]+ '...' if len(f_name[0])>15 else f_name[0] return f_name[0][:14]+ '...' if len(f_name[0])>15 else f_name[0]
return '' return ''
def searchQuery(self, instance, text): def searchQuery(self, instance):
'''This method is used for showing searched mails''' '''This method is used for showing searched mails'''
if self.root.ids.search_input.opacity == 0: # import pdb;pdb.set_trace()
self.root.ids.search_input.opacity = 1 if str(instance.text):
self.root.ids.search_input.size_hint = 4,None
# self.root.ids.serch_btn.opacity = 0
# self.root.ids.serch_btn.disabled = True
self.root.ids.search_input.disabled = False
self.root.ids.search_input.focus = True
self.root.ids.toolbar.left_action_items = []
self.root.ids.toolbar.title = ''
self.root.ids.myButton.opacity = 0
self.root.ids.myButton.disabled = True
self.root.ids.reset_navbar.opacity = 1
self.root.ids.reset_navbar.disabled = False
elif str(text):
state.search_screen = self.root.ids.scr_mngr.current state.search_screen = self.root.ids.scr_mngr.current
state.searcing_text = str(text).strip() state.searcing_text = str(instance.text).strip()
if state.search_screen == 'inbox': if state.search_screen == 'inbox':
self.root.ids.sc1.clear_widgets() self.root.ids.sc1.clear_widgets()
self.root.ids.sc1.add_widget(Inbox()) self.root.ids.sc1.add_widget(Inbox())
@ -922,6 +911,29 @@ class NavigateApp(App):
self.root.ids.sc4.clear_widgets() self.root.ids.sc4.clear_widgets()
self.root.ids.sc4.add_widget(Sent()) self.root.ids.sc4.add_widget(Sent())
self.root.ids.scr_mngr.current = state.search_screen self.root.ids.scr_mngr.current = state.search_screen
# if self.root.ids.search_input.opacity == 0:
# self.root.ids.search_input.opacity = 1
# self.root.ids.search_input.size_hint = 4,None
# # self.root.ids.serch_btn.opacity = 0
# # self.root.ids.serch_btn.disabled = True
# self.root.ids.search_input.disabled = False
# self.root.ids.search_input.focus = True
# self.root.ids.toolbar.left_action_items = []
# self.root.ids.toolbar.title = ''
# self.root.ids.myButton.opacity = 0
# self.root.ids.myButton.disabled = True
# self.root.ids.reset_navbar.opacity = 1
# self.root.ids.reset_navbar.disabled = False
# elif str(text):
# state.search_screen = self.root.ids.scr_mngr.current
# state.searcing_text = str(text).strip()
# if state.search_screen == 'inbox':
# self.root.ids.sc1.clear_widgets()
# self.root.ids.sc1.add_widget(Inbox())
# else:
# self.root.ids.sc4.clear_widgets()
# self.root.ids.sc4.add_widget(Sent())
# self.root.ids.scr_mngr.current = state.search_screen
def reset_navdrawer(self, instance): def reset_navdrawer(self, instance):
'''This methos is used for reseting navigation drawer''' '''This methos is used for reseting navigation drawer'''
@ -946,6 +958,9 @@ class NavigateApp(App):
def check_search_screen(self, instance): def check_search_screen(self, instance):
'''This method is used for showing search button only on inbox or sent screen''' '''This method is used for showing search button only on inbox or sent screen'''
if instance.text == 'Inbox' or instance.text == 'Sent': if instance.text == 'Inbox' or instance.text == 'Sent':
if not self.root.ids.search_bar.children:
self.root.ids.search_bar.add_widget(MDIconButton(icon = 'magnify'))
# self.root.ids.search_bar.add_widget(MDTextField(id='search_field', hint_text='Search icon', on_text=app.searchQuery(self)))
self.root.ids.serch_btn.opacity = 1 self.root.ids.serch_btn.opacity = 1
self.root.ids.serch_btn.disabled = False self.root.ids.serch_btn.disabled = False
state.searcing_text = '' state.searcing_text = ''
@ -954,6 +969,7 @@ class NavigateApp(App):
self.root.ids.sc1.add_widget(Inbox()) self.root.ids.sc1.add_widget(Inbox())
self.root.ids.sc4.add_widget(Sent()) self.root.ids.sc4.add_widget(Sent())
else: else:
self.root.ids.search_bar.clear_widgets()
self.root.ids.serch_btn.opacity = 0 self.root.ids.serch_btn.opacity = 0
self.root.ids.serch_btn.disabled = True self.root.ids.serch_btn.disabled = True
return return
@ -1191,7 +1207,6 @@ class ShowQRCode(Screen):
def qrdisplay(self): def qrdisplay(self):
self.ids.qr.clear_widgets() self.ids.qr.clear_widgets()
if platform == 'android':
from kivy.garden.qrcode import QRCodeWidget from kivy.garden.qrcode import QRCodeWidget
self.ids.qr.add_widget(QRCodeWidget(data=self.manager.get_parent_window().children[0].address)) self.ids.qr.add_widget(QRCodeWidget(data=self.manager.get_parent_window().children[0].address))