Added Ui for Search bar for message searching and also manage exit button on Action bar

This commit is contained in:
surbhi 2018-09-05 19:42:55 +05:30
parent ccd383b72f
commit 61aa874f09
No known key found for this signature in database
GPG Key ID: 88928762974D3618
3 changed files with 33 additions and 8 deletions

View File

@ -46,14 +46,24 @@ BoxLayout:
title: app.getCurrentAccount() title: app.getCurrentAccount()
background_color: app.theme_cls.primary_dark background_color: app.theme_cls.primary_dark
left_action_items: [['menu', lambda x: app.nav_drawer.toggle()]] left_action_items: [['menu', lambda x: app.nav_drawer.toggle()]]
Button:
text:"EXIT" ActionView:
color: 0,0,0,1 SearchBar:
background_color: (0,0,0,0) size_hint_x: 1.7
size_hint_y: 0.4 size_hint_y: .5
size_hint_x: 0.1 pos_hint: {'x': 0, 'center_y':.5}
pos_hint: {'x': 0.8, 'y':0.4} on_text_validate: searchbutt.trigger_action()
on_press: app.say_exit()
ActionPrevious:
with_previous: False
app_icon: ''
ActionOverflow:
ActionButton:
text: 'Filters'
ActionButton:
text: 'Exit'
on_press: app.say_exit()
ScreenManager: ScreenManager:
id: scr_mngr id: scr_mngr

View File

@ -20,6 +20,7 @@ from helper_ackPayload import genAckPayload
from addresses import decodeAddress, addBMIfNotPresent from addresses import decodeAddress, addBMIfNotPresent
from helper_sql import sqlExecute from helper_sql import sqlExecute
from kivy.core.window import Window from kivy.core.window import Window
from kivy.uix.actionbar import ActionItem
statusIconColor = 'red' statusIconColor = 'red'
@ -43,11 +44,15 @@ class NavigateApp(App, TextInput):
return main_widget return main_widget
def _key_handler(self, instance, key, *args): def _key_handler(self, instance, key, *args):
"""Escape key manages previous screen on back."""
if key is 27: if key is 27:
print(args)
print(instance)
self.set_previous_screen() self.set_previous_screen()
return True return True
def set_previous_screen(self): def set_previous_screen(self):
"""Set previous screen based on back."""
if self.root.ids.scr_mngr.current != 'inbox': if self.root.ids.scr_mngr.current != 'inbox':
self.root.ids.scr_mngr.transition.direction = 'left' self.root.ids.scr_mngr.transition.direction = 'left'
self.root.ids.scr_mngr.current = 'inbox' self.root.ids.scr_mngr.current = 'inbox'
@ -401,5 +406,15 @@ class NewIdentity(Screen):
self.manager.current = 'add_sucess' self.manager.current = 'add_sucess'
class SearchBar(TextInput, ActionItem):
def __init__(self, *args, **kwargs):
super(SearchBar, self).__init__(*args, **kwargs)
self.hint_text = 'Search'
def search(self):
request = self.text
return str(request)
if __name__ == '__main__': if __name__ == '__main__':
NavigateApp().run() NavigateApp().run()

BIN
src/images/search.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB