Пример #1
0
 public TimeLineViewHolder(View itemView, int viewType)
     : base(itemView)
 {
     name = itemView.FindViewById<TextView>(Resource.Id.tx_name);
     mTimelineView = itemView.FindViewById<TimelineView>(Resource.Id.time_marker);
     mTimelineView.InitLine(viewType);
 }
Пример #2
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.Main);

			mCustomConfig = FindViewById <CheckBox> (Resource.Id.custom_app_limits);
		
			bool customChecked = 
				PreferenceManager.GetDefaultSharedPreferences (this).GetBoolean (
					CUSTOM_CONFIG_KEY, false);

			if (customChecked) mCustomConfig.Checked = true;

			mMultiEntryValue = FindViewById <TextView> (Resource.Id.multi_entry_id);
			mChoiceEntryValue = FindViewById <TextView> (Resource.Id.choice_entry_id);
			mBooleanEntryValue = FindViewById <TextView> (Resource.Id.boolean_entry_id);

			/**
    		* Saves custom app restriction to the shared preference.
    	 	*
    		* This flag is used by {@code GetRestrictionsReceiver} to determine if a custom app
    	 	* restriction activity should be used.
    	 	*
    	 	* @param view
    	 	*/
			mCustomConfig.Click += delegate (object sender, EventArgs e) {
				var editor = PreferenceManager.GetDefaultSharedPreferences (this).Edit ();
				editor.PutBoolean (CUSTOM_CONFIG_KEY, mCustomConfig.Checked).Commit ();
			};
		}
Пример #3
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

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

			// Get our button from the layout resource,
			// and attach an event to it
			GetButton = FindViewById<Button> (Resource.Id.GetButton);
			ResultTextView = FindViewById<TextView> (Resource.Id.ResultTextView);
			ResultEditText = FindViewById<EditText> (Resource.Id.ResultEditText);
			DownloadedImageView = FindViewById<ImageView> (Resource.Id.DownloadedImageView);

			GetButton.Click += async (sender, e) => {
				
				Task<int> sizeTask = DownloadHomePageAsync();

				ResultTextView.Text = "Loading...";
				ResultEditText.Text = "Loading...\n";

				DownloadedImageView.SetImageResource ( Android.Resource.Drawable.IcMenuGallery);

				var length = await sizeTask;

				ResultTextView.Text = "length:  " + length;

			};

		}
Пример #4
0
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			// Use this to return your custom view for this Fragment
			// return inflater.Inflate(Resource.Layout.YourFragment, container, false);

			//	  Lich hoc theo HK
			var rootView = inflater.Inflate (Resource.Layout.LichHoc_HK, container, false);
			isfirst = true;
			listView_HK = rootView.FindViewById<ListView> (Resource.Id.listLH);
			lbl_HK = rootView.FindViewById<TextView> (Resource.Id.lbl_HK_LH);
			lbl_NH = rootView.FindViewById<TextView> (Resource.Id.lbl_NH_LH);
			progress = rootView.FindViewById<ProgressBar> (Resource.Id.progressLH);
			linear = rootView.FindViewById<LinearLayout>(Resource.Id.linear_HK_LH);
			linearLH = rootView.FindViewById<LinearLayout>(Resource.Id.linearLH);
			txtNotify = rootView.FindViewById<TextView>(Resource.Id.txtNotify_LT_HK);
		//	radioGroup = rootView.FindViewById<RadioGroup>(Resource.Id.radioGroup1);
		    bundle=this.Arguments;
			check = bundle.GetBoolean ("Remind");
			autoupdate = bundle.GetBoolean ("AutoUpdateData");

			//load data

			LoadData_HK ();
		
			// row click
			listView_HK.ItemLongClick += listView_ItemClick;
						

			return rootView;
		}
Пример #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            var layout = new LinearLayout(this) {
                Orientation = Orientation.Vertical
            };
            this.AddContentView(layout, new ViewGroup.LayoutParams(-1, -1));

            this.T1 = new TextView(this);
            this.T2 = new TextView(this) {
                Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
            };

            layout.AddView(this.T1);
            layout.AddView(this.T2);

            var btn = new Button(this) {
                Text = "Search"
            };

            btn.Click += Btn_Click;
            layout.AddView(btn);

            this.HandleIntent(this.Intent);
        }
Пример #6
0
        void UpdateToolbarTitle(Page lastPage, Android.Widget.TextView titleTextView, Android.Widget.TextView subTitleTextView, Typeface originalFont, ColorStateList defaultColorStateList)
        {
            //Check support for CustomPage
            if (lastPage is CustomPage)
            {
                var cPage = lastPage as CustomPage;

                //Update main title formatted text
                UpdateFormattedTitleText(titleTextView, cPage.FormattedTitle, lastPage.Title);

                //Update subtitle text view
                UpdateToolbarSubtitle(cPage, subTitleTextView, originalFont, defaultColorStateList);
            }
            else
            {
                subTitleTextView.TextFormatted = new Java.Lang.String("");
                subTitleTextView.Text          = string.Empty;
                subTitleTextView.Visibility    = ViewStates.Gone;

                //Update main title text
                UpdateTitleText(titleTextView, lastPage.Title);
            }

            //Update main title color
            UpdateToolbarTextColor(titleTextView, CustomNavigationPage.GetTitleColor(lastPage), defaultColorStateList);

            //Update main title font
            UpdateToolbarTextFont(titleTextView, CustomNavigationPage.GetTitleFont(lastPage), originalFont);
        }
Пример #7
0
        protected override void OnCreate(Bundle bundle)
        {
            Console.WriteLine("AboutActivity - OnCreate");
            base.OnCreate(bundle);

            _navigationManager = Bootstrapper.GetContainer().Resolve<MobileNavigationManager>();
            SetContentView(Resource.Layout.About);
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetHomeButtonEnabled(true);

            _progressBar = FindViewById<ProgressBar>(Resource.Id.about_progressBar);
            _lblLoading = FindViewById<TextView>(Resource.Id.about_lblLoading);
            _webView = FindViewById<WebView>(Resource.Id.about_webView);
            _webViewClient = new MyWebViewClient();
            _webViewClient.PageFinished += (sender, args) => {
                Animation anim = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out);
                anim.AnimationEnd += (animSender, animArgs) => {
                    _lblLoading.Visibility = ViewStates.Gone;
                };
                _lblLoading.StartAnimation(anim);

                Animation anim2 = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out);
                anim2.AnimationEnd += (animSender, animArgs) => {
                    _progressBar.Visibility = ViewStates.Gone;
                };
                _progressBar.StartAnimation(anim2);
            };
            _webView.SetWebViewClient(_webViewClient);

            // Since the onViewReady action could not be added to an intent, tell the NavMgr the view is ready
            //((AndroidNavigationManager)_navigationManager).SetAboutActivityInstance(this);
            _navigationManager.BindAboutView(this);
        }
        /// <summary>
        /// Handles the Element Changed messages
        /// </summary>
        /// <param name="e">The e.</param>
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);
            if (this.Control != null && e.NewElement != null)
            {
                if (_helper == null)
                {
                    _helper = new TextViewRenderHelper(Context);
                }
                if (_iconSpan == null)
                {
                    _nativeLabel = (Android.Widget.TextView) this.Control;
                    _iconLabel   = (IconLabel)e.NewElement;
                    //Set default value
                    if (_iconLabel.IconSize == 0)
                    {
                        _iconLabel.IconSize = _iconLabel.FontSize;
                    }

                    _iconFont = _helper.TrySetFont("fontawesome-webfont.ttf");
                    _textFont = _iconLabel.Font.ToTypeface();
                }
                SetText();
            }
        }
Пример #9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.Main);

            Button prevButton = FindViewById<Button> (Resource.Id.prevButton);
            Button nextButton = FindViewById<Button> (Resource.Id.nextButton);
            Button listenButton = FindViewById<Button> (Resource.Id.listenButton);

            phraseTextView = FindViewById<TextView> (Resource.Id.phraseTextView);
            translationTextView = FindViewById<TextView> (Resource.Id.translationTextView);

            SoundPlayer soundPlayer = new SoundPlayerIml (Assets);

            db = new InMemoryDatabase ();

            new PopulateInMemoryDatabaseWithSampleDataCmd (db as InMemoryDatabase)
                .Execute ();

            presenter = new PhrasesPresenterIml (this, soundPlayer, db, lessonNumber);

            prevButton.Click += delegate {
                presenter.MovePrevious ();
            };

            nextButton.Click += delegate {
                presenter.MoveNext ();
            };

            listenButton.Click += delegate {
                presenter.PlaySoundStart ();
            };
        }
Пример #10
0
		public override View GetView(Context context, View convertView, ViewGroup parent)
        {
			var view = convertView as RelativeLayout;
			
			if (view == null)
				view = new RelativeLayout(context);
						
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);
            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule((int) LayoutRules.AlignParentLeft);

            _caption = new TextView(context) {Text = Caption, TextSize = 16f};
            view.AddView(_caption, parms);

            if (!string.IsNullOrEmpty(Value))
            {
                var tparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                             ViewGroup.LayoutParams.WrapContent);
                tparms.SetMargins(5, 3, 5, 0);
                tparms.AddRule((int) LayoutRules.AlignParentRight);

                _text = new TextView(context) {Text = Value, TextSize = 16f};
                view.AddView(_text, tparms);
            }

            return view;
        }
Пример #11
0
 public virtual Com.Zhy.Adapter.Abslistview.ViewHolder SetTextColor(int viewId, int
                                                                    textColor)
 {
     Android.Widget.TextView view = GetView <TextView>(viewId);
     view.SetTextColor(Android.Content.Res.ColorStateList.ValueOf(new Android.Graphics.Color(textColor)));
     return(this);
 }
Пример #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            button = FindViewById<Button>(Resource.Id.GetLocationButton);
            latitude = FindViewById<TextView>(Resource.Id.LatitudeText);
            longitude = FindViewById<TextView>(Resource.Id.LongitudeText);
            provider = FindViewById<TextView>(Resource.Id.ProviderText);
            address = FindViewById<TextView>(Resource.Id.AddressText);

            // MapFragment の用意と初期の場所を指定します。
            // MapFragment.Map が deprecated みたいなので、正しい書き方を教えてください><
            MapFragment mapFrag = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.MapFragment);
            map = mapFrag.Map;
            if (map != null) // Map の準備が出来たら (最初は null を返します)
            {
                map.MyLocationEnabled = true; // 現在地ボタン オン
                map.UiSettings.ZoomControlsEnabled = true; // ズームコントロール オン
                // 初期位置(カメラ)を移動
                map.AnimateCamera(CameraUpdateFactory.NewCameraPosition(
                    new CameraPosition(
                        new LatLng(35.685344d, 139.753029d), // 皇居(中心位置)
                        12f, 0f, 0f))); // ズームレベル、方位、傾き
            }
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            var display = WindowManager.DefaultDisplay;
            var horiPager = new HorizontalPager(this.ApplicationContext, display);
            horiPager.ScreenChanged += new ScreenChangedEventHandler(horiPager_ScreenChanged);

            //You can also use:
            /*horiPager.ScreenChanged += (sender, e) =>
            {
                System.Diagnostics.Debug.WriteLine("Switched to screen: " + ((HorizontalPager)sender).CurrentScreen);
            };*/

            var backgroundColors = new Color[] { Color.Red, Color.Blue, Color.Cyan, Color.Green, Color.Yellow };

            for (int i = 0; i < 5; i++)
            {
                var textView = new TextView(this.ApplicationContext);
                textView.Text = (i + 1).ToString();
                textView.TextSize = 100;
                textView.SetTextColor(Color.Black);
                textView.Gravity = GravityFlags.Center;
                textView.SetBackgroundColor(backgroundColors[i]);
                horiPager.AddView(textView);
            }

            SetContentView(horiPager);
        }
		public FileListRowViewHolder(TextView timeTextView, TextView textView, ImageView imageView, FloatingActionButton fab)
		{
			TimeTextView = timeTextView;
			TextView = textView;
			ImageView = imageView;
			Fab = fab;
		}
Пример #15
0
            public PickerCellView(Context context, Cell cell) : base(context)
            {
                _cell = cell;
                SetMinimumWidth((int)context.ToPixels(50));
                SetMinimumHeight((int)context.ToPixels(36));
                Orientation = Orientation.Horizontal;

                var padding = (int)context.ToPixels(8);

                SetPadding((int)context.ToPixels(15), padding, padding, padding);

                _label = new ATextView(context);
                Android.Support.V4.Widget.TextViewCompat.SetTextAppearance(_label, Android.Resource.Style.TextAppearanceSmall);
                _label.SetWidth((int)context.ToPixels(80));

                var layoutParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
                {
                    Gravity = GravityFlags.CenterVertical
                };

                using (layoutParams)
                    AddView(_label, layoutParams);

                EditText                       = new EditText(context);
                EditText.KeyListener           = null;
                EditText.OnFocusChangeListener = this;
                //editText.SetBackgroundDrawable (null);
                layoutParams = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
                {
                    Width = 0, Weight = 1, Gravity = GravityFlags.FillHorizontal | GravityFlags.Center
                };
                using (layoutParams)
                    AddView(EditText, layoutParams);
            }
Пример #16
0
        private void Initialize (Context ctx)
        {
            var dm = ctx.Resources.DisplayMetrics;
            var inflater = LayoutInflater.FromContext (ctx);

            overlayInset = (int)TypedValue.ApplyDimension (ComplexUnitType.Dip, 45, dm);

            backgroundView = new SliceView (ctx) {
                StartAngle = 0,
                EndAngle = 360,
                Color = emptyPieColor,
            };
            AddView (backgroundView);

            loadingOverlayView = inflater.Inflate (Resource.Layout.PieChartLoading, this, false);
            AddView (loadingOverlayView);

            emptyOverlayView = inflater.Inflate (Resource.Layout.PieChartEmpty, this, false);
            emptyOverlayView.Visibility = ViewStates.Gone;
            AddView (emptyOverlayView);

            statsOverlayView = inflater.Inflate (Resource.Layout.PieChartStats, this, false);
            statsOverlayView.Visibility = ViewStates.Gone;
            AddView (statsOverlayView);

            statsTimeTextView = statsOverlayView.FindViewById<TextView> (Resource.Id.TimeTextView);
            statsMoneyTextView = statsOverlayView.FindViewById<TextView> (Resource.Id.MoneyTextView);

            Click += delegate {
                // Deselect slices on click. The Clickable property is set to true only when a slice is selected.
                ActiveSlice = -1;
            };
            Clickable = false;
        }
Пример #17
0
		protected override void OnCreate (Bundle bundle)
		{
			dice1 = new Dice(1, 1, 6);
			dice2 = new Dice(2, 1, 6);
			audio = new PlayAudio (this);
		
			base.OnCreate (bundle);

			game = LbManager.GetGame(Intent.GetIntExtra ("Battle", -1), Intent.GetIntExtra("Scenario", -1));

			// set our layout to be the home screen
			SetContentView(Resource.Layout.General);		

			imgBack = FindViewById<ImageView> (Resource.Id.titleSubLbBack);
			imgLb = FindViewById<ImageView> (Resource.Id.titleSubLb);

			// title
			txtBattleName = FindViewById<TextView>(Resource.Id.titleSubBattleName);
			txtScenarioName = FindViewById<TextView>(Resource.Id.titleSubScenarioName);
			
			imgGeneral2Die1 = FindViewById<ImageView> (Resource.Id.imgGeneral2Die1);
			imgGeneral2Die2 = FindViewById<ImageView> (Resource.Id.imgGeneral2Die2);
			btnGeneral2DiceRoll = FindViewById<Button>(Resource.Id.btnGeneral2DiceRoll);

			imgGeneral1Die1 = FindViewById<ImageView> (Resource.Id.imgGeneral1Die1);
			btnGeneral1DiceRoll = FindViewById<Button>(Resource.Id.btnGeneral1DiceRoll);
		}
Пример #18
0
 /// <summary>设置TextView的值</summary>
 /// <param name="viewId"/>
 /// <param name="text"/>
 /// <returns/>
 public virtual Com.Zhy.Adapter.Abslistview.ViewHolder SetText(int viewId, string
                                                               text)
 {
     Android.Widget.TextView tv = GetView <TextView>(viewId);
     tv.Text = (text);
     return(this);
 }
Пример #19
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            textRegistrationStatus = FindViewById<TextView>(Resource.Id.textRegistrationStatus);
            textRegistrationId = FindViewById<TextView>(Resource.Id.textRegistrationId);
            textLastMsg = FindViewById<TextView>(Resource.Id.textLastMessage);
            buttonRegister = FindViewById<Button>(Resource.Id.buttonRegister);

            Log.Info("C2DM-Sharp-UI", "Hello World");

            this.buttonRegister.Click += delegate
            {
                if (!registered)
                {
                    Log.Info("C2DM-Sharp", "Registering...");
                    PushSharp.Client.MonoForAndroid.C2dmClient.Register(this, senderIdEmail);
                }
                else
                {
                    Log.Info("C2DM-Sharp", "Unregistering...");
                    PushSharp.Client.MonoForAndroid.C2dmClient.Unregister(this);
                }

                RunOnUiThread(() =>
                {
                    //Disable the button so that we can't click it again
                    //until we get back to the activity from a notification
                    this.buttonRegister.Enabled = false;
                });
            };
        }
Пример #20
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.SearchActivity);

            searchViewModel = new SearchViewModel (Android.Application.Service, new Search ("Default")) {
                GroupByLastName = false,
            };
            searchViewModel.SearchCompleted += HandleSearchCompleted;

            progressBar = FindViewById<ProgressBar> (Resource.Id.progressBar1);
            searchingText = FindViewById<TextView> (Resource.Id.emptyTextView);

            ListAdapter = new PeopleGroupsAdapter () {
                ItemsSource = searchViewModel.Groups,
            };

            // Start the search
            var intent = Intent;
            if (!Intent.ActionSearch.Equals (intent.Action))
                return;

            searchViewModel.SearchText = intent.GetStringExtra (SearchManager.Query);
            searchViewModel.SearchProperty = SearchProperty.All;
            searchViewModel.Search ();
        }
Пример #21
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.ShareLocation);

            customDate = DateTime.Now;

            boxProgress = FindViewById<LinearLayout> (Resource.Id.boxProgress);
            boxProgress.Visibility = ViewStates.Gone;

            textDate = FindViewById<TextView> (Resource.Id.textDate);
            textDate.Visibility = ViewStates.Gone;

            spinnerTime = FindViewById<Spinner> (Resource.Id.spinnerTime);
            spinnerTime.ItemSelected += HandleItemSelected;
            arrayAdapter = ArrayAdapter.CreateFromResource (this, Resource.Array.expiration_time_array, Android.Resource.Layout.SimpleSpinnerItem);
            arrayAdapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
            spinnerTime.Adapter = arrayAdapter;
            spinnerTime.SetSelection (defaultTimeIndex);
            selectedTime = timeValues [defaultTimeIndex];

            shareButton = FindViewById<Button> (Resource.Id.buttonShare);
            shareButton.Click += HandleShareClick;

            textDate.Click += delegate {
                ShowDialog (0);
            };
        }
Пример #22
0
		protected override void OnCreate(Bundle bundle)
		{
			base.OnCreate(bundle);

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

			_output = FindViewById<TextView>(Resource.Id.output);
			_ports = FindViewById<TextView>(Resource.Id.ports);

			FindViewById<Button>(Resource.Id.connect).Click += connect_Click;
			FindViewById<Button>(Resource.Id.disconnect).Click += disconnect_Click;
			FindViewById<Button>(Resource.Id.playTone).Click += playTone_Click;
			FindViewById<Button>(Resource.Id.getFwVersion).Click += getFwVersion_Click;
			FindViewById<Button>(Resource.Id.turnMotorAtPower).Click += turnMotorAtPower_Click;
			FindViewById<Button>(Resource.Id.turnMotorAtSpeed).Click += turnMotorAtSpeed_Click;
			FindViewById<Button>(Resource.Id.stepMotorAtPower).Click += stepMotorAtPower_Click;
			FindViewById<Button>(Resource.Id.stepMotorAtSpeed).Click += stepMotorAtSpeed_Click;
			FindViewById<Button>(Resource.Id.timeMotorAtPower).Click += timeMotorAtPower_Click;
			FindViewById<Button>(Resource.Id.timeMotorAtSpeed).Click += timeMotorAtSpeed_Click;

			FindViewById<Button>(Resource.Id.stopMotor).Click += stopMotor_Click;
			FindViewById<Button>(Resource.Id.setLed).Click += setLed_Click;
			FindViewById<Button>(Resource.Id.playSound).Click += playSound_Click;
			FindViewById<Button>(Resource.Id.draw).Click += draw_Click;
			FindViewById<Button>(Resource.Id.batchNoReply).Click += batchNoReply_Click;
			FindViewById<Button>(Resource.Id.batchReply).Click += batchReply_Click;


			_brick = new Brick(new BluetoothCommunication());
			//_brick = new Brick(new NetworkCommunication("192.168.2.237"));
			_brick.BrickChanged += brick_BrickChanged;
		}
Пример #23
0
		void Initialize ()
		{
			this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			this.SetGravity(GravityFlags.Center);


			image = new RelativeLayout(context);
			txtDescription = new TextView (context);
			txtTitle = new TextView (context);
			background = new LinearLayout (context);

			image.SetGravity (GravityFlags.Center);
			background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (530), Configuration.getHeight (356));
			background.Orientation = Orientation.Vertical;
			background.SetBackgroundColor (Color.ParseColor ("#50000000"));

			image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));

			txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
			txtDescription.SetTextColor(Color.ParseColor("#ffffff"));
			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			txtDescription.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));

			background.AddView (txtTitle);
			background.AddView (txtDescription);



			image.AddView (background);

			this.AddView (image);
			//this.AddView (background);


		}
Пример #24
0
        void KeepMe()
        {
            var txt = new TextView(null);
            txt.Text = txt.Text;

            var iv = new ImageView(null);
            var obj = iv.Drawable;

            var prog = new ProgressBar(null);
            prog.Progress = prog.Progress;

            var cb = new RadioButton(null);
            cb.Checked = cb.Checked;

            var np = new NumberPicker(null);
            np.Value = np.Value;

            var rb = new RatingBar(null);
            rb.Rating = rb.Rating;

            var cv = new CalendarView(null);
            cv.Date = cv.Date;

            var th = new TabHost(null);
            th.CurrentTab = th.CurrentTab;

            var tp = new TimePicker(null);
            tp.CurrentHour = tp.CurrentHour;
            tp.CurrentMinute = tp.CurrentMinute;

            
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

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

			tvOutput = FindViewById<TextView> (Resource.Id.tvOutput);
			btnPickDate = FindViewById<Button> (Resource.Id.btnPickDate);

			/*
			btnPickDate.Click += delegate {
				ShowDialog (DATE_DIALOG_ID);
			};
				
			date = DateTime.Today;
			*/

			btnPickDate.Click += (sender, e) => ShowDialog(DATE_DIALOG_ID);
			hour = DateTime.Now.Hour;
			minute = DateTime.Now.Minute;

			UpdateDisplay ();

		}
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            _view = FindViewById<LinearLayout>(Resource.Id.parentLayout);
            _text = FindViewById<TextView>(Resource.Id.logTextView);

            UpdateDisplay(INITIAL_MESSAGE,Color.White);

            var beaconManager = new BeaconManager(this);

            indoorLocationController = new IndoorLocationController(beaconManager);
            indoorLocationController.BeaconFound += HandleBeaconFound;
            indoorLocationController.BeaconLost += HandleBeaconLost;

            var beacon1 = DummyBeaconCreator.CreateBeaconUrsin();
            var beacon2 = DummyBeaconCreator.CreateBeaconMarcel();
            indoorLocationController.AddBeaconsAndStart(new List<Beacon>{beacon1,beacon2});

            if (!IsBluetoothAvailable)
            {
                Toast.MakeText(this, "Please activate Bluetooth! iBeacons works only when Bluetooth available.",ToastLength.Long).Show();
            }
        }
Пример #27
0
        void UpdateTitleViewLayoutAlignment(LinearLayout titleViewLayout, Android.Widget.TextView titleTextView, Android.Widget.TextView subTitleTextView, CustomNavigationPage.TitleAlignment alignment)
        {
            var titleViewParams        = titleViewLayout.LayoutParameters as Android.Widget.FrameLayout.LayoutParams;
            var titleTextViewParams    = titleTextView.LayoutParameters as LinearLayout.LayoutParams;
            var subTitleTextViewParams = subTitleTextView.LayoutParameters as LinearLayout.LayoutParams;

            switch (alignment)
            {
            case CustomNavigationPage.TitleAlignment.Start:
                titleViewParams.Gravity        = GravityFlags.Start | GravityFlags.CenterVertical;
                titleTextViewParams.Gravity    = GravityFlags.Start;
                subTitleTextViewParams.Gravity = GravityFlags.Start;

                break;

            case CustomNavigationPage.TitleAlignment.Center:

                titleViewParams.Gravity        = GravityFlags.Center;
                titleTextViewParams.Gravity    = GravityFlags.Center;
                subTitleTextViewParams.Gravity = GravityFlags.Center;
                break;

            case CustomNavigationPage.TitleAlignment.End:
                titleViewParams.Gravity        = GravityFlags.End | GravityFlags.CenterVertical;
                titleTextViewParams.Gravity    = GravityFlags.End;
                subTitleTextViewParams.Gravity = GravityFlags.End;
                break;
            }


            titleViewLayout.LayoutParameters = titleViewParams;
        }
Пример #28
0
 protected override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate (savedInstanceState);
     TextView textview = new TextView (this);
     textview.Text = "This is the Connection Tab";
     SetContentView (textview);
 }
Пример #29
0
        public static void DecodeFloatElementLayout(Context context, View layout, out TextView label, out SeekBar slider,
                                                    out ImageView left, out ImageView right)
        {
            if (layout == null)
            {
                label = null;
                slider = null;
                left = null;
                right = null;
                return;
            }

            label =
                layout.FindViewById<TextView>(context.Resources.GetIdentifier("dialog_LabelField", "id",
                                                                              context.PackageName));
            slider =
                layout.FindViewById<SeekBar>(context.Resources.GetIdentifier("dialog_SliderField", "id",
                                                                             context.PackageName));
            left =
                layout.FindViewById<ImageView>(context.Resources.GetIdentifier("dialog_ImageLeft", "id",
                                                                               context.PackageName));
            right =
                layout.FindViewById<ImageView>(context.Resources.GetIdentifier("dialog_ImageRight", "id",
                                                                               context.PackageName));
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            ScrollView scrollView = new ScrollView(this);

            TableLayout tableLayout = new TableLayout(this);
            TableRow tablerow = new TableRow(this);

            // make columns span the whole width
            tableLayout.SetColumnStretchable(0, true);
            tableLayout.SetColumnStretchable(1, true);

            TextView DepartCollumn = new TextView(this);
            DepartCollumn.Text = "Depart";
            tablerow.AddView(DepartCollumn);
            TimetableList.TimeColumns.Add(DepartCollumn);
            TextView ArriveCollumn = new TextView(this);
            ArriveCollumn.Text = "Arrive";
            tablerow.AddView(ArriveCollumn);
            TimetableList.TimeColumns.Add(ArriveCollumn);

            tableLayout.AddView(tablerow);
            //			tableLayout.SetScrollContainer(true);

            scrollView.AddView(tableLayout);

            SetContentView(scrollView);
        }
Пример #31
0
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			SetContentView (Resource.Layout.activity_main);

			if (savedInstanceState != null) {
				mIsResolving = savedInstanceState.GetBoolean (KEY_IS_RESOLVING);
				mShouldResolve = savedInstanceState.GetBoolean (KEY_SHOULD_RESOLVE);
			}

			FindViewById (Resource.Id.sign_in_button).SetOnClickListener (this);
			FindViewById (Resource.Id.sign_out_button).SetOnClickListener (this);
			FindViewById (Resource.Id.disconnect_button).SetOnClickListener (this);

			FindViewById<SignInButton> (Resource.Id.sign_in_button).SetSize (SignInButton.SizeWide);
			FindViewById (Resource.Id.sign_in_button).Enabled = false;

			mStatus = FindViewById<TextView> (Resource.Id.status);

			mGoogleApiClient = new GoogleApiClientBuilder (this)
				.AddConnectionCallbacks (this)
				.AddOnConnectionFailedListener (this)
				.AddApi (PlusClass.API)
				.AddScope (new Scope (Scopes.Profile))
				.Build ();
		}
Пример #32
0
		public override View GetView (Context context, View convertView, ViewGroup parent)
		{
			var view = new RelativeLayout(context);
						
            var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                                                        ViewGroup.LayoutParams.WrapContent);

            view.SetMinimumHeight(150);
            parms.SetMargins(5, 3, 5, 0);
            parms.AddRule(LayoutRules.AlignParentLeft);

			_caption = new TextView (context);
			SetCaption (Caption);
            view.AddView(_caption, parms);
			
			if (!String.IsNullOrWhiteSpace (Indicator)) {
	            var tparms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
	                                                         ViewGroup.LayoutParams.WrapContent);
	            tparms.SetMargins(5, 3, 5, 5);
	            tparms.AddRule(LayoutRules.CenterVertical);
				tparms.AddRule(LayoutRules.AlignParentRight);
	
	            _text = new TextView (context) {
					Text = Indicator,
					TextSize = 22f
				};
	            view.AddView(_text, tparms);
			}
			return view;
		}
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			if (container == null) {
				// Currently in a layout without a container, so no reason to create our view.
				return null;
			}

			var view = inflater.Inflate(Resource.Layout.speaker_screen, container, false);

			var speaker = EvolveData.SpeakerData [ShownSpeakerIndex];

			headshotImageView = view.FindViewById<ImageView> (Resource.Id.headshotImageView);
			var headshot = GetHeadShot (speaker.HeadshotUrl);
			headshotImageView.SetImageDrawable (headshot);

			speakerNameTextView = view.FindViewById<TextView> (Resource.Id.speakerNameTextView);
			speakerNameTextView.Text = speaker.Name;

			companyNameTextView = view.FindViewById<TextView> (Resource.Id.companyNameTextView);
			companyNameTextView.Text = speaker.Company;

			twitterHandleView = view.FindViewById<TextView> (Resource.Id.twitterTextView);
			twitterHandleView.Text = "@" + speaker.TwitterHandle;

			return view;
		}
Пример #34
0
        protected override void OnCreate(Bundle savedInstance) 
        {
            base.OnCreate(savedInstance);
			var tv = new TextView(this);
			tv.Text = ("Hello Dot42");
			SetContentView(tv);
        }
        protected override void OnCreate (Bundle bundle)
        {
            base.OnCreate (bundle);
            Title = "C# Client Library Tests";

            RequestWindowFeature (WindowFeatures.Progress);

            SetContentView (Resource.Layout.Harness);

            this.runStatus = FindViewById<TextView> (Resource.Id.RunStatus);

            this.list = FindViewById<ExpandableListView> (Resource.Id.List);
            this.list.SetAdapter (new TestListAdapter (this, App.Listener));
            this.list.ChildClick += (sender, e) => {
                Intent testIntent = new Intent (this, typeof(TestActivity));

                GroupDescription groupDesc = (GroupDescription)this.list.GetItemAtPosition (e.GroupPosition);
                TestDescription desc = groupDesc.Tests.ElementAt (e.ChildPosition);

                testIntent.PutExtra ("name", desc.Test.Name);
                testIntent.PutExtra ("desc", desc.Test.Description);
                testIntent.PutExtra ("log", desc.Log);

                StartActivity (testIntent);
            };

            SetProgressBarVisibility (true);
        }
Пример #36
0
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			View v = inflater.Inflate (Resource.Layout.WebViewDialog, container, false);

			txtTitle = v.FindViewById<TextView> (Resource.Id.txt_dialog_title);
			divider = v.FindViewById<View> (Resource.Id.title_divider);
			webView = v.FindViewById<WebView> (Resource.Id.dialog_web_view);

			if (title == null || title.Length < 1) {
				txtTitle.Visibility = divider.Visibility = ViewStates.Gone;
			} else {
				txtTitle.Text = title;
			}

			if (url != null && url.Length > 0) {
				webView.LoadUrl (url);
			}

			if (showOkay) {
				btnOk.Visibility = ViewStates.Visible;
				btnOk.Click += (object sender, EventArgs e) => {
					this.Dismiss ();
				};
			}

			return v;
		}
Пример #37
0
        public void ChangeFont(Android.Widget.TextView control, string fontFamily)
        {
            control.TransformationMethod = null;
            var typeface = string.IsNullOrEmpty(fontFamily) ?
                           Typeface.Default :
                           GetTypeface(fontFamily);

            control.Typeface = typeface;
        }
Пример #38
0
        public virtual Com.Zhy.Adapter.Abslistview.ViewHolder SetTextColorRes(int viewId,
                                                                              int textColorRes)
        {
            Android.Widget.TextView view = GetView <TextView>(viewId);
#pragma warning disable CS0618 // Type or member is obsolete
            view.SetTextColor(mContext.Resources.GetColor(textColorRes));
#pragma warning restore CS0618 // Type or member is obsolete
            return(this);
        }
Пример #39
0
 public bool OnEditorAction(AWidget.TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e)
 {
     if (actionId == ImeAction.Search)
     {
         Search?.Invoke(this, EventArgs.Empty);
         return(true);
     }
     return(false);
 }
Пример #40
0
        protected virtual View CreateDefaultControl(string value)
        {
            var innerDefaultControl = new Android.Widget.TextView(this.Context);

            innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
            innerDefaultControl.SetSingleLine(true);
            innerDefaultControl.Text = value;
            return(innerDefaultControl);
        }
Пример #41
0
        private void initialSettings()
        {
            pageTitle    = FindViewById <TextView>(Resource.Id.textViewtitle);
            messagePart1 = FindViewById <TextView>(Resource.Id.tvMessagePart1);
            messagePart2 = FindViewById <TextView>(Resource.Id.tvMessagePart2);

            Button messageBtn = FindViewById <Button>(Resource.Id.BtnMessageOk);

            messageBtn.SetOnClickListener(this);
        }
 void UpdateToolbarTextColor(Android.Widget.TextView textView, Xamarin.Forms.Color?titleColor, ColorStateList defaultColorStateList)
 {
     if (titleColor != null)
     {
         textView.SetTextColor(titleColor?.ToAndroid() ?? Android.Graphics.Color.White);
     }
     else
     {
         //textView.SetTextColor(defaultColorStateList);
     }
 }
Пример #43
0
 public virtual Com.Zhy.Adapter.Abslistview.ViewHolder SetTypeface(Android.Graphics.Typeface
                                                                   typeface, params int[] viewIds)
 {
     foreach (int viewId in viewIds)
     {
         Android.Widget.TextView view = GetView <TextView>(viewId);
         view.Typeface   = typeface;
         view.PaintFlags = (view.PaintFlags | Android.Graphics.PaintFlags.SubpixelText);
     }
     return(this);
 }
Пример #44
0
        public static Font GetFont(this AW.TextView view)
        {
            var fontData = view.Typeface.ToXwt();

            if (fontData == null)
            {
                return(null);
            }
            fontData.Size = view.TextSize;
            return(fontData.ToXwt());
        }
 void UpdateTitleText(Android.Widget.TextView titleTextView, string text)
 {
     if (!string.IsNullOrEmpty(text))
     {
         titleTextView.Text = text;
     }
     else
     {
         titleTextView.Text          = string.Empty;
         titleTextView.TextFormatted = new Java.Lang.String("");
     }
 }
 void UpdateFormattedTitleText(Android.Widget.TextView titleTextView, FormattedString formattedString, string defaulTitle)
 {
     if (formattedString != null && formattedString.Spans.Count > 0)
     {
         titleTextView.TextFormatted = formattedString.ToAttributed(Font.Default, Xamarin.Forms.Color.Default, titleTextView);
     }
     else
     {
         //Update if not formatted text then update with normal title text
         UpdateTitleText(titleTextView, defaulTitle);
     }
 }
        void UpdateToolbarTextFont(Android.Widget.TextView textView, Font customFont, Typeface originalFont)
        {
            if (customFont != null)
            {
                textView.Typeface = customFont.ToTypeface();

                float tValue = customFont.ToScaledPixel();
                textView.SetTextSize(ComplexUnitType.Sp, tValue);
            }
            else
            {
                textView.Typeface = originalFont;
            }
        }
        void UpdateToolbarTitle(Page lastPage, Android.Widget.TextView titleTextView, Android.Widget.TextView subTitleTextView, Typeface originalFont, ColorStateList defaultColorStateList)
        {
            subTitleTextView.TextFormatted = new Java.Lang.String("");
            subTitleTextView.Text          = string.Empty;
            subTitleTextView.Visibility    = ViewStates.Gone;

            //Update main title text
            UpdateTitleText(titleTextView, lastPage.Title);

            //Update main title color
            UpdateToolbarTextColor(titleTextView, CustomNavigationPage.GetTitleColor(lastPage), defaultColorStateList);

            //Update main title font
            UpdateToolbarTextFont(titleTextView, CustomNavigationPage.GetTitleFont(lastPage), originalFont);
        }
Пример #49
0
 protected override void OnAttached()
 {
     try
     {
         control = Control as Android.Widget.TextView;
         UpdateRadius();
         UpdateColor();
         UpdateOffset();
         UpdateControl();
     }
     catch (Exception ex)
     {
         Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
     }
 }
Пример #50
0
        public void mostrarVentanaAgregartexto(int idCampo, string titulo)
        {
            //Se crea el layoutInflater en base a la actividad que esta ejecutando el fragmento actual
            LayoutInflater layoutInflater = LayoutInflater.From(this);
            //Se crea la vista que contiene los controles que muestra la ventana de observaciones
            View contenedorVentanaModal = layoutInflater.Inflate(Resource.Layout.VentanaObservaciones, null);

            //Se instancia el constructor de la ventana
            Android.App.AlertDialog.Builder constructorVentana = new Android.App.AlertDialog.Builder(this);
            constructorVentana.SetView(contenedorVentanaModal);//Se agrega la vista que va a mostrar la ventana de observaciones

            //Se crea la instancia del edit text donde se colocara la observación
            Android.Widget.EditText observacion = (Android.Widget.EditText)contenedorVentanaModal.FindViewById(Resource.Id.txtObservacionesVentana);
            //Se cambia el titulo de la ventana
            Android.Widget.TextView tituloVentana = (Android.Widget.TextView)contenedorVentanaModal.FindViewById(Resource.Id.txtTituloVentana);
            tituloVentana.Text = titulo;

            //Se crea la instancia del edit text al que se le asignara el texto de la ventana
            Android.Widget.EditText campoTexto = (Android.Widget.EditText) this.FindViewById(idCampo);
            //Se evalua el campo de texto, si no esta vacio se asigna al campo de texto de la ventana
            if (campoTexto.Text != "")
            {
                observacion.Text = campoTexto.Text;//Se realiza la asignación del texto
            }
            //Se agregan los eventos para los botones de cancelar y de Aceptar
            constructorVentana.SetCancelable(false).SetPositiveButton("Aceptar", (sender, args) => {
                //Al presionar el botón de Aceptar se asigna el texto agregado en la ventana
                //en el campo de texto
                campoTexto.Text = observacion.Text;
            }).SetNegativeButton("Cancelar", (sender, args) => {
                //Evento al presionar el botón de cancelar
            }).SetNeutralButton("Borrar todo", (System.EventHandler <DialogClickEventArgs>)null);

            //Se crea la ventana de dialogo y se instancia con el constructor de la ventana creado anteriormente
            Android.App.AlertDialog ventana = constructorVentana.Create();
            ventana.Show();//Se muestra la ventana

            //Se crea una instancia del botón neutral de la ventana
            var btnBorrar = ventana.GetButton((int)DialogButtonType.Neutral);

            //Se crea el evento al presionar el botón de borrar
            btnBorrar.Click += (sender, args) => {
                observacion.Text = "";//Se limpia el texto de la ventana
            };
        }
        //protected Visibility NativeComputedHorizontalScrollBarVisibility
        //{
        //    get
        //    {
        //        return ((NativeScrollViewer)this.ContentNativeUIElement).VerticalScrollBarEnabled;
        //    }
        //    set
        //    {
        //    }
        //}

        //protected Visibility NativeComputedVerticalScrollBarVisibility
        //{
        //    get
        //    {
        //        return ((NativeScrollViewer)this.ContentNativeUIElement).VerticalScrollBarEnabled;
        //    }
        //    set
        //    {
        //    }
        //}

        protected override View CreateDefaultControl(string value)
        {
            var innerDefaultControl = new NativeScrollViewer(this.Context);

            innerDefaultControl.ScrollChanged   += innerDefaultControl_ScrollChanged;
            innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
            if (this.Background != null)
            {
                innerDefaultControl.SetBackgroundDrawable(this.Background.ToDrawable());
            }
            var text = new Android.Widget.TextView(this.Context);

            text.LayoutParameters = this.CreateLayoutParams();
            text.Text             = value;
            text.SetSingleLine(true);
            innerDefaultControl.ChildView = text;
            this.ContentNativeUIElement   = innerDefaultControl;
            return(innerDefaultControl);
        }
Пример #52
0
        void UpdateToolbarSubtitle(CustomPage cPage, Android.Widget.TextView subTitleTextView, Typeface originalFont, ColorStateList defaultColorStateList)
        {
            ClearTextView(subTitleTextView, true);

            if (cPage.FormattedSubtitle != null && cPage.FormattedSubtitle.Spans.Count > 0)
            {
                subTitleTextView.TextFormatted = cPage.FormattedSubtitle.ToAttributed(Font.Default, Xamarin.Forms.Color.Default, _subTitleTextView);

                subTitleTextView.Visibility = ViewStates.Visible;
            }
            else if (!string.IsNullOrEmpty(cPage.Subtitle))
            {
                UpdateToolbarTextColor(subTitleTextView, CustomNavigationPage.GetSubtitleColor(cPage), _originalColorStateList);
                UpdateToolbarTextFont(subTitleTextView, CustomNavigationPage.GetSubtitleFont(cPage), _originalFont);

                subTitleTextView.Text       = cPage.Subtitle;
                subTitleTextView.Visibility = ViewStates.Visible;
            }
        }
Пример #53
0
        public void HandleCustomEntry()
        {
            SetContentView(Resource.Layout.Main);                                                                          // xml specifies layout view
            mKeyboard = new Android.InputMethodServices.Keyboard(this, Resource.Xml.keyboard2);                            // KB xml
            et        = (TextView)FindViewById(Resource.Id.target);                                                        // User input is text view. Text entry caused standard KB to appear
            var inputManager = (InputMethodManager)MainActivity.mainActivity.GetSystemService(Context.InputMethodService); // Not necessary now

            inputManager.HideSoftInputFromWindow(et.WindowToken, HideSoftInputFlags.None);
            inputManager.HideSoftInputFromInputMethod(et.WindowToken, HideSoftInputFlags.None);
            Window.DecorView.ClearFocus();
            et.ClearFocus();
            mKeyboardView            = (CustomKeyboardView)this.FindViewById(Resource.Id.keyboard_view);
            mKeyboardView.Keyboard   = mKeyboard;
            mKeyboardView.Visibility = ViewStates.Visible;
            // MainActivity.app.Unfocus();

            /*
             * et.Touch += (sender1, e1) => {
             *  System.Diagnostics.Debug.WriteLine("onTouch - true");
             *  // mKeyboardView.Visibility = ViewStates.Visible;
             *  // ShowKeyboard(mTargetView);
             *  // ShowKeyboardWithAnimation();
             *  // MainActivity.app.Unfocus();
             *  e1.Handled = true;
             * };
             */

            mKeyboardView.Key += (sender1, e1) =>
            {
                long eventTime = JavaSystem.CurrentTimeMillis();
                // System.Diagnostics.Debug.WriteLine("mKeyboardView.Key event, primarycode: " + e1.PrimaryCode);
                if (ProcessKeyCode(e1.PrimaryCode))
                {
                    // System.Diagnostics.Debug.WriteLine("mKeyboardView done with keyboard entry");
                    active = false;
                    Finish();
                }
            };
        }
Пример #54
0
        private void CreateDbIfRequired()
        {
            var dbAccess = new DbAccess();
            var msg      = "Hello";

            try
            {
                msg = dbAccess.CreateDatabaseIfRequired();
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }

            var label = new Android.Widget.TextView(this)
            {
                Text     = msg,
                TextSize = 36
            };

            this.SetContentView(label);
        }
Пример #55
0
        protected override void OnCreate(Bundle bundle)
        {
            //LocationManager _locMgr;

            //_locMgr = GetSystemService(Context.LocationService) as
            //LocationManager;

            base.OnCreate(bundle);


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

            // Get our button from the layout resource,
            // and attach an event to it
            Button button  = FindViewById <Button>(Resource.Id.MyButton);
            Button button1 = FindViewById <Button>(Resource.Id.button9);

            Android.Widget.TextView Text = FindViewById <Android.Widget.TextView>(Resource.Id.editText1);
            button.Click  += delegate { button.Text = string.Format("{0} clicks!", count++); };
            button1.Click += delegate { Text.Text = string.Format("Bonjou tout moun"); };
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);
            if (this.Control != null && e.NewElement != null)
            {
                if (iconSpan == null)
                {
                    nativeLabel = (Android.Widget.TextView) this.Control;
                    iconLabel   = (IconLabel)e.NewElement;
                    //Set default value
                    if (iconLabel.IconSize == 0)
                    {
                        iconLabel.IconSize = iconLabel.FontSize;
                    }



                    iconFont = TrySetFont("fontawesome-webfont.ttf");
                    textFont = iconLabel.Font.ToTypeface();
                    SetText();
                }
            }
        }
        void UpdateTitleViewLayoutAlignment(LinearLayout titleViewLayout, Android.Widget.TextView titleTextView, Android.Widget.TextView subTitleTextView, CustomNavigationPage.TitleAlignment alignment)
        {
            var titleViewParams        = titleViewLayout.LayoutParameters as Android.Support.V7.App.ActionBar.LayoutParams;
            var titleTextViewParams    = titleTextView.LayoutParameters as LinearLayout.LayoutParams;
            var subTitleTextViewParams = subTitleTextView.LayoutParameters as LinearLayout.LayoutParams;
            var leftMenuParams         = _leftMenuLayout.LayoutParameters as Android.Support.V7.App.ActionBar.LayoutParams;
            var rightMenuParams        = _rightMenuLayout.LayoutParameters as Android.Support.V7.App.ActionBar.LayoutParams;

            switch (alignment)
            {
            case CustomNavigationPage.TitleAlignment.Start:
                titleViewParams.Gravity        = (int)GravityFlags.Start;
                titleTextViewParams.Gravity    = GravityFlags.Start;
                subTitleTextViewParams.Gravity = GravityFlags.Start;

                break;

            case CustomNavigationPage.TitleAlignment.Center:
                leftMenuParams.Gravity         = (int)GravityFlags.Start;
                rightMenuParams.Gravity        = (int)GravityFlags.End;
                rightMenuParams.MarginEnd      = 20;
                titleViewParams.Gravity        = (int)GravityFlags.Center;
                titleTextViewParams.Gravity    = GravityFlags.Center;
                subTitleTextViewParams.Gravity = GravityFlags.Center;
                break;

            case CustomNavigationPage.TitleAlignment.End:
                titleViewParams.Gravity        = (int)GravityFlags.End;
                titleTextViewParams.Gravity    = GravityFlags.End;
                subTitleTextViewParams.Gravity = GravityFlags.End;
                break;
            }


            titleViewLayout.LayoutParameters = titleViewParams;
        }
Пример #58
0
 protected override View CreateDefaultControl(string value)
 {
     if (this.Content is string)
     {
         var control = new TextBlock
         {
             FontFamily = this.FontFamily,
             Text       = this.Content as string,
             FontSize   = this.FontSize,
             FontStyle  = this.FontStyle,
             Foreground = this.Foreground
         };
         LogicalTreeHelper.AddLogicalChild(this, control);
         return(control.NativeUIElement);
     }
     else
     {
         var innerDefaultControl = new Android.Widget.TextView(this.Context);
         innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
         innerDefaultControl.SetSingleLine(true);
         innerDefaultControl.TextFormatted = Html.FromHtml(String.Format("<a href=\"\">{0}</a>", value));
         return(innerDefaultControl);
     }
 }
        void UpdateTitleViewLayout(Page lastPage, Android.Widget.LinearLayout titleViewLayout, Android.Widget.TextView titleTextView, Android.Widget.TextView subTitleTextView, Android.Graphics.Drawables.Drawable defaultBackground)
        {
            UpdateTitleViewLayoutAlignment(titleViewLayout, titleTextView, subTitleTextView, CustomNavigationPage.GetTitlePosition(lastPage));

            if (!string.IsNullOrEmpty(CustomNavigationPage.GetTitleBackground(lastPage)))
            {
                UpdateTitleViewLayoutBackground(titleViewLayout, CustomNavigationPage.GetTitleBackground(lastPage), defaultBackground);
            }
            else
            {
                _titleViewLayout?.SetBackground(CreateShape(ShapeType.Rectangle, (int)CustomNavigationPage.GetTitleBorderWidth(lastPage), (int)CustomNavigationPage.GetTitleBorderCornerRadius(lastPage), CustomNavigationPage.GetTitleFillColor(lastPage), CustomNavigationPage.GetTitleBorderColor(lastPage)));
            }

            UpdateTitleViewLayoutMargin(titleViewLayout, CustomNavigationPage.GetTitleMargin(lastPage));

            UpdateTitleViewLayoutPadding(titleViewLayout, CustomNavigationPage.GetTitlePadding(lastPage));
        }
Пример #60
0
 public virtual Com.Zhy.Adapter.Abslistview.ViewHolder Linkify(int viewId)
 {
     Android.Widget.TextView view = GetView <TextView>(viewId);
     Android.Text.Util.Linkify.AddLinks(view, Android.Text.Util.MatchOptions.All);
     return(this);
 }