diff --git a/src/bitmessagekivy/android/python-for-android/recipes/kivymd/__init__.py b/src/bitmessagekivy/android/python-for-android/recipes/kivymd/__init__.py index b49013a7..d7e91a90 100644 --- a/src/bitmessagekivy/android/python-for-android/recipes/kivymd/__init__.py +++ b/src/bitmessagekivy/android/python-for-android/recipes/kivymd/__init__.py @@ -10,36 +10,14 @@ from pythonforandroid.recipe import PythonRecipe class KivyMDRecipe(PythonRecipe): # This recipe installs KivyMD into the android dist from source version = 'master' - # url = 'https://gitlab.com/kivymd/KivyMD/repository/{version}/archive.zip' - url = 'https://github.com/HeaTTheatR/KivyMD/archive/master.zip' + url = 'https://github.com/surbhicis/kivymd/archive/master.zip' depends = ['kivy'] site_packages_name = 'kivymd' call_hostpython_via_targetpython = False - # patches = ['kivymd-fix-dev-compatibility.patch'] - # Made commented as use different repo for updates def should_build(self, arch): return True - # def unpack(self, arch): - # info_main('Unpacking {} for {}'.format(self.name, arch)) - # - # build_dir = self.get_build_container_dir(arch) - # - # user_dir = environ.get('P4A_{}_DIR'.format(self.name.lower())) - # - # if user_dir is not None: - # info("Installing KivyMD development version (from modded source)") - # self.clean_build() - # shprint(sh.rm, '-rf', build_dir) - # shprint(sh.mkdir, '-p', build_dir) - # shprint(sh.rmdir, build_dir) - # ensure_dir(build_dir) - # ensure_dir(build_dir + "/kivymd") - # shprint(sh.cp, user_dir + '/setup.py', self.get_build_dir(arch) + "/setup.py") - # shprint(sh.cp, '-a', user_dir + "/kivymd", self.get_build_dir(arch) + "/kivymd") - # return - def get_recipe_env(self, arch): env = super(KivyMDRecipe, self).get_recipe_env(arch) env['PYTHON_ROOT'] = self.ctx.get_python_install_dir() diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index ee44841e..4b72022b 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -174,44 +174,6 @@ NavigationLayout: background_palette: 'Primary' background_hue: '500' left_action_items: [['menu', lambda x: app.root.toggle_nav_drawer()]] - Button: - id: reset_navbar - size_hint_y: 0.35 - size_hint_x: 0.2 - opacity: 0 - disabled: True - pos_hint: {'x': .1, 'y': 0.3} - color: 0,0,0,1 - background_color: (0,0,0,0) - on_press:app.reset_navdrawer(self) - Image: - source: './images/left_arrow.png' - center_x: self.parent.center_x - center_y: self.parent.center_y - size: 40, 40 - TextInput: - id: search_input - hint_text: 'search' - opacity: 0 - size_hint: 1,None - height: dp(32) - disabled: True - pos_hint: {'center_x':.565,'center_y': .5} - multiline: False - padding_y: [self.height / 2.0 - (self.line_height / 2.0) * len(self._lines), 0] - padding_x: 20,20 - Button: - id: serch_btn - size_hint_y: 0.35 - size_hint_x: 0.2 - pos_hint: {'x': .1, 'y': 0.3} - color: 0,0,0,1 - background_color: (0,0,0,0) - Image: - source: './images/search_mail.png' - center_x: self.parent.center_x - center_y: self.parent.center_y - size: 55, 55 Button: id: myButton size_hint_y: 0.35 @@ -282,7 +244,7 @@ NavigationLayout: root_layout: root MDList: id: ml - ComposerButton + ComposerButton: : name: 'sent' diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 9be788dc..f8e7015a 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -148,6 +148,7 @@ class Inbox(Screen): def inbox_detail(self, receivedTime, *args): """Load inbox page details.""" + remove_search_bar(self) state.detailPageType = 'inbox' state.sentMailTime = receivedTime if self.manager: @@ -155,7 +156,6 @@ class Inbox(Screen): else: src_mng_obj = self.parent.parent - hide_search_btn(src_mng_obj) src_mng_obj.screens[13].clear_widgets() src_mng_obj.screens[13].add_widget(MailDetail()) src_mng_obj.current = 'mailDetail' @@ -464,10 +464,6 @@ class DropDownWidget(BoxLayout): self.parent.parent.current = 'sent' self.ids.btn.text = 'select' self.ids.ti.text = '' - self.parent.parent.parent.parent.parent\ - .ids.serch_btn.opacity = 1 - self.parent.parent.parent.parent.parent\ - .ids.serch_btn.disabled = False return None else: @@ -728,13 +724,13 @@ class Sent(Screen): def sent_detail(self, lastsenttime, *args): """Load sent mail details.""" + remove_search_bar(self) state.detailPageType = 'sent' state.sentMailTime = lastsenttime if self.manager: src_mng_obj = self.manager else: src_mng_obj = self.parent.parent - hide_search_btn(src_mng_obj) src_mng_obj.screens[13].clear_widgets() src_mng_obj.screens[13].add_widget(MailDetail()) src_mng_obj.current = 'mailDetail' @@ -994,7 +990,7 @@ class NavigateApp(App): if self.root.ids.scr_mngr.current == "mailDetail": self.root.ids.scr_mngr.current = \ 'sent' if state.detailPageType == 'sent' else 'inbox' - show_search_btn(self) + self.add_search_bar() elif self.root.ids.scr_mngr.current == "create": composer_objs = self.root from_addr = str(self.root.children[1].children[0].children[ @@ -1003,16 +999,15 @@ class NavigateApp(App): 0].children[0].children[0].ids.txt_input.text) if from_addr and to_addr: Draft().draft_msg(composer_objs) - self.root.ids.serch_btn.opacity = 1 - self.root.ids.serch_btn.disabled = False self.root.ids.scr_mngr.current = 'inbox' + self.add_search_bar() elif self.root.ids.scr_mngr.current == "showqrcode": self.root.ids.scr_mngr.current = 'myaddress' elif self.root.ids.scr_mngr.current == "random": self.root.ids.scr_mngr.current = 'login' else: self.root.ids.scr_mngr.current = 'inbox' - show_search_btn(self) + self.add_search_bar() self.root.ids.scr_mngr.transition.direction = 'right' self.root.ids.scr_mngr.transition.bind(on_complete=self.restart) return True @@ -1030,8 +1025,7 @@ class NavigateApp(App): def clear_composer(self): """If slow down the nwe will make new composer edit screen.""" - self.root.ids.serch_btn.opacity = 0 - self.root.ids.serch_btn.disabled = True + self.root.ids.search_bar.clear_widgets() composer_obj = self.root.ids.sc3.children[0].ids composer_obj.ti.text = '' composer_obj.btn.text = 'Select' @@ -1086,7 +1080,7 @@ class NavigateApp(App): return f_name[0][:14] + '...' if len(f_name[0]) > 15 else f_name[0] return '' - def searchQuery(self, instance): + def searchQuery(self, instance, *args): '''This method is used for showing searched mails''' state.search_screen = self.root.ids.scr_mngr.current state.searcing_text = str(instance.text).strip() @@ -1097,59 +1091,15 @@ class NavigateApp(App): self.root.ids.sc4.clear_widgets() self.root.ids.sc4.add_widget(Sent()) 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): - """Method used for reseting navigation drawer.""" - self.root.ids.search_input.text = '' - self.root.ids.search_input.opacity = 0 - self.root.ids.search_input.size_hint = 1, None - self.root.ids.search_input.disabled = True - self.root.ids.toolbar.left_action_items = [ - ['menu', lambda x: self.root.toggle_nav_drawer()]] - self.root.ids.toolbar.title = self.current_address_label() - self.root.ids.myButton.opacity = 1 - self.root.ids.myButton.disabled = False - self.root.ids.reset_navbar.opacity = 0 - self.root.ids.reset_navbar.disabled = True - state.searcing_text = '' - 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()) def check_search_screen(self, instance): - """Method shows search button on inbox and sent screen only.""" + """Method used for showing search button only on inbox or sent screen.""" 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.disabled = False + text_field = MDTextField(id='search_field', hint_text='Search icon') + text_field.bind(text = self.searchQuery) + self.root.ids.search_bar.add_widget(text_field) state.searcing_text = '' self.root.ids.sc1.clear_widgets() self.root.ids.sc4.clear_widgets() @@ -1157,10 +1107,15 @@ class NavigateApp(App): self.root.ids.sc4.add_widget(Sent()) else: self.root.ids.search_bar.clear_widgets() - self.root.ids.serch_btn.opacity = 0 - self.root.ids.serch_btn.disabled = True return + def add_search_bar(self): + """This method is used for adding search function on screen""" + if not self.root.ids.search_bar.children: + self.root.ids.search_bar.add_widget(MDIconButton(icon = 'magnify')) + text_field = MDTextField(id='search_field', hint_text='Search icon') + text_field.bind(text = self.searchQuery) + self.root.ids.search_bar.add_widget(text_field) class GrashofPopup(Popup): """Methods for saving contacts, error messages.""" @@ -1194,8 +1149,6 @@ class GrashofPopup(Popup): queues.UISignalQueue.put(('rerenderAddressBook', '')) self.dismiss() sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address) - self.parent.children[1].ids.serch_btn.opacity = 0 - self.parent.children[1].ids.serch_btn.disabled = True self.parent.children[1].ids.scr_mngr.current = 'addressbook' def show_error_message(self): @@ -1330,8 +1283,6 @@ class MailDetail(Screen): state.trash_count = str(int(state.trash_count) + 1) self.parent.parent.screens[4].clear_widgets() self.parent.parent.screens[4].add_widget(Trash()) - self.parent.parent.parent.parent.parent.ids.serch_btn.opacity = 1 - self.parent.parent.parent.parent.parent.ids.serch_btn.disabled = False def inbox_reply(self): """Method used for replying inbox messages.""" @@ -1577,30 +1528,6 @@ class Draft(Screen): return -def show_search_btn(self): - """Method used to show search button.""" - self.root.ids.serch_btn.opacity = 1 - self.root.ids.serch_btn.disabled = False - - -def hide_search_btn(mgr_objs): - """Method used to hide search button and search box.""" - - mgr_objs.parent.parent.parent.ids.serch_btn.opacity = 0 - mgr_objs.parent.parent.parent.ids.serch_btn.disabled = True - mgr_objs.parent.parent.parent.ids.search_input.size_hint = 1, None - mgr_objs.parent.parent.parent.ids.search_input.disabled = True - mgr_objs.parent.parent.parent.ids.search_input.opacity = 0 - mgr_objs.parent.parent.parent.ids.toolbar.left_action_items = \ - [['menu', lambda x: mgr_objs.parent.parent.parent.toggle_nav_drawer()]] - mgr_objs.parent.parent.parent.ids.toolbar.title = \ - NavigateApp().current_address_label() - mgr_objs.parent.parent.parent.ids.myButton.opacity = 1 - mgr_objs.parent.parent.parent.ids.myButton.disabled = False - mgr_objs.parent.parent.parent.ids.reset_navbar.opacity = 0 - mgr_objs.parent.parent.parent.ids.reset_navbar.disabled = True - - class CustomSpinner(Spinner): """This class is used for setting spinner size.""" @@ -1610,3 +1537,7 @@ class CustomSpinner(Spinner): max = 2.8 self.dropdown_cls.max_height = self.height * max + max * 4 print(args) + + +def remove_search_bar(self): + self.parent.parent.parent.parent.parent.ids.search_bar.clear_widgets() diff --git a/src/bitmessagemain.py b/src/bitmessagemain.py index 808b52da..a5fe29a1 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -247,7 +247,10 @@ class Main: ' \'-c\' as a commandline argument.' ) # is the application already running? If yes then exit. - shared.thisapp = singleinstance("", daemon) + try: + shared.thisapp = singleinstance("", daemon) + except Exception as e: + pass if daemon: with shared.printLock: diff --git a/src/buildozer.spec b/src/buildozer.spec index cc91e880..f6fdacde 100644 --- a/src/buildozer.spec +++ b/src/buildozer.spec @@ -1,10 +1,10 @@ [app] # (str) Title of your application -title = bluewhale +title = messageapp # (str) Package name -package.name = bluewhale +package.name = messageapp # (str) Package domain (needed for android/ios packaging) package.domain = org.test @@ -35,21 +35,29 @@ version = 0.1 # version.filename = %(source.dir)s/main.py # (list) Application requirements -# comma seperated e.g. requirements = sqlite3,kivy -requirements = python2, sqlite3, kivy, openssl, bitmsghash, libexpat, kivymd +# comma separated e.g. requirements = sqlite3,kivy +requirements = + openssl, + sqlite3, + python2, + kivy, + bitmsghash, + kivymd, + kivy-garden, + qrcode # (str) Custom source folders for requirements # Sets custom source for any requirements with recipes # requirements.source.kivy = ../../kivy # (list) Garden requirements -#garden_requirements = +garden_requirements = qrcode # (str) Presplash of the application -presplash.filename = "images/presplas.gif" +#presplash.filename = %(source.dir)s/data/presplash.png # (str) Icon of the application -icon.filename ='images/if_android_1220385.png' +#icon.filename = %(source.dir)s/data/icon.png # (str) Supported orientation (one of landscape, portrait or all) orientation = portrait @@ -88,28 +96,28 @@ fullscreen = 0 android.permissions = INTERNET, WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE # (int) Android API to use -android.api = 19 +android.api = 27 # (int) Minimum API required -#android.minapi = 9 +android.minapi = 21 # (int) Android SDK version to use android.sdk = 20 # (str) Android NDK version to use -android.ndk = 10e +android.ndk = 17c # (bool) Use --private data storage (True) or --dir public storage (False) -#android.private_storage = True +# android.private_storage = True # (str) Android NDK directory (if empty, it will be automatically downloaded.) -android.ndk_path =/home/cis/Downloads/android-ndk-r10e +#android.ndk_path = # (str) Android SDK directory (if empty, it will be automatically downloaded.) -android.sdk_path =/home/cis/Android/Sdk +#android.sdk_path = # (str) ANT directory (if empty, it will be automatically downloaded.) -android.ant_path =/home/cis/apache-ant-1.10.5 +#android.ant_path = # (bool) If True, then skip trying to update the Android sdk # This can be useful to avoid excess Internet downloads or save time @@ -146,7 +154,10 @@ android.ant_path =/home/cis/apache-ant-1.10.5 # bootstrap) #android.gradle_dependencies = -# (str) python-for-android branch to use, defaults to master +# (list) Java classes to add as activities to the manifest. +#android.add_activites = com.example.ExampleActivity + +# (str) python-for-android branch to use, defaults to stable p4a.branch = master # (str) OUYA Console category. Should be one of GAME or APP @@ -159,7 +170,10 @@ p4a.branch = master # (str) XML file to include as an intent filters in tag #android.manifest.intent_filters = -# (list) Android additionnal libraries to copy into libs/armeabi +# (str) launchMode to set for the main activity +#android.manifest.launch_mode = standard + +# (list) Android additional libraries to copy into libs/armeabi #android.add_libs_armeabi = libs/android/*.so #android.add_libs_armeabi_v7a = libs/android-v7/*.so #android.add_libs_x86 = libs/android-x86/*.so @@ -193,7 +207,7 @@ android.arch = armeabi-v7a #p4a.source_dir = # (str) The directory in which python-for-android should look for your own build recipes (if any) -p4a.local_recipes =/home/cis/Desktop/Mobileandroid/peter_android/PyBitmessage/src/bitmessagekivy/android/python-for-android/recipes/ +p4a.local_recipes = /home/cis/navjotrepo/PyBitmessage/src/bitmessagekivy/android/python-for-android/recipes/ # (str) Filename to the hook for p4a #p4a.hook = @@ -201,6 +215,9 @@ p4a.local_recipes =/home/cis/Desktop/Mobileandroid/peter_android/PyBitmessage/sr # (str) Bootstrap to use for android builds # p4a.bootstrap = sdl2 +# (int) port number to specify an explicit --port= p4a argument (eg for bootstrap flask) +#p4a.port = + # # iOS specific @@ -267,4 +284,4 @@ warn_on_root = 1 # # Then, invoke the command line with the "demo" profile: # -#buildozer --profile demo android debug +#buildozer --profile demo android debug \ No newline at end of file diff --git a/src/paths.py b/src/paths.py index 63e92704..110a32bd 100644 --- a/src/paths.py +++ b/src/paths.py @@ -43,7 +43,8 @@ def lookupAppdataFolder(): sys.exit() elif platform == 'android': # dataFolder = path.join(os.path.dirname(os.path.abspath("__file__")), "PyBitmessage") + '/' - dataFolder = path.join('/sdcard/', 'DCIM/', APPNAME) + '/' + dataFolder = path.join(os.environ['ANDROID_PRIVATE'] + '/', APPNAME) + '/' + # dataFolder = path.join('/sdcard/', 'DCIM/', APPNAME) + '/' elif 'win32' in sys.platform or 'win64' in sys.platform: dataFolder = path.join(environ['APPDATA'].decode(sys.getfilesystemencoding(), 'ignore'), APPNAME) + path.sep diff --git a/src/pyelliptic/openssl.py b/src/pyelliptic/openssl.py index 97510cc1..4c8c4973 100644 --- a/src/pyelliptic/openssl.py +++ b/src/pyelliptic/openssl.py @@ -534,6 +534,8 @@ def loadOpenSSL(): elif platform == "android": libdir.append('libcrypto1.0.2p.so') libdir.append('libssl1.0.2p.so') + libdir.append('libcrypto1.1.so') + libdir.append('libssl1.1.so') else: libdir.append('libcrypto.so') @@ -541,7 +543,10 @@ def loadOpenSSL(): libdir.append('libcrypto.so.1.0.0') libdir.append('libssl.so.1.0.0') if 'linux' in sys.platform or 'darwin' in sys.platform or 'bsd' in sys.platform: - libdir.append(find_library('ssl')) + try: + libdir.append(find_library('ssl')) + except OSError: + pass elif 'win32' in sys.platform or 'win64' in sys.platform: libdir.append(find_library('libeay32')) for library in libdir: