コード例 #1
0
        private void InitToolbar()
        {
            try
            {
                Toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
                if (Toolbar != null)
                {
                    Toolbar.Title = " ";
                    Toolbar.SetTitleTextColor(Color.White);
                    SetSupportActionBar(Toolbar);
                    SupportActionBar.SetDisplayShowCustomEnabled(true);
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                    SupportActionBar.SetHomeButtonEnabled(true);
                    SupportActionBar.SetDisplayShowHomeEnabled(true);
                }

                SearchView = FindViewById <AutoCompleteTextView>(Resource.Id.searchBox);
                SearchView.SetOnEditorActionListener(this);
                //SearchView.ClearFocus();

                //Change text colors
                SearchView.SetHintTextColor(Color.ParseColor("#efefef"));
                SearchView.SetTextColor(Color.White);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #2
0
        private void InitToolbar()
        {
            try
            {
                var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);
                if (toolbar != null)
                {
                    toolbar.Title = "";
                    toolbar.SetTitleTextColor(Color.White);
                    SetSupportActionBar(toolbar);
                    SupportActionBar.SetDisplayShowCustomEnabled(true);
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                    SupportActionBar.SetHomeButtonEnabled(true);
                    SupportActionBar.SetDisplayShowHomeEnabled(true);
                }

                SearchView = FindViewById <AutoCompleteTextView>(Resource.Id.searchBox);
                SearchView.SetOnEditorActionListener(this);
                //SearchView.ClearFocus();

                //Change text colors
                SearchView.SetHintTextColor(Color.Gray);
                SearchView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
コード例 #3
0
        private void InitComponent(View view)
        {
            try
            {
                EmptyStateLayout  = (ViewStub)view.FindViewById(Resource.Id.viewStub);
                TopSongsViewStub  = (ViewStub)view.FindViewById(Resource.Id.viewStubTopSongs);
                TopAlbumsViewStub = (ViewStub)view.FindViewById(Resource.Id.viewStubTopAlbums);

                SwipeRefreshLayout = (SwipeRefreshLayout)view.FindViewById(Resource.Id.swipeRefreshLayout);
                SwipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
                SwipeRefreshLayout.Refreshing = true;
                SwipeRefreshLayout.Enabled    = true;
                SwipeRefreshLayout.SetProgressBackgroundColorSchemeColor(AppSettings.SetTabDarkTheme ? Color.ParseColor("#424242") : Color.ParseColor("#f7f7f7"));
                SwipeRefreshLayout.Refresh += SwipeRefreshLayoutOnRefresh;

                SearchBox = view.FindViewById <AutoCompleteTextView>(Resource.Id.searchViewBox);
                SearchBox.SetHintTextColor(AppSettings.SetTabDarkTheme ?  Color.White : Color.Gray);
                SearchBox.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Gray);
                SearchBox.Click += SearchBoxOnClick;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #4
0
        private void InitToolbar()
        {
            try
            {
                var toolBar = FindViewById <Toolbar>(Resource.Id.toolbar);
                if (toolBar != null)
                {
                    toolBar.Title = "";
                    toolBar.SetTitleTextColor(Color.ParseColor(AppSettings.MainColor));
                    SetSupportActionBar(toolBar);
                    SupportActionBar.SetDisplayShowCustomEnabled(true);
                    SupportActionBar.SetDisplayHomeAsUpEnabled(true);
                    SupportActionBar.SetHomeButtonEnabled(true);
                    SupportActionBar.SetDisplayShowHomeEnabled(true);
                    SupportActionBar.SetHomeAsUpIndicator(AppCompatResources.GetDrawable(this, AppSettings.FlowDirectionRightToLeft ? Resource.Drawable.ic_action_right_arrow_color : Resource.Drawable.ic_action_left_arrow_color));
                }

                SearchView = FindViewById <AutoCompleteTextView>(Resource.Id.searchBox);
                SearchView.SetOnEditorActionListener(this);
                //SearchView.ClearFocus();

                //Change text colors
                SearchView.SetHintTextColor(Color.Gray);
                SearchView.SetTextColor(AppSettings.SetTabDarkTheme ? Color.White : Color.Black);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
コード例 #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            ActionBar actionBar = ActionBar;

            actionBar.Title = "";
            actionBar.SetDisplayHomeAsUpEnabled(false);
            actionBar.SetDisplayShowCustomEnabled(true);
            actionBar.SetCustomView(Resource.Layout.actionBar);
            actionBar.NavigationMode  = ActionBarNavigationMode.Standard;
            this.RequestedOrientation = Android.Content.PM.ScreenOrientation.Sensor;

            try
            {
                Toolbar parent = (Toolbar)actionBar.CustomView.Parent;
                parent.SetContentInsetsAbsolute(0, 0);
            }
            catch (Exception e)
            {
                Toast.MakeText(this, e.Message, ToastLength.Long).Show();
            }

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                Window.SetStatusBarColor(Color.ParseColor("#9c0303"));
            }

            ll              = FindViewById <LinearLayout>(Resource.Id.LL);
            textView2       = FindViewById <TextView>(Resource.Id.textView2);
            autocomplete    = FindViewById <AutoCompleteTextView>(Resource.Id.autocomplete_codes);
            tableLayout     = FindViewById <TableLayout>(Resource.Id.results1);
            imageClear      = FindViewById <ImageButton>(Resource.Id.imageButton1);
            imageHelp       = FindViewById <ImageView>(Resource.Id.imageView2);
            bntSendFromMain = FindViewById <Button>(Resource.Id.btnSendFromMain);

            ll.SetBackgroundColor(Color.ParseColor("#f0f0f0"));
            ll.Click += LL_Click;

            хdoc = XDocument.Load(Resources.GetXml(Resource.Xml.codes));
            var codes   = хdoc.Root.Elements("item").Select(x => x);
            var ids     = codes.Select(x => x.Attribute("order").Value + " | " + x.Attribute("type").Value).ToList();
            var adapter = new ArrayExAdapter <string>(this, Resource.Layout.listItem, ids);

            //var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.Codes, Resource.Layout.list_item);

            autocomplete.SetHintTextColor(Color.Red);
            autocomplete.Adapter   = adapter;
            autocomplete.Threshold = 1;
            autocomplete.AddTextChangedListener(new MyTextWatcher(this.BaseContext, imageClear));
            autocomplete.ItemClick += AutoComplete_ItemClick;

            imageClear.Click      += ImageClear_Click;
            imageHelp.Click       += ImageHelp_Click;
            bntSendFromMain.Click += BtnFromMain_Click;
        }
コード例 #6
0
        protected override void OnCreate(Bundle bundle)//создаем и инициализируем необходимые переменные для
        //функционирования графического интерфейса пользователя
        {
            try
            {
                base.OnCreate(bundle);

                SetContentView(Resource.Layout.Main);

                nameView      = FindViewById <EditText>(Resource.Id.name);
                nameView.Hint = "Имя";
                nameView.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                nameView.AfterTextChanged += NameView_AfterTextChanged;

                surnameView      = FindViewById <EditText>(Resource.Id.surname);
                surnameView.Hint = "Фамилия";
                surnameView.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                surnameView.Enabled           = false;
                surnameView.AfterTextChanged += SurnameView_AfterTextChanged;

                bFillBlank         = FindViewById <Button>(Resource.Id.fillinBtn);
                bFillBlank.Enabled = false;
                bFillBlank.Click  += BFillBlank_Click;

                WebRequest  wr          = WebRequest.Create("https://api.vk.com/method/database.getCountries?need_all=1&lang=0&count=229");
                WebResponse webResponse = wr.GetResponse();
                Stream      stream      = webResponse.GetResponseStream();

                root = (RootObjectCountry) new DataContractJsonSerializer(typeof(RootObjectCountry)).ReadObject(stream);
                listCountriesTitles = root.response.Select(r => r.title).ToList();
                cidCountries        = root.response.Select(r => r.cid).ToArray();

                textViewCountries = FindViewById <AutoCompleteTextView>(Resource.Id.autocomplete_country);
                var adapterCountry = new ArrayAdapter <String>(this, Resource.Layout.list_view, listCountriesTitles);
                textViewCountries.Hint = "Название страны";
                textViewCountries.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                textViewCountries.Enabled    = false;
                textViewCountries.ItemClick += TextViewCountries_ItemClick;
                textViewCountries.Adapter    = adapterCountry;

                textViewCities      = FindViewById <AutoCompleteTextView>(Resource.Id.autocomplete_city);
                textViewCities.Hint = "Название города";
                textViewCities.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                textViewCities.Enabled = false;

                textViewUnivercities      = FindViewById <AutoCompleteTextView>(Resource.Id.autocomplete_univercity);
                textViewUnivercities.Hint = "Название университета";
                textViewUnivercities.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                textViewUnivercities.Enabled = false;
            }
            catch (Exception ex)
            {
                Toast.MakeText(ApplicationContext, ex.Message, ToastLength.Long).Show();
            }
        }
コード例 #7
0
        private void BGetBack_Click(object sender, EventArgs e)//создаем вьюшку бланка и всё необходимое для ее
        //функционирования, инициализуем переменные полей сохраненными данными
        {
            try
            {
                SetContentView(Resource.Layout.Main);

                nameView      = FindViewById <EditText>(Resource.Id.name);
                nameView.Hint = "Имя";
                nameView.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                nameView.AfterTextChanged += NameView_AfterTextChanged;
                nameView.Text              = savedNamePerson;

                surnameView      = FindViewById <EditText>(Resource.Id.surname);
                surnameView.Hint = "Фамилия";
                surnameView.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                surnameView.AfterTextChanged += SurnameView_AfterTextChanged;
                surnameView.Text              = savedSurnamePerson;

                textViewCountries = FindViewById <AutoCompleteTextView>(Resource.Id.autocomplete_country);
                var adapterCountry = new ArrayAdapter <String>(this, Resource.Layout.list_view, listCountriesTitles);
                textViewCountries.Hint = "Название страны";
                textViewCountries.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                textViewCountries.ItemClick += TextViewCountries_ItemClick;
                textViewCountries.Adapter    = adapterCountry;
                textViewCountries.Text       = savedTitleCountry;

                textViewCities = FindViewById <AutoCompleteTextView>(Resource.Id.autocomplete_city);
                var adapterCity = new ArrayAdapter <String>(this, Resource.Layout.list_view, listCitiesTitles);
                textViewCities.Hint = "Название города";
                textViewCities.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                textViewCities.ItemClick += TextViewCities_ItemClick;
                textViewCities.Adapter    = adapterCity;
                textViewCities.Text       = savedTitleCity;

                textViewUnivercities = FindViewById <AutoCompleteTextView>(Resource.Id.autocomplete_univercity);
                var adapterUnivercity = new ArrayAdapter <String>(this, Resource.Layout.list_view, listUnivercitiesTitles);
                textViewUnivercities.Hint = "Название университета";
                textViewUnivercities.SetHintTextColor(ColorStateList.ValueOf(Android.Graphics.Color.Black));
                textViewUnivercities.ItemClick += TextViewUnivercities_ItemClick;
                textViewUnivercities.Adapter    = adapterUnivercity;
                textViewUnivercities.Text       = savedTitleUnivercity;

                bFillBlank        = FindViewById <Button>(Resource.Id.fillinBtn);
                bFillBlank.Click += BFillBlank_Click;
            }
            catch (Exception ex)
            {
                Toast.MakeText(ApplicationContext, ex.Message, ToastLength.Long).Show();
            }
        }