コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            spinnerColors     = FindViewById <Spinner>(Resource.Id.spinnerColors);
            buttonCreateGroup = FindViewById <Button>(Resource.Id.buttonCreateGroup);

            var adapter = ArrayAdapter.CreateFromResource(
                this,
                Resource.Array.colors_array,
                Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerColors.Adapter = adapter;

            buttonCreateGroup.Click += delegate
            {
                string name        = FindViewById <EditText>(Resource.Id.textName).Text;
                string description = FindViewById <EditText>(Resource.Id.textDescription).Text;
                string password    = FindViewById <EditText>(Resource.Id.textPassword).Text;
                float  color       = ColorParser.parseColorToFloat(FindViewById <Spinner>(Resource.Id.spinnerColors).SelectedItem.ToString());

                string user = this.GetSharedPreferences("User.data", FileCreationMode.Private).GetString("Email", "");

                if (String.IsNullOrWhiteSpace(name) || String.IsNullOrWhiteSpace(description))
                {
                    Toast.MakeText(
                        this,
                        "Brak nazwy lub opisu",
                        ToastLength.Long).Show();

                    return;
                }

                string url = string.Format("http://www.friendszone.cba.pl/api/add_group.php?name={0}&description={1}&password={2}&user={3}&color={4}",
                                           name,
                                           description,
                                           password,
                                           user,
                                           color
                                           );

                HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
                request.Method = "GET";

                HttpWebResponse response = request.GetResponse() as HttpWebResponse;

                StreamReader reader = new StreamReader(response.GetResponseStream(), UTF8Encoding.UTF8);
                String       json   = reader.ReadToEnd();

                processResponse(json);
            };
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                SetContentView(Resource.Layout.Produits);

                //var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
                //toolbar.SetTitleTextColor(Android.Graphics.Color.White);
                //toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(40, 195, 195));
                //SetActionBar(toolbar);
                //ActionBar.Title = "Produit/Service";
                Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

                SetSupportActionBar(toolbar);
                toolbar.SetTitleTextColor(Android.Graphics.Color.Rgb(0, 250, 154));
                toolbar.SetBackgroundColor(Android.Graphics.Color.Rgb(27, 49, 71));

                var spiner = FindViewById <Spinner>(Resource.Id.spinnerchoix);



                var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.Produit, Android.Resource.Layout.SimpleSpinnerItem);

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

                spiner.Adapter       = adapter;
                spiner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);

                //def les contrelleur
                //  var codebarre = FindViewById<EditText>(Resource.Id.editTextcodebarre);

                var produitNom = FindViewById <EditText>(Resource.Id.textInputEditTextnomproduit);

                var prix = FindViewById <EditText>(Resource.Id.editTextPrix);



                var btnenregitProduit = FindViewById <Button>(Resource.Id.buttonproduit);


                btnenregitProduit.Click += delegate
                {
                    InsetionProduit(produitNom.Text, float.Parse(prix.Text), toast);

                    Intent intent = new Intent(this, typeof(ListProduitsDevis));

                    StartActivity(intent);
                };
            }
            catch (Exception ex)
            {
                Toast.MakeText(this, ex.Message, ToastLength.Long).Show();
            }
        }
コード例 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            var spinner = FindViewById <Spinner>(Resource.Id.spinner);
            var button  = FindViewById <Button>(Resource.Id.button);
            var text    = FindViewById <TextView>(Resource.Id.result);

            spinner.Prompt = "Choose A Dice";
            var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.Counter, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;
            button.Click   += delegate
            {
                switch (spinner.SelectedItem.ToString())
                {
                case "D4":

                    text.Text = ("D4: " + Roll.Roll.D4().ToString());
                    break;

                case "D6":

                    text.Text = ("D6: " + Roll.Roll.D6().ToString());
                    break;

                case "D8":

                    text.Text = ("D8: " + Roll.Roll.D8().ToString());
                    break;

                case "D10":

                    text.Text = ("D10: " + Roll.Roll.D10().ToString());
                    break;

                case "D10 Percentile":

                    text.Text = ("D10 Percentile: " + Roll.Roll.D10Pecentile().ToString());
                    break;

                case "D12":

                    text.Text = ("D12: " + Roll.Roll.D12().ToString());
                    break;

                case "D20":

                    text.Text = ("D20: " + Roll.Roll.D20().ToString());
                    break;
                }
            };
        }
コード例 #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_data_labels);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.dataLabels);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            // initializing widget
            mChart = this.FindViewById <FlexChart>(Resource.Id.flexchart);

            mDataLabelSpinner = (Spinner)FindViewById(Resource.Id.dataLabelSpinner);

            // set the binding for X-axis of FlexChart
            mChart.BindingX = "Name";

            // initialize series elements and set the binding to variables of
            // ChartPoint
            ChartSeries seriesSales = new ChartSeries();

            seriesSales.Chart      = mChart;
            seriesSales.SeriesName = "Sales";
            seriesSales.Binding    = "Sales";

            // add series to list
            mChart.Series.Add(seriesSales);

            // setting the source of data/items in FlexChart
            mChart.ItemsSource = ChartPoint.GetList();

            mChart.ChartType = ChartType.Bar;

            mChart.DataLabel.Content     = "{x},{y}";
            mChart.DataLabel.Border      = true;
            mChart.DataLabel.BorderStyle = new ChartStyle()
            {
                Stroke = Color.Green, StrokeThickness = 2, Fill = Color.Transparent
            };

            // create custom adapter for spinner and initialize with string array
            ArrayAdapter adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.chartDataLabelPositionSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem);

            // Specify the layout to use when the list of choices appears
            adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            // Apply the adapter to the spinner
            mDataLabelSpinner.Adapter = adapter1;

            int defaultPosition = adapter1.GetPosition("Left");

            mDataLabelSpinner.SetSelection(defaultPosition);
            mDataLabelSpinner.ItemSelected += MDataLabelSpinner_ItemSelected;
        }
コード例 #5
0
ファイル: HomeActivity.cs プロジェクト: pchahal/ApnaPages
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.main);

            AutoCompleteTextView textView = FindViewById <AutoCompleteTextView>(Resource.Id.autoCompleteTextView);

            string[] businessNames = Resources.GetStringArray(Resource.Array.businessNames);
            var      adapter       = new ArrayAdapter <String>(this, Resource.Layout.AutoComplete_list_item, businessNames);

            textView.Adapter = adapter;

            Spinner spinner = FindViewById <Spinner>(Resource.Id.spinner);

            spinner.ItemSelected += new EventHandler <ItemEventArgs>(spinner_ItemSelected);
            var adapterSpinner = ArrayAdapter.CreateFromResource(
                this, Resource.Array.locations_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapterSpinner.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapterSpinner;



            var btnFind = FindViewById <Button>(Resource.Id.btnFind);

            btnFind.Click += (sender, e) =>
            {
                if (textView.Text != "")
                {
                    string category       = Categories.GetEnumValueFromDescription(textView.Text).ToString();
                    var    targetActivity = new Intent(this, typeof(CategoryActivity));
                    targetActivity.PutExtra("SearchFilter", textView.Text);
                    targetActivity.PutExtra("Category", category);
                    StartActivity(targetActivity);
                }
            };
            var btnDirectory = FindViewById <Button> (Resource.Id.btnDirectory);

            btnDirectory.Click += (sender, e) =>
            {
                StartActivity(typeof(ApnaPages.DirectoryActivity));
            };
            var btnFavorite = FindViewById <Button>(Resource.Id.btnFavorite);

            btnFavorite.Click += (sender, e) =>
            {
                ISharedPreferences pref = GetSharedPreferences("favoritesFile", FileCreationMode.Private);
                string             val  = pref.GetString("favoritesList", "");
                Toast.MakeText(Application, "Favorites " + val, ToastLength.Short).Show();
                var targetActivity = new Intent(this, typeof(CategoryActivity));
                targetActivity.PutExtra("SearchFilter", val);
                targetActivity.PutExtra("Category", "1000");
                StartActivity(targetActivity);
            };
        }
コード例 #6
0
        protected override void OnCreate(Bundle Bundle)
        {
            base.OnCreate(Bundle);
            SetContentView(Resource.Layout.CreateUserProfile);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            toolbar.SetTitleTextColor(Android.Graphics.Color.White);
            SetSupportActionBar(toolbar);

            mRegisterFirst   = FindViewById <EditText>(Resource.Id.editUserFirstName);
            mRegisterLast    = FindViewById <EditText>(Resource.Id.editUserLastName);
            mRegisteredEmail = FindViewById <EditText>(Resource.Id.editUserEmailAddress);

            mSubmitUserProfile        = FindViewById <Button>(Resource.Id.submitUserProfile);
            mSubmitUserProfile.Click += mSubmitUserProfile_Click;

            mRegisteredUser = JsonConvert.DeserializeObject <vmMusicianProfile>(Intent.GetStringExtra("User"));

            mRegisterFirst.Text   = mRegisteredUser.FirstName.ToString();
            mRegisterLast.Text    = mRegisteredUser.LastName.ToString();
            mRegisteredEmail.Text = mRegisteredUser.Email.ToString();
            mRegisteredId         = mRegisteredUser.AppUserId;


            //spinner class
            mStateSpinner   = FindViewById <Spinner>(Resource.Id.spinnerState);
            mCitySpinner    = FindViewById <Spinner>(Resource.Id.spinnerCity);
            mZipCodeSpinner = FindViewById <Spinner>(Resource.Id.spinnerZip);


            //state spinner
            mStateSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinner_ItemSelected);
            var StateAdapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.states_array, Android.Resource.Layout.SimpleSpinnerItem);


            StateAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            mStateSpinner.Adapter = StateAdapter;

            //city spinner
            mCitySpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var CityAdapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.cities_array, Android.Resource.Layout.SimpleSpinnerItem);

            CityAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            mCitySpinner.Adapter = CityAdapter;

            //Zip Code Spinner Adapter
            mZipCodeSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var zipCodeAdapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.zip_array, Android.Resource.Layout.SimpleSpinnerItem);

            zipCodeAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            mZipCodeSpinner.Adapter = zipCodeAdapter;
            // Create your application here
        }
コード例 #7
0
ファイル: AddAlarm.cs プロジェクト: davo75/Alarm-App
        /// <summary>
        /// Displays the alarm field for the user to fill in to create a new alarm
        /// </summary>
        /// <param name="savedInstanceState"></param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            //add the toolbar
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetActionBar(toolbar);
            ActionBar.Title = "Add Alarm";

            //set the username
            username = Intent.GetStringExtra("Username");

            //get references to the text fields
            alarmName = FindViewById <EditText>(Resource.Id.txtAlarmName);
            alarmTime = FindViewById <EditText>(Resource.Id.txtAlarmTime);
            //alarmReminder = FindViewById<EditText>(Resource.Id.txtAlarmReminder);
            alarmSound = FindViewById <EditText>(Resource.Id.txtAlarmSound);

            //set a custom font for edit text fields
            Typeface font = Typeface.CreateFromAsset(Assets, "fonts/Myriad-Pro-Bold.ttf");

            alarmName.Typeface  = font;
            alarmTime.Typeface  = font;
            alarmSound.Typeface = font;

            //setup the reminder time drop down list
            alarmReminderSpinner = FindViewById <Spinner>(Resource.Id.reminderList);
            alarmReminderSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(alarmReminderSpinner_ItemSelected);

            var adapter = ArrayAdapter.CreateFromResource(
                this, Resource.Array.reminder_array, Resource.Drawable.spinner_style);

            adapter.SetDropDownViewResource(Resource.Drawable.spinner_item_style);
            alarmReminderSpinner.Adapter = adapter;

            alarmTime.Click += AlarmTime_Click;

            alarmSound.Click += AlarmSound_Click;

            //save button
            ImageButton saveBtn = FindViewById <ImageButton>(Resource.Id.btnSaveAlarm);

            saveBtn.Click += SaveBtn_Click;

            //cancel button
            ImageButton cancelBtn = FindViewById <ImageButton>(Resource.Id.btnCancelAddAlarm);

            cancelBtn.Click += (object sender, EventArgs e) =>
            {
                Finish();
            };
        }
コード例 #8
0
ファイル: EntryActivityEx.cs プロジェクト: mokth/merpV3
 void SpinnerHandling()
 {
     dAdapterQty = ArrayAdapter.CreateFromResource(this, Resource.Array.qtytype, Resource.Layout.spinner_item);
     dAdapterQty.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx);
     dAdapterItem = new ArrayAdapter <String> (this, Resource.Layout.spinner_item, icodes);
     dAdapterItem.SetDropDownViewResource(Resource.Layout.SimpleSpinnerDropDownItemEx);
     spinItem.Adapter       = dAdapterItem;
     spinItem.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs> (spinnerItem_ItemSelected);
     spinQty.Adapter        = dAdapterQty;
 }
コード例 #9
0
        private void initializeSpinner(Spinner spinner, int resource)
        {
            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);

            var adapter = ArrayAdapter.CreateFromResource(
                this, resource, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;
        }
コード例 #10
0
        private void LoadViews()
        {
            var adapter = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.Languages, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;

            adapter          = new ArrayAdapter <String>(this.Activity, Resource.Layout.WordListItem, wordList.Select(a => a.Word).ToList());
            WordText.Adapter = adapter;
        }
コード例 #11
0
        private void InitSpinner()
        {
            ArrayAdapter adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.intervals_array, Resource.Layout.spinner_item);

            spinner = (Spinner)FindViewById(Resource.Id.spinner1);
            adapter.SetDropDownViewResource(Resource.Layout.spinner_dropdown_item);
            spinner.Adapter       = adapter;
            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            spinner.Visibility    = ViewStates.Invisible;
        }
コード例 #12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Spinner spinner = FindViewById <Spinner>(Resource.Id.spinnerRole);
            var     adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.role_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerItem);
            spinner.Adapter = adapter;
        }
コード例 #13
0
        //create spinner
        public void createSpinner()
        {
            Spinner spinner = FindViewById <Spinner>(Resource.Id.spinner);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.menu_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;
        }
コード例 #14
0
        private void InitComponents()
        {
            _spinner = _view.FindViewById <Spinner>(Resource.Id.spinner);
            var adapter = ArrayAdapter.CreateFromResource(_context,
                                                          Resource.Array.planetsArray, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            _spinner.Adapter       = adapter;
            _spinner.ItemSelected += spinner_ItemSelected;
        }
コード例 #15
0
        public override void OnResume()
        {
            base.OnResume();

            this.Activity.Title = "Edycja przypomnienia";

            eventTitle.Text       = eventToEdit.Title;
            eventDescription.Text = eventToEdit.Description;

            //medicine
            medicineCount.Text = eventToEdit.Count.ToString();

            //measurement
            var adapterM = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.measurements_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapterM.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            measurementSpinner.Adapter = adapterM;
            measurementSpinner.SetSelection(adapterM.GetPosition(eventToEdit.Title), true);

            //set remindBefore views fields
            remindMinutesBefore = eventToEdit.MinutesBefore;
            var adapterV = ArrayAdapter.CreateFromResource(this.Activity, Resource.Array.visits_reminder_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapterV.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            remindBeforeSpinner.Adapter = adapterV;
            int z = 0;

            if (remindMinutesBefore % 1440 == 0)
            {
                remindBeforeMultiplier = 60 * 24;

                z = remindMinutesBefore / 1440;
                remindBeforeValue.Text = z.ToString();

                remindBeforeSpinner.SetSelection(2, true);
            }
            else if (remindMinutesBefore % 60 == 0)
            {
                remindBeforeMultiplier = 60;

                z = remindMinutesBefore / 60;
                remindBeforeValue.Text = z.ToString();

                remindBeforeSpinner.SetSelection(1, true);
            }
            else
            {
                remindBeforeMultiplier = 1;

                z = remindMinutesBefore;
                remindBeforeValue.Text = z.ToString();

                remindBeforeSpinner.SetSelection(0, true);
            }
        }
コード例 #16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_basic_chart_types);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.basicChartTypes);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            // initializing widgets
            mChart            = (FlexChart)FindViewById(Resource.Id.flexchart);
            mChartTypeSpinner = (Spinner)FindViewById(Resource.Id.chartTypeSpinner);
            mStackingSpinner  = (Spinner)FindViewById(Resource.Id.stackingSpinner);
            mRotatedSwitch    = (Switch)FindViewById(Resource.Id.rotatedSwitch);

            // set the binding for X-axis of FlexChart


            // setting the source of data/items in FlexChart
            dataSource = ChartPoint.GetList();

            Chartinitialization.InitialDefaultChart(mChart, dataSource);

            ArrayAdapter adapter1 = ArrayAdapter.CreateFromResource(this, Resource.Array.chartTypeSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem);

            // Specify the layout to use when the list of choices appears
            adapter1.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            // Apply the adapter to the spinner
            mChartTypeSpinner.Adapter       = adapter1;
            mChartTypeSpinner.ItemSelected += MChartTypeSpinner_ItemSelected;

            // create custom adapter for second spinner and initialize with string
            // array
            ArrayAdapter adapter2 = ArrayAdapter.CreateFromResource(this, Resource.Array.stackingSpinnerValues, Android.Resource.Layout.SimpleSpinnerItem);

            // Specify the layout to use when the list of choices appears
            adapter2.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            // Apply the adapter to the spinner
            mStackingSpinner.Adapter       = adapter2;
            mStackingSpinner.ItemSelected += MStackingSpinner_ItemSelected;
            mRotatedSwitch.CheckedChange  += MRotatedSwitch_CheckedChange;


            mChart.SelectionMode  = ChartSelectionModeType.Point;
            mChart.SelectionStyle = new ChartStyle();
            mChart.SelectionStyle.StrokeDashArray = new double[] { 10, 10 };

            mChart.SelectionStyle.Stroke          = Color.Red;
            mChart.SelectionStyle.StrokeThickness = 3;

            //  mChart.SetBackgroundColor(Color.Gray);
        }
コード例 #17
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.flexpie_activity_selection);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.selection);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            // initializing widgets
            mFlexPie          = (FlexPie)FindViewById(Resource.Id.flexPie);
            mOffset           = (TextView)FindViewById(Resource.Id.offset);
            mButtonMinus      = (Button)FindViewById(Resource.Id.buttonMinus);
            mButtonPlus       = (Button)FindViewById(Resource.Id.buttonPlus);
            mSelectionSpinner = (Spinner)FindViewById(Resource.Id.selectionSpinner);

            // creating a list of fruit objects of type BindObject
            IList <Object> flexpieFruits = new List <Object>();

            flexpieFruits.Add(new BindObject("Oranges", 11));
            flexpieFruits.Add(new BindObject("Apples", 94));
            flexpieFruits.Add(new BindObject("Pears", 93));
            flexpieFruits.Add(new BindObject("Bananas", 2));
            flexpieFruits.Add(new BindObject("Pineapples", 53));

            // set the binding of FlexPie to variables of BindObject
            mFlexPie.BindingName = "Name";
            mFlexPie.Binding     = "Value";

            // setting the source of data/items and default values in FlexPie
            mFlexPie.ItemsSource        = flexpieFruits;
            mOffset.Text                = mOffsetValue.ToString();
            mFlexPie.SelectedItemOffset = mOffsetValue;
            mFlexPie.SelectionMode      = ChartSelectionModeType.Point;

            // initializing adapter to string array
            ArrayAdapter adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.selection_spinner_values, Android.Resource.Layout.SimpleSpinnerItem);

            // Specify the layout to use when the list of choices appears
            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            // Apply the adapter to the spinner
            mSelectionSpinner.Adapter       = adapter;
            mSelectionSpinner.ItemSelected += mSelectionSpinner_ItemSelected;

            mSelectionSpinner.SetSelection(1);

            Button button = (Button)FindViewById(Resource.Id.buttonMinus);

            button.Click += button_Click;
            button        = (Button)FindViewById(Resource.Id.buttonPlus);
            button.Click += button_Click;
        }
コード例 #18
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);

            var toolBar = FindViewById <Toolbar>(Resource.Id.toolbar);

            toolBar.SetTitle(Resource.String.app_name);
            SetSupportActionBar(toolBar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.menu2);

            var localDatas = Application.Context.GetSharedPreferences("MyDatas", Android.Content.FileCreationMode.Private);

            drawerLayout = FindViewById <Android.Support.V4.Widget.DrawerLayout>(Resource.Id.drawer_layout);
            navView      = FindViewById <NavigationView>(Resource.Id.nav_view);
            Android.App.FragmentTransaction transaction = this.FragmentManager.BeginTransaction();
            HomeFragment home = new HomeFragment();

            transaction.Add(Resource.Id.framelayout, home).Commit();

            var headerView = navView.GetHeaderView(0);

            lastName  = headerView.FindViewById <TextView>(Resource.Id.menuLastName);
            firstName = headerView.FindViewById <TextView>(Resource.Id.menuFirstName);
            userImage = headerView.FindViewById <ImageView>(Resource.Id.userImg);

            string data_lastName  = localDatas.GetString("LastName", "");
            string data_firstName = localDatas.GetString("FirstName", "");
            string data_uri       = localDatas.GetString("Uri", "");

            lastName.Text  = data_lastName;
            firstName.Text = data_firstName;

            Android.Net.Uri uri = Android.Net.Uri.Parse(data_uri);
            if (uri == null)
            {
                userImage.SetImageResource(Resource.Drawable.user);
            }
            else
            {
                userImage.SetImageURI(uri);
            }

            Spinner spinner = FindViewById <Spinner>(Resource.Id.spinner);

            spinner.ItemSelected += spinner_ItemSelected;
            var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.curr_array, Resource.Layout.SpinnerItem);

            adapter.SetDropDownViewResource(Resource.Layout.SpinnerDropdown);
            spinner.Adapter = adapter;
            setupDrawerContent(navView);
        }
コード例 #19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.LayDeathAdd);


            txtfname  = FindViewById <EditText> (Resource.Id.txtfname);
            txtlname  = FindViewById <EditText> (Resource.Id.txtlname);
            txtexname = FindViewById <EditText> (Resource.Id.txtexname);
            txtbday   = FindViewById <EditText> (Resource.Id.txtageatdeath);

            spngender        = FindViewById <Spinner> (Resource.Id.spngender);
            spndeathcert     = FindViewById <Spinner> (Resource.Id.spndeathcert);
            spnregisterdeath = FindViewById <Spinner> (Resource.Id.spnregisterdeath);


            var adaptergender = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Gender_Spinner, Android.Resource.Layout.SimpleSpinnerItem);

            adaptergender.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spngender.Adapter = adaptergender;

            var adpdeathcert = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Death_certificate, Android.Resource.Layout.SimpleSpinnerItem);

            adpdeathcert.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spndeathcert.Adapter = adpdeathcert;

            var adpregisterdeath = ArrayAdapter.CreateFromResource(
                this, Resource.Array.Death_register, Android.Resource.Layout.SimpleSpinnerItem);

            adpregisterdeath.SetDropDownViewResource(Android.Resource.Layout.SimpleListItemActivated1);
            spnregisterdeath.Adapter = adpregisterdeath;

            var items = ConDeath.GetListSingle("select * from tblDeath where id='" + Intent.GetStringExtra("death_id") + "'");

            txtfname.Text  = items.fname;
            txtlname.Text  = items.lname;
            txtexname.Text = items.ename;
            txtbday.Text   = items.age_death;

            string[] array;
            array = Resources.GetStringArray(Resource.Array.Gender_Spinner);
            fcnspinner(spngender, array, items.gender);

            array = Resources.GetStringArray(Resource.Array.Death_certificate);
            fcnspinner(spndeathcert, array, items.birthcertificate);
            array = Resources.GetStringArray(Resource.Array.Death_register);
            fcnspinner(spnregisterdeath, array, items.register);

            btnAddaddress        = FindViewById <Button> (Resource.Id.btnAddAddress);
            btnAddaddress.Click += new EventHandler(btnAddaddress_Clicked);
        }
コード例 #20
0
        private void SpinnerMaritalStatus_Fill()
        {
            Spinner spinner = view.FindViewById <Spinner>(Resource.Id.spinnerMaritalStatus);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinnerMaritalStatus_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(
                view.Context, Resource.Array.marital_status, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;
        }
コード例 #21
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            ActionBar.Hide();   //Not necessary in home screen
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            if (mCIR == null)
            {
                mCIR = (ConsumerIrManager)GetSystemService(Context.ConsumerIrService);
            }
            prefs = PreferenceManager.GetDefaultSharedPreferences(this.ApplicationContext);

            glbl_temperature = prefs.GetInt("TEMPERATURE", 20);
            glbl_mode        = (byte)prefs.GetInt("MODE", 0x06);
            //
            FindViewById <TextView>(Resource.Id.editTemp).SetText(FormatTemp(glbl_temperature), TextView.BufferType.Normal);
            //
            Spinner spinner = FindViewById <Spinner>(Resource.Id.spinnerMode);
            var     adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.modes_array, Resource.Layout.spinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter       = adapter;
            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);

            if (glbl_mode == 0x01)
            {
                spinner.SetSelection(0);    //< item > FAN </ item >
            }
            else if (glbl_mode == 0x02)
            {
                spinner.SetSelection(1);   // < item > COOL </ item >
            }
            else if (glbl_mode == 0x03)
            {
                spinner.SetSelection(2);   // < item > DRY </ item >
            }
            else if (glbl_mode == 0x04)
            {
                spinner.SetSelection(3);   // < item > HEAT </ item >
            }
            else if (glbl_mode == 0x06)
            {
                spinner.SetSelection(4);   // < item > AUTO </ item >
            }

            //....
#if false
            irService = GetSystemService("irda");
            readIR    = irService.Class.GetMethod("read_irsend", new Class[0]);
            sendIR    = irService.Class.GetMethod("write_irsend", Java.Lang.Class.FromType(typeof(Java.Lang.String)));
            sendIR.Invoke(irService, new Java.Lang.Object[]);
#endif
        }
コード例 #22
0
        private void InitializeSpinner()
        {
            Spinner uriSpinner = FindViewById <Spinner>(Resource.Id.launch_uri_spinner);

            uriSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
            var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.uri_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            uriSpinner.Adapter = adapter;
            uriSpinner.SetSelection(0);
        }
コード例 #23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetTheme(Android.Resource.Style.ThemeDeviceDefault);
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.PassengerDetails_Edit);
            ActionBar ab = ActionBar;

            ab.SetDisplayHomeAsUpEnabled(true);

            Android.Net.ConnectivityManager cm = (Android.Net.ConnectivityManager) this.GetSystemService(Context.ConnectivityService);
            if (cm.ActiveNetworkInfo == null)
            {
                Toast.MakeText(this, "Network error. Try again later.", ToastLength.Long).Show();
            }
            else
            {
                progress = new Android.App.ProgressDialog(this);
                progress.Indeterminate = true;
                progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
                progress.SetMessage("Loading ...");
                progress.SetCancelable(false);

                ISharedPreferences pref = GetSharedPreferences(GetString(Resource.String.PreferenceFileName), FileCreationMode.Private);
                var member = pref.GetString(GetString(Resource.String.PreferenceSavedMember), "");
                user = JsonConvert.DeserializeObject <Member>(member);

                etUsername    = (EditText)FindViewById(Resource.Id.edittext_username);
                etPassword    = (EditText)FindViewById(Resource.Id.edittext_password);
                etConPassword = (EditText)FindViewById(Resource.Id.edittext_confirm_password);
                etPhone       = (EditText)FindViewById(Resource.Id.edittext_phone);
                spnGender     = (Spinner)FindViewById(Resource.Id.spinner_gender);
                buttonUpdate  = (Button)FindViewById(Resource.Id.button_update);

                var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.signup_gender, Resource.Layout.Custom_Spinner_Edit_Details);
                adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
                spnGender.Adapter = adapter;

                etUsername.Text    = user.username;
                etPassword.Text    = user.password;
                etConPassword.Text = user.password;
                etPhone.Text       = user.phoneno;
                if (user.gender.Equals("Male"))
                {
                    spnGender.SetSelection(1);
                }
                else
                {
                    spnGender.SetSelection(2);
                }
                buttonUpdate.Click += UpdateClick;

                SetValidation();
            }
        }
コード例 #24
0
        private void BindData()
        {
            var terrainSelectAdapter = ArrayAdapter.CreateFromResource(this,
                                                                       Resource.Array.terrain_options_filling_view, Android.Resource.Layout.SimpleSpinnerItem);

            terrainSelectAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            _terrainLevelSelect.Adapter = terrainSelectAdapter;

            _routeSurfaceSlider.SetSelectedMaxValue(50);
            _routeDistanceTextView.Text = Resources.GetString(Resource.String.route_length) + ": " + _route.Properties.Distance;
        }
コード例 #25
0
        private void SetSpinnersListeners()
        {
            Spinner spType = FindViewById <Spinner>(Resource.Id.spType);

            var adapterT = ArrayAdapter.CreateFromResource(this, Resource.Array.type_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapterT.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spType.Adapter = adapterT;

            spType.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);
        }
コード例 #26
0
ファイル: Add_Edit_Account.cs プロジェクト: kw3rti/transact
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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

            type = Intent.GetStringExtra("Type");

            name         = FindViewById <EditText>(Resource.Id.txtAccountName);
            note         = FindViewById <EditText>(Resource.Id.txtAccountNote);
            startBalance = FindViewById <EditText>(Resource.Id.txtAccountStartBalance);

            accountType        = FindViewById <Spinner>(Resource.Id.spinnerAccountType);
            accountTypeAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.account_array, Android.Resource.Layout.SimpleSpinnerDropDownItem);
            //accountTypeAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            accountType.Adapter = accountTypeAdapter;

            if (type == "Edit")
            {
                accountPK = Intent.GetIntExtra("AccountPK", 0);
                loadAccount(accountPK);
            }

            //top toolbar
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar_top);

            SetActionBar(toolbar);
            ActionBar.Title = type + " Account";

            //bottom toolbar
            var bottomToolbar = FindViewById <Toolbar>(Resource.Id.toolbar_bottom);

            bottomToolbar.Title = "";
            bottomToolbar.InflateMenu(Resource.Menu.bottom_menu_add_account);
            bottomToolbar.MenuItemClick += (sender, e) => {
                if (e.Item.TitleFormatted.ToString() == "Save")
                {
                    if (type == "Add")
                    {
                        addAccount();
                    }
                    else if (type == "Edit")
                    {
                        updateAccount();
                    }
                }
                else if (e.Item.TitleFormatted.ToString() == "Cancel")
                {
                    this.Finish();
                }
            };
        }
コード例 #27
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = inflater.Inflate(Resource.Layout.Settings, container, false);

            SetHasOptionsMenu(true);

            var refreshSettingsButton = view.FindViewById <Button>(Resource.Id.RefreshSettingsButton);

            refreshSettingsButton.Click += delegate
            {
                //refreshSettingsButton.Text = string.Format("Настройки обновлены!\nОбновить еще раз?");
                Toast.MakeText(this.Activity, Resource.String.SettingsSaved, ToastLength.Long);
            };

            RadioButton only_my_cityRadio        = view.FindViewById <RadioButton>(Resource.Id.Only_my_city);
            RadioButton other_cities_regionRadio = view.FindViewById <RadioButton>(Resource.Id.Other_cities_region);

            only_my_cityRadio.Click        += RadioButtonClick;
            other_cities_regionRadio.Click += RadioButtonClick;


            Spinner spinner = view.FindViewById <Spinner>(Resource.Id.City_spinner);

            spinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);

            var adapter = ArrayAdapter.CreateFromResource(Activity, Resource.Array.Cities_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinner.Adapter = adapter;

            //LoginLogoutButton
            var loginLogoutButton = view.FindViewById <TextView>(Resource.Id.LoginLogoutButton);

            loginLogoutButton.Click += delegate
            {
                //Login или Logout
                if (((DrawerAct)this.Activity).authentication)
                {
                    ((DrawerAct)this.Activity).authentication = false;
                    loginLogoutButton.Text = string.Format("LogIn");
                }
                else
                {
                    ((DrawerAct)this.Activity).authentication = true;
                    var intent = new Intent(Activity, typeof(AccLogInAct));
                    intent.AddFlags(ActivityFlags.ClearTop);
                    StartActivity(intent);
                }
                ((DrawerAct)this.Activity).MySuperInvalidateOptionsMenu();
            };

            return(view);
        }
コード例 #28
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            var toggle       = FindViewById <ToggleButton>(Resource.Id.toggleButton1);
            var radioGroup   = FindViewById <RadioGroup>(Resource.Id.radioGroup1);
            var spinner      = FindViewById <Spinner>(Resource.Id.spinner1);
            var radioButton1 = FindViewById <RadioButton>(Resource.Id.radioButton1);
            var radioButton2 = FindViewById <RadioButton>(Resource.Id.radioButton2);

            toggle.Checked = true;
            ArrayAdapter adapter = ArrayAdapter.CreateFromResource(this,
                                                                   Resource.Array.italianFood,
                                                                   Android.Resource.Layout.SimpleSpinnerItem);

            spinner.Adapter = adapter;


            toggle.CheckedChange += delegate
            {
                if (toggle.Checked)
                {
                    radioGroup.Visibility = Android.Views.ViewStates.Visible;
                    spinner.Visibility    = Android.Views.ViewStates.Visible;
                }
                else
                {
                    radioGroup.Visibility = Android.Views.ViewStates.Invisible;
                    spinner.Visibility    = Android.Views.ViewStates.Invisible;
                }
            };

            radioGroup.CheckedChange += delegate
            {
                if (radioButton1.Checked)
                {
                    adapter = ArrayAdapter.CreateFromResource(this,
                                                              Resource.Array.italianFood,
                                                              Android.Resource.Layout.SimpleSpinnerItem);
                    spinner.Adapter = adapter;
                }
                else
                {
                    adapter = ArrayAdapter.CreateFromResource(this,
                                                              Resource.Array.frenchFood,
                                                              Android.Resource.Layout.SimpleSpinnerItem);
                    spinner.Adapter = adapter;
                }
            };
        }
コード例 #29
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.dialog_main_layout);
            // Create your application here

            SpItems   = Resources.GetStringArray(Resource.Array.spinner_items);
            SpAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.spinner_items, Resource.Layout.spinner_selected_item);

            FindViews();
            HandleEvents();
        }
コード例 #30
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_custom_marker);

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = GetString(Resource.String.customMarker);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            // initializing widget
            mChart             = this.FindViewById <FlexChart>(Resource.Id.flexchart);
            mChart.ItemsSource = new LineMarkerViewModel().Items;
            // initialize series elements and set the binding to variables of
            // ChartPoint
            mChart.ChartType = ChartType.Line;
            mChart.BindingX  = "Date";
            ChartSeries inputSeries  = new ChartSeries();
            ChartSeries outputSeries = new ChartSeries();

            inputSeries.SeriesName  = "Input";
            inputSeries.Binding     = "Input";
            outputSeries.SeriesName = "Output";
            outputSeries.Binding    = "Output";
            mChart.Series.Add(inputSeries);
            mChart.Series.Add(outputSeries);

            initMarker();
            mChart.Layers.Add(lineMarker);

            mLineTypeSpinner = (Spinner)FindViewById(Resource.Id.lineTypeSpinner);
            ArrayAdapter lineTypeAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.lineMarkerLines, Android.Resource.Layout.SimpleSpinnerItem);

            lineTypeAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            mLineTypeSpinner.Adapter       = lineTypeAdapter;
            mLineTypeSpinner.ItemSelected += MLineTypeSpinner_ItemSelected;

            mAlignmentSpinner = (Spinner)FindViewById(Resource.Id.alignmentSpinner);
            ArrayAdapter alignmentAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.lineMarkerAlignment, Android.Resource.Layout.SimpleSpinnerItem);

            alignmentAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            mAlignmentSpinner.Adapter       = alignmentAdapter;
            mAlignmentSpinner.ItemSelected += MAlignmentSpinner_ItemSelected;

            mInteractiveSpinner = (Spinner)FindViewById(Resource.Id.interactiveSpinner);
            ArrayAdapter interactiveAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.lineMarkerInteraction, Android.Resource.Layout.SimpleSpinnerItem);

            interactiveAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            mInteractiveSpinner.Adapter       = interactiveAdapter;
            mInteractiveSpinner.ItemSelected += MInteractiveSpinner_ItemSelected;
        }