예제 #1
0
        public static BasicMyConversationsFragment NewInstance()
        {
            var fragment = new BasicMyConversationsFragment {
                Arguments = new Bundle()
            };

            return(fragment);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            View view = inflater.Inflate(Resource.Layout.basic_fragment_browse_users, null);

            Activity.Title = "SuperHumans";

            ViewModel = new UsersViewModel();

            fab = view.FindViewById <FloatingActionButton>(Resource.Id.fab);

            recyclerView = view.FindViewById <RecyclerView>(Resource.Id.recyclerView);

            recyclerView.HasFixedSize = true;

            recyclerView.SetAdapter(adapter = new BrowseUsersAdapter(Activity, ViewModel));

            refresher = view.FindViewById <SwipeRefreshLayout>(Resource.Id.refresher);
            refresher.SetColorSchemeColors(Resource.Color.accent);

            progress            = view.FindViewById <ProgressBar>(Resource.Id.progressbar_loading);
            progress.Visibility = ViewStates.Gone;

            filterSpinner = view.FindViewById <Spinner>(Resource.Id.filter_spinner);
            filterSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var spinnerAdapter = ArrayAdapter.CreateFromResource(
                Activity, Resource.Array.users_spinner_array, Resource.Layout.spinnerLayout);

            spinnerAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);

            filterSpinner.Adapter = spinnerAdapter;

            fab.Click += (sender, e) =>
            {
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, BasicMyConversationsFragment.NewInstance())
                .AddToBackStack(null).Commit();
            };

            return(view);
        }