Ejemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.room_management);

            actionText    = new string[2];
            actionText[0] = GetString(Resource.String.next_image_text);
            actionText[1] = GetString(Resource.String.save_text);

            roomId = Intent.GetIntExtra(IntentManagement.IntentManagement.ROOM_ID, -1);

            RoomDatabaseManagement roomDatabaseManagement = new RoomDatabaseManagement();

            roomDatabaseManagement.CalculateRoomCleannessAndTimeOfRoomCleaning(this);
            roomIds    = roomDatabaseManagement.GetRoomIds();
            roomTitles = roomDatabaseManagement.GetRoomTitles();
            timeOfRoomCleaningInteger = roomDatabaseManagement.GetTimeOfRoomCleaning();
            roomCleannessInteger      = roomDatabaseManagement.GetRoomCleanness();
            roomImageIds = roomDatabaseManagement.GetRoomImageIds();
            isRoom       = roomDatabaseManagement.GetIsRoom();

            timeOfRoomCleaning = new string[timeOfRoomCleaningInteger.Length];
            roomCleanness      = new string[roomCleannessInteger.Length];

            spinnerPosition    = new int[1];
            spinnerPosition[0] = 0;

            isSecondActionButtonIsVisible    = new bool[1];
            isSecondActionButtonIsVisible[0] = false;

            if (roomId == -1)
            {
                roomId = roomIds[0];
            }

            for (int i = 0; i < roomIds.Length; i++)
            {
                if (roomId == roomIds[i])
                {
                    break;
                }
                else
                {
                    spinnerPosition[0]++;
                }
            }

            for (int i = 0; i < roomIds.Length; i++)
            {
                timeOfRoomCleaning[i] = timeOfRoomCleaningInteger[i].ToString() + " " + GetString(Resource.String.minute_text);
                roomCleanness[i]      = roomCleannessInteger[i].ToString() + "%";
            }

            roomRecycler = FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.room_recycler);

            SetAdapterForRoomRecycler();
            LinearLayoutManager roomLinearLayoutManager = new LinearLayoutManager(this);

            roomRecycler.SetLayoutManager(roomLinearLayoutManager);

            #region Висувний список та Action Bar
            mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolBar);
            SetSupportActionBar(mToolBar);

            mActionBar = SupportActionBar;
            mActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            mActionBar.SetHomeButtonEnabled(true);
            mActionBar.SetDisplayHomeAsUpEnabled(true);

            mDrawerLayout   = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            mNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (mNavigationView != null)
            {
                SetUpDrawerContent(mNavigationView);
            }
            #endregion

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);
            fab.Click += Fab_Click;

            UpdateTasks();

            listOfTasksRecycler = FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.list_of_tasks_recycler);

            SetAdapterForTaskRecycler();
            LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
            listOfTasksRecycler.SetLayoutManager(linearLayoutManager);
        }
Ejemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.list_of_rooms);

            #region Висувний список та Action Bar
            mToolBar = FindViewById <SupportToolbar>(Resource.Id.toolBar);
            SetSupportActionBar(mToolBar);

            mActionBar = SupportActionBar;
            mActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            mActionBar.SetHomeButtonEnabled(true);
            mActionBar.SetDisplayHomeAsUpEnabled(true);

            mDrawerLayout   = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            mNavigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (mNavigationView != null)
            {
                SetUpDrawerContent(mNavigationView);
            }
            #endregion

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);
            //fab.BackgroundTintList = ColorStateList.ValueOf(Android.Graphics.Color.LightCyan);

            fab.Click += Fab_Click;

            try
            {
                RoomDatabaseManagement roomDatabaseManagement = new RoomDatabaseManagement();
                roomDatabaseManagement.FindRightOrderOfRoomTitles(this);
                roomIds    = roomDatabaseManagement.GetRoomIds();
                roomTitles = roomDatabaseManagement.GetRoomTitles();

                timeOfRoomCleaning = new string[roomTitles.Length];
                roomCleanness      = new string[roomTitles.Length];

                RoomDatabaseManagement roomDatabaseManagement2 = new RoomDatabaseManagement();
                roomDatabaseManagement2.CalculateRoomCleannessAndTimeOfRoomCleaning(this);
                timeOfRoomCleaningInteger = roomDatabaseManagement2.GetTimeOfRoomCleaning();
                roomCleannessInteger      = roomDatabaseManagement2.GetRoomCleanness();

                for (int i = 0; i < timeOfRoomCleaning.Length; i++)
                {
                    timeOfRoomCleaning[i] = timeOfRoomCleaningInteger[i].ToString() + " " + GetString(Resource.String.minute_text);
                    roomCleanness[i]      = roomCleannessInteger[i].ToString() + "%";
                }


                listOfRoomsRecycler = FindViewById <Android.Support.V7.Widget.RecyclerView>(Resource.Id.list_of_rooms_recycler);

                RoomInListAdapter adapter = new RoomInListAdapter(roomTitles, timeOfRoomCleaning, roomCleanness);
                adapter.ItemClick += OnItemClick;
                listOfRoomsRecycler.SetAdapter(adapter);
                LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this);
                listOfRoomsRecycler.SetLayoutManager(linearLayoutManager);
                listOfRoomsRecycler.NestedScrollingEnabled = false;
            }
            catch (Exception)
            {
            }
        }