#--[Start platform specific code]
"""This code to detect it's Android or not 
if it's not android than app window size change in android phone size"""
from kivy.utils import platform

if platform != 'android':
    from kivy.config import Config
    Config.set("graphics","width",360)
    Config.set("graphics","height",740)
    Config.set('graphics', 'borderless', 'True')
#--[End platform specific code]

#--[Start Soft_Keyboard code ]Config
"""code for android keyboard. when in android keyboard show textbox 
automatic go to top of keyboard so user can see when he type msg"""
from kivy.core.window import Window

Window.keyboard_anim_args = {"d":.2,"t":"linear"}
Window.softinput_mode = "below_target"
#--[End Soft_Keyboard code ]

from ProjectFiles.uix.baseclass.login import Login_Screen
from ProjectFiles.uix.baseclass.Instruction import Instruction_Screen
from ProjectFiles.uix.baseclass.root import Root
from ProjectFiles.uix.baseclass.Paddy_Waste import Paddy_Waste_Screen
from ProjectFiles.uix.baseclass.homeList import HomeList_Screen
from ProjectFiles.uix.baseclass.Diseases_Leaf import Diseases_Leaf_Screen

from ProjectFiles.uix.baseclass.verification import Verification_Screen
from main_imports import ImageLeftWidget, MDApp, TwoLineAvatarListItem


class HamsterApp(MDApp):
    """
    Hamster App start from here this class is root of app.
    in kivy (.kv) file when use app.method_name app is start from here
    """

    def __init__(self, **kwargs):
        super(HamsterApp, self).__init__(**kwargs)
        
        self.APP_NAME = "SMART FARMING"
        self.COMPANY_NAME = "2022"
        

    
    def all_chats(self):
        # self.change_screen("profile")
        twolineW= TwoLineAvatarListItem(text=f"DIABETES IDENTIFICATION WITH ML",
            secondary_text="@username",
            on_touch_up=self.chat_room)

        twolineW.add_widget(ImageLeftWidget(source="assets//img//hamster_icon.png"))
        self.screen_manager.get_screen("login").ids.chat_tab.add_widget(twolineW)

    def build(self):
        self.theme_cls.primary_palette = "LightGreen"
        self.theme_cls.primary_hue = "500"
        self.theme_cls.accent_palette = "LightGreen"
        self.theme_cls.accent_hue = "500"
        self.theme_cls.theme_style = "Light"
    
        self.screen_manager = Root()
        self.screen_manager.add_widget(Login_Screen())
        self.screen_manager.add_widget(Instruction_Screen())
        self.screen_manager.add_widget(Paddy_Waste_Screen())
        self.screen_manager.add_widget(Diseases_Leaf_Screen())

        self.screen_manager.add_widget(HomeList_Screen())
        self.screen_manager.add_widget(Verification_Screen())
        return self.screen_manager
    
    def on_start(self):
        self.screen_manager.change_screen("Paddy_Waste")

if __name__ == "__main__":
    HamsterApp().run() 
