예제 #1
0
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			var view = inflater.Inflate(Resource.Layout.ListViewWithSwipe, container, false);


			SwipeRefreshLayout = (SwipeRefreshLayout)view.FindViewById(Resource.Id.swipe_refresh_layout);
			SwipeRefreshLayout.SetColorSchemeColors(Resource.Color.tenBlue,
				Resource.Color.colorPrimary,
				Resource.Color.colorAccent,
				Resource.Color.colorPrimaryDark);
			SwipeRefreshLayout.Refresh += async delegate
			{
				await FetchTableData();
			};


			ListView = view.FindViewById<ListView>(Resource.Id.list);
			ListView.SetOnScrollListener(new TailFetchListViewListener(this));
			ListView.AddFooterView(FooterView, null, false);
			ListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
			{
				TenServiceHelper.GoToGuestProfile(FragmentManager, Master.Id, TableItems[e.Position]);
			};


			BackgroundTextView = (TextView)view.FindViewById<TextView>(Resource.Id.backgroundTextView);
			BackgroundTextView.Text = EmptyTableString;
			return view;
		}
예제 #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _viewModel = _navigationService.GetAndRemoveParameter(Intent) as CommentViewModel;
            SetContentView(Resource.Layout.Comments);

            SetSupportActionBar(FindViewById<Toolbar>(Resource.Id.CommentsToolbar));
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            Title = _viewModel.Title;

            _commentsList = FindViewById<ListView>(Resource.Id.CommentsListView);

            _replyButton = FindViewById<TextView>(Resource.Id.CommentReplyButton);
            _replyButton.SetCommand("Click", _viewModel.ReplyCommand);
            _replyButton.Enabled = false;

            _comment = FindViewById<EditText>(Resource.Id.CommentReplyText);
            _comment.Hint = _viewModel.CommentPlaceholder;

            _commentsList.Adapter = new ObservableAdapter<IListItem>()
            {
                    DataSource = _viewModel.CardViewModels,
                    GetTemplateDelegate = GetCell,
            };
            var footer = new View(this);
            footer.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)Math.Ceiling(TypedValue.ApplyDimension(ComplexUnitType.Dip, 50f, Application.Context.Resources.DisplayMetrics)));

            _commentsList.AddFooterView(footer);

            _comment.TextChanged += (sender, e) => _viewModel.Comments = _comment.Text;

            _viewModel.RequestDismissKeyboard = () =>
            {
                    InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService);
                    imm.HideSoftInputFromWindow(_comment.WindowToken, 0);

            };
            
            _viewModel.RequestCanExecute = (enabled) => _replyButton.Enabled = enabled;
            _viewModel.PropertyChanged += (sender, e) => 
                {
                    switch(e.PropertyName)
                    {
                        case "Comments":
                            if(!_comment.Text.Equals(_viewModel.Comments))
                                _comment.Text = _viewModel.Comments;
                            break;
                    }
                };
        }
예제 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.List);
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbarList);

            SetActionBar(toolbar);
            ActionBar.Title = "Big Days";

            _UiBigDaysListView  = (ListView)FindViewById(Resource.Id.BigDaysListView);
            _BigDaysListAdapter = new BigDaysListAdapter(this, MainActivity._BDitems.ToArray());
                        #if _TRIAL_
            View trial = this.LayoutInflater.Inflate(Resource.Layout.BigDaysListItemTrial, null);
            trial.Click += (sender, e) => {
                Intent browserIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(Constants.VersionLink));
                StartActivity(browserIntent);
            };
            _UiBigDaysListView.AddFooterView(trial);
                        #endif
            _UiBigDaysListView.Adapter    = _BigDaysListAdapter;
            _UiBigDaysListView.ItemClick += OnListItemClick;
            var ui_addBigDaysBtn = FindViewById <ImageButton> (Resource.Id.addBigDays);
            ui_addBigDaysBtn.Click += (sender, e) => {
                                #if _TRIAL_
                if (MainActivity._BDitems.Count == 1)
                {
                    AlertDialog.Builder builder;
                    builder = new AlertDialog.Builder(this);
                    builder.SetTitle("Free Version");
                    builder.SetMessage("You can add only 1 Big Day item in free version. Please purchase full version to enable adding unlimited Big Days items and Facebook share function.\n\nBy clicking \"Buy Now\" you will redirect to Full version (no ad banner) purchase page.");
                    builder.SetCancelable(false);
                    builder.SetPositiveButton("Buy Now", delegate {
                        Intent browserIntent = new Intent(Intent.ActionView, Android.Net.Uri.Parse(Constants.VersionLink));
                        StartActivity(browserIntent);
                    });
                    builder.SetNegativeButton("Continue", delegate {  });
                    builder.Show();
                }
                else
                {
                    var IntentNewBigDaysActivity = new Intent(this, typeof(NewBigDays));
                    StartActivityForResult(IntentNewBigDaysActivity, 0);
                }
                                #else
                var IntentNewBigDaysActivity = new Intent(this, typeof(NewBigDays));
                StartActivityForResult(IntentNewBigDaysActivity, 0);
                                #endif
            };
            _TimerHandler = new Handler();
            UpdateGeneration();
        }
예제 #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.activity_profile);

            //Setup firebase and firestore
            app     = FirebaseApp.Instance;
            auth    = FirebaseAuth.GetInstance(app);
            db      = FirebaseFirestore.GetInstance(app);
            storage = FirebaseStorage.GetInstance(app);

            var name = Global.FName == string.Empty ? auth.CurrentUser.Email : Global.FName + " " + Global.LName;

            //ListView
            listView = FindViewById <ListView>(Resource.Id.profile_listview);
            List <ListItem> listData = new List <ListItem>
            {
                new ListItem {
                    Heading = "NAME", SubHeading = name
                },
                new ListItem {
                    Heading = "EMAIL", SubHeading = auth.CurrentUser.Email
                },
                new ListItem {
                    Heading = "PHONE", SubHeading = Global.Phone == string.Empty ? "" : Global.Phone
                },
                new ListItem {
                    Heading = "ACCOUNT", SubHeading = Global.UserType == string.Empty ? "Customer" : Global.UserType
                }
            };

            listView.Adapter = new ListAdapter(this, listData);
            listView.AddFooterView(new View(this));


            displayName      = FindViewById <TextView>(Resource.Id.profile_name);
            displayName.Text = name;

            profilePic = FindViewById <ImageView>(Resource.Id.profile_pic);
            Picasso.Get().LoggingEnabled = true;
            Picasso.Get().Load(new File(Global.PhotoUrl)).Placeholder(Resource.Drawable.female_user_256)
            .Error(Resource.Drawable.female_user_256)
            .Into(profilePic);

            profilePic.Click += ProfilePic_Click;
        }
예제 #5
0
        private void InitializeListView()
        {
            deviceList             = new List <string>();
            deviceListView         = this.mActivity.FindViewById <ListView>(Resource.Id.listView1);
            deviceListAdapter      = new ArrayAdapter <string>(this.mActivity, Resource.Layout.listviewtemplate, Resource.Id.lbltransparent, deviceList);
            deviceListView.Adapter = deviceListAdapter;
            deviceListView.AddFooterView(new View(this.mActivity));
            deviceListView.ItemClick += deviceListView_ItemClick;
            this.mActivity.RegisterForContextMenu(deviceListView);

            rtspList             = new List <string>();
            rtspListView         = this.mActivity.FindViewById <ListView>(Resource.Id.listView2);
            rtspListAdapter      = new ArrayAdapter <string>(this.mActivity, Resource.Layout.listviewtemplate, Resource.Id.lbltransparent, rtspList);
            rtspListView.Adapter = rtspListAdapter;
            rtspListView.AddFooterView(new View(this.mActivity));
            rtspListView.ItemClick += rtspListView_ItemClick;
            this.mActivity.RegisterForContextMenu(rtspListView);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.PerformedCargoesMain);

            typeOfUser = int.Parse(AuthService.UserType);

            mListView = FindViewById <ListView>(Resource.Id.lstPcPerformed);


            var originValue     = Intent.GetStringExtra("originValue");
            var destinyValue    = Intent.GetStringExtra("destinyValue");
            var cargoTypeValue  = Intent.GetStringExtra("cargoTypeValue");
            var priceRangeValue = Intent.GetStringExtra("priceRangeValue");


            LayoutInflater inflater      = (LayoutInflater)this.GetSystemService(Context.LayoutInflaterService);
            View           headerView    = inflater.Inflate(Resource.Layout.CargoesHeader, null);
            TextView       lblTextHeader = (TextView)headerView.FindViewById <TextView>(Resource.Id.lblChTitleList);

            lblTextHeader.SetText(typeOfUser == 1 ?Resource.String.PublishedTripTitle : Resource.String.PublishedCargoesTitle);

            View footerView = inflater.Inflate(Resource.Layout.CargoesFooter, null);
            var  data       = new DataModels.DataModels();

            var mItems = GetTrips(originValue, destinyValue, cargoTypeValue, priceRangeValue);
            PerformedCargoesAdapter adapter = new PerformedCargoesAdapter(this, mItems);

            mListView.AddHeaderView(headerView);
            mListView.AddFooterView(footerView);
            mListView.Adapter = adapter;

            btnVolver            = FindViewById <Button>(Resource.Id.btnCfReturn);
            lblName              = FindViewById <TextView>(Resource.Id.txtPcUser);
            mListView.ItemClick += MListView_ItemClick;

            btnVolver.Click += delegate
            {
                Intent nextScreen = new Intent(this, typeof(SearchCargoesActivity));
                StartActivity(nextScreen);
            };
        }
예제 #7
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Window.RequestFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.ProductListView);

            allItems               = new List <Product>();
            productList            = FindViewById <ListView>(Resource.Id.productListView);
            productList.ItemClick += OnProductClickHandler;

            progressDialog = UITools.CreateAndShowLoadingDialog(this);

            await RESTService.DownloadProductsFromAPI().ContinueWith(t =>
            {
                RunOnUiThread(() =>
                {
                    UITools.EndLoadingDialog(progressDialog);
                });
            });

            allItems    = SessionService.cachedProducts.Take(PAGESIZE).ToList();
            maxPosition = allItems.Count;

            btnLoad      = new Button(this);
            btnLoad.Text = "Load more";

            if (allItems.Count == 0)
            {
                btnLoad.Enabled = false;
                btnLoad.Text    = "Brak przedmiotów!";
            }
            else if (SessionService.cachedProducts.Count <= PAGESIZE)
            {
                btnLoad.Visibility = ViewStates.Invisible;
            }

            btnLoad.Click += BtnLoadMore_ClickAsync;
            productList.AddFooterView(btnLoad);

            productList.Adapter = new MyCustomListAdapter(allItems);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Solutions);


            LayoutInflater inflater   = Window.LayoutInflater;
            View           footerView = ((LayoutInflater)inflater.Context.GetSystemService(Context.LayoutInflaterService))
                                        .Inflate(Resource.Layout.FooterView, null, false);


            backButton = FindViewById <ImageButton>(Resource.Id.button_back);
            rateButton = FindViewById <ImageButton>(Resource.Id.button_rate);
            editButton = FindViewById <ImageButton>(Resource.Id.button_edit);
            listView   = FindViewById <ListView>(Resource.Id.list);
            listView.AddFooterView(footerView);

            addButton = FindViewById <ImageView>(Resource.Id.add_button);

            // Get Data using APIConnection
            List <SolutionModel> listSolution = new List <SolutionModel>();
            APIConnection        connector    = new APIConnection();

            listSolution = connector.GetData <List <SolutionModel> >(APIConnection.Solutions);

            listView.Adapter = new SolutionsAdapter(this, listSolution);

            addButton.Click += delegate
            {
                StartActivity(typeof(AddSolutionsActivity));
            };
            backButton.Click += delegate
            {
                this.OnBackPressed();
            };
            editButton.Click += delegate
            {
                Intent editSolutionActivity = new Intent(this, typeof(EditSolutionActivity));
                StartActivity(editSolutionActivity);
            };
        }
예제 #9
0
        public void SetupFooterListView()
        {
            decimal sumOfSplitPayments = mItems.Sum(x => x.amount);
            decimal totalSaleAmount    = mTotalSaleAmount;

            txtBalanceOrChange.Text = GenerateBalanceOrChange(sumOfSplitPayments, totalSaleAmount);
            if (sumOfSplitPayments != 0 && (sumOfSplitPayments != totalSaleAmount))
            {
                if (mLvSplitPayments.FooterViewsCount == 0)
                {
                    mLvSplitPayments.AddFooterView(footerView);
                }
            }
            else if (sumOfSplitPayments == totalSaleAmount || sumOfSplitPayments == 0)
            {
                if (mLvSplitPayments.FooterViewsCount > 0)
                {
                    mLvSplitPayments.RemoveFooterView(footerView);
                }
            }
        }
예제 #10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            CommonUtils.SetFullScreen(this);
            SetContentView(Resource.Layout.Main);

            _listView = FindViewById<ListView>(Resource.Id.List);
            _listAdapter = new ListAdapter(this, new List<Tweet>());

            var footerView =
                ((LayoutInflater) GetSystemService(LayoutInflaterService)).Inflate(Resource.Layout.FooterView, null);
            _headerButton = footerView.FindViewById<Button>(Resource.Id.buttonMoreFooter);
            _headerButton.Text = "Loading";

            _listView.AddFooterView(footerView);
            _listView.Adapter = _listAdapter;

            ThreadPool.QueueUserWorkItem(lt => LoadTweets());

            FindViewById<Button>(Resource.Id.buttonFavourites).Click +=
                delegate { CommonUtils.StartNewActivity(this, typeof (FavouritesActivity)); };
        }
예제 #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            LayoutInflater li = (LayoutInflater)GetSystemService(Context.LayoutInflaterService);

            footer        = li.Inflate(Resource.Layout.load_more_footer, null);
            resultDetails = (TextView)footer.FindViewById(Resource.Id.result_details);
            footer.Click += OnFooterClicked;

            ListView.AddFooterView(footer);
            ListAdapter = new SearchResultsAdapter(this, new List <Property>()
            {
            });

            var app = (PropertyFinderApplication)Application;

            presenter = (SearchResultsPresenter)app.Presenter;
            presenter.SetView(this);
            app.CurrentActivity = this;
        }
        private void initializeHeaderAndFooter()
        {
            ListAdapter = null;
            if (hasHeaderAndFooter)
            {
                ListView list = ListView;

                LayoutInflater inflater = LayoutInflater.From(this);
                TextView       header1  = (TextView)inflater.Inflate(Android.Resource.Layout.SimpleListItem1, list, false);
                header1.Text = "First header";
                list.AddHeaderView(header1);

                TextView header2 = (TextView)inflater.Inflate(Android.Resource.Layout.SimpleListItem1, list, false);
                header2.Text = "Second header";
                list.AddHeaderView(header2);

                TextView footer = (TextView)inflater.Inflate(Android.Resource.Layout.SimpleListItem1, list, false);
                footer.Text = "Single footer";
                list.AddFooterView(footer);
            }

            initializeAdapter();
        }
예제 #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar_main);

            toolbar.Title = GetString(Resource.String.app_name);
            SetSupportActionBar(toolbar);

            listViewData = FindViewById <ListView>(Resource.Id.list_view_main);
            LoadData();
            maxPosition = lstSource.Count;
            var buttonLoadMore = new Button(this)
            {
                Text = GetString(Resource.String.txt_load_more)
            };

            listViewData.Adapter  = new ListViewAdapter(this, lstSource);
            buttonLoadMore.Click += ButtonLoadMore_Click;
            listViewData.AddFooterView(buttonLoadMore);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View rootView = inflater.Inflate(Resource.Layout.fragment_tiles, container, false);
            mListTiles = rootView.FindViewById<ListView>(Resource.Id.listTiles);

            RelativeLayout header = (RelativeLayout)inflater.Inflate(Resource.Layout.fragment_tiles_header, null);

            mTextRemainingCapacity = header.FindViewById<TextView>(Resource.Id.textAvailableCapacity);
            mButtonAddTile = header.FindViewById<Button>(Resource.Id.buttonAddTile);
            mButtonAddTile.Click += async delegate
            {
                try
                {
                    //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
                    //ORIGINAL LINE: final android.graphics.BitmapFactory.Options options = new android.graphics.BitmapFactory.Options();
                    BitmapFactory.Options options = new BitmapFactory.Options();
                    options.InScaled = false;
                    BandIcon tileIcon = BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.tile, options));

                    BandIcon badgeIcon = mCheckboxBadging.Checked ? BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.badge, options)) : null;

                    BandTile tile = 
                        new BandTile.Builder(Java.Util.UUID.RandomUUID(), mEditTileName.Text, tileIcon)
                        .SetTileSmallIcon(badgeIcon)
                        .SetTheme(mCheckboxCustomTheme.Checked ? mThemeView.Theme : null)
                        .Build();

                    try
                    {
                        var result = await Model.Instance.Client.TileManager.AddTileTaskAsync(Activity, tile);
                        if (result)
                        {
                            Toast.MakeText(Activity, "Tile added", ToastLength.Short).Show();
                        }
                        else
                        {
                            Toast.MakeText(Activity, "Unable to add tile", ToastLength.Short).Show();
                        }
                    }
                    catch (Exception ex)
                    {
                        Util.ShowExceptionAlert(Activity, "Add tile", ex);
                    }

                    // Refresh our tile list and count
                    await RefreshData();
                    RefreshControls();
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Add tile", e);
                }
            };
            mButtonRemoveTile = header.FindViewById<Button>(Resource.Id.buttonRemoveTile);
            mButtonRemoveTile.Click += async delegate
            {
                try
                {
                    await Model.Instance.Client.TileManager.RemoveTileTaskAsync(mSelectedTile.TileId);
                    mSelectedTile = null;
                    Toast.MakeText(Activity, "Tile removed", ToastLength.Short).Show();
                    await RefreshData();
                    RefreshControls();
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Remove tile", e);
                }
            };
            mCheckboxBadging = header.FindViewById<CheckBox>(Resource.Id.cbBadging);

            mThemeView = header.FindViewById<BandThemeView>(Resource.Id.viewCustomTheme);
            mThemeView.Theme = BandTheme.CyberTheme;
            mCheckboxCustomTheme = header.FindViewById<CheckBox>(Resource.Id.cbCustomTheme);
            mCheckboxCustomTheme.CheckedChange += (sender, e) =>
            {
                    mThemeView.Visibility = e.IsChecked ? ViewStates.Visible : ViewStates.Gone;
            };

            mEditTileName = header.FindViewById<EditText>(Resource.Id.editTileName);
            mEditTileName.TextChanged += (sender, e) => RefreshControls();

            RelativeLayout footer = (RelativeLayout)inflater.Inflate(Resource.Layout.fragment_tiles_footer, null);

            mEditTitle = footer.FindViewById<EditText>(Resource.Id.editTitle);
            mEditBody = footer.FindViewById<EditText>(Resource.Id.editBody);
            mCheckboxWithDialog = footer.FindViewById<CheckBox>(Resource.Id.cbWithDialog);

            mButtonSendMessage = footer.FindViewById<Button>(Resource.Id.buttonSendMessage);
            mButtonSendMessage.Click += async delegate
            {
                try
                {
                    await Model.Instance.Client.NotificationManager.SendMessageTaskAsync(
                        mSelectedTile.TileId,
                        mEditTitle.Text,
                        mEditBody.Text,
                        DateTime.Now,
                        mCheckboxWithDialog.Checked);
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Send message", e);
                }
            };

            mButtonSendDialog = footer.FindViewById<Button>(Resource.Id.buttonSendDialog);
            mButtonSendDialog.Click += async delegate
            {
                try
                {
                    await Model.Instance.Client.NotificationManager.ShowDialogTaskAsync(mSelectedTile.TileId, mEditTitle.Text, mEditBody.Text);
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Show dialog", e);
                }
            };

            mListTiles.AddHeaderView(header);
            mListTiles.AddFooterView(footer);

            mTileListAdapter = new TileListAdapter(this);
            mListTiles.Adapter = mTileListAdapter;

            mListTiles.ItemClick += (sender, e) =>
            {
                var position = e.Position - 1; // ignore the header
                if (position >= 0 && position < mTileListAdapter.Count)
                {
                    mSelectedTile = (BandTile) mTileListAdapter.GetItem(position);
                    RefreshControls();
                }
            };

            return rootView;
        }
예제 #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Places);

            _gpsTracker = ((AfaApplication)ApplicationContext).GetGpsTracker(this);
            _googlePlaces = new GooglePlacesApi.GooglePlaces(AfaConfig.GoogleApiKey);
            _loading = DialogManager.ShowLoadingDialog(this, "Retrieving Nearby Places");

            Log.Debug("Position Lat:", _gpsTracker.Latitude.ToString());
            Log.Debug("Position Lng:", _gpsTracker.Longitude.ToString());

            _placesListView = FindViewById<ListView>(Resource.Id.Places);

            var layout = new LinearLayout(this);
            _loadMoreButton = new Button(this);
            _loadMoreButton.Text = "Load More Results";
            _loadMoreButton.LayoutParameters = new TableLayout.LayoutParams(TableLayout.LayoutParams.WrapContent,
                                                                            TableLayout.LayoutParams.WrapContent, 1f);
            layout.AddView(_loadMoreButton);
            _addNewPlaceButton = new Button(this);
            _addNewPlaceButton.Text = "Add New";
            _addNewPlaceButton.LayoutParameters = new TableLayout.LayoutParams(TableLayout.LayoutParams.WrapContent,
                                                                            TableLayout.LayoutParams.WrapContent, 1f);
            layout.AddView(_addNewPlaceButton);
            _placesListView.AddFooterView(layout);

            _loadMoreButton.Click += (sender, args) => FetchMoreResults();

            _addNewPlaceButton.Click += (sender, args) =>
                                            {
                                                var intent = new Intent(this, typeof (AddPlaceActivity));
                                                StartActivity(intent);
                                            };

            DoPlacesSearch();

            var searchButton = FindViewById<ImageButton>(Resource.Id.searchButton);
            searchButton.Click += (sender, args) =>
                                      {
                                          _loading.Show();
                                          var inputManager = (InputMethodManager) GetSystemService(Context.InputMethodService);
                                          inputManager.HideSoftInputFromWindow(CurrentFocus.WindowToken, HideSoftInputFlags.NotAlways);

                                          var placeNameInput = FindViewById<EditText>(Resource.Id.placeNameSearch);
                                          var locationNameInput = FindViewById<EditText>(Resource.Id.locationSearch);

                                          var placeNameSpecified = !String.IsNullOrWhiteSpace(placeNameInput.Text);
                                          var locationNameSpecified = !String.IsNullOrWhiteSpace(locationNameInput.Text);

                                          if (!placeNameSpecified && !locationNameSpecified)
                                          {
                                              // Nothing specified, do default search
                                              DoPlacesSearch();
                                          }
                                          else if (locationNameSpecified)
                                          {
                                              _googlePlaces.Search(this, locationNameInput.Text, PlaceTypes, placeNameInput.Text, SearchCallback);
                                          }
                                          else
                                          {
                                              _googlePlaces.Search(_gpsTracker.Latitude, _gpsTracker.Longitude,
                                                                   PlaceTypes, placeNameInput.Text, SearchCallback);
                                          }
                                      };
        }
예제 #16
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Xamarin.Insights.Initialize("key", this);
            Xamarin.Insights.ForceDataTransmission = true;
            AndroidExtensions.Initialize(this);

            SetContentView(Resource.Layout.Main);

            this.drawer       = FindViewById <DrawerLayout> (Resource.Id.drawer_layout);
            this.drawerToggle = new MoyeuActionBarToggle(this,
                                                         drawer,
                                                         Resource.Drawable.ic_drawer,
                                                         Resource.String.open_drawer,
                                                         Resource.String.close_drawer)
            {
                OpenCallback = () => {
                    ActionBar.Title = Title;

                    if (CurrentFragment != null)
                    {
                        CurrentFragment.HasOptionsMenu = false;
                    }

                    InvalidateOptionsMenu();
                },
                CloseCallback = () => {
                    var currentFragment = CurrentFragment;
                    if (currentFragment != null)
                    {
                        ActionBar.Title = ((IMoyeuSection)currentFragment).Title;
                        currentFragment.HasOptionsMenu = true;
                    }
                    InvalidateOptionsMenu();
                },
            };
            drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow, (int)GravityFlags.Left);
            drawer.SetDrawerListener(drawerToggle);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            Hubway.Instance.Subscribe(this);
            FavoriteManager.FavoritesChanged += (sender, e) => aroundAdapter.Refresh();

            FindViewById <Button>(Resource.Id.button_about).Click += (sender, e) => {
                StartActivity(new Intent(this, typeof(SettingsActivity)));
                var data = new Dictionary <string, string> ();
                data.Add("Section", "Settings");
                Xamarin.Insights.Track("Navigated", data);
            };

            drawerMenu = FindViewById <ListView> (Resource.Id.left_drawer);
            drawerMenu.AddFooterView(new Space(this));
            drawerMenu.ItemClick += HandleSectionItemClick;
            menuNormalTf          = Typeface.Create(Resources.GetString(Resource.String.menu_item_fontFamily),
                                                    TypefaceStyle.Normal);
            menuHighlightTf = Typeface.Create(Resources.GetString(Resource.String.menu_item_fontFamily),
                                              TypefaceStyle.Bold);
            drawerMenu.Adapter = new DrawerMenuAdapter(this);

            drawerAround            = FindViewById <ListView> (Resource.Id.left_drawer_around);
            drawerAround.ItemClick += HandleAroundItemClick;
            drawerAround.Adapter    = aroundAdapter = new DrawerAroundAdapter(this);

            drawerMenu.SetItemChecked(0, true);
            if (CheckGooglePlayServices())
            {
                client = CreateApiClient();
                SwitchTo(mapFragment = new HubwayMapFragment(this));
                ActionBar.Title      = ((IMoyeuSection)mapFragment).Title;
            }
        }
예제 #17
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            Xamarin.Insights.Initialize("0d4fce398ef6007c41608174cd08dca7ea995c7a", this);
            Xamarin.Insights.ForceDataTransmission = true;
            AndroidExtensions.Initialize(this);

            this.drawer       = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            this.drawerToggle = new ProntoActionBarToggle(this,
                                                          drawer,
                                                          Resource.String.open_drawer,
                                                          Resource.String.close_drawer)
            {
                OpenCallback = () =>
                {
                    SupportActionBar.Title = Title;
                    if (CurrentFragment != null)
                    {
                        CurrentFragment.HasOptionsMenu = false;
                    }
                    InvalidateOptionsMenu();
                },
                CloseCallback = () =>
                {
                    var currentFragment = CurrentFragment;
                    if (currentFragment != null)
                    {
                        SupportActionBar.Title         = ((IProntoSection)currentFragment).Title;
                        currentFragment.HasOptionsMenu = true;
                    }
                    InvalidateOptionsMenu();
                },
            };
            drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow, (int)GravityFlags.Left);
            drawer.SetDrawerListener(drawerToggle);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            Pronto.Instance.Subscribe(this);
            FavoriteManager.FavoritesChanged += (sender, e) => aroundAdapter.Refresh();

            drawerMenu = FindViewById <ListView>(Resource.Id.left_drawer);
            drawerMenu.AddFooterView(new Android.Support.V4.Widget.Space(this));
            drawerMenu.ItemClick += HandleSectionItemClick;
            menuNormalTf          = Typeface.Create(Resources.GetString(Resource.String.menu_item_fontFamily),
                                                    TypefaceStyle.Normal);

            drawerMenu.Adapter = new DrawerMenuAdapter(this);

            drawerAround            = FindViewById <ListView>(Resource.Id.left_drawer_around);
            drawerAround.ItemClick += HandleAroundItemClick;
            drawerAround.Adapter    = aroundAdapter = new DrawerAroundAdapter(this);

            drawerMenu.SetItemChecked(0, true);

            if (CheckGooglePlayServices())
            {
                client = CreateApiClient();
                SwitchTo(mapFragment   = new ProntoMapFragment(this));
                SupportActionBar.Title = ((IProntoSection)mapFragment).Title;
            }
        }
        //---------------------------------------------------------------------------------------------------------------------------------------------------

        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View List = inflater.Inflate(Resource.Layout.tab_parameters_List, null);

            base.OnCreateView(inflater, container, savedInstanceState);

            //Initializing elements from the layout.
            IdentifierOfAUser   = List.FindViewById <TextView>(Resource.Id.IdentifierOfAUser);
            SetParametersButton = List.FindViewById <Button>(Resource.Id.SetParametersButton);
            ListForParameters   = List.FindViewById <ListView>(Resource.Id.ListForParameters);

            WeightText  = Footer.FindViewById <EditText>(Resource.Id.WeightText);
            WeightText1 = Footer.FindViewById <EditText>(Resource.Id.WeightText1);
            HeightText  = Footer.FindViewById <EditText>(Resource.Id.HeightText);
            HeightText1 = Footer.FindViewById <EditText>(Resource.Id.HeightText1);
            BMIText     = Footer.FindViewById <EditText>(Resource.Id.BMIText);
            BMIText1    = Footer.FindViewById <EditText>(Resource.Id.BMIText1);

            //If the user is choosed.
            if (Classes.User.CurrentUser != -1)
            {
                //Setting the text.
                IdentifierOfAUser.Text = Resources.GetString(Resource.String.UserCharacteristic_ParametersOfUser) + " " + DatabaseUser.GetUser(User.CurrentUser).Name;

                //Getting parameters of currrent user from DB.
                foreach (ParametresOfUser TempParametres in DatabaseUser.GetUser(User.CurrentUser).Parameters)
                {
                    ListForUserParameters.Add(new TableRowParameters(TempParametres.EntryDate.ToShortDateString(), TempParametres.Weight, TempParametres.Height, TempParametres.Index));
                    if (TempParametres.Weight > maxWeight)
                    {
                        maxWeight = TempParametres.Weight;
                    }
                    if (TempParametres.Height > maxHeight)
                    {
                        maxHeight = TempParametres.Height;
                    }
                    if (TempParametres.Weight < minWeight || minWeight == -1)
                    {
                        minWeight = TempParametres.Weight;
                    }
                    if (TempParametres.Height < minHeight || minHeight == -1)
                    {
                        minHeight = TempParametres.Height;
                    }
                }

                //Setting max and min parameters
                if (maxWeight > 0)
                {
                    WeightText.Text = maxWeight.ToString();
                }
                if (maxHeight > 0)
                {
                    HeightText.Text = maxHeight.ToString();
                }
                if (minWeight > 0)
                {
                    WeightText1.Text = minWeight.ToString();
                }
                if (minHeight > 0)
                {
                    HeightText1.Text = minHeight.ToString();
                }
                BMIText.Text  = "-";
                BMIText1.Text = "-";

                //Showing in the list.
                HelpclassListAdapter AdapterForUserParameters = new HelpclassListAdapter(Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity, ListForUserParameters);
                ListForParameters.Adapter = AdapterForUserParameters;

                //If there isn't a footer, setting one.
                if (ListForParameters.FooterViewsCount == 0)
                {
                    ListForParameters.AddFooterView(Footer);
                }
            }

            //If the user isn't choosed.
            else
            {
                IdentifierOfAUser.Text = Resources.GetString(Resource.String.ErrorMessage_Unchoosed);
            }

            //Actions on clicks.
            SetParametersButton.Click += SetParametersButton_Click;

            return(List);
        }
        //---------------------------------------------------------------------------------------------------------------------------------------------------

        //Setting parametres for a user.
        private void SetParametersButton_Click(object sender, EventArgs e)
        {
            //Creating a new layout for setting parameters of a user.
            AlertDialog.Builder Object   = new AlertDialog.Builder(ListOfParameters.activity);
            LayoutInflater      inflater = LayoutInflater.From(ListOfParameters.activity);
            LinearLayout        layout   = new LinearLayout(ListOfParameters.activity);
            View FormViewsSetParametres  = inflater.Inflate(Resource.Layout.parametres_Set, layout);

            Object.SetView(FormViewsSetParametres);

            //Elements from the layout.
            NumberPicker HeightPicker = FormViewsSetParametres.FindViewById <NumberPicker>(Resource.Id.HeightPicker);
            NumberPicker WeightPicker = FormViewsSetParametres.FindViewById <NumberPicker>(Resource.Id.WeightPicker);

            //Pickers parameters.
            HeightPicker.MinValue = 50;
            HeightPicker.MaxValue = 250;

            if (DatabaseUser.GetUser(User.CurrentUser).Parameters.Count != 0)
            {
                HeightPicker.Value = (int)DatabaseUser.GetUser(User.CurrentUser).Parameters.Last().Height;
            }
            else
            {
                HeightPicker.Value = 150;
            }

            WeightPicker.MinValue = 30;
            WeightPicker.MaxValue = 500;

            if (DatabaseUser.GetUser(User.CurrentUser).Parameters.Count != 0)
            {
                WeightPicker.Value = (int)DatabaseUser.GetUser(User.CurrentUser).Parameters.Last().Weight;
            }
            else
            {
                WeightPicker.Value = 60;
            }

            //Action on pressing posititve button.
            Object.SetPositiveButton(Resource.String.Action_AddEntry, new EventHandler <DialogClickEventArgs>(delegate(object Sender, DialogClickEventArgs e1)
            {
                //If the user is choosed.
                if (Classes.User.CurrentUser != -1)
                {
                    //Getting data and changing the symbols.
                    DateTime DTForData = System.DateTime.Now;

                    //Creating temporary parameters for a new user.
                    ParametresOfUser TempParametres = new ParametresOfUser(DTForData, WeightPicker.Value, HeightPicker.Value);

                    //For showing results of changes.
                    string ForIndexResults      = "";
                    string ForParametersResults = "";

                    //Change of user's BMI.
                    if (!HelpclassDataValidation.ComparingValues(TempParametres.Index, 15.0))
                    {
                        ForIndexResults = Resources.GetString(Resource.String.MessageParameters_BMIout) + " " + TempParametres.Index + Resources.GetString(Resource.String.MessageParameters_VerySeverelyUnderweight);
                    }

                    else if (!HelpclassDataValidation.ComparingValues(TempParametres.Index, 16.0))
                    {
                        ForIndexResults = Resources.GetString(Resource.String.MessageParameters_BMIout) + " " + TempParametres.Index + Resources.GetString(Resource.String.MessageParameters_SeverelyUnderweight);
                    }

                    else if (!HelpclassDataValidation.ComparingValues(TempParametres.Index, 18.5))
                    {
                        ForIndexResults = Resources.GetString(Resource.String.MessageParameters_BMIout) + " " + TempParametres.Index + Resources.GetString(Resource.String.MessageParameters_Underweight);
                    }

                    else if (!HelpclassDataValidation.ComparingValues(TempParametres.Index, 25.0))
                    {
                        ForIndexResults = Resources.GetString(Resource.String.MessageParameters_BMIout) + " " + TempParametres.Index + Resources.GetString(Resource.String.MessageParameters_HealthyWeight);
                    }

                    else if (!HelpclassDataValidation.ComparingValues(TempParametres.Index, 30.0))
                    {
                        ForIndexResults = Resources.GetString(Resource.String.MessageParameters_BMIout) + " " + TempParametres.Index + Resources.GetString(Resource.String.MessageParameters_Overweight);
                    }

                    else if (!HelpclassDataValidation.ComparingValues(TempParametres.Index, 35.0))
                    {
                        ForIndexResults = Resources.GetString(Resource.String.MessageParameters_BMIout) + " " + TempParametres.Index + Resources.GetString(Resource.String.MessageParameters_ModeratelyOverweight);
                    }

                    else if (!HelpclassDataValidation.ComparingValues(TempParametres.Index, 40.0))
                    {
                        ForIndexResults = Resources.GetString(Resource.String.MessageParameters_BMIout) + " " + TempParametres.Index + Resources.GetString(Resource.String.MessageParameters_SeverelyOverweight);
                    }

                    else
                    {
                        ForIndexResults = Resources.GetString(Resource.String.MessageParameters_BMIout) + " " + TempParametres.Index + Resources.GetString(Resource.String.MessageParameters_VerySeverelyOverweight);
                    }

                    /*Change of user's weight and height.*/

                    //If the list of parameters isn't empty.
                    if (DatabaseUser.GetUser(User.CurrentUser).Parameters.Count != 0)
                    {
                        //Ñhange of weight.
                        if (DatabaseUser.GetUser(User.CurrentUser).Parameters.Last().Weight > TempParametres.Weight)
                        {
                            ForParametersResults = Resources.GetString(Resource.String.MessageParameters_Lost) + " " + Math.Abs(DatabaseUser.GetUser(User.CurrentUser).Parameters.Last().Weight - TempParametres.Weight) + " " + Resources.GetString(Resource.String.other_Kilograms);
                        }

                        else if (DatabaseUser.GetUser(User.CurrentUser).Parameters.Last().Weight < TempParametres.Weight)
                        {
                            ForParametersResults = Resources.GetString(Resource.String.MessageParameters_Gained) + " " + Math.Abs(DatabaseUser.GetUser(User.CurrentUser).Parameters.Last().Weight - TempParametres.Weight) + " " + Resources.GetString(Resource.String.other_Kilograms);
                        }

                        //Ñhange of height.
                        if (DatabaseUser.GetUser(User.CurrentUser).Parameters.Last().Height < TempParametres.Height)
                        {
                            ForParametersResults = ForParametersResults + " " + Resources.GetString(Resource.String.MessageGeneral_YouAre) + " " + Math.Abs(DatabaseUser.GetUser(User.CurrentUser).Parameters.Last().Height - TempParametres.Height) + " " + Resources.GetString(Resource.String.other_Centimetres);
                        }
                    }

                    //Showing info.
                    View view = inflater.Inflate(Resource.Layout.message_Parameters, null);
                    var txt1  = view.FindViewById <TextView>(Resource.Id.TextForResult);
                    var txt2  = view.FindViewById <TextView>(Resource.Id.TextForComparing);
                    txt1.Text = ForIndexResults;
                    txt2.Text = ForParametersResults;

                    var toast = new Toast(Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity)
                    {
                        Duration = ToastLength.Long,
                        View     = view
                    };
                    toast.Show();

                    //Updating user parameters.
                    User TempUser = DatabaseUser.GetUser(User.CurrentUser);
                    TempUser.Parameters.Add(TempParametres);
                    DatabaseUser.SQConnection.UpdateWithChildren(TempUser);

                    //Getting parameters of currrent user from DB.
                    ListForUserParameters.Add(new TableRowParameters(TempParametres.EntryDate.ToShortDateString(), TempParametres.Weight, TempParametres.Height, TempParametres.Index));

                    if (TempParametres.Weight > maxWeight)
                    {
                        maxWeight = TempParametres.Weight;
                    }
                    if (TempParametres.Height > maxHeight)
                    {
                        maxHeight = TempParametres.Height;
                    }
                    if (TempParametres.Weight < minWeight || minWeight == -1)
                    {
                        minWeight = TempParametres.Weight;
                    }
                    if (TempParametres.Height < minHeight || minHeight == -1)
                    {
                        minHeight = TempParametres.Height;
                    }

                    if (maxWeight > 0)
                    {
                        WeightText.Text = maxWeight.ToString();
                    }
                    if (maxHeight > 0)
                    {
                        HeightText.Text = maxHeight.ToString();
                    }
                    if (minWeight > 0)
                    {
                        WeightText1.Text = minWeight.ToString();
                    }
                    if (minHeight > 0)
                    {
                        HeightText1.Text = minHeight.ToString();
                    }
                    BMIText.Text  = "-";
                    BMIText1.Text = "-";

                    //Setting the parameters to the list.
                    HelpclassListAdapter AdapterForUserParameters = new HelpclassListAdapter(Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity, ListForUserParameters);
                    ListForParameters.Adapter = AdapterForUserParameters;

                    //If there isn't a footer, adding one.
                    if (ListForParameters.FooterViewsCount == 0)
                    {
                        ListForParameters.AddFooterView(Footer);
                    }
                }

                //If the user is not choosed.
                else
                {
                    HelpclassDataValidation.MakingErrorToast(Resource.String.ErrorMessage_Unchoosed);
                }
            }));

            //Action on pressing negative button.
            Object.SetNegativeButton(Resource.String.Cancel, new EventHandler <DialogClickEventArgs>(delegate(object Sender, DialogClickEventArgs e1) {}));

            //Showing the new form for entering the parametres.
            Object.Show();
        }
예제 #20
0
 void setupDrinksListView(View view)
 {
     drinksListView = view.FindViewById<ListView>(Resource.Id.DrinkList);
     drinksListView.ItemClick += haveDrink;
     drinksListView.ItemLongClick += showAboutDrinkAlert;
     drinksListView.SetMinimumHeight(100);
     var inflater = Application.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater;
     var footerLayout = inflater.Inflate(Resource.Layout.DrinksListFooter, null);
     setupNewDrinkButton(footerLayout);
     drinksListView.AddFooterView(footerLayout);
 }
예제 #21
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View rootView = inflater.Inflate(Resource.Layout.fragment_tiles, container, false);

            mListTiles = rootView.FindViewById <ListView>(Resource.Id.listTiles);

            RelativeLayout header = (RelativeLayout)inflater.Inflate(Resource.Layout.fragment_tiles_header, null);

            mTextRemainingCapacity = header.FindViewById <TextView>(Resource.Id.textAvailableCapacity);
            mButtonAddTile         = header.FindViewById <Button>(Resource.Id.buttonAddTile);
            mButtonAddTile.Click  += async delegate
            {
                try
                {
                    //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
                    //ORIGINAL LINE: final android.graphics.BitmapFactory.Options options = new android.graphics.BitmapFactory.Options();
                    BitmapFactory.Options options = new BitmapFactory.Options();
                    options.InScaled = false;
                    BandIcon tileIcon = BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.tile, options));

                    BandIcon badgeIcon = mCheckboxBadging.Checked ? BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.badge, options)) : null;

                    BandTile tile =
                        new BandTile.Builder(Java.Util.UUID.RandomUUID(), mEditTileName.Text, tileIcon)
                        .SetTileSmallIcon(badgeIcon)
                        .SetTheme(mCheckboxCustomTheme.Checked ? mThemeView.Theme : null)
                        .Build();

                    try
                    {
                        var result = await Model.Instance.Client.TileManager.AddTileTaskAsync(Activity, tile);

                        if (result)
                        {
                            Toast.MakeText(Activity, "Tile added", ToastLength.Short).Show();
                        }
                        else
                        {
                            Toast.MakeText(Activity, "Unable to add tile", ToastLength.Short).Show();
                        }
                    }
                    catch (Exception ex)
                    {
                        Util.ShowExceptionAlert(Activity, "Add tile", ex);
                    }

                    // Refresh our tile list and count
                    await RefreshData();

                    RefreshControls();
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Add tile", e);
                }
            };
            mButtonRemoveTile        = header.FindViewById <Button>(Resource.Id.buttonRemoveTile);
            mButtonRemoveTile.Click += async delegate
            {
                try
                {
                    await Model.Instance.Client.TileManager.RemoveTileTaskAsync(mSelectedTile.TileId);

                    mSelectedTile = null;
                    Toast.MakeText(Activity, "Tile removed", ToastLength.Short).Show();
                    await RefreshData();

                    RefreshControls();
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Remove tile", e);
                }
            };
            mCheckboxBadging = header.FindViewById <CheckBox>(Resource.Id.cbBadging);

            mThemeView           = header.FindViewById <BandThemeView>(Resource.Id.viewCustomTheme);
            mThemeView.Theme     = BandTheme.CyberTheme;
            mCheckboxCustomTheme = header.FindViewById <CheckBox>(Resource.Id.cbCustomTheme);
            mCheckboxCustomTheme.CheckedChange += (sender, e) =>
            {
                mThemeView.Visibility = e.IsChecked ? ViewStates.Visible : ViewStates.Gone;
            };

            mEditTileName              = header.FindViewById <EditText>(Resource.Id.editTileName);
            mEditTileName.TextChanged += (sender, e) => RefreshControls();

            RelativeLayout footer = (RelativeLayout)inflater.Inflate(Resource.Layout.fragment_tiles_footer, null);

            mEditTitle          = footer.FindViewById <EditText>(Resource.Id.editTitle);
            mEditBody           = footer.FindViewById <EditText>(Resource.Id.editBody);
            mCheckboxWithDialog = footer.FindViewById <CheckBox>(Resource.Id.cbWithDialog);

            mButtonSendMessage        = footer.FindViewById <Button>(Resource.Id.buttonSendMessage);
            mButtonSendMessage.Click += async delegate
            {
                try
                {
                    await Model.Instance.Client.NotificationManager.SendMessageTaskAsync(
                        mSelectedTile.TileId,
                        mEditTitle.Text,
                        mEditBody.Text,
                        DateTime.Now,
                        mCheckboxWithDialog.Checked);
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Send message", e);
                }
            };

            mButtonSendDialog        = footer.FindViewById <Button>(Resource.Id.buttonSendDialog);
            mButtonSendDialog.Click += async delegate
            {
                try
                {
                    await Model.Instance.Client.NotificationManager.ShowDialogTaskAsync(mSelectedTile.TileId, mEditTitle.Text, mEditBody.Text);
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Show dialog", e);
                }
            };

            mListTiles.AddHeaderView(header);
            mListTiles.AddFooterView(footer);

            mTileListAdapter   = new TileListAdapter(this);
            mListTiles.Adapter = mTileListAdapter;

            mListTiles.ItemClick += (sender, e) =>
            {
                var position = e.Position - 1; // ignore the header
                if (position >= 0 && position < mTileListAdapter.Count)
                {
                    mSelectedTile = (BandTile)mTileListAdapter.GetItem(position);
                    RefreshControls();
                }
            };

            return(rootView);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View rootView = inflater.Inflate(Resource.Layout.fragment_tiles, container, false);
            mListTiles = rootView.FindViewById<ListView>(Resource.Id.listTiles);

            RelativeLayout header = (RelativeLayout)inflater.Inflate(Resource.Layout.fragment_tiles_header, null);

			mTextRemainingCapacity = header.FindViewById<TextView>(Resource.Id.textAvailableCapacity);
			mButtonAddButtonTile = header.FindViewById<Button>(Resource.Id.buttonAddButtonTile);
			mButtonAddButtonTile.Click += async delegate
			{
				try
				{
					//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
					//ORIGINAL LINE: final android.graphics.BitmapFactory.Options options = new android.graphics.BitmapFactory.Options();
					BitmapFactory.Options options = new BitmapFactory.Options();
					options.InScaled = false;
					BandIcon tileIcon = BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.tile, options));

					BandIcon badgeIcon = BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.badge, options));

					FilledButton button = new FilledButton(0, 5, 210, 45);
                    button.BackgroundColor = Color.Red;
					button.Margins = new Margins(0, 5, 0 ,0);
					button.ElementId = 12;

					TextButton button2 = new TextButton(0, 0, 210, 45);
                    button2.PressedColor = Color.Blue;
					button2.Margins = new Margins(0, 5, 0 ,0);
					button2.ElementId = 21;

					FlowPanel flowPanel = new FlowPanel(15, 0, 260, 105, FlowPanelOrientation.Vertical);
					flowPanel.AddElements(button);
					flowPanel.AddElements(button2);

					PageLayout pageLayout = new PageLayout(flowPanel);

					BandTile.Builder builder = new BandTile.Builder(Java.Util.UUID.RandomUUID(), mEditTileName.Text, tileIcon);
					if (mCheckboxBadging.Checked)
					{
						builder.SetTileSmallIcon(badgeIcon);
					}
					if (mCheckboxCustomTheme.Checked)
					{
						builder.SetTheme(mThemeView.Theme);
					}
					builder.SetPageLayouts(pageLayout);
					BandTile tile = builder.Build();

					try
					{
						var result = await Model.Instance.Client.TileManager.AddTileTaskAsync(Activity, tile);
						if (result)
						{
							Toast.MakeText(Activity, "Tile added", ToastLength.Short).Show();
						}
						else
						{
							Toast.MakeText(Activity, "Unable to add tile", ToastLength.Short).Show();
						}
					}
					catch (Exception ex)
					{
						Util.ShowExceptionAlert(Activity, "Add tile", ex);
					}

					PageData pageData = new PageData(Java.Util.UUID.RandomUUID(), 0);
					pageData.Update(new FilledButtonData(12, Color.Yellow));
					pageData.Update(new TextButtonData(21, "Text Button"));
					await Model.Instance.Client.TileManager.SetPagesTaskAsync(tile.TileId, pageData);

					Toast.MakeText(Activity, "Page updated", ToastLength.Short).Show();

					// Refresh our tile list and count
					await RefreshData();
					RefreshControls();
				}
				catch (Exception e)
				{
					Util.ShowExceptionAlert(Activity, "Add tile", e);
				}
			};
			mButtonAddBarcodeTile = header.FindViewById<Button>(Resource.Id.buttonAddBarcodeTile);
			mButtonAddBarcodeTile.Click += async delegate
			{
				try
				{
					//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
					//ORIGINAL LINE: final android.graphics.BitmapFactory.Options options = new android.graphics.BitmapFactory.Options();
					BitmapFactory.Options options = new BitmapFactory.Options();
					options.InScaled = false;
					BandIcon tileIcon = BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.tile, options));

					BandIcon badgeIcon = BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.badge, options));

					// create layout 1

					Barcode barcode1 = new Barcode(new PageRect(0, 0, 221, 70), BarcodeType.Code39);
					barcode1.Margins = new Margins(3, 0, 0, 0);
					barcode1.ElementId = 11;

					TextBlock textBlock1 = new TextBlock(new PageRect(0, 0, 230, 30), TextBlockFont.Small, 0);
					textBlock1.Color = Color.Red;
					textBlock1.ElementId = 21;

					FlowPanel flowPanel1 = new FlowPanel(new PageRect(15, 0, 245, 105), FlowPanelOrientation.Vertical);
					flowPanel1.AddElements(barcode1);
					flowPanel1.AddElements(textBlock1);

					PageLayout pageLayout1 = new PageLayout(flowPanel1);

					// create layout 2

					Barcode barcode2 = new Barcode(0, 0, 221, 70, BarcodeType.Pdf417);
					barcode2.Margins = new Margins(3, 0, 0, 0);
					barcode2.ElementId = 11;

					TextBlock textBlock2 = new TextBlock(0, 0, 230, 30, TextBlockFont.Small, 0);
					textBlock2.Color = Color.Red;
					textBlock2.ElementId = 21;

					FlowPanel flowPanel2 = new FlowPanel(15, 0, 245, 105, FlowPanelOrientation.Vertical);
					flowPanel2.AddElements(barcode2);
					flowPanel2.AddElements(textBlock2);

					PageLayout pageLayout2 = new PageLayout(flowPanel2);

					// create the tile

					BandTile.Builder builder = new BandTile.Builder(Java.Util.UUID.RandomUUID(), mEditTileName.Text, tileIcon);
					if (mCheckboxBadging.Checked)
					{
						builder.SetTileSmallIcon(badgeIcon);
					}
					if (mCheckboxCustomTheme.Checked)
					{
						builder.SetTheme(mThemeView.Theme);
					}
					builder.SetPageLayouts(pageLayout1, pageLayout2);
					BandTile tile = builder.Build();

					// add tile

					try
					{
						var result = await Model.Instance.Client.TileManager.AddTileTaskAsync(Activity, tile);
						if (result)
						{
							Toast.MakeText(Activity, "Tile added", ToastLength.Short).Show();
						}
						else
						{
							Toast.MakeText(Activity, "Unable to add tile", ToastLength.Short).Show();
						}
					}
					catch (Exception ex)
					{
						Util.ShowExceptionAlert(Activity, "Add tile", ex);
					}

					PageData pageData1 = new PageData(Java.Util.UUID.RandomUUID(), 0);
					pageData1.Update(new BarcodeData(11, "MK12345509", BarcodeType.Code39));
					pageData1.Update(new TextButtonData(21, "MK12345509"));

					PageData pageData2 = new PageData(Java.Util.UUID.RandomUUID(), 1);
					pageData2.Update(new BarcodeData(11, "901234567890123456", BarcodeType.Pdf417));
					pageData2.Update(new TextButtonData(21, "901234567890123456"));

					await Model.Instance.Client.TileManager.SetPagesTaskAsync(tile.TileId, pageData1, pageData2);

					Toast.MakeText(Activity, "Page updated", ToastLength.Short).Show();

					// Refresh our tile list and count
					await RefreshData();
					RefreshControls();
				}
				catch (Exception e)
				{
					Util.ShowExceptionAlert(Activity, "Add tile", e);
				}
			};
            mButtonAddTile = header.FindViewById<Button>(Resource.Id.buttonAddTile);
            mButtonAddTile.Click += async delegate
            {
                try
                {
                    //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
                    //ORIGINAL LINE: final android.graphics.BitmapFactory.Options options = new android.graphics.BitmapFactory.Options();
                    BitmapFactory.Options options = new BitmapFactory.Options();
                    options.InScaled = false;
                    BandIcon tileIcon = BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.tile, options));
					BandIcon badgeIcon = BandIcon.ToBandIcon(BitmapFactory.DecodeResource(Resources, Resource.Raw.badge, options));

					BandTile.Builder builder = new BandTile.Builder(Java.Util.UUID.RandomUUID(), mEditTileName.Text, tileIcon);
					if (mCheckboxBadging.Checked)
					{
						builder.SetTileSmallIcon(badgeIcon);
					}
					if (mCheckboxCustomTheme.Checked)
					{
						builder.SetTheme(mThemeView.Theme);
					}
					BandTile tile = builder.Build();

                    try
                    {
                        var result = await Model.Instance.Client.TileManager.AddTileTaskAsync(Activity, tile);
                        if (result)
                        {
                            Toast.MakeText(Activity, "Tile added", ToastLength.Short).Show();
                        }
                        else
                        {
                            Toast.MakeText(Activity, "Unable to add tile", ToastLength.Short).Show();
                        }
                    }
                    catch (Exception ex)
                    {
                        Util.ShowExceptionAlert(Activity, "Add tile", ex);
                    }

                    // Refresh our tile list and count
                    await RefreshData();
                    RefreshControls();
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Add tile", e);
                }
            };
            mButtonRemoveTile = header.FindViewById<Button>(Resource.Id.buttonRemoveTile);
            mButtonRemoveTile.Click += async delegate
            {
                try
                {
                    await Model.Instance.Client.TileManager.RemoveTileTaskAsync(mSelectedTile.TileId);
                    mSelectedTile = null;
                    Toast.MakeText(Activity, "Tile removed", ToastLength.Short).Show();
                    await RefreshData();
                    RefreshControls();
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Remove tile", e);
                }
            };
            mCheckboxBadging = header.FindViewById<CheckBox>(Resource.Id.cbBadging);

            mThemeView = header.FindViewById<BandThemeView>(Resource.Id.viewCustomTheme);
            mCheckboxCustomTheme = header.FindViewById<CheckBox>(Resource.Id.cbCustomTheme);
            mCheckboxCustomTheme.CheckedChange += (sender, e) =>
            {
                    mThemeView.Visibility = e.IsChecked ? ViewStates.Visible : ViewStates.Gone;
            };

            mEditTileName = header.FindViewById<EditText>(Resource.Id.editTileName);
            mEditTileName.TextChanged += (sender, e) => RefreshControls();

            RelativeLayout footer = (RelativeLayout)inflater.Inflate(Resource.Layout.fragment_tiles_footer, null);

            mEditTitle = footer.FindViewById<EditText>(Resource.Id.editTitle);
            mEditBody = footer.FindViewById<EditText>(Resource.Id.editBody);
            mCheckboxWithDialog = footer.FindViewById<CheckBox>(Resource.Id.cbWithDialog);

            mButtonSendMessage = footer.FindViewById<Button>(Resource.Id.buttonSendMessage);
            mButtonSendMessage.Click += async delegate
            {
                try
                {
                    await Model.Instance.Client.NotificationManager.SendMessageTaskAsync(
                        mSelectedTile.TileId,
                        mEditTitle.Text,
                        mEditBody.Text,
                        DateTime.Now,
                        mCheckboxWithDialog.Checked);
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Send message", e);
                }
            };

            mButtonSendDialog = footer.FindViewById<Button>(Resource.Id.buttonSendDialog);
            mButtonSendDialog.Click += async delegate
            {
                try
                {
                    await Model.Instance.Client.NotificationManager.ShowDialogTaskAsync(mSelectedTile.TileId, mEditTitle.Text, mEditBody.Text);
                }
                catch (Exception e)
                {
                    Util.ShowExceptionAlert(Activity, "Show dialog", e);
                }
            };

            mListTiles.AddHeaderView(header);
            mListTiles.AddFooterView(footer);

            mTileListAdapter = new TileListAdapter(this);
            mListTiles.Adapter = mTileListAdapter;

            mListTiles.ItemClick += (sender, e) =>
            {
                var position = e.Position - 1; // ignore the header
                if (position >= 0 && position < mTileListAdapter.Count)
                {
                    mSelectedTile = (BandTile) mTileListAdapter.GetItem(position);
                    RefreshControls();
                }
            };

            return rootView;
        }