Пример #1
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;
        }
Пример #2
0
 public MyFilter(ArrayExAdapter <Object> adapter)
 {
     this.adapter = adapter;
 }