コード例 #1
0
        public async void FillTabs(int group_id, int group_type)
        {
            var host = _prefs.GetString("host", null);

            _manager = new ApiManager(host);
            var token = _prefs.GetString("token", null);

            fragments = new List <Android.Support.V4.App.Fragment>
            {
                FeedFragment.newInstance(group_id),
                GroupMembersFragment.newInstance(group_id)
                //CategoriesContainerFragment.newInstance(category_id)
            };
            titles = new List <string>
            {
                "Объявления",
                "Члены"
            };

            var isAdministrator = await _manager.CheckIfAdmin(token, group_id);

            if (isAdministrator)
            {
                fragments.Add(RequestsFragment.newInstance(group_id, group_type == 1));
                titles.Add("Администрирование");
                NotifyDataSetChanged();
            }
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "group" layout resource
            SetContentView(Resource.Layout.Group);

            string group_name = GroupManagerActivity.current_group_selected.groupName;

            //on affecte le groupe courant au groupe selectionné
            foreach (Group grp in DataBase.current_user.groups)
            {
                if (grp.groupName == group_name)
                {
                    current_group = grp;

                    if (grp != null)
                    {
                        Title = current_group.groupName;
                    }
                }
            }

            //click sur Membres
            TextView membres = FindViewById <TextView>(Resource.Id.groupMembersTextView);

            membres.Click += delegate
            {
                FragmentTransaction  tx             = FragmentManager.BeginTransaction();
                GroupMembersFragment contactsDialog = new GroupMembersFragment();
                contactsDialog.Show(tx, "Membres");
            };

            //click sur Admins
            TextView admins = FindViewById <TextView>(Resource.Id.groupAdminsTextView);

            admins.Click += delegate
            {
                FragmentTransaction tx             = FragmentManager.BeginTransaction();
                GroupAdminsFragment contactsDialog = new GroupAdminsFragment();
                contactsDialog.Show(tx, "Admins");
            };

            //click sur évènements
            TextView ev = FindViewById <TextView>(Resource.Id.groupEventsTextView);

            ev.Click += delegate
            {
                UserService uService = new UserService(DataBase.current_user);
                StartActivity(typeof(GroupEventsActivity));
            };


            //


            // Service
            uService = new UserService(DataBase.current_user);

            // views
            // Comment content
            comContentET = FindViewById <EditText>(Resource.Id.group_comment_text);

            // valid button
            comValidButton = FindViewById <ImageButton>(Resource.Id.group_commentSend_btn);

            if (comValidButton != null)
            {
                comValidButton.Click += delegate
                {
                    if (comContentET != null)
                    {
                        Comment comment = publishComment();

                        // Ajout du commentaire dans l'événement

                        if (current_group != null)
                        {
                            commentList = current_group.AddComment(comment);
                        }

                        // Refresh the list
                        EventCommentAdapter newAdapter = new EventCommentAdapter(this, commentList);
                        listView.Adapter = newAdapter;
                    }
                }
            }
            ;

            // ListView
            listView = FindViewById <ListView>(Resource.Id.group_comment_listView);

            // Notifications list : liste de commentaires des événements
            commentList = current_group.GetAllComments();

            // Create and set the adapter
            EventCommentAdapter adapter = new EventCommentAdapter(this, commentList);

            if (listView != null)
            {
                listView.Adapter = adapter;
            }
        }