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); base.OnCreateView (inflater, container, savedInstanceState); Dialog.SetCanceledOnTouchOutside (true); View view = inflater.Inflate (Resource.Layout.RoutDialog, container, false); tvSearchPhrase = view.FindViewById <TextView> (Resource.Id.rdSearchPhrase); tvSearchPhrase.TextChanged += SearchPhrase_TextChanged; tvDanger = view.FindViewById <TextView> (Resource.Id.rdDangerText); tvSuccess = view.FindViewById <TextView> (Resource.Id.rdSuccessText); btnPick = view.FindViewById <Button> (Resource.Id.rdPick); btnPick.Click += (object sender, EventArgs e) => { if (position != -1) { Arguments.PutInt(PHARMACY_ID, pharmacies[position].id); OnAfterPick(EventArgs.Empty); Dismiss(); } }; llDanger = view.FindViewById <LinearLayout> (Resource.Id.rdDangerLayout); llSuccess = view.FindViewById <LinearLayout> (Resource.Id.rdSuccessLayout); spnPharmacyPicker = view.FindViewById <Spinner> (Resource.Id.rdPharmacyPicker); spnPharmacyPicker.ItemSelected += PharmacyPicker_ItemSelected; return view; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var layot = new LinearLayout(this); layot.Orientation = Orientation.Vertical; _btn1 = new Button(this); _btn1.SetText(Resource.String.Button1Text); _btn1.Click += OnClickButton1; _btn2 = new Button(this); _btn2.SetText(Resource.String.Button2Text); _btn2.Click += OnClickButton2; _btn3 = new Button(this); _btn3.SetText(Resource.String.Button3Text); _btn3.Click += OnClickButton3; _btn4 = new Button(this); _btn4.SetText(Resource.String.Button4Text); _btn4.Click += OnClickButton4; layot.AddView(_btn1); layot.AddView(_btn2); layot.AddView(_btn3); layot.AddView(_btn4); SetContentView(layot); }
protected override void OnElementChanged(ElementChangedEventArgs<Page> e) { base.OnElementChanged(e); var actionBar = ((Activity)Context).ActionBar; LinearLayout layout = new LinearLayout(Context); layout.Orientation = Orientation.Horizontal; layout.WeightSum = Width; layout.SetGravity(GravityFlags.Left); TextView title = new TextView(Context); title.Text = actionBar.Title; title.TextSize = 18; Typeface font = Typeface.CreateFromAsset(Forms.Context.Assets, "BTrafcBd.ttf"); title.Typeface = font; LayoutParams textlp = new LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); ImageView logo = new ImageView(Context); logo.Clickable = true; logo.Click += Logo_Click; logo.SetImageResource(Resource.Drawable.Logo); logo.SetScaleType(ImageView.ScaleType.FitStart); layout.AddView(logo); actionBar.SetCustomView(layout, new ActionBar.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)); actionBar.SetDisplayOptions(ActionBarDisplayOptions.ShowCustom, ActionBarDisplayOptions.ShowCustom); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); Xamarin.Motion.Tweener.Sync = this; canvas = new Canvas (this.BaseContext); canvas.SetBackground (new Color (1, 1, 1)); coverflow = new Xamarin.Canvas.Controls.Coverflow (new [] { "cover1.jpg", "cover2.jpg", "cover3.jpg", "cover4.jpg", "cover5.jpg", "cover6.jpg", "cover7.jpg", "cover8.jpg", "cover9.jpg", "cover10.jpg", "cover1.jpg", "cover2.jpg", "cover3.jpg", "cover4.jpg", "cover5.jpg", "cover6.jpg", "cover7.jpg", "cover8.jpg", "cover9.jpg", "cover10.jpg", }); canvas.Root.Add (coverflow); canvas.Root.SizeChanged += (sender, e) => { coverflow.WidthRequest = canvas.Root.Width; coverflow.HeightRequest = canvas.Root.Height; }; LinearLayout layout = new LinearLayout (BaseContext); SetContentView (layout); layout.AddView (canvas); }
protected override View OnCreateDialogView() { var layout = new LinearLayout(_context) {Orientation = Orientation.Vertical}; layout.SetPadding(10, 10, 10, 10); layout.SetBackgroundColor(Color.Black); _serverUrl = new TextView(_context) {Text = "Server url:"}; _serverUrl.SetTextColor(Color.White); _serverUrl.SetPadding(0, 8, 0, 3); _serverUrlBox = new EditText(_context); _serverUrlBox.SetSingleLine(true); _userKey = new TextView(_context) {Text = "User key:"}; _userKey.SetTextColor(Color.White); _userKeyBox = new EditText(_context); _userKeyBox.SetSingleLine(true); layout.AddView(_serverUrl); layout.AddView(_serverUrlBox); layout.AddView(_userKey); layout.AddView(_userKeyBox); return layout; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); _layout = new LinearLayout(this); // Get our button from the layout resource, // and attach an event to it Button btnClickMe = FindViewById<Button>(Resource.Id.btnClickMe); //button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); }; btnClickMe.Click += new EventHandler(button_Click); Button btnClear = FindViewById<Button>(Resource.Id.btnClear); btnClear.Click += new EventHandler(btnClear_Click); Button btnShowSecond = FindViewById<Button>(Resource.Id.btnShowSecond); //btnShowSecond.Click += (sender, e) => { StartActivity(typeof(SecondActivity)); }; btnShowSecond.Click += (sender, e) => { var second = new Intent(this, typeof(SecondActivity)); second.PutExtra("FirstData", "Data from First Activity"); StartActivity(second); }; Button btnTabbed = FindViewById<Button>(Resource.Id.btnTabbedPage); btnTabbed.Click += (sender, e) => { StartActivity(typeof(TabbedActivity)); }; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.fragment_profile, null); ratingCircle = view.FindViewById<RatingCircle>(Resource.Id.rating_circle); circleImage = view.FindViewById<CircleImageView>(Resource.Id.profile_image); viewModel = new ProfileViewModel(); Square.Picasso.Picasso.With(Activity).Load(Settings.Current.UserProfileUrl).Into(circleImage); trips = view.FindViewById<TextView>(Resource.Id.text_trips); time = view.FindViewById<TextView>(Resource.Id.text_time); distance = view.FindViewById<TextView>(Resource.Id.text_distance); maxSpeed = view.FindViewById<TextView>(Resource.Id.text_max_speed); fuelUsed = view.FindViewById<TextView>(Resource.Id.text_fuel_consumption); accelerations = view.FindViewById<TextView>(Resource.Id.text_hard_accelerations); stops = view.FindViewById<TextView>(Resource.Id.text_hard_breaks); profileAll = view.FindViewById<LinearLayout>(Resource.Id.text_profile_all); profileGreat = view.FindViewById<TextView>(Resource.Id.text_profile_great); profileRating = view.FindViewById<TextView>(Resource.Id.text_profile_rating); profileAll.Visibility = ViewStates.Invisible; UpdateUI(); return view; }
public void AddSpinner(ViewGroup rootview,string loadingtext) { loading = true; if(loadingcontainer==null||(loadingcontainer!=null&&!loadingcontainer.IsShown)){ loadingcontainer = new RelativeLayout (nn_activity); loadingcontainer.LayoutParameters = new RelativeLayout.LayoutParams (RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent); loadingcontainer.SetBackgroundColor (Color.White); var detailcontainer = new LinearLayout (nn_activity); detailcontainer.Orientation = Orientation.Vertical; RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams ((int)TapUtil.dptodx (100), RelativeLayout.LayoutParams.WrapContent); param.AddRule (LayoutRules.CenterInParent); detailcontainer.LayoutParameters = param; LinearLayout.LayoutParams linearlayoutparm = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); linearlayoutparm.Gravity = GravityFlags.CenterHorizontal; ProgressBar progressbar = new ProgressBar (nn_activity); progressbar.LayoutParameters = linearlayoutparm; TextView tectview = new TextView (nn_activity); tectview.LayoutParameters = linearlayoutparm; tectview.Text = loadingtext; tectview.Gravity = GravityFlags.CenterHorizontal; detailcontainer.AddView (progressbar); detailcontainer.AddView (tectview); loadingcontainer.AddView (detailcontainer); rootview.AddView (loadingcontainer); } }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.AddPhotoPopUpLayout); optionalCaption = (EditText)FindViewById (Resource.Id.photoPopupDescription); optionalCaption.Enabled = !Assignment.IsHistory; dateTime = (TextView)FindViewById (Resource.Id.photoDateTime); photoCount = (TextView)FindViewById (Resource.Id.photoCountText); deletePhoto = (LinearLayout)FindViewById (Resource.Id.photoDeleteImage); deletePhoto.Enabled = !Assignment.IsHistory; deletePhoto.Click += (sender, e) => DeletePhoto (); var nextPhoto = (ImageButton)FindViewById (Resource.Id.photoNextButton); var previousPhoto = (ImageButton)FindViewById (Resource.Id.photoPreviousButton); var cancel = (Button)FindViewById (Resource.Id.photoCancelImage); cancel.Click += (sender, e) => Dismiss (); var done = (Button)FindViewById (Resource.Id.photoDoneImage); done.Click += (sender, e) => SavePhoto (); photo = (ImageView)FindViewById (Resource.Id.photoImageSource); nextPhoto.Visibility = previousPhoto.Visibility = photoCount.Visibility = ViewStates.Invisible; }
void Initialize () { this.LayoutParameters = new RelativeLayout.LayoutParams(-1,-1); this.SetGravity(GravityFlags.CenterHorizontal); mainLinearLayout = new LinearLayout (context); mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1); mainLinearLayout.Orientation = Orientation.Vertical; imBack = new ImageView (context); txtDescription = new TextView (context); txtTitle = new TextView (context); txtTitle.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38)); txtDescription.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32)); txtTitle.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf"); txtDescription.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf"); int padW = Configuration.getWidth(30); int padH = Configuration.getHeight (0); this.SetPadding (padW,padH,padW,padH); mainLinearLayout.AddView (txtTitle); mainLinearLayout.AddView (imBack); mainLinearLayout.AddView (txtDescription); this.AddView (mainLinearLayout); //this.AddView (background); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); RequestWindowFeature (WindowFeatures.ActionBarOverlay); ActionBar.SetBackgroundDrawable (new ColorDrawable (Color.Transparent)); SetContentView (Resource.Layout.Main); var list = FindViewById<OverscrollListView> (Resource.Id.listView1); loadingBars = FindViewById<LinearLayout> (Resource.Id.loadingBars); bar1 = FindViewById<ProgressBar> (Resource.Id.loadingBar1); bar2 = FindViewById<ProgressBar> (Resource.Id.loadingBar2); swipeText = FindViewById<TextView> (Resource.Id.swipeToRefreshText); // Remove progress bar background foreach (var p in new[] { bar1, bar2 }) { var layer = p.ProgressDrawable as LayerDrawable; if (layer != null) layer.SetDrawableByLayerId (Android.Resource.Id.Background, new ColorDrawable (Color.Transparent)); } list.OverScrolled += deltaY => { ShowSwipeDown (); accumulatedDeltaY += -deltaY; bar1.Progress = bar2.Progress = accumulatedDeltaY; if (accumulatedDeltaY == 0) HideSwipeDown (); }; list.OverScrollCanceled += HideSwipeDown; }
public override void Login(LoginConfig config) { var context = Utils.GetActivityContext(); var txtUser = new EditText(context) { Hint = config.LoginPlaceholder, Text = config.LoginValue ?? String.Empty }; var txtPass = new EditText(context) { Hint = config.PasswordPlaceholder, TransformationMethod = PasswordTransformationMethod.Instance }; var layout = new LinearLayout(context) { Orientation = Orientation.Vertical }; layout.AddView(txtUser, ViewGroup.LayoutParams.MatchParent); layout.AddView(txtPass, ViewGroup.LayoutParams.MatchParent); Utils.RequestMainThread(() => new AlertDialog .Builder(Utils.GetActivityContext()) .SetTitle(config.Title) .SetMessage(config.Message) .SetView(layout) .SetPositiveButton(config.OkText, (o, e) => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, true)) ) .SetNegativeButton(config.CancelText, (o, e) => config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, false)) ) .Show() ); }
public NavToolbarFragment( ) : base( ) { BackButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); ShareButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); CreateButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); ButtonLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); }
protected override void OnCreate(Bundle bundle) { RequestWindowFeature(WindowFeatures.ActionBar); base.OnCreate(bundle); SetContentView(Resource.Layout.AssessmentActivity); SupportActionBar.SetDisplayHomeAsUpEnabled(true); recButton = FindViewById<Button>(Resource.Id.assessment_startBtn); recButton.Text = "Begin"; recButton.Click += recButton_Click; recButton.Visibility = ViewStates.Gone; assessmentType = FindViewById<TextView>(Resource.Id.assessment_type); assessmentType.Text = ""; localTempDirectory = AppData.Cache.Path + "/assessment"; if (!Directory.Exists(localTempDirectory)) Directory.CreateDirectory(localTempDirectory); preambleContainer = FindViewById<LinearLayout>(Resource.Id.preamble_container); preambleContainer.Visibility = ViewStates.Gone; loadingContainer = FindViewById<LinearLayout>(Resource.Id.assessment_loading); loadingContainer.Visibility = ViewStates.Gone; fragmentContainer = FindViewById<FrameLayout>(Resource.Id.fragment_container); fragmentContainer.Visibility = ViewStates.Gone; helpButton = FindViewById<ImageView>(Resource.Id.assessment_info); helpButton.Click += helpButton_Click; helpButton.Visibility = ViewStates.Gone; LoadData(bundle); }
public ForwardNavigationMenu(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { _mainContainer = new LinearLayout (context); _mainContainer.Orientation = Android.Widget.Orientation.Vertical; _mainContainer.LayoutParameters = new LayoutParams (LayoutParams.MatchParent, LayoutParams.MatchParent); _context = context; var dm = Resources.DisplayMetrics; textSize = (int)TypedValue.ApplyDimension (ComplexUnitType.Sp, textSize, dm); var a = context.ObtainStyledAttributes (attrs, Attrs); a = context.ObtainStyledAttributes (attrs, Resource.Styleable.ForwardNavigationMenu); contentPadding = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmContentPadding, contentPadding); padding = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPadding, padding); paddingLeft = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingLeft, paddingLeft); paddingBottom = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingBottom, paddingBottom); paddingRight = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingRight, paddingRight); paddingTop = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingTop, paddingTop); margin = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMargin, margin); marginRight = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginRight, marginRight); marginLeft = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginLeft, marginLeft); marginBottom = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginBottom, marginBottom); marginTop = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginTop, marginTop); typefaceStyle = (TypefaceStyle)a.GetInt (Resource.Styleable.ForwardNavigationMenu_fnmTextStyle, (int)TypefaceStyle.Normal); textAlpha = a.GetInt (Resource.Styleable.ForwardNavigationMenu_fnmTextAlpha, textAlpha); a.Recycle (); _mainContainer.SetPadding (contentPadding, contentPadding, contentPadding, contentPadding); AddView (_mainContainer); }
//this comment should only be available in dev //this comment should only be available in release branch protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); var surfaceOrientation = WindowManager.DefaultDisplay.Rotation; mainLayout = viewResource.LinLayout (this); if(surfaceOrientation == SurfaceOrientation.Rotation0 || surfaceOrientation == SurfaceOrientation.Rotation180) { mainLayout.Orientation = Orientation.Vertical; } else if (surfaceOrientation == SurfaceOrientation.Rotation90 || surfaceOrientation == SurfaceOrientation.Rotation270) { mainLayout.Orientation = Orientation.Horizontal; } topLayout = viewResource.LinLayout (this); topLayout.Id = 1; topLayout.WeightSum = 1; //topLayout.SetMinimumHeight(mainLayout.Height * .25); bottomLayout = viewResource.LinLayout (this); bottomLayout.Id = 2; bottomLayout.WeightSum = 1; //bottomLayout.SetMinimumHeight( mainLayout.Height * .75); LoadFragments (); mainLayout.AddView (topLayout); mainLayout.AddView (bottomLayout); SetContentView (mainLayout); Console.WriteLine(mainLayout.ToString ()); }
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; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView (inflater, container, savedInstanceState); var view = inflater.Inflate (Resource.Layout.Tab1, container, false); var list = view.FindViewById<OverscrollListView> (Resource.Id.listView1); loadingBars = view.FindViewById<LinearLayout> (Resource.Id.loadingBars); bar1 = view.FindViewById<ProgressBar> (Resource.Id.loadingBar1); bar2 = view.FindViewById<ProgressBar> (Resource.Id.loadingBar2); swipeText = view.FindViewById<TextView> (Resource.Id.swipeToRefreshText); fakeActionBar = view.FindViewById<FrameLayout> (Resource.Id.fakeActionBar); // Remove progress bar background foreach (var p in new[] { bar1, bar2 }) { var layer = p.ProgressDrawable as LayerDrawable; if (layer != null) layer.SetDrawableByLayerId (Android.Resource.Id.Background, new ColorDrawable (Color.Transparent)); } list.OverScrolled += deltaY => { ShowSwipeDown (); accumulatedDeltaY += -deltaY; bar1.Progress = bar2.Progress = accumulatedDeltaY; if (accumulatedDeltaY == 0) HideSwipeDown (); }; list.OverScrollCanceled += HideSwipeDown; return view; }
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); }
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); }; }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate (Resource.Layout.FeedbackFragment, container, false); feedbackPositiveButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackPositiveButton); feedbackNeutralButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackNeutralButton); feedbackNegativeButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackNegativeButton); feedbackPositiveButton.Click += (sender, e) => SetRating (ratingPositive); feedbackNeutralButton.Click += (sender, e) => SetRating (ratingNeutral); feedbackNegativeButton.Click += (sender, e) => SetRating (ratingNegative); feedbackMessageEditText = view.FindViewById<EditText> (Resource.Id.FeedbackMessageText).SetFont (Font.Roboto); feedbackMessageEditText.AfterTextChanged += OnEdit; submitFeedbackButton = view.FindViewById<Button> (Resource.Id.SendFeedbackButton).SetFont (Font.Roboto); submitFeedbackButton.Click += OnSendClick; feedbackContainer = view.FindViewById<LinearLayout> (Resource.Id.FeedbackContainer); disclaimerContainer = view.FindViewById<LinearLayout> (Resource.Id.FeedbackDisclaimer); noUserRegisterButton = view.FindViewById<Button> (Resource.Id.FeedbackRegisterButton); bool offline = ServiceContainer.Resolve<AuthManager> ().OfflineMode; disclaimerContainer.Visibility = offline ? ViewStates.Visible : ViewStates.Gone; feedbackContainer.Visibility = offline ? ViewStates.Gone : ViewStates.Visible; noUserRegisterButton.Click += OpenRegisterScreen; SetRating (userRating); return view; }
//-----------clicking on images -> image on fullscreen---------// protected void ImageZoom(ImageView imageView, string Tag, LinearLayout fullScreen, LinearLayout downScreen, Button takeIt) { imageView.Click += ((object sender, System.EventArgs e) => { Log.Info(Tag, "isImageFitToScreen: " + isImageFitToScreen.ToString()); if (isImageFitToScreen) { downScreen.RemoveView(imageView); imageView.SetMaxHeight (1500); imageView.SetMaxWidth (1500); fullScreen.AddView(imageView); fullScreen.AddView(takeIt); Log.Info(Tag, "maximize"); canBeSelected = true; isImageFitToScreen = false; } else { fullScreen.RemoveView(takeIt); fullScreen.RemoveView(imageView); imageView.SetMaxHeight (450); imageView.SetMaxWidth (450); downScreen.AddView(imageView); Log.Info(Tag, "minimize"); canBeSelected = false; isImageFitToScreen = true; } }); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup rootView = (ViewGroup)inflater.Inflate(Resource.Layout.fragment_calendar_events_read, container, false); settingsLayout = (LinearLayout)rootView.FindViewById(Resource.Id.go_settings_layout); readEventsLayout = (LinearLayout)rootView.FindViewById(Resource.Id.read_events_layout); RadCalendarView calendarView = new RadCalendarView(Activity); adapter = new EventReadAdapter(calendarView); calendarView.EventAdapter = adapter; Button settingsButton = (Button)rootView.FindViewById(Resource.Id.go_settings_button); settingsButton.Click += (object sender, EventArgs e) => { GoToSettings(); }; Button readEventsButton = (Button)rootView.FindViewById(Resource.Id.read_events_button); readEventsButton.Click += (object sender, EventArgs e) => { TryReadEvents(); }; InitLayoutVisibility(); rootView.AddView(calendarView); return rootView; }
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); rootView = inflater.Inflate(Resource.Layout.HocPhi, container, false); Bundle bundle=this.Arguments; check = bundle.GetBoolean ("Remind"); autoupdate = bundle.GetBoolean ("AutoUpdateData"); progress=rootView.FindViewById<ProgressBar>(Resource.Id.progressHP); listView = rootView.FindViewById<ListView>(Resource.Id.listHP); txtHocKyHP = rootView.FindViewById<TextView>(Resource.Id.txtHocKyHP); txtNotify = rootView.FindViewById<TextView> (Resource.Id.txtNotify_HP); linear = rootView.FindViewById<LinearLayout> (Resource.Id.linear10); //load data progress.Visibility = ViewStates.Visible; progress.Indeterminate = true; //progress.Indeterminate = true; LoadData (); return rootView; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RequestWindowFeature(WindowFeatures.NoTitle); SetContentView(Resource.Layout.passcode_main); _listener = new MessageListener(ACTION_SHAKE, ACTION_DISMISS); _listener.MessageReceived += HandleMessageReceived; _numbersEntered = 0; InitButtons(); _selectedLayout = FindViewById<LinearLayout>(Resource.Id.passcode_toplayout); if(Intent != null) { bool showCancel = Intent.GetBooleanExtra(EXTRA_SHOW_CANCEL, false); _cancelButton.Visibility = showCancel ? ViewStates.Visible : ViewStates.Invisible; _passcodeLength = Intent.GetIntExtra(EXTRA_LENGTH, 4); _animationIn = Intent.GetIntExtra(EXTRA_IN_ANIMATION, 0); _animationOut = Intent.GetIntExtra(EXTRA_OUT_ANIMATION, 0); } HideUnusedCircles(); _passcodeEntered = new int[_passcodeLength]; _shakeAnimation = AnimationUtils.LoadAnimation(this, Resource.Animation.passcode_shake); }
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); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootview = (RelativeLayout)inflater.Inflate (Resource.Layout.raffleroot, container, false); locationcontainerlayout=(LinearLayout)rootview.FindViewById (Resource.Id.raffleroot_locationcontainer_linerlayout); TextView locationtext=new TextView(nn_activity); locationtext.Text=nn_location; LinearLayout.LayoutParams param=new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent,LinearLayout.LayoutParams.WrapContent); param.Gravity=global::Android.Views.GravityFlags.Center; param.LeftMargin=TapUtil.dptodx(5); locationtext.LayoutParameters=param; locationcontainerlayout.AddView (locationtext); //initialize listview listview=(ListView)rootview.FindViewById(Resource.Id.raffleroot_eventlist_listview); listview.Divider = null; adapter = new EventListAdapter (nn_activity,eventcards); listview.Adapter = adapter; //adapter.NotifyListChange (); listview.ItemClick+= (object sender, AdapterView.ItemClickEventArgs e) => { (nn_activity as HomeScreen).ShowRaffleDetailFragment(e.Position); }; return rootview; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); LinearLayout rootLayout = new LinearLayout(this) { Orientation = Orientation.Vertical }; // TODO: Demo2 - Step 2 - Start the service // Button startButton = new Button(this) { // Text = "Start the Service", // LayoutParameters = new LinearLayout.LayoutParams( // ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent), // }; // rootLayout.AddView(startButton); // // startButton.Click += delegate { // StartService(new Intent(this, typeof(TheService))); // }; // TODO: Demo2 - Step 4a - Request the service stop // Button stopButton = new Button(this) { // Text = "Stop the Service", // LayoutParameters = new LinearLayout.LayoutParams( // ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent), // }; // rootLayout.AddView(stopButton); // // stopButton.Click += delegate { // StopService(new Intent(this, typeof(TheService))); // }; SetContentView(rootLayout); }
protected override void OnElementChanged(ElementChangedEventArgs<Page> e) { base.OnElementChanged(e); myAMapPage = e.NewElement as TencentMapPage; layout1 = new LinearLayout(this.Context); this.AddView(layout1); mapView = new MapView(this.Context) { LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent) }; LatLng SHANGHAI = new LatLng( 31.238068, 121.501654); mapView.Map.SetCenter(SHANGHAI); var pins = myAMapPage.Pins; Drawable d = Resources.GetDrawable(Resource.Drawable.red_location); Bitmap bitmap = ((BitmapDrawable)d).Bitmap; LatLng latLng1; foreach (UserTaskEntInfo pin in pins) { latLng1 = new LatLng(pin.Longitude ?? 31.238068, pin.Latitude ?? 121.501654); var markOption = new MarkerOptions(); markOption.InvokeIcon(new BitmapDescriptor(bitmap)); markOption.InvokeTitle(pin.Name); markOption.InvokePosition(latLng1); var fix = mapView.Map.AddMarker(markOption); fix.ShowInfoWindow(); } mapView.Map.SetZoom(15); mapView.OnCreate(bundle); layout1.AddView(mapView); }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate (Resource.Layout.ProjectListFragment, container, false); recyclerView = view.FindViewById<RecyclerView> (Resource.Id.ProjectListRecyclerView); recyclerView.SetLayoutManager (new LinearLayoutManager (Activity)); recyclerView.AddItemDecoration (new ShadowItemDecoration (Activity)); recyclerView.AddItemDecoration (new DividerItemDecoration (Activity, DividerItemDecoration.VerticalList)); emptyStateLayout = view.FindViewById<LinearLayout> (Resource.Id.ProjectListEmptyState); searchEmptyState = view.FindViewById<LinearLayout> (Resource.Id.ProjectListSearchEmptyState); tabLayout = view.FindViewById<TabLayout> (Resource.Id.WorkspaceTabLayout); newProjectFab = view.FindViewById<AddProjectFab> (Resource.Id.AddNewProjectFAB); toolBar = view.FindViewById<Toolbar> (Resource.Id.ProjectListToolbar); var activity = (Activity)Activity; activity.SetSupportActionBar (toolBar); activity.SupportActionBar.SetDisplayHomeAsUpEnabled (true); activity.SupportActionBar.SetTitle (Resource.String.ChooseTimeEntryProjectDialogTitle); HasOptionsMenu = true; newProjectFab.Click += OnNewProjectFabClick; tabLayout.SetOnTabSelectedListener (this); return view; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.History); try { nGXPrinter = NGXPrinter.NgxPrinterInstance; nGXPrinter.InitService(this, this); } catch (Exception ex) { ExceptionLog.LogDetails(this, "Printer not connected " + ex.Message); Console.WriteLine(ex.Message); } var clearAlertDialog = new Android.App.AlertDialog.Builder(this); clearAlertDialog.SetTitle("Clear History"); clearAlertDialog.SetMessage("Do you want to clear history ?"); clearAlertDialog.SetPositiveButton("OK", (ss, se) => { ClearHistory(); }); clearAlertDialog.SetNegativeButton("Cancel", (ss, se) => { }); var home = FindViewById <Button>(Resource.Id.btnHomeFromHistory); var btnPrint = FindViewById <Button>(Resource.Id.btnHistoryPrint); btnclearHistory = FindViewById <Button>(Resource.Id.btnClearHistory); var btnHome = FindViewById <Button>(Resource.Id.btnHomeFromHistory); linearLayout = FindViewById <LinearLayout>(Resource.Id.baseLinearLayout); ParentLinearLayout = FindViewById <LinearLayout>(Resource.Id.parentLinearLayout); btnclearHistory.Click += (s, e) => { clearAlertDialog.Show(); }; btnPrint.Click += BtnPrint_Click; btnHome.Click += BtnHome_Click; historyList = FindViewById <ListView>(Resource.Id.historylistView); billHistory = FuelDB.Singleton.GetBillHitory(); try { if (billHistory?.Count() > 0) { adapter = new BillHistoryListAdapter(this, billHistory.ToList()); historyList.Adapter = adapter; DisableClearButton(true); } else { Toast.MakeText(this, "There is no history to show..", ToastLength.Short).Show(); DisableClearButton(false); } } catch { Toast.MakeText(this, "There is no history to show..", ToastLength.Short).Show(); DisableClearButton(false); } }
public void Dispose() { if (sfschedule != null) { sfschedule.Dispose(); sfschedule = null; } if (propertylayout != null) { propertylayout.Dispose(); propertylayout = null; } if (monthViewLayout != null) { monthViewLayout.Dispose(); monthViewLayout = null; } if (otherviewsLayout != null) { otherviewsLayout.Dispose(); otherviewsLayout = null; } if (workHourRangeSlider != null) { workHourRangeSlider.RangeChanged -= WorkHour_rangeSlider_RangeChanged; workHourRangeSlider.Dispose(); workHourRangeSlider = null; } if (showWeekNumber != null) { showWeekNumber.CheckedChange -= Show_week_number_CheckedChange; showWeekNumber.Dispose(); showWeekNumber = null; } if (workingHoursTxtBlock != null) { workingHoursTxtBlock.Dispose(); workingHoursTxtBlock = null; } if (showNonAccessibleBlockcheckBox != null) { showNonAccessibleBlockcheckBox.CheckedChange -= Show_Non_Accessible_Block_checkBox_CheckedChange; showNonAccessibleBlockcheckBox.Dispose(); showNonAccessibleBlockcheckBox = null; } if (showBlackoutDates != null) { showBlackoutDates.CheckedChange -= Show_Blackout_Dates_CheckedChange; showBlackoutDates.Dispose(); showBlackoutDates = null; } if (monthViewLayout != null) { monthViewLayout.Dispose(); monthViewLayout = null; } }
private FrameLayout SetOptionPage(Context context) { FrameLayout propertyLayout = new FrameLayout(context); LinearLayout layout = new LinearLayout(context); layout.Orientation = Android.Widget.Orientation.Vertical; layout.SetBackgroundColor(Color.White); layout.SetPadding(15, 15, 15, 20); monthViewLayout = new LinearLayout(context); monthViewLayout.Orientation = Android.Widget.Orientation.Vertical; monthViewLayout.SetBackgroundColor(Color.White); monthViewLayout.SetPadding(15, 15, 15, 20); otherviewsLayout = new LinearLayout(context); otherviewsLayout.Orientation = Android.Widget.Orientation.Vertical; otherviewsLayout.SetBackgroundColor(Color.White); otherviewsLayout.SetPadding(15, 15, 15, 20); //Schedule Type TextView scheduleType_txtBlock = new TextView(context); scheduleType_txtBlock.Text = "Select the Schedule Type"; scheduleType_txtBlock.TextSize = 20; scheduleType_txtBlock.SetPadding(0, 0, 0, 10); scheduleType_txtBlock.SetTextColor(Color.Black); Spinner typeSpinner = new Spinner(context, SpinnerMode.Dialog); typeSpinner.SetMinimumHeight(60); typeSpinner.SetBackgroundColor(Color.Gray); typeSpinner.DropDownWidth = 600; typeSpinner.SetPadding(10, 10, 0, 10); typeSpinner.SetGravity(GravityFlags.CenterHorizontal); layout.AddView(scheduleType_txtBlock); layout.AddView(typeSpinner); List <String> list = new List <String>(); list.Add("Week View"); list.Add("Day View"); list.Add("Work Week View"); list.Add("Month View"); ArrayAdapter <String> dataAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, list); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); typeSpinner.Adapter = dataAdapter; typeSpinner.ItemSelected += SType_spinner_ItemSelected; View divider1 = new View(context); divider1.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 2); divider1.SetBackgroundColor(Color.Gray); otherviewsLayout.AddView(divider1); //Working Hours Duration workingHoursTxtBlock = new TextView(context); workingHoursTxtBlock.SetPadding(0, 20, 0, 0); workingHoursTxtBlock.Text = "Working Hours Duration"; workingHoursTxtBlock.TextSize = 20; workingHoursTxtBlock.SetTextColor(Color.Black); workHourRangeSlider = new SfRangeSlider(context); workHourRangeSlider.SetPadding(0, 0, 0, 30); workHourRangeSlider.Minimum = 0; workHourRangeSlider.Maximum = 24; workHourRangeSlider.TickFrequency = 2; workHourRangeSlider.StepFrequency = 1; workHourRangeSlider.RangeStart = weekViewSetting.WorkStartHour; workHourRangeSlider.RangeEnd = weekViewSetting.WorkEndHour; workHourRangeSlider.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 100); workHourRangeSlider.RangeChanged += WorkHour_rangeSlider_RangeChanged; workHourRangeSlider.ShowRange = true; workHourRangeSlider.ValuePlacement = ValuePlacement.TopLeft; workHourRangeSlider.ToolTipPlacement = ToolTipPlacement.None; workHourRangeSlider.TickPlacement = TickPlacement.None; workHourRangeSlider.ShowValueLabel = true; workHourRangeSlider.SnapsTo = SnapsTo.StepValues; if (context.Resources.DisplayMetrics.Density < 2) { workHourRangeSlider.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 150); } else if (context.Resources.DisplayMetrics.Density == 2) { workHourRangeSlider.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 200); } else { workHourRangeSlider.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 250); } otherviewsLayout.AddView(workingHoursTxtBlock); otherviewsLayout.AddView(workHourRangeSlider); View divider2 = new View(context); divider2.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 2); divider2.SetBackgroundColor(Color.Gray); otherviewsLayout.AddView(divider2); showNonAccessibleBlockcheckBox = new CheckBox(context); showNonAccessibleBlockcheckBox.SetPadding(0, 10, 0, 10); showNonAccessibleBlockcheckBox.Text = "Show Non-Accessible Blocks"; showNonAccessibleBlockcheckBox.TextSize = 20; showNonAccessibleBlockcheckBox.SetTextColor(Color.Black); showNonAccessibleBlockcheckBox.Checked = true; showNonAccessibleBlockcheckBox.CheckedChange += Show_Non_Accessible_Block_checkBox_CheckedChange; otherviewsLayout.AddView(showNonAccessibleBlockcheckBox); View monthlayoutDivider = new View(context); monthlayoutDivider.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 2); monthlayoutDivider.SetBackgroundColor(Color.Gray); monthViewLayout.AddView(monthlayoutDivider); //Show black out dates showBlackoutDates = new CheckBox(context); showBlackoutDates.SetPadding(0, 10, 0, 10); showBlackoutDates.Text = "Show Blackout days"; showBlackoutDates.TextSize = 20; showBlackoutDates.Checked = true; showBlackoutDates.SetTextColor(Color.Black); showBlackoutDates.CheckedChange += Show_Blackout_Dates_CheckedChange; monthViewLayout.AddView(showBlackoutDates); //Show week number showWeekNumber = new CheckBox(context); showWeekNumber.SetPadding(0, 10, 0, 10); showWeekNumber.Text = "Show Week number"; showWeekNumber.TextSize = 20; showWeekNumber.Checked = true; showWeekNumber.SetTextColor(Color.Black); showWeekNumber.CheckedChange += Show_week_number_CheckedChange; monthViewLayout.AddView(showWeekNumber); View monthLayoutdivider2 = new View(context); monthLayoutdivider2.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 2); monthLayoutdivider2.SetBackgroundColor(Color.Gray); monthViewLayout.AddView(monthLayoutdivider2); View divider5 = new View(context); divider5.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 2); divider5.SetBackgroundColor(Color.Gray); otherviewsLayout.AddView(divider5); FrameLayout collapsedLayouts = new FrameLayout(context); collapsedLayouts.AddView(otherviewsLayout); collapsedLayouts.AddView(monthViewLayout); layout.AddView(collapsedLayouts); if (sfschedule.ScheduleView != ScheduleView.MonthView) { monthViewLayout.Visibility = ViewStates.Invisible; } propertyLayout.AddView(layout); return(propertyLayout); }
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 // 初始化控件 linearLayout_Point = FindViewById <LinearLayout>(Resource.Id.point); viewpage = FindViewById <ViewPager>(Resource.Id.viewpage); tv = FindViewById <TextView>(Resource.Id.guideText); // 注册事件 tv.SetOnClickListener(this); viewpage.AddOnPageChangeListener(this); // 给ViewPage 添加图片 list = new List <View>(); // 设置图片布局参数 LinearLayout.LayoutParams ps = new LinearLayout.LayoutParams(ActionBar.LayoutParams.MatchParent, ActionBar.LayoutParams.MatchParent); // 创建引导图 for (int i = 0; i < imageView.Length; i++) { ImageView iv = new ImageView(this); iv.LayoutParameters = ps; iv.SetScaleType(ImageView.ScaleType.FitXy); iv.SetImageResource(imageView[i]); list.Add(iv); } // 加入适配器 viewpage.Adapter = new GuideAdapter(list); // 添加小圆点 for (int i = 0; i < imageView.Length; i++) { // 圆点大小适配 var size = Resources.GetDimensionPixelSize(Resource.Dimension.Size_18); LinearLayout.LayoutParams pointParams = new LinearLayout.LayoutParams(size, size); if (i < 1) { pointParams.SetMargins(0, 0, 0, 0); } else { pointParams.SetMargins(10, 0, 0, 0); } ImageView imageView = new ImageView(this); imageView.LayoutParameters = pointParams; imageView.SetBackgroundResource(Resource.Drawable.NoPress); linearLayout_Point.AddView(imageView); } // 设置默认选中第一张圆点 linearLayout_Point.GetChildAt(0).SetBackgroundResource(Resource.Drawable.Press); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); try { SetContentView(Resource.Layout.RegionForSearching); loc_pref = Application.Context.GetSharedPreferences("coordinates", FileCreationMode.Private); pref = Application.Context.GetSharedPreferences("coordinates", FileCreationMode.Private); InputMethodManager imm = (InputMethodManager)GetSystemService(Context.InputMethodService); searchET = FindViewById <EditText>(Resource.Id.searchET); close_searchBn = FindViewById <ImageButton>(Resource.Id.close_searchBn); activityIndicatorSearch = FindViewById <ProgressBar>(Resource.Id.activityIndicatorSearch); search_recyclerView = FindViewById <RecyclerView>(Resource.Id.search_recyclerView); searchLL = FindViewById <LinearLayout>(Resource.Id.searchLL); nothingIV = FindViewById <ImageView>(Resource.Id.nothingIV); searchIV = FindViewById <ImageView>(Resource.Id.searchIV); nothingTV = FindViewById <TextView>(Resource.Id.nothingTV); your_city_valueTV = FindViewById <TextView>(Resource.Id.your_city_valueTV); recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView); layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); recyclerView.SetLayoutManager(layoutManager); back_button = FindViewById <ImageButton>(Resource.Id.back_button); autolocatonBn = FindViewById <Button>(Resource.Id.autolocatonBn); backRelativeLayout = FindViewById <RelativeLayout>(Resource.Id.backRelativeLayout); tintLL = FindViewById <RelativeLayout>(Resource.Id.tintLL); noTV = FindViewById <TextView>(Resource.Id.noTV); yesTV = FindViewById <TextView>(Resource.Id.yesTV); activityIndicator = FindViewById <ProgressBar>(Resource.Id.activityIndicator); activityIndicator.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); activityIndicatorSearch.IndeterminateDrawable.SetColorFilter(Resources.GetColor(Resource.Color.buttonBackgroundColor), Android.Graphics.PorterDuff.Mode.Multiply); search_layoutManager = new LinearLayoutManager(this, LinearLayoutManager.Vertical, false); search_recyclerView.SetLayoutManager(search_layoutManager); Typeface tf = Typeface.CreateFromAsset(Assets, "Roboto-Regular.ttf"); FindViewById <TextView>(Resource.Id.headerTV).SetTypeface(tf, TypefaceStyle.Bold); autolocatonBn.SetTypeface(tf, TypefaceStyle.Normal); searchET.SetTypeface(tf, TypefaceStyle.Normal); FindViewById <TextView>(Resource.Id.textView5).SetTypeface(tf, TypefaceStyle.Normal); your_city_valueTV.SetTypeface(tf, TypefaceStyle.Normal); yesTV.SetTypeface(tf, TypefaceStyle.Normal); noTV.SetTypeface(tf, TypefaceStyle.Normal); nothingTV.SetTypeface(tf, TypefaceStyle.Normal); backRelativeLayout.Click += (s, e) => { OnBackPressed(); }; back_button.Click += (s, e) => { OnBackPressed(); }; autolocatonBn.Click += async(s, e) => { activityIndicator.Visibility = ViewStates.Visible; var myLocJson = await countryMethods.CurrentLocation(pref.GetString("latitude", String.Empty), pref.GetString("longitude", String.Empty)); myLocDeserialized = JsonConvert.DeserializeObject <List <MyLocation> >(myLocJson); your_city_valueTV.Text = myLocDeserialized[0].city.name + "?"; activityIndicator.Visibility = ViewStates.Gone; tintLL.Visibility = ViewStates.Visible; }; yesTV.Click += (s, e) => { edit_loc = loc_pref.Edit(); edit_loc.PutString("auto_city_id", myLocDeserialized[0].city.id); edit_loc.PutString("auto_city_name", myLocDeserialized[0].city.name); edit_loc.PutString("auto_region_id", myLocDeserialized[0].region.id); edit_loc.PutString("auto_region_name", myLocDeserialized[0].region.name); edit_loc.PutString("auto_country_id", myLocDeserialized[0].country.id); edit_loc.PutString("auto_country_name", myLocDeserialized[0].country.name); edit_loc.Apply(); tintLL.Visibility = ViewStates.Gone; StartActivity(typeof(SpecialistsCategoryActivity)); }; noTV.Click += (s, e) => { tintLL.Visibility = ViewStates.Gone; }; searchET.TextChanged += async(s, e) => { if (!String.IsNullOrEmpty(searchET.Text)) { nothingIV.Visibility = ViewStates.Gone; nothingTV.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Visible; close_searchBn.Visibility = ViewStates.Visible; activityIndicatorSearch.Visibility = ViewStates.Visible; search_recyclerView.Visibility = ViewStates.Gone; var search_content = await countryMethods.RegionsSearch(loc_pref.GetString("auto_country_id", String.Empty), searchET.Text); if (!search_content.ToLower().Contains("пошло не так".ToLower()) && !search_content.Contains("null")) { search_recyclerView.Visibility = ViewStates.Visible; deserialized_search = JsonConvert.DeserializeObject <List <RegionSearch> >(search_content.ToString()); List <RegionSearch> searchDisplayings = new List <RegionSearch>(); foreach (var item in deserialized_search) { searchDisplayings.Add(new RegionSearch { id = item.id, region = item.region }); } regionsSearchAdapter = new RegionsSearchAdapter(searchDisplayings, this, tf); regionsSearchAdapter.NotifyDataSetChanged(); search_recyclerView.SetAdapter(regionsSearchAdapter); regionsSearchAdapter.NotifyDataSetChanged(); } else { search_recyclerView.Visibility = ViewStates.Gone; nothingIV.Visibility = ViewStates.Visible; nothingTV.Visibility = ViewStates.Visible; } activityIndicatorSearch.Visibility = ViewStates.Gone; } else { searchIV.Visibility = ViewStates.Visible; close_searchBn.Visibility = ViewStates.Gone; searchLL.Visibility = ViewStates.Gone; } }; close_searchBn.Click += (s, e) => { searchET.Text = null; imm.HideSoftInputFromWindow(searchET.WindowToken, 0); searchLL.Visibility = ViewStates.Gone; }; searchET.EditorAction += (object sender, EditText.EditorActionEventArgs e) => { imm.HideSoftInputFromWindow(searchET.WindowToken, 0); }; activityIndicator.Visibility = ViewStates.Visible; var regionsJson = await countryMethods.GetRegions(loc_pref.GetString("auto_country_id", String.Empty)); activityIndicator.Visibility = ViewStates.Gone; var deserialized_regions = JsonConvert.DeserializeObject <List <RegionSearch> >(regionsJson); var countryAdapter = new RegionAdapter(deserialized_regions, this, tf); recyclerView.SetAdapter(countryAdapter); } catch { StartActivity(typeof(MainActivity)); } }
private void SuggestionModeLayout() { /****************** **SuggestionMode** ******************/ TextView suggestionModeLabel = new TextView(context); suggestionModeLabel.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center); suggestionModeLabel.Text = "Suggestion Mode"; suggestionModeLabel.TextSize = 15; suggestionModeLabel.Gravity = GravityFlags.Left; //SuggestionList List <String> suggestionModeList = new List <String>(); suggestionModeList.Add("StartsWith"); suggestionModeList.Add("StartsWithCaseSensitive"); suggestionModeList.Add("Contains"); suggestionModeList.Add("ContainsWithCaseSensitive"); suggestionModeList.Add("EndsWith"); suggestionModeList.Add("EndsWithCaseSensitive"); suggestionModeList.Add("Equals"); suggestionModeList.Add("EqualsWithCaseSensitive"); suggestionModeSpinner = new Spinner(context, SpinnerMode.Dialog); suggestionModeDataAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, suggestionModeList); suggestionModeDataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); suggestionModeSpinner.Adapter = suggestionModeDataAdapter; suggestionModeSpinner.SetSelection(selectionPosition); suggestionModeSpinner.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center); //suggestionModeSpinner ItemSelected Listener suggestionModeSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { selectionPosition = e.Position; String selectedItem = suggestionModeDataAdapter.GetItem(e.Position); if (selectedItem.Equals("StartsWith")) { suggestionModes = SuggestionMode.StartsWith; } else if (selectedItem.Equals("StartsWithCaseSensitive")) { suggestionModes = SuggestionMode.StartsWithCaseSensitive; } else if (selectedItem.Equals("Contains")) { suggestionModes = SuggestionMode.Contains; } else if (selectedItem.Equals("ContainsWithCaseSensitive")) { suggestionModes = SuggestionMode.ContainsWithCaseSensitive; } else if (selectedItem.Equals("EndsWith")) { suggestionModes = SuggestionMode.EndsWith; } else if (selectedItem.Equals("EndsWithCaseSensitive")) { suggestionModes = SuggestionMode.EndsWithCaseSensitive; } else if (selectedItem.Equals("Equals")) { suggestionModes = SuggestionMode.Equals; } else if (selectedItem.Equals("EqualsWithCaseSensitive")) { suggestionModes = SuggestionMode.EqualsWithCaseSensitive; } ApplyChanges(); }; LinearLayout suggestionModeLayout = new LinearLayout(context); suggestionModeLayout.Orientation = Android.Widget.Orientation.Horizontal; suggestionModeLayout.AddView(suggestionModeLabel); suggestionModeLayout.AddView(suggestionModeSpinner); proprtyOptionsLayout.AddView(suggestionModeLayout); TextView spaceText2 = new TextView(context); spaceText2.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 38, GravityFlags.Center); proprtyOptionsLayout.AddView(spaceText2); }
void Initialize() { this.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); this.Orientation = Orientation.Vertical; linea_separador = new View(context); linea_separador.LayoutParameters = new ViewGroup.LayoutParams(-1, 5); linea_separador.SetBackgroundColor(Color.ParseColor("#eeeeee")); imgUser = new ImageView(context); scrollImage = new HorizontalScrollView(context); scrollImage.HorizontalScrollBarEnabled = false; linearImage = new LinearLayout(context); linearPanelScroll = new LinearLayout(context); linearContainer = new LinearLayout(context); linearAll = new LinearLayout(context); txtAuthor = new TextView(context); txtContainer = new TextView(context); txtTitle = new TextView(context); linearAll.LayoutParameters = new LinearLayout.LayoutParams(-1, -2); linearImage.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(140), -2); linearContainer.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(500), -2); linearPanelScroll.LayoutParameters = new LinearLayout.LayoutParams(-2, -2); scrollImage.LayoutParameters = new ViewGroup.LayoutParams(Configuration.getWidth(500), -2); linearAll.Orientation = Orientation.Horizontal; linearImage.Orientation = Orientation.Vertical; linearContainer.Orientation = Orientation.Vertical; txtTitle.SetTextSize(ComplexUnitType.Px, Configuration.getHeight(40)); txtAuthor.SetTextSize(ComplexUnitType.Px, Configuration.getHeight(30)); txtContainer.SetTextSize(ComplexUnitType.Px, Configuration.getHeight(45)); txtAuthor.SetTextColor(Color.ParseColor("#3c3c3c")); txtContainer.SetTextColor(Color.ParseColor("#3c3c3c")); txtTitle.SetSingleLine(true); txtAuthor.SetSingleLine(true); txtContainer.SetSingleLine(false); txtContainer.SetPadding(0, 0, 20, 0); txtContainer.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf"); txtAuthor.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf"); scrollImage.AddView(linearPanelScroll); linearAll.AddView(linearImage); linearAll.AddView(linearContainer); linearImage.AddView(imgUser); linearContainer.AddView(txtTitle); linearContainer.AddView(txtAuthor); linearContainer.AddView(txtContainer); linearContainer.AddView(scrollImage); int space = Configuration.getHeight(50); scrollImage.SetPadding(0, 0, 0, space); this.AddView(linearAll); this.AddView(linea_separador); this.SetPadding(0, 0, 0, space); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); if (DataManager.Get <ISettingsManager>().Settings.InAppPurchase) { BillingHandler = new SaneInAppBillingHandler(this, DataManager.Get <ISettingsManager>().Settings.PublicKey); try { Task.Run( async() => { await BillingHandler.Connect(); if (DownloadManager.IsLogged()) { //abbonamenti var purch = await BillingHandler.GetPurchases(ItemType.Subscription); var subList = new List <Dictionary <string, string> >(); foreach (var p in purch) { //BillingHandler.ConsumePurchase(p); Dictionary <string, string> data = new Dictionary <string, string>(); string orderID = p.OrderId; if (orderID == null || orderID == "") { orderID = p.PurchaseToken; } data.Add("packageName", this.PackageName); data.Add("orderId", orderID); data.Add("productId", p.ProductId); data.Add("developerPayload", p.DeveloperPayload); data.Add("purchaseTime", p.PurchaseTime.ToString()); data.Add("purchaseToken", p.PurchaseToken); data.Add("purchaseState", p.PurchaseState.ToString()); subList.Add(data); } var encodeData = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(subList))); Notification.CheckSubscriptions(encodeData); } } ); //await _billingHandler.Connect(); } catch (InAppBillingException ex) { // Thrown if the commection fails for whatever reason (device doesn't support In-App billing, etc.) // All methods (except for Disconnect()) may throw this exception, // handling it is omitted for brevity in the rest of the samples Log.Error("HomeScreen", ex.Message); } } //permessi cartella condivisa if (!this.CanAccessExternal()) { var permissions = new string[] { Manifest.Permission.ReadExternalStorage, Manifest.Permission.WriteExternalStorage }; this.RequestPermissions(permissions, 1); } //this.SetTheme(Resource.Style.MB); SetContentView(Resource.Layout.HomeScreen); MenuLabels = new Dictionary <string, string>() { { "edicola", GetString(Resource.String.menu_Edicola) }, { "download", GetString(Resource.String.menu_Download) }, { "impostazioni", GetString(Resource.String.menu_Settings) }, { "crediti", GetString(Resource.String.menu_Credits) }, { "ciccio", "ddddddd" } }; _Title = _DrawerTitle = Title = this.AppName(); _Drawer = this.FindViewById <DrawerLayout>(Resource.Id.drawer_layout); _DrawerList = this.FindViewById <ListView>(Resource.Id.left_drawer); _DrawerContent = this.FindViewById <LinearLayout>(Resource.Id.drawer_content); _Drawer.SetBackgroundColor(Color.Transparent.FromHex("eeeeee")); //voci menu List <string> Sections = new List <string>(); if (DataManager.Get <ISettingsManager>().Settings.EdicolaEnabled) { MenuItems.Add("edicola"); Sections.Add(MenuLabels["edicola"]); } if (DataManager.Get <ISettingsManager>().Settings.DownloadEnabled) { MenuItems.Add("download"); Sections.Add(MenuLabels["download"]); } if (DataManager.Get <ISettingsManager>().Settings.SettingsEnabled) { MenuItems.Add("impostazioni"); Sections.Add(MenuLabels["impostazioni"]); } MenuItems.Add("crediti"); Sections.Add(MenuLabels["crediti"]); //_DrawerList.Adapter = new ArrayAdapter<string>(this, Resource.Layout.DrawerListItem, Sections); _DrawerList.Adapter = new DrawerAdapter <string>(this, Resource.Layout.DrawerListItem, Sections); _DrawerList.ItemClick += (sender, args) => ListItemClicked(args.Position); _Drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow_light, (int)Android.Views.GravityFlags.Start); _DrawerContent.SetBackgroundColor(Color.Transparent.FromHex(DataManager.Get <ISettingsManager>().Settings.MenuFondoColor)); _DrawerList.SetBackgroundColor(Color.Transparent.FromHex(DataManager.Get <ISettingsManager>().Settings.MenuFondoColor)); _DrawerList.Divider = new ColorDrawable(Color.Transparent); _DrawerList.DividerHeight = 8; _DrawerToggle = new MyActionBarDrawerToggle(this, _Drawer, Resource.Drawable.ic_drawer, Resource.String.DrawerOpen, Resource.String.DrawerClose); //Display the current fragments title and update the options menu _DrawerToggle.DrawerClosed += (o, args) => { this.ActionBar.Title = _Title; ActionBar.SetDisplayShowCustomEnabled(true); this.InvalidateOptionsMenu(); }; //Display the drawer title and update the options menu _DrawerToggle.DrawerOpened += (o, args) => { this.ActionBar.Title = _DrawerTitle; ActionBar.SetDisplayShowCustomEnabled(false); this.InvalidateOptionsMenu(); }; //Set the drawer lister to be the toggle. _Drawer.SetDrawerListener(this._DrawerToggle); //if first time you will want to go ahead and click first item. if (bundle == null) { ListItemClicked(0); } /*string color = "#" + DataManager.Get<ISettingsManager>().Settings.NavigationBarColor; * ActionBar.SetBackgroundDrawable(new ColorDrawable(Color.ParseColor(color))); * * int amId = this.Resources.GetIdentifier("action_context_bar", "id", "android"); * View view= FindViewById(amId); * view.SetBackgroundColor(Color.ParseColor(color)); */ ActionBar.SetCustomView(Resource.Layout.CustomActionBar); ActionBar.SetDisplayShowCustomEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetHomeButtonEnabled(true); //ActionBar.SetDisplayShowHomeEnabled (false); ActionBar.SetIcon(Android.Resource.Color.Transparent); ActionBar.SetBackgroundDrawable(new ColorDrawable(Color.Transparent.FromHex(DataManager.Get <ISettingsManager>().Settings.NavigationBarColor))); //ActionBar.CustomView.Background.Colorize(DataManager.Get<ISettingsManager>().Settings.NavigationBarColor); var btnBack = ActionBar.CustomView.FindViewById <Button>(Resource.Id.btnBack); btnBack.SetTextColor(Color.Transparent.FromHex(DataManager.Get <ISettingsManager>().Settings.TintColor)); btnBack.Click += (sender, e) => { if (_CurrentItem == "crediti" || _CurrentItem == "impostazioni") { _Drawer.OpenDrawer(_DrawerContent); } }; //colore titolo var titleId = Resources.GetIdentifier("action_bar_title", "id", "android"); var abTitle = FindViewById <TextView>(titleId); abTitle.SetTextColor(Color.Transparent.FromHex(DataManager.Get <ISettingsManager>().Settings.TintColor)); //se è un'applicazione edicola e non ci sono documenti lo mando direttamente ai downloads if (DataManager.Get <ISettingsManager>().Settings.EdicolaEnabled&& DataManager.Get <ISettingsManager>().Settings.DownloadEnabled) { if (FileSystemManager.ElemetsInBaseDir == 0) { //if(/*this.CanAccessExternal() &&*/ FileSystemManager.DocumentsToImport == 0) GoTo(1); } } //coloro l'icona di navigazione ColorizeDrawer(); }
/// <summary> /// Method that initializes views /// </summary> void Initialize() { // Initialize app // Add all necessary Views Window.Instance.BackgroundColor = Color.Red; Size2D ScreenSize = Window.Instance.WindowSize; RootView = new View(); RootView.BackgroundColor = Color.White; RootView.Size2D = ScreenSize; // Add linear layout that will serve as a root for other layouts LinearLayout RootLayout = new LinearLayout(); RootLayout.LinearOrientation = LinearLayout.Orientation.Vertical; RootView.Layout = RootLayout; RootView.Padding = new Extents(20, 20, 20, 20); // Create the first View View1 = new View(); View1.BackgroundColor = new Color(0.8f, 0.7f, 0.3f, 1.0f); View1.WidthSpecification = LayoutParamPolicies.MatchParent; View1.HeightSpecification = LayoutParamPolicies.MatchParent; View1.Weight = 0.45f; View1.Padding = new Extents(10, 10, 10, 10); View1.Margin = new Extents(5, 5, 5, 5); // Create LinearLayout LinearLayout Layout1 = new LinearLayout(); Layout1.LinearAlignment = LinearLayout.Alignment.Begin; Layout1.LinearOrientation = LinearLayout.Orientation.Horizontal; View1.Layout = Layout1; AddText(View1); // Create second View View2 = new View(); View2.BackgroundColor = new Color(0.8f, 0.7f, 0.3f, 1.0f); View2.WidthSpecification = LayoutParamPolicies.MatchParent; View2.HeightSpecification = LayoutParamPolicies.MatchParent; View2.Weight = 0.25f; View2.Margin = new Extents(5, 5, 5, 5); // Create LinearLayout LinearLayout Layout2 = new LinearLayout(); Layout2.LinearAlignment = LinearLayout.Alignment.Center; Layout2.LinearOrientation = LinearLayout.Orientation.Horizontal; View2.Layout = Layout2; AddImages(View2); // Create third View View3 = new View(); View3.BackgroundColor = new Color(0.8f, 0.7f, 0.3f, 1.0f); View3.WidthSpecification = LayoutParamPolicies.MatchParent; View3.HeightSpecification = LayoutParamPolicies.MatchParent; View3.Weight = 0.3f; View3.Margin = new Extents(5, 5, 5, 5); // Create LinearLayout LinearLayout Layout3 = new LinearLayout(); Layout3.LinearAlignment = LinearLayout.Alignment.Begin; Layout3.LinearOrientation = LinearLayout.Orientation.Horizontal; View3.Layout = Layout3; AddColors(View3); // Add child views RootView.Add(View1); RootView.Add(View2); RootView.Add(View3); Window.Instance.Add(RootView); Window.Instance.KeyEvent += OnKeyEvent; }
protected virtual BottomSheetDialog CreateMoreBottomSheet(Action <ShellSection, BottomSheetDialog> selectCallback) { var bottomSheetDialog = new BottomSheetDialog(Context); var bottomSheetLayout = new LinearLayout(Context); using (var bottomShellLP = new LP(LP.MatchParent, LP.WrapContent)) bottomSheetLayout.LayoutParameters = bottomShellLP; bottomSheetLayout.Orientation = Orientation.Vertical; // handle the more tab for (int i = 4; i < ShellItem.Items.Count; i++) { var shellContent = ShellItem.Items[i]; using (var innerLayout = new LinearLayout(Context)) { innerLayout.SetClipToOutline(true); innerLayout.SetBackground(CreateItemBackgroundDrawable()); innerLayout.SetPadding(0, (int)Context.ToPixels(6), 0, (int)Context.ToPixels(6)); innerLayout.Orientation = Orientation.Horizontal; using (var param = new LP(LP.MatchParent, LP.WrapContent)) innerLayout.LayoutParameters = param; // technically the unhook isn't needed // we dont even unhook the events that dont fire void clickCallback(object s, EventArgs e) { selectCallback(shellContent, bottomSheetDialog); if (!innerLayout.IsDisposed()) { innerLayout.Click -= clickCallback; } } innerLayout.Click += clickCallback; var image = new ImageView(Context); var lp = new LinearLayout.LayoutParams((int)Context.ToPixels(32), (int)Context.ToPixels(32)) { LeftMargin = (int)Context.ToPixels(20), RightMargin = (int)Context.ToPixels(20), TopMargin = (int)Context.ToPixels(6), BottomMargin = (int)Context.ToPixels(6), Gravity = GravityFlags.Center }; image.LayoutParameters = lp; lp.Dispose(); ShellContext.ApplyDrawableAsync(shellContent, ShellSection.IconProperty, icon => { if (!image.IsDisposed()) { var color = Color.Black.MultiplyAlpha(0.6).ToAndroid(); icon.SetTint(color); image.SetImageDrawable(icon); } }); innerLayout.AddView(image); using (var text = new TextView(Context)) { text.Typeface = "sans-serif-medium".ToTypeFace(); text.SetTextColor(AColor.Black); text.Text = shellContent.Title; lp = new LinearLayout.LayoutParams(0, LP.WrapContent) { Gravity = GravityFlags.Center, Weight = 1 }; text.LayoutParameters = lp; lp.Dispose(); innerLayout.AddView(text); } bottomSheetLayout.AddView(innerLayout); } } bottomSheetDialog.SetContentView(bottomSheetLayout); bottomSheetLayout.Dispose(); return(bottomSheetDialog); }
// https://github.com/opersys/raidl // http://stackoverflow.com/questions/6274141/trigger-background-service-at-a-specific-time-in-android // http://stackoverflow.com/questions/7144908/how-is-an-intent-service-declared-in-the-android-manifest // http://developer.android.com/guide/topics/manifest/service-element.html //AtBootCompleted hack1; protected override void onCreate(global::android.os.Bundle savedInstanceState) { // http://developer.android.com/guide/topics/ui/notifiers/notifications.html base.onCreate(savedInstanceState); var sv = new ScrollView(this); var ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll); #region startservice var startservice = new Button(this); startservice.setText("Start Service"); startservice.AtClick( delegate { startservice.setEnabled(false); //this.ShowToast("startservice_onclick"); //var intent = new Intent(this, NotifyService.Class); var intent = new Intent(this, typeof(NotifyService).ToClass()); this.startService(intent); // http://developer.android.com/reference/android/app/Activity.html#recreate%28%29 //this.recreate(); this.finish(); } ); ll.addView(startservice); #endregion #region stopservice var stopservice = new Button(this); stopservice.setText("Stop Service"); stopservice.AtClick( delegate { this.ShowToast("stopservice_onclick"); var intent = new Intent(); intent.setAction(NotifyService.ACTION); intent.putExtra("RQS", NotifyService.RQS_STOP_SERVICE); this.sendBroadcast(intent); // seems stop takes a while //Task.Delay(100); Thread.Sleep(30); this.recreate(); } ); ll.addView(stopservice); #endregion stopservice.setEnabled(false); // http://stackoverflow.com/questions/12891903/android-check-if-my-service-is-running-in-the-background var m = (ActivityManager)this.getSystemService(Context.ACTIVITY_SERVICE); Console.WriteLine("getRunningServices"); var s = m.getRunningServices(1000); Console.WriteLine("getRunningServices " + s.size()); var se = Enumerable.Range(0, s.size()).Select(i => (android.app.ActivityManager.RunningServiceInfo)s.get(i)); foreach (var ss in se) { var cn = ss.service.getClassName(); Console.WriteLine(new { cn }); // I/System.Console(17713): { cn = AndroidServiceUDPNotification.Activities.NotifyService } if (cn == typeof(NotifyService).FullName) { startservice.setEnabled(false); stopservice.setEnabled(true); // its running // http://stackoverflow.com/questions/7170730/how-to-set-a-control-panel-for-my-service-in-android // http://www.techques.com/question/1-7170730/How-to-set-a-control-panel-for-my-Service-in-Android // http://alvinalexander.com/java/jwarehouse/android/core/java/android/app/ActivityManagerNative.java.shtml #if XCONTROLPANEL PendingIntent cp = m.getRunningServiceControlPanel(ss.service); Console.WriteLine(new { cp }); if (cp != null) { #region cpb var cpb = new Button(this); cpb.setText("ServiceControlPanel"); cpb.AtClick( delegate { //new Intent( //PendingIntent.getActivity( //startActivity(cp); // http://iserveandroid.blogspot.com/2011/03/how-to-launch-pending-intent.html Intent intent = new Intent(); try { cp.send(this, 0, intent); } catch { throw; } } ); ll.addView(cpb); } #endregion #endif } } this.setContentView(sv); this.ShowToast("http://jsc-solutions.net"); }
private void CreateFunctionLibraryDesign(Context context) { int width = (int)(context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.Density); scrollView = new ScrollView(context); scrollView.SetPadding(10, 10, 10, 20); LinearLayout linearLayout = new LinearLayout(context); linearLayout.Orientation = Orientation.Vertical; linearLayout.Focusable = true; linearLayout.FocusableInTouchMode = true; linearLayout.SetPadding(10, 10, 10, 10); LinearLayout linearLayout1 = new LinearLayout(context); linearLayout1.Orientation = Orientation.Vertical; TextView titleText = new TextView(context) { Text = "Functions Library", TextAlignment = TextAlignment.Center, Gravity = GravityFlags.Center, TextSize = 30 }; titleText.SetTypeface(null, TypefaceStyle.Bold); titleText.SetWidth(width); TextView descText = new TextView(context) { Text = "This sample demonstrates the calculation using various Excel-like functions.", TextAlignment = TextAlignment.TextStart, Gravity = GravityFlags.FillHorizontal, TextSize = 12 }; descText.SetPadding(0, 10, 0, 0); descText.SetWidth(width); linearLayout1.AddView(titleText); linearLayout1.AddView(descText); LinearLayout linearLayout2 = new LinearLayout(context); linearLayout2.Orientation = Orientation.Horizontal; linearLayout2.SetPadding(0, 10, 0, 0); TextView functionsText = new TextView(context) { Text = "Select a function", Gravity = GravityFlags.Start, TextSize = 15 }; functionsText.SetWidth((int)(width * 0.4)); Spinner spinner = new Spinner(context, SpinnerMode.Dialog); var functions = GetLibraryFunctions(); var adapter = new ArrayAdapter <string>(context, Resource.Drawable.SpinnerExt, functions); spinner.Adapter = adapter; spinner.SetGravity(GravityFlags.Start); spinner.SetMinimumWidth(width - (int)(width * 0.4)); spinner.ItemSelected += Spinner_ItemSelected; linearLayout2.AddView(functionsText); linearLayout2.AddView(spinner); LinearLayout gridLinearLayout = new LinearLayout(context) { Orientation = Orientation.Vertical }; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); layoutParams.TopMargin = 25; gridLinearLayout.LayoutParameters = layoutParams; gridLinearLayout.SetBackgroundResource(Resource.Drawable.LinearLayout_Border); int padding = gridLinearLayout.PaddingLeft + gridLinearLayout.PaddingRight; int firstColWidth = (int)(width * 0.1) - padding; int cellWidth = ((width - firstColWidth) / 3) - padding; // First Row LinearLayout linearLayout3 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout3.SetPadding(0, 10, 0, 0); TextView text00 = new TextView(context); text00.SetWidth((int)(width * 0.1)); TextView text01 = new TextView(context) { Text = "A", Gravity = GravityFlags.Center, TextSize = 15 }; text01.SetWidth(cellWidth); TextView text02 = new TextView(context) { Text = "B", Gravity = GravityFlags.Center, TextSize = 15 }; text02.SetWidth(cellWidth); TextView text03 = new TextView(context) { Text = "C", Gravity = GravityFlags.Center, TextSize = 15 }; text03.SetWidth(cellWidth); linearLayout3.AddView(text00); linearLayout3.AddView(text01); linearLayout3.AddView(text02); linearLayout3.AddView(text03); // Second Row LinearLayout linearLayout4 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout4.SetPadding(0, 10, 0, 0); TextView text10 = new TextView(context) { Text = "1", Gravity = GravityFlags.Center, TextSize = 15 }; text10.SetWidth((int)(width * 0.1)); txtA1 = CreateEditText(context, "32"); txtA1.SetWidth(cellWidth); txtB1 = CreateEditText(context, "50"); txtB1.SetWidth(cellWidth); txtC1 = CreateEditText(context, "10"); txtC1.SetWidth(cellWidth); linearLayout4.AddView(text10); linearLayout4.AddView(txtA1); linearLayout4.AddView(txtB1); linearLayout4.AddView(txtC1); // Third Row LinearLayout linearLayout5 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout5.SetPadding(0, 10, 0, 0); TextView text20 = new TextView(context) { Text = "2", Gravity = GravityFlags.Center, TextSize = 15 }; text20.SetWidth((int)(width * 0.1)); txtA2 = CreateEditText(context, "12"); txtA2.SetWidth(cellWidth); txtB2 = CreateEditText(context, "24"); txtB2.SetWidth(cellWidth); txtC2 = CreateEditText(context, "90"); txtC2.SetWidth(cellWidth); linearLayout5.AddView(text20); linearLayout5.AddView(txtA2); linearLayout5.AddView(txtB2); linearLayout5.AddView(txtC2); // Fourth Row LinearLayout linearLayout6 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout6.SetPadding(0, 10, 0, 0); TextView text30 = new TextView(context) { Text = "3", Gravity = GravityFlags.Center, TextSize = 15 }; text30.SetWidth((int)(width * 0.1)); txtA3 = CreateEditText(context, "88"); txtA3.SetWidth(cellWidth); txtB3 = CreateEditText(context, "-22"); txtB3.SetWidth(cellWidth); txtC3 = CreateEditText(context, "37"); txtC3.SetWidth(cellWidth); linearLayout6.AddView(text30); linearLayout6.AddView(txtA3); linearLayout6.AddView(txtB3); linearLayout6.AddView(txtC3); // Fifth Row LinearLayout linearLayout7 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout7.SetPadding(0, 10, 0, 0); TextView text40 = new TextView(context) { Text = "4", Gravity = GravityFlags.Center, TextSize = 15 }; text40.SetWidth((int)(width * 0.1)); txtA4 = CreateEditText(context, "73"); txtA4.SetWidth(cellWidth); txtB4 = CreateEditText(context, "91"); txtB4.SetWidth(cellWidth); txtC4 = CreateEditText(context, "21"); txtC4.SetWidth(cellWidth); linearLayout7.AddView(text40); linearLayout7.AddView(txtA4); linearLayout7.AddView(txtB4); linearLayout7.AddView(txtC4); // Sixth Row LinearLayout linearLayout11 = new LinearLayout(context) { Orientation = Orientation.Horizontal }; linearLayout11.SetPadding(0, 10, 0, 0); TextView text50 = new TextView(context) { Text = "5", Gravity = GravityFlags.Center, TextSize = 15 }; text50.SetWidth((int)(width * 0.1)); txtA5 = CreateEditText(context, "63"); txtA5.SetWidth(cellWidth); txtB5 = CreateEditText(context, "29"); txtB5.SetWidth(cellWidth); txtC5 = CreateEditText(context, "44"); txtC5.SetWidth(cellWidth); linearLayout11.AddView(text50); linearLayout11.AddView(txtA5); linearLayout11.AddView(txtB5); linearLayout11.AddView(txtC5); LinearLayout linearLayout8 = new LinearLayout(context); linearLayout8.Orientation = Orientation.Horizontal; linearLayout8.SetPadding(0, 25, 0, 0); TextView formulaText = new TextView(context) { Text = "Formula", Gravity = GravityFlags.Start, TextSize = 15 }; formulaText.SetWidth((int)(width * 0.4)); formulaEdit = new EditText(context) { TextSize = 15 }; formulaEdit.SetWidth(width - (int)(width * 0.4)); formulaEdit.SetSingleLine(true); linearLayout8.AddView(formulaText); linearLayout8.AddView(formulaEdit); LinearLayout linearLayout9 = new LinearLayout(context); linearLayout9.SetPadding(0, 5, 0, 0); Button compute = new Button(context); compute.Text = "Compute"; compute.Click += Compute_Click; compute.SetWidth(width); linearLayout9.AddView(compute); LinearLayout linearLayout10 = new LinearLayout(context); linearLayout10.Orientation = Orientation.Horizontal; linearLayout10.SetPadding(0, 20, 0, 0); TextView computedText = new TextView(context) { Text = "Computed Value", Gravity = GravityFlags.Start, TextSize = 15 }; computedText.SetWidth((int)(width * 0.4)); computedValueEdit = new TextViewExt(context) { TextSize = 15 }; computedValueEdit.SetWidth(width - (int)(width * 0.4)); computedValueEdit.SetSingleLine(true); linearLayout10.AddView(computedText); linearLayout10.AddView(computedValueEdit); gridLinearLayout.AddView(linearLayout3); gridLinearLayout.AddView(linearLayout4); gridLinearLayout.AddView(linearLayout5); gridLinearLayout.AddView(linearLayout6); gridLinearLayout.AddView(linearLayout7); gridLinearLayout.AddView(linearLayout11); linearLayout.AddView(linearLayout1); linearLayout.AddView(linearLayout2); linearLayout.AddView(gridLinearLayout); linearLayout.AddView(linearLayout8); linearLayout.AddView(linearLayout9); linearLayout.AddView(linearLayout10); linearLayout.Touch += (object sender, View.TouchEventArgs e) => { if (e.Event.Action == MotionEventActions.Up) { ClearFocus(); } }; scrollView.AddView(linearLayout); }
public override View GetSampleContent(Context con) { float height = con.Resources.DisplayMetrics.HeightPixels;; LinearLayout layout = new LinearLayout(con); Typeface tf = Typeface.CreateFromAsset(con.Assets, "Segoe_MDL2_Assets.ttf"); layout.Orientation = Android.Widget.Orientation.Vertical; sfpicker = new SfPicker(con); sfpicker.ShowHeader = true; List <String> source = new List <string>(); source.Add("Yellow"); source.Add("Green"); source.Add("Orange"); source.Add("Lime"); source.Add("LightBlue"); source.Add("Pink"); source.Add("SkyBlue"); source.Add("White"); source.Add("Red"); source.Add("Aqua"); sfpicker.ItemsSource = source; sfpicker.LayoutParameters = new ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, (int)(height * 0.60)); sfpicker.PickerMode = PickerMode.Default; sfpicker.ShowFooter = false; sfpicker.ShowColumnHeader = false; sfpicker.UnSelectedItemTextColor = Color.Black; sfpicker.SelectedIndex = 7; float density = con.Resources.DisplayMetrics.Density; eventLog = new TextView(con); eventLog.LayoutParameters = new ViewGroup.LayoutParams(800, 400); layout.SetGravity(GravityFlags.CenterHorizontal); layout.AddView(sfpicker); string headerText1 = "PICK A COLOR"; sfpicker.ShowHeader = true; sfpicker.HeaderText = headerText1; sfpicker.BorderColor = Color.Red; TextView textview = new TextView(con); textview.Text = "Event Log"; textview.Typeface = tf; textview.SetTextColor(Color.Black); textview.TextSize = 20; if (density > 2) { textview.SetPadding(20, 0, 0, 20); } else { textview.SetPadding(10, 0, 0, 10); } layout.AddView(textview); var scrollviewer = new ScrollView(con); var textFrame = new LinearLayout(con); textFrame.Orientation = Android.Widget.Orientation.Vertical; scrollviewer.AddView(textFrame); scrollviewer.VerticalScrollBarEnabled = true; FrameLayout bottomFrame = new FrameLayout(con); bottomFrame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(height * 0.40)); bottomFrame.SetBackgroundColor(Color.Silver); bottomFrame.AddView(scrollviewer); bottomFrame.SetPadding(10, 0, 10, 0); layout.AddView(bottomFrame); sfpicker.ColumnHeaderText = "COLOR"; sfpicker.OnSelectionChanged += (sender, e) => { eventLog = new TextView(con); eventLog.SetTextColor(Color.Black); if (textFrame.ChildCount == 6) { textFrame.RemoveViewAt(0); } textFrame.AddView(eventLog); eventLog.Text = (e.NewValue).ToString() + " " + "has been Selected"; Color color = PickerHelper.GetColor(e.NewValue.ToString()); sfpicker.SetBackgroundColor(color); sfpicker.Alpha = 0.4f; scrollviewer.ScrollTo(0, textFrame.Bottom); }; return(layout); }
public override void Create() { Window window = Window.Instance; View01 = new View() { BackgroundColor = Color.Green, Position2D = new Position2D(0, window.Size.Height / 8), Size2D = new Size2D(window.Size.Width / 2, (window.Size.Height / 8) * 7), Name = "View01" }; window.Add(View01); View02 = new View() { Position2D = new Position2D(window.Size.Width / 2, window.Size.Height / 8), WidthSpecification = (window.Size.Width / 2), HeightSpecification = (window.Size.Height / 8) * 7, BackgroundColor = Color.Blue, Layout = new LinearLayout(), Name = "View02LinearView", }; window.Add(View02); View03 = new View() { BackgroundColor = Color.Yellow, Name = "View03", Size2D = new Size2D(20, (window.Size.Height / 8) * 7) }; View01.Add(View03); LinearLayout verticalLayout = new LinearLayout(); verticalLayout.LinearOrientation = LinearLayout.Orientation.Vertical; View04 = new View() { BackgroundColor = Color.Cyan, PositionX = View03.Size2D.Width, WidthSpecification = LayoutParamPolicies.WrapContent, HeightSpecification = LayoutParamPolicies.MatchParent, Layout = verticalLayout, Name = "View04LinearView", }; View01.Add(View04); View07 = new View() { BackgroundColor = Color.Blue, Size2D = new Size2D(200, 200), Name = "View07" }; View03.Add(View07); ImageView06 = LayoutingExample.CreateChildImageView("res/images/application-icon-101.png", new Size2D(100, 100)); ImageView06.Name = "imageView-06"; View04.Add(ImageView06); ImageView04 = LayoutingExample.CreateChildImageView("res/images/application-icon-101.png", new Size2D(200, 200)); ImageView04.Name = "imageView-04"; View07.Add(ImageView04); View08 = new View() { BackgroundColor = Color.Magenta, Size2D = new Size2D(280, 280), Name = "View08" }; View04.Add(View08); ImageView03 = LayoutingExample.CreateChildImageView("res/images/application-icon-101.png", new Size2D(100, 100)); ImageView03.Name = "imageView-03"; View08.Add(ImageView03); View05 = new View() { BackgroundColor = Color.Yellow, Name = "View05", Size2D = new Size2D(20, 100) }; View02.Add(View05); FlexContainer legacyContainer = new FlexContainer(); legacyContainer.FlexDirection = FlexContainer.FlexDirectionType.Column; legacyContainer.Size2D = new Size2D(View02.Size2D.Width / 2, 280); legacyContainer.Name = "legacyFlexContainer"; View02.Add(legacyContainer); ImageView02 = LayoutingExample.CreateChildImageView("res/images/application-icon-103.png", new Size2D(100, 100)); ImageView02.Name = "imageView-02"; legacyContainer.Add(ImageView02); ImageView01 = LayoutingExample.CreateChildImageView("res/images/application-icon-104.png", new Size2D(100, 100)); ImageView01.Name = "imageView-01"; legacyContainer.Add(ImageView01); ImageView05 = LayoutingExample.CreateChildImageView("res/images/application-icon-102.png", new Size2D(100, 100)); ImageView05.Name = "imageView-05"; View05.Add(ImageView05); CreateHelpButton(); LayoutingExample.GetToolbar().Add(helpButton); }
/// <summary> /// 重写OnElementChanged呈现的本机的页和写入逻辑,以自定义页面的方法 /// </summary> /// <param name="e"></param> protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { base.OnElementChanged(e); if (e.NewElement == null || e.OldElement != null) { return; } //e.NewElement就是承载的界面,这里就是PCL项目里面的MainPage var mainPage = e.NewElement as SiteMap; //初始化mapView mapView = new MapView(this.Context); mapView.OnCreate(null); //初始化视图 layout = new LinearLayout(this.Context); layout.AddView(mapView); this.AddView(layout); //这里可以比对以下我们的写法跟腾讯官网里Java写法的区别,可以看出Java里面的属性是set,get前缀,而在C#里面都被隐藏了,直接用C#惯用的属性写法来代替,而方法则还是同样的SetXXX(),GetXXX(),但是Java是camelCasing,C#用PascalCasing写法(博主非常喜欢C#写法,而很讨厌Java的写法 :-))。这些区别,都是Xamarin 里 绑定Java库的转换规则。 #region TencentMap类 //腾讯地图的设置是通过TencentMap类进行设置,可以控制地图的底图类型、显示范围、缩放级别、添加 / 删除marker和图形,此外对于地图的各种回调监听也是绑定到TencentMap。下面是TencentMap类的使用示例: //获取TencentMap实例 TencentMap tencentMap = mapView.Map; //设置实时路况开启 tencentMap.TrafficEnabled = true; //设置地图中心点 //108.941338,34.364438 tencentMap.SetCenter(new Com.Tencent.Mapsdk.Raster.Model.LatLng(34.364438, 108.941338)); //设置缩放级别 tencentMap.SetZoom(11); #endregion #region UiSettings类 //UiSettings类用于设置地图的视图状态,如Logo位置设置、比例尺位置设置、地图手势开关等。下面是UiSettings类的使用示例: //获取UiSettings实例 UiSettings uiSettings = mapView.UiSettings; //设置logo到屏幕底部中心 uiSettings.SetLogoPosition(UiSettings.LogoPositionCenterBottom); //设置比例尺到屏幕右下角 uiSettings.SetScaleViewPosition(UiSettings.ScaleviewPositionRightBottom); //启用缩放手势(更多的手势控制请参考开发手册) uiSettings.SetZoomGesturesEnabled(true); #endregion #region 使用marker //注意,这里要往resources/drawable/里添加一个red_location.png的图片 var bitmap = Resources.GetBitmap("red_location.png"); BitmapDescriptor des = new BitmapDescriptor(bitmap); foreach (var item in mainPage.Options) { MarkerOptions options = new MarkerOptions(); options.InvokeIcon(des); options.InvokeTitle(item.Title); options.Anchor(0.5f, 0.5f); options.InvokePosition(new LatLng(item.Lat, item.Lng)); options.Draggable(true); Marker marker = mapView.AddMarker(options); marker.ShowInfoWindow(); } //SetLocation // #endregion }
///////////////////////////////////////////////////////////////////////////////////////////////////////// ////// START DIALOG DEFINITION ////// ////////////////////////////////////////////////////////////////////////////////////////////////////////// private AlertDialog.Builder CreateDirectoryChooserDialog(String title, List <String> listItems, EventHandler <DialogClickEventArgs> onClickListener) { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(_mContext); //////////////////////////////////////////////// // Create title text showing file select type // //////////////////////////////////////////////// _mTitleView1 = new TextView(_mContext); _mTitleView1.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); //m_titleView1.setTextAppearance(m_context, android.R.style.TextAppearance_Large); //m_titleView1.setTextColor( m_context.getResources().getColor(android.R.color.black) ); if (_selectType == _fileOpen) { _mTitleView1.Text = "Open"; } if (_selectType == _fileSave) { _mTitleView1.Text = "Save As"; } if (_selectType == _folderChoose) { _mTitleView1.Text = "Select folder"; } //need to make this a variable Save as, Open, Select Directory _mTitleView1.Gravity = GravityFlags.CenterVertical; //_mTitleView1.SetBackgroundColor(Color.DarkGray); // dark gray -12303292 _mTitleView1.SetTextColor(Color.Black); _mTitleView1.SetPadding((int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), 0, (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 15)); _mTitleView1.SetTextSize(ComplexUnitType.Dip, 18); _mTitleView1.SetTypeface(null, TypefaceStyle.Bold); // Create custom view for AlertDialog title LinearLayout titleLayout1 = new LinearLayout(_mContext); titleLayout1.Orientation = Orientation.Vertical; titleLayout1.AddView(_mTitleView1); if (_selectType == _fileSave) { /////////////////////////////// // Create New Folder Button // /////////////////////////////// Button newDirButton = new Button(_mContext); newDirButton.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); newDirButton.Text = "New Folder"; newDirButton.Click += (sender, args) => { EditText input = new EditText(_mContext); new AlertDialog.Builder(_mContext).SetTitle("New Folder Name").SetView(input).SetPositiveButton("OK", (o, eventArgs) => { String newDirName = input.Text; // Create new directory if (CreateSubDir(_mDir + "/" + newDirName)) { // Navigate into the new directory _mDir += "/" + newDirName; UpdateDirectory(); } else { Toast.MakeText(_mContext, "Failed to create '" + newDirName + "' folder", ToastLength.Short).Show(); } }).SetNegativeButton("Cancel", (o, eventArgs) => { }).Show(); }; titleLayout1.AddView(newDirButton); } ///////////////////////////////////////////////////// // Create View with folder path and entry text box // ///////////////////////////////////////////////////// LinearLayout titleLayout = new LinearLayout(_mContext); titleLayout.Orientation = Orientation.Vertical; var currentSelection = new TextView(_mContext); currentSelection.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); currentSelection.SetTextColor(Color.Black); currentSelection.Gravity = GravityFlags.CenterVertical; currentSelection.Text = "Current selection:"; currentSelection.SetPadding((int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 5), 0, (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 3)); currentSelection.SetTextSize(ComplexUnitType.Dip, 12); currentSelection.SetTypeface(null, TypefaceStyle.Bold); titleLayout.AddView(currentSelection); _mTitleView = new TextView(_mContext); _mTitleView.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); _mTitleView.SetTextColor(Color.Black); _mTitleView.Gravity = GravityFlags.CenterVertical; _mTitleView.Text = title; _mTitleView.SetPadding((int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), 0, (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 10), (int)SystemHelper.ConvertDpToPixel(_mContext.Resources, 5)); _mTitleView.SetTextSize(ComplexUnitType.Dip, 10); _mTitleView.SetTypeface(null, TypefaceStyle.Normal); titleLayout.AddView(_mTitleView); if (_selectType == _fileOpen || _selectType == _fileSave) { _inputText = new EditText(_mContext); _inputText.Text = DefaultFileName; titleLayout.AddView(_inputText); } ////////////////////////////////////////// // Set Views and Finish Dialog builder // ////////////////////////////////////////// dialogBuilder.SetView(titleLayout); dialogBuilder.SetCustomTitle(titleLayout1); _mListAdapter = CreateListAdapter(listItems); dialogBuilder.SetSingleChoiceItems(_mListAdapter, -1, onClickListener); dialogBuilder.SetCancelable(true); return(dialogBuilder); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.IncidentDetail); CurrentIncident = App.SelectedIncidet; backBtn = (ImageView)FindViewById(Resource.Id.detail_back); tabWrap1 = (LinearLayout)FindViewById(Resource.Id.detail_tab1); tabWrap2 = (LinearLayout)FindViewById(Resource.Id.detail_tab2); tabWrap3 = (LinearLayout)FindViewById(Resource.Id.detail_tab3); camera = (ImageView)FindViewById(Resource.Id.detail_camera); inspectionImages = (LinearLayout)FindViewById(Resource.Id.detail_inspectionImages); repairImages = (LinearLayout)FindViewById(Resource.Id.detail_repairImages); largeLayout = (RelativeLayout)FindViewById(Resource.Id.detail_largeLayout); largeImage = (ImageView)FindViewById(Resource.Id.detail_largeImage); closeImage = (ImageView)FindViewById(Resource.Id.detail_largeClose); propertyLogo = (ImageView)FindViewById(Resource.Id.detail_propertyPhoto); doneBtn = (Button)FindViewById(Resource.Id.detail_commentDone); repairComment = (TextView)FindViewById(Resource.Id.detail_incidentRepairComments); repairCommentEdit = (EditText)FindViewById(Resource.Id.detail_incidentRepairCommentsEdit); finalizeBtn = (Button)FindViewById(Resource.Id.detail_finalizeBtn); backBtn.Click += delegate { Finish(); }; ((Button)FindViewById(Resource.Id.detail_tabBtn1)).Click += delegate { SelectTab(1); }; ((Button)FindViewById(Resource.Id.detail_tabBtn2)).Click += delegate { SelectTab(2); }; ((Button)FindViewById(Resource.Id.detail_tabBtn3)).Click += delegate { SelectTab(3); }; closeImage.Click += delegate { largeLayout.Visibility = ViewStates.Gone; }; camera.Click += delegate { if (this.CanEdit) { OpenCamera(); } }; largeLayout.Click += delegate { }; doneBtn.Click += delegate { UpdateRepairComments(); }; SelectTab(1); BindData(); LoadPropertyPhoto(); LoadRepariPhotos(); LoadRoomInspectionPhotos(); }
public override View GetPropertyWindowLayout(Context context) { LinearLayout gridLinearLayout = new LinearLayout(context) { Orientation = Android.Widget.Orientation.Vertical }; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layoutParams.TopMargin = (int)(25 * currentDensity); gridLinearLayout.LayoutParameters = layoutParams; gridLinearLayout.SetBackgroundResource(Resource.Drawable.LinearLayout_Border); int width = (int)(context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.Density) / 3; LinearLayout linearLayout4 = new LinearLayout(context); linearLayout4.Orientation = Android.Widget.Orientation.Vertical; linearLayout4.SetMinimumHeight((int)(70 * currentDensity)); linearLayout4.SetMinimumWidth(width); TextView selectText = new TextView(context) { Text = "Grid Color", Gravity = GravityFlags.Start, TextSize = 5 * currentDensity }; selectText.SetMinimumHeight((int)(20 * currentDensity)); selectText.SetWidth((int)(width * 0.4 * currentDensity)); HorizontalScrollView horizontalScroll = new HorizontalScrollView(context); horizontalScroll.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); horizontalScroll.FillViewport = true; horizontalScroll.HorizontalScrollBarEnabled = true; horizontalScroll.SetMinimumHeight((int)(60 * currentDensity)); horizontalScroll.Layout(0, (int)(20 * currentDensity), (int)(80 * currentDensity * 14), (int)(60 * currentDensity)); scrollLayout = new LinearLayout(context); scrollLayout.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); horizontalScroll.AddView(scrollLayout); AddColors(); linearLayout4.AddView(selectText); linearLayout4.AddView(horizontalScroll); LinearLayout linearLayout1 = new LinearLayout(context); linearLayout1.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); linearLayout1.SetMinimumHeight((int)(30 * currentDensity)); TextView showGrid = new TextView(context) { Text = "Show Grid", Gravity = GravityFlags.Start, TextSize = 5 * currentDensity }; showGrid.SetMinimumHeight((int)(20 * currentDensity)); showGrid.SetWidth((int)(width * 0.4 * currentDensity)); Switch showGridSwitch = new Switch(context); showGridSwitch.CheckedChange += ShowGridSwitch_CheckedChange; showGridSwitch.Gravity = GravityFlags.Right; showGridSwitch.SetMinimumHeight((int)(20 * currentDensity)); showGridSwitch.SetWidth((int)(width * 0.4 * currentDensity)); linearLayout1.AddView(showGrid); linearLayout1.AddView(showGridSwitch); LinearLayout linearLayout2 = new LinearLayout(context); linearLayout2.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); linearLayout2.SetMinimumHeight((int)(30 * currentDensity)); TextView snapToGrid = new TextView(context) { Text = "Snap To Grid", Gravity = GravityFlags.Start, TextSize = 5 * currentDensity }; snapToGrid.SetMinimumHeight((int)(20 * currentDensity)); snapToGrid.SetWidth((int)(width * 0.4 * currentDensity)); snapToGridSwitch = new Switch(context); snapToGridSwitch.Enabled = false; snapToGridSwitch.CheckedChange += SnapToGridSwitch_CheckedChange; snapToGridSwitch.Gravity = GravityFlags.Right; snapToGridSwitch.SetMinimumHeight((int)(20 * currentDensity)); snapToGridSwitch.SetWidth((int)(width * 0.4 * currentDensity)); linearLayout2.AddView(snapToGrid); linearLayout2.AddView(snapToGridSwitch); LinearLayout linearLayout3 = new LinearLayout(context); linearLayout3.SetPadding(0, (int)(10 * currentDensity), 0, (int)(10 * currentDensity)); linearLayout3.SetMinimumHeight((int)(60 * currentDensity)); TextView connectorSize = new TextView(context) { Text = "Size", Gravity = GravityFlags.CenterVertical, TextSize = 5 * currentDensity }; connectorSize.SetMinimumHeight((int)(20 * currentDensity)); connectorSize.SetWidth((int)(width * 0.4 * currentDensity)); LinearLayout plusMinus = new LinearLayout(context); plusMinus.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent); plusMinus.SetMinimumHeight((int)(40 * currentDensity)); plusMinus.SetMinimumWidth((int)((width - (int)(width * 0.4)) * currentDensity)); ImageButton minusButton = new ImageButton(context); minusButton.SetMinimumHeight((int)(20 * currentDensity)); minusButton.Click += MinusButton_Click; string imageId = "diagramsub.png"; if (imageId != null) { var imageData = LoadResource(imageId).ToArray(); minusButton.SetImageBitmap(BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length)); } plusMinus.AddView(minusButton); label = new TextView(context); label.Text = "12"; label.TextAlignment = TextAlignment.Center; label.Gravity = GravityFlags.Center; label.SetMinimumHeight((int)(60 * currentDensity)); label.SetWidth((int)(50 * currentDensity)); plusMinus.AddView(label); ImageButton plusButton = new ImageButton(context); imageId = "diagramplus.png"; plusButton.Click += PlusButton_Click; plusButton.TextAlignment = TextAlignment.ViewEnd; if (imageId != null) { var imageData = LoadResource(imageId).ToArray(); plusButton.SetImageBitmap(BitmapFactory.DecodeByteArray(imageData, 0, imageData.Length)); } plusMinus.AddView(plusButton); linearLayout3.AddView(connectorSize); linearLayout3.AddView(plusMinus); gridLinearLayout.AddView(linearLayout4); gridLinearLayout.AddView(linearLayout1); gridLinearLayout.AddView(linearLayout2); gridLinearLayout.AddView(linearLayout3); return(gridLinearLayout); }
private void PopUpDelayLayout() { /*************** **Popup Delay** ***************/ TextView popUpDelayLabel = new TextView(context); popUpDelayLabel.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center); popUpDelayLabel.Text = "PopUp Delay"; popUpDelayLabel.TextSize = 15; //popUpDelayText popUpDelayText = new EditText(context); popUpDelayText.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent, GravityFlags.Center); popUpDelayText.Text = popUpDelayPosition.ToString(); popUpDelayText.TextSize = 16; popUpDelayText.InputType = Android.Text.InputTypes.ClassPhone; minPrefixCharacterText.SetWidth(50); maxDropDownHeightText.SetWidth(50); popUpDelayText.SetWidth(50); //popUpDelayText TextChanged Listener popUpDelayText.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => { try { if (popUpDelayText.Text.Length > 0) { popupdelay = Convert.ToInt32(e.Text.ToString()); } else { popupdelay = 100; } } catch (Exception e1) { } popUpDelayPosition = popupdelay; ApplyChanges(); }; LinearLayout popUpDelayLayout = new LinearLayout(context); popUpDelayLayout.Orientation = Android.Widget.Orientation.Horizontal; popUpDelayLayout.AddView(popUpDelayLabel); popUpDelayLayout.AddView(popUpDelayText); proprtyOptionsLayout.AddView(popUpDelayLayout); TextView spaceLabel = new TextView(context); spaceLabel.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.167), ViewGroup.LayoutParams.WrapContent); LinearLayout layout1 = new LinearLayout(context); layout1.Orientation = Android.Widget.Orientation.Horizontal; layout1.AddView(spaceLabel); layout1.AddView(proprtyOptionsLayout); propertylayout.AddView(topProperty); propertylayout.AddView(layout1); propertylayout.SetBackgroundColor(Color.Rgb(240, 240, 240)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Window.RequestFeature(WindowFeatures.ActionBar); SetContentView(Resource.Layout.SummaryFragmentLayout); number = FindViewById <TextView> (Resource.Id.selectedAssignmentNumber); name = FindViewById <TextView> (Resource.Id.selectedAssignmentContactName); phone = FindViewById <TextView> (Resource.Id.selectedAssignmentPhoneNumber); address = FindViewById <TextView> (Resource.Id.selectedAssignmentAddress); items = FindViewById <TextView> (Resource.Id.selectedAssignmentTotalItems); addItems = FindViewById <Button> (Resource.Id.selectedAssignmentAddItem); addLabor = FindViewById <Button> (Resource.Id.selectedAssignmentAddLabor); addExpense = FindViewById <Button> (Resource.Id.selectedAssignmentAddExpense); navigationFragmentContainer = FindViewById <FrameLayout> (Resource.Id.navigationFragmentContainer); mapButton = FindViewById <LinearLayout> (Resource.Id.summaryMapIconLayout); phoneButton = FindViewById <LinearLayout> (Resource.Id.summaryPhoneIconLayout); phoneButton.Click += (sender, e) => { AndroidExtensions.MakePhoneCall(this, phone.Text); }; mapButton.Click += (sender, e) => { var navFragment = FragmentManager.FindFragmentById <NavigationFragment> (Resource.Id.navigationFragmentContainer); var index = Constants.Navigation.IndexOf("Map"); navFragment.SetNavigation(index); }; if (assignment != null) { ActionBar.Title = string.Format("#{0} {1} {2}", assignment.JobNumber, "Summary", assignment.StartDate.ToShortDateString()); number.Text = assignment.Priority.ToString(); name.Text = assignment.ContactName; phone.Text = assignment.ContactPhone; address.Text = string.Format("{0}\n{1}, {2} {3}", assignment.Address, assignment.City, assignment.State, assignment.Zip); } //portrait mode, flip back and forth when selecting the navigation menu. if (Resources.Configuration.Orientation == Orientation.Landscape) { navigationFragmentContainer.Visibility = ViewStates.Visible; } else { navigationFragmentContainer.Visibility = ViewStates.Invisible; } //setting up default fragments var transaction = FragmentManager.BeginTransaction(); navigationFragment = new NavigationFragment(); navigationFragment.Assignment = assignment; transaction.SetTransition(FragmentTransit.FragmentOpen); transaction.Replace(Resource.Id.navigationFragmentContainer, navigationFragment); transaction.Commit(); items.Visibility = addItems.Visibility = ViewStates.Invisible; addLabor.Visibility = ViewStates.Gone; addItems.Click += (sender, e) => { itemDialog = new ItemsDialog(this); itemDialog.Assignment = assignment; itemDialog.Show(); }; addLabor.Click += (sender, e) => { laborDialog = new AddLaborDialog(this); laborDialog.Assignment = assignment; laborDialog.CurrentLabor = new Labor(); laborDialog.Show(); }; addExpense.Click += (sender, e) => { //show add expense dialog; expenseDialog = new ExpenseDialog(this); expenseDialog.Assignment = assignment; expenseDialog.CurrentExpense = new Expense(); expenseDialog.Show(); }; ActionBar.SetLogo(Resource.Drawable.XamarinTitle); ActionBar.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.actionbar)); ActionBar.SetDisplayHomeAsUpEnabled(true); }
public override View GetPropertyWindowLayout(Android.Content.Context context) { LinearLayout gridLinearLayout = new LinearLayout(context) { Orientation = Android.Widget.Orientation.Vertical }; LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent); layoutParams.TopMargin = 25; gridLinearLayout.LayoutParameters = layoutParams; gridLinearLayout.SetBackgroundResource(Resource.Drawable.LinearLayout_Border); int width = (int)(context.Resources.DisplayMetrics.WidthPixels - context.Resources.DisplayMetrics.Density); LinearLayout linearLayout1 = new LinearLayout(context); linearLayout1.Orientation = Android.Widget.Orientation.Vertical; TextView titleText = new TextView(context) { Text = "Orientation and ChartType", TextAlignment = TextAlignment.Center, Gravity = GravityFlags.Center, TextSize = 30 }; titleText.SetTypeface(null, TypefaceStyle.Bold); titleText.SetWidth(width); TextView descText = new TextView(context) { Text = "Please select the orientation and chart type.", TextAlignment = TextAlignment.TextStart, Gravity = GravityFlags.FillHorizontal, TextSize = 12 }; descText.SetPadding(0, 10, 0, 0); descText.SetWidth(width); linearLayout1.AddView(titleText); linearLayout1.AddView(descText); LinearLayout linearLayout2 = new LinearLayout(context); linearLayout2.SetPadding(0, 5, 0, 0); horizontal = new Button(context); horizontal.Text = "Horizontal"; horizontal.Click += ComputeHorizontal_Click; horizontal.SetWidth(width); linearLayout2.AddView(horizontal); LinearLayout linearLayout3 = new LinearLayout(context); linearLayout3.SetPadding(0, 5, 0, 0); vertical = new Button(context); vertical.Text = "Vertical"; vertical.Click += ComputeVertical_Click; vertical.SetWidth(width); linearLayout3.AddView(vertical); LinearLayout linearLayout4 = new LinearLayout(context); linearLayout4.Orientation = Android.Widget.Orientation.Horizontal; linearLayout4.SetPadding(0, 10, 0, 0); TextView selectText = new TextView(context) { Text = "Select a chart type", Gravity = GravityFlags.Start, TextSize = 15 }; selectText.SetWidth((int)(width * 0.4)); Spinner spinner = new Spinner(context, SpinnerMode.Dialog); spinner.SetMinimumHeight(60); spinner.SetBackgroundColor(Color.Gray); spinner.DropDownWidth = 600; List <String> list = new List <String>(); list.Add("Alternate"); list.Add("Right"); list.Add("Left"); ArrayAdapter <String> dataAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, list); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); spinner.Adapter = dataAdapter; spinner.ItemSelected += sType_spinner_ItemSelected; spinner.SetGravity(GravityFlags.Start); spinner.SetMinimumWidth(width - (int)(width * 0.4)); linearLayout4.AddView(selectText); linearLayout4.AddView(spinner); gridLinearLayout.AddView(linearLayout1); gridLinearLayout.AddView(linearLayout2); gridLinearLayout.AddView(linearLayout3); gridLinearLayout.AddView(linearLayout4); return(gridLinearLayout); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); //Status bar if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds); } SupportToolbar toolBar = FindViewById <SupportToolbar>(Resource.Id.my_toolbar); SetSupportActionBar(toolBar); SupportActionBar ab = SupportActionBar; ab.SetHomeAsUpIndicator(Resource.Drawable.ic_menu1); ab.SetDisplayHomeAsUpEnabled(true); CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout)FindViewById(Resource.Id.collapsing_toolbar); collapsingToolbar.Title = "Pronounce"; //History var listView = FindViewById <ListView>(Resource.Id.listView1); editText = FindViewById <EditText>(Resource.Id.editText1); items = new List <string>(new[] { "History" }); adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, items); listView.Adapter = adapter; FindViewById <Button>(Resource.Id.MyButton).Click += HandleClick; listView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args) { editText.Text = ((TextView)args.View).Text; }; //Drawer mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); if (navigationView != null) { SetUpDrawerContent(navigationView); } // Volume bar setup mgr = (AudioManager)GetSystemService(Context.AudioService); //// _seekBarAlarm = FindViewById <SeekBar>(Resource.Id.seekBar1); // modify the ring initBar(_seekBarAlarm, Android.Media.Stream.Music); /// <summary> /// initBar /// </summary> /// <param name="bar"></param> /// <param name="stream"></param> /// //tts tts = new TextToSpeech(this.ApplicationContext, this); tts.SetLanguage(Java.Util.Locale.Default); Button dbutton = FindViewById <Button>(Resource.Id.MyButton); Button clear_button = FindViewById <Button>(Resource.Id.button1); editText = FindViewById <EditText>(Resource.Id.editText1); //Pitch and Speed var txtSpeedVal = FindViewById <TextView>(Resource.Id.textSpeed); var txtPitchVal = FindViewById <TextView>(Resource.Id.textPitch); var seekSpeed = FindViewById <SeekBar>(Resource.Id.seekSpeed); var seekPitch = FindViewById <SeekBar>(Resource.Id.seekPitch); // set up the initial pitch and speed values then the onscreen values // the pitch and rate both go from 0f to 1f, however if you have a seek bar with a max of 1, you get a single step // therefore, a simpler option is to have the slider go from 0 to 255 and divide the position of the slider by 255 to get // the float seekSpeed.Progress = seekPitch.Progress = 255; txtSpeedVal.Text = "1"; txtPitchVal.Text = "1"; // set the speed and pitch tts.SetPitch(1.0f); tts.SetSpeechRate(1.0f); // sliders seekPitch.StopTrackingTouch += (object sender, SeekBar.StopTrackingTouchEventArgs e) => { var seek = sender as SeekBar; var progress = seek.Progress / 255f; tts.SetPitch(progress); txtPitchVal.Text = progress.ToString("F2"); }; seekSpeed.StopTrackingTouch += (object sender, SeekBar.StopTrackingTouchEventArgs e) => { var seek = sender as SeekBar; var progress = seek.Progress / 255f; tts.SetSpeechRate(progress); txtSpeedVal.Text = progress.ToString("F2"); }; //Bottom sheet LinearLayout sheet = FindViewById <LinearLayout>(Resource.Id.bottom_sheet); BottomSheetBehavior bottomSheetBehavior = BottomSheetBehavior.From(sheet); var metrics = Resources.DisplayMetrics; var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); if (heightInDp <= 731) { // it's a phone bottomSheetBehavior.PeekHeight = 120; } else { // it's a tablet bottomSheetBehavior.PeekHeight = 360; } bottomSheetBehavior.Hideable = false; bottomSheetBehavior.SetBottomSheetCallback(new MyBottomSheetCallBack()); //Speak button dbutton.Click += Button_Click; //Clear button clear_button.Click += delegate { if (!string.IsNullOrEmpty(editText.Text)) { editText.Text = ""; } }; //Clear history button Button clear_history = FindViewById <Button>(Resource.Id.button3); clear_history.Click += delegate { adapter.Clear(); adapter.NotifyDataSetChanged(); }; //setup navigation view _navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { try { base.OnCreateView(inflater, container, savedInstanceState); var view = inflater.Inflate(Resource.Layout.CSIMiscIssueReceiptAndQtyAdjust, container, false); Cancelable = false; WhseEdit = view.FindViewById <EditText>(Resource.Id.WhseEdit); TransDateText = view.FindViewById <TextView>(Resource.Id.TransDateText); ItemScanButton = view.FindViewById <ImageButton>(Resource.Id.ItemScanButton); ItemEdit = view.FindViewById <EditText>(Resource.Id.ItemEdit); UMScanButton = view.FindViewById <ImageButton>(Resource.Id.UMScanButton); UMEdit = view.FindViewById <EditText>(Resource.Id.UMEdit); QtyScanButton = view.FindViewById <ImageButton>(Resource.Id.QtyScanButton); QtyEdit = view.FindViewById <EditText>(Resource.Id.QtyEdit); LocScanButton = view.FindViewById <ImageButton>(Resource.Id.LocScanButton); LocEdit = view.FindViewById <EditText>(Resource.Id.LocEdit); LotScanButton = view.FindViewById <ImageButton>(Resource.Id.LotScanButton); LotEdit = view.FindViewById <EditText>(Resource.Id.LotEdit); ReasonScanButton = view.FindViewById <ImageButton>(Resource.Id.ReasonScanButton); ReasonEdit = view.FindViewById <EditText>(Resource.Id.ReasonEdit); QtyLinearLayout = view.FindViewById <LinearLayout>(Resource.Id.QtyLinearLayout); LotLinearLayout = view.FindViewById <LinearLayout>(Resource.Id.LotLinearLayout); SNButton = view.FindViewById <Button>(Resource.Id.SNButton); ProcessButton = view.FindViewById <Button>(Resource.Id.ProcessButton); Layout = view.FindViewById <LinearLayout>(Resource.Id.LinearLayout); ItemDescText = view.FindViewById <TextView>(Resource.Id.ItemDescText); ItemUMText = view.FindViewById <TextView>(Resource.Id.ItemUMText); OnHandQuantityText = view.FindViewById <TextView>(Resource.Id.OnHandQuantityText); LocDescText = view.FindViewById <TextView>(Resource.Id.LocDescText); ReasonDescText = view.FindViewById <TextView>(Resource.Id.ReasonDescText); CloseImage = view.FindViewById <ImageView>(Resource.Id.CloseImage); ProgressBar = view.FindViewById <ProgressBar>(Resource.Id.ProgressBar); ItemScanButton.Click += ItemScanButton_Click; UMScanButton.Click += UMScanButton_Click; QtyScanButton.Click += QtyScanButton_Click; LocScanButton.Click += LocScanButton_Click; LotScanButton.Click += LotScanButton_Click; ReasonScanButton.Click += ReasonScanButton_Click; ItemEdit.FocusChange += ItemEdit_FocusChange; UMEdit.FocusChange += UMEdit_FocusChange; QtyEdit.FocusChange += QtyEdit_FocusChange; LocEdit.FocusChange += LocEdit_FocusChange; LotEdit.FocusChange += LotEdit_FocusChange; ReasonEdit.FocusChange += ReasonEdit_FocusChange; ItemEdit.KeyPress += ItemEdit_KeyPress; UMEdit.KeyPress += UMEdit_KeyPress; QtyEdit.KeyPress += QtyEdit_KeyPress; LocEdit.KeyPress += LocEdit_KeyPress; LotEdit.KeyPress += LotEdit_KeyPress; ReasonEdit.KeyPress += ReasonEdit_KeyPress; ItemEdit.RequestFocus(); SNButton.Click += SNButton_Click; ProcessButton.Click += ProcessButton_Click; CloseImage.Click += (sender, args) => { Dismiss(); Dispose(); }; ShowProgressBar(false); Initialize(); EnableDisableComponents(); return(view); }catch (Exception Ex) { WriteErrorLog(Ex); Dismiss(); Dispose(); return(null); } }
private void AddCharacterList(LayoutInflater inflater, ViewGroup container, View v, int id, bool monsters) { LinearLayout cl = (LinearLayout)inflater.Inflate(Resource.Layout.CharacterList, container, false); cl.LayoutParameters = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent, 1f); ListView lv = cl.FindViewById <ListView>(Resource.Id.characterList); lv.Adapter = (new CharacterListAdapter(_CombatState, monsters)); lv.ItemSelected += (sender, e) => { Character c = ((BaseAdapter <Character>)lv.Adapter)[e.Position]; ShowCharacter(v, c); }; lv.ItemClick += (sender, e) => { Character c = ((BaseAdapter <Character>)lv.Adapter)[e.Position]; ShowCharacter(v, c); }; if (!monsters) { _PlayerList = lv; } else { _MonsterList = lv; } lv.SetOnDragListener(new ListOnDragListener(monsters, v)); cl.FindViewById <ImageButton>(Resource.Id.blankButton).Click += (object sender, EventArgs e) => { _CombatState.AddBlank(monsters); }; cl.FindViewById <ImageButton>(Resource.Id.monsterButton).Click += (object sender, EventArgs e) => { MonsterPickerDialog dl = new MonsterPickerDialog(v.Context, monsters, _CombatState); dl.Show(); }; cl.FindViewById <ImageButton>(Resource.Id.loadButton).Click += (object sender, EventArgs e) => { FileDialog fd = new FileDialog(cl.Context, _Extensions, true); fd.Show(); fd.DialogComplete += (object s, FileDialog.FileDialogEventArgs ea) => { string name = ea.Filename; string fullname = Path.Combine(fd.Folder, name); FileInfo file = new FileInfo(fullname); if (String.Compare(".por", file.Extension, true) == 0 || String.Compare(".rpgrp", file.Extension, true) == 0) { List <Monster> importmonsters = Monster.FromFile(fullname); if (importmonsters != null) { foreach (Monster m in importmonsters) { Character ch = new Character(m, false); ch.IsMonster = monsters; _CombatState.AddCharacter(ch); } } } else { List <Character> l = XmlListLoader <Character> .Load(fullname); foreach (var c in l) { c.IsMonster = monsters; _CombatState.AddCharacter(c); } } }; }; cl.FindViewById <ImageButton>(Resource.Id.saveButton).Click += (object sender, EventArgs e) => { FileDialog fd = new FileDialog(v.Context, _Extensions, false); fd.DialogComplete += (object s, FileDialog.FileDialogEventArgs ea) => { string name = ea.Filename; if (!name.EndsWith(".cmpt", StringComparison.CurrentCultureIgnoreCase)) { name = name + ".cmpt"; } string fullname = Path.Combine(fd.Folder, name); XmlListLoader <Character> .Save(new List <Character>(_CombatState.Characters.Where((a) => a.IsMonster == monsters)), fullname); }; fd.Show(); }; cl.FindViewById <Button>(Resource.Id.clearButton).Click += (object sender, EventArgs e) => { AlertDialog.Builder bui = new AlertDialog.Builder(v.Context); bui.SetMessage("Clear " + (monsters?"Monsters":"Players") + " List?"); bui.SetPositiveButton("OK", (a, x) => { List <Character> removeList = new List <Character>(from c in _CombatState.Characters where c.IsMonster == monsters select c); foreach (Character c in removeList) { _CombatState.RemoveCharacter(c); } }); bui.SetNegativeButton("Cancel", (a, x) => {}); bui.Show(); }; if (monsters) { _XPText = cl.FindViewById <TextView>(Resource.Id.xpText); ReloadXPText(); } v.FindViewById <LinearLayout>(id).AddView(cl); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.AssignmentsLayout); assignmentsListView = FindViewById <ListView> (Resource.Id.assignmentsListView); assignmentActiveLayout = FindViewById <LinearLayout> (Resource.Id.assignmentSelectedItem); assignmentActiveLayout.Click += (sender, e) => AssignmentSelected(-1); assignmentsListView.ItemClick += (sender, e) => AssignmentSelected(e.Position); //View containing the active assignment var view = new View(this); LayoutInflater inflator = (LayoutInflater)GetSystemService(Context.LayoutInflaterService); view = inflator.Inflate(Resource.Layout.AssignmentItemLayout, null); assignmentActiveLayout.AddView(view); view.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent); view.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.active_assignment_selector)); number = view.FindViewById <TextView> (Resource.Id.assignmentItemNumber); job = view.FindViewById <TextView> (Resource.Id.assignmentJob); name = view.FindViewById <TextView> (Resource.Id.assignmentName); phone = view.FindViewById <TextView> (Resource.Id.assignmentPhone); address = view.FindViewById <TextView> (Resource.Id.assignmentAddress); buttonLayout = view.FindViewById <LinearLayout> (Resource.Id.assignmentButtonLayout); timerLayout = view.FindViewById <LinearLayout> (Resource.Id.assignmentTimerLayout); activeSpinner = view.FindViewById <Spinner> (Resource.Id.assignmentStatus); spinnerImage = view.FindViewById <ImageView> (Resource.Id.assignmentStatusImage); timer = view.FindViewById <ToggleButton> (Resource.Id.assignmentTimer); timerText = view.FindViewById <TextView> (Resource.Id.assignmentTimerText); phoneButton = view.FindViewById <RelativeLayout> (Resource.Id.assignmentPhoneLayout); mapButton = view.FindViewById <RelativeLayout> (Resource.Id.assignmentAddressLayout); assignmentViewModel.LoadTimerEntryAsync().ContinueWith(_ => { RunOnUiThread(() => { if (assignmentViewModel.Recording) { timer.Checked = true; } else { timer.Checked = false; } }); }); timer.CheckedChange += (sender, e) => { if (e.IsChecked != assignmentViewModel.Recording) { if (assignmentViewModel.Recording) { assignmentViewModel.PauseAsync(); } else { assignmentViewModel.RecordAsync(); } } }; activeSpinner.ItemSelected += (sender, e) => { if (assignment != null) { var selected = assignmentViewModel.AvailableStatuses.ElementAtOrDefault(e.Position); if (selected != assignment.Status) { switch (selected) { case AssignmentStatus.Hold: assignment.Status = selected; assignmentViewModel.SaveAssignmentAsync(assignment).ContinueWith(_ => RunOnUiThread(ReloadAssignments)); break; case AssignmentStatus.Complete: //go to confirmations, this is getting called multiple times. var intent = new Intent(this, typeof(SummaryActivity)); menuViewModel.MenuIndex = Constants.Navigation.IndexOf(Constants.Confirmations); StartActivity(intent); break; default: break; } } } }; mapButton.Click += (sender, e) => { var activity = (AssignmentTabActivity)Parent; var intent = new Intent(activity, typeof(SummaryActivity)); menuViewModel.MenuIndex = Constants.Navigation.IndexOf("Map"); assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment; activity.StartActivity(intent); }; phoneButton.Click += (sender, e) => { Extensions.MakePhoneCall(this, phone.Text); }; }
public override View GetSampleContent(Context context) { chart = new SfChart(context); chart.Title.Text = "Average Sales Comparison"; chart.Title.TextSize = 15; chart.Legend.Visibility = Visibility.Visible; chart.Legend.IconHeight = 14; chart.Legend.IconWidth = 14; chart.Legend.DockPosition = ChartDock.Bottom; chart.Legend.ToggleSeriesVisibility = true; chart.ColorModel.ColorPalette = ChartColorPalette.Natural; chart.PrimaryAxis = new CategoryAxis(); secondaryAxis = new NumericalAxis(); secondaryAxis.LabelStyle.LabelFormat = "#'M'"; chart.SecondaryAxis = secondaryAxis; RadarSeries radarSeries1 = new RadarSeries(); radarSeries1.TooltipEnabled = true; radarSeries1.EnableAnimation = true; radarSeries1.Label = "Product A"; radarSeries1.Closed = true; radarSeries1.DrawType = PolarChartDrawType.Area; radarSeries1.Alpha = 0.5f; radarSeries1.ItemsSource = MainPage.GetPolarData1(); radarSeries1.XBindingPath = "XValue"; radarSeries1.YBindingPath = "YValue"; chart.Series.Add(radarSeries1); RadarSeries radarSeries2 = new RadarSeries(); radarSeries2.TooltipEnabled = true; radarSeries2.EnableAnimation = true; radarSeries2.Label = "Product B"; radarSeries2.Closed = true; radarSeries2.DrawType = PolarChartDrawType.Area; radarSeries2.Alpha = 0.5f; radarSeries2.ItemsSource = MainPage.GetPolarData2(); radarSeries2.XBindingPath = "XValue"; radarSeries2.YBindingPath = "YValue"; chart.Series.Add(radarSeries2); RadarSeries radarSeries3 = new RadarSeries(); radarSeries3.TooltipEnabled = true; radarSeries3.EnableAnimation = true; radarSeries3.Label = "Product C"; radarSeries3.Closed = true; radarSeries3.DrawType = PolarChartDrawType.Area; radarSeries3.Alpha = 0.5f; radarSeries3.ItemsSource = MainPage.GetPolarData3(); radarSeries3.XBindingPath = "XValue"; radarSeries3.YBindingPath = "YValue"; chart.Series.Add(radarSeries3); Spinner selectLabelMode = new Spinner(context, SpinnerMode.Dialog); polarAngleMode = new List <String>() { "Rotate 0", "Rotate 90", "Rotate 180", "Rotate 270" }; ArrayAdapter <String> dataAdapter = new ArrayAdapter <String> (context, Android.Resource.Layout.SimpleSpinnerItem, polarAngleMode); dataAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleDropDownItem1Line); selectLabelMode.Adapter = dataAdapter; selectLabelMode.ItemSelected += SelectLabelMode_ItemSelected; LinearLayout linearLayout = new LinearLayout(context); linearLayout.SetPadding(20, 0, 20, 30); linearLayout.SetBackgroundColor(Color.Rgb(236, 235, 242)); linearLayout.Orientation = Orientation.Vertical; linearLayout.SetBackgroundColor(Color.White); linearLayout.AddView(selectLabelMode); linearLayout.AddView(chart); return(linearLayout); }
protected virtual View CreateDefaultView() { var mainLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); var layout = new LinearLayout(this) { Orientation = Orientation.Vertical, LayoutParameters = mainLayoutParams }; var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 1) { Gravity = GravityFlags.Bottom | GravityFlags.CenterHorizontal }; var textView = new TextView(this) { Gravity = layoutParams.Gravity, LayoutParameters = layoutParams, Text = GetApplicationName() }; textView.SetTextSize(ComplexUnitType.Dip, 30); layout.AddView(textView); layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { Gravity = GravityFlags.Center }; //NOTE using App context to set platform specific theme for progressbar var bar = new ProgressBar(Application) { LayoutParameters = layoutParams, Indeterminate = true }; layout.AddView(bar); layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent, 1) { Gravity = GravityFlags.Bottom | GravityFlags.CenterHorizontal }; textView = new TextView(this) { Gravity = layoutParams.Gravity, LayoutParameters = layoutParams, Text = GetVersion() }; layout.AddView(textView); layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { Gravity = GravityFlags.Bottom | GravityFlags.CenterHorizontal }; textView = new TextView(this) { Gravity = layoutParams.Gravity, LayoutParameters = layoutParams, Text = GetFooter() }; layout.AddView(textView); return(layout); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); MobileBarcodeScanner.Initialize(Application); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); //Inicializar base de datos GestorApp.myData = new Biltegi2.Negocio.BD.BDManager(); GestorApp.myData.SetContext(this); //inicializar dialogos UserDialogs.Init(Application); //Inicializar Menu var menu = FindViewById <FlyOutContainer>(Resource.Id.FlyOutContainer); var menuButton = FindViewById(Resource.Id.MenuButton); var button = FindViewById <SatelliteMenuButton>(Resource.Id.menuSatelite); menuButton.Click += (sender, e) => { menu.AnimatedOpened = !menu.AnimatedOpened; if (menu.AnimatedOpened) { button.Visibility = ViewStates.Visible; } else { button.Visibility = ViewStates.Invisible; } }; button.AddItems(new[] { new SatelliteMenuButtonItem(Negocio.Constantes.MENU_SCAN, Resource.Drawable.ic_barcode_scan) }); button.MenuItemClick += MenuItem_Click; //Añadir elementos al menú de forma dinamica List <Negocio.Grupo> ListaGrupos = GestorApp.myData.GetAllGrupos(); View vBotonAdd = FindViewById <View>(Resource.Id.addGroupButton); vBotonAdd.Click += BotonAdd_Click; LinearLayout lvPadre = FindViewById <LinearLayout>(Resource.Id.layoutpadre); LinearLayout lvDummy = FindViewById <LinearLayout>(Resource.Id.layoutCategorias); TextView txtCategorias = FindViewById <TextView>(Resource.Id.txtTodasCategorias); txtCategorias.Click += TxtCategorias_Click; _grupo = new Negocio.Grupo(); TextView txt = FindViewById <TextView>(Resource.Id.txtBarraMain); EditText txtEdit = FindViewById <EditText>(Resource.Id.txtEditMain); txt.Text = GetString(Resource.String.TODOS); txt.Visibility = ViewStates.Visible; txtEdit.Visibility = ViewStates.Gone; if (bundle != null) { _grupo.IdGrupo = bundle.GetInt(Negocio.Constantes.MENSAJE_IDGRUPO); int accionTemp = bundle.GetInt(Negocio.Constantes.MENSAJE_ACCION); AccionEnCurso = (Negocio.Constantes.Acciones)accionTemp; if (_grupo.IdGrupo != 0) { _grupo.GetGrupoById(); if (AccionEnCurso == Negocio.Constantes.Acciones.ACCIONES_NONE) { txt.Text = _grupo.Descripcion; button.AddItems(new[] { new SatelliteMenuButtonItem(Negocio.Constantes.MENU_ANADIR, Resource.Drawable.ic_add_circle_outline_black_24dp), new SatelliteMenuButtonItem(Negocio.Constantes.MENU_BORRAR, Resource.Drawable.ic_delete_black_24dp), new SatelliteMenuButtonItem(Negocio.Constantes.MENU_EDIT, Resource.Drawable.ic_create_black_24dp) }); } else if (AccionEnCurso == Negocio.Constantes.Acciones.ACCIONES_EDIT) { txtEdit.Text = _grupo.Descripcion; txt.Visibility = ViewStates.Gone; txtEdit.Visibility = ViewStates.Visible; button.AddItems(new[] { new SatelliteMenuButtonItem(Negocio.Constantes.MENU_SALVAR, Resource.Drawable.ic_save_black_24dp), new SatelliteMenuButtonItem(Negocio.Constantes.MENU_CANCELAR, Resource.Drawable.ic_clear_black_24dp), }); } } } else { txtEdit.Visibility = ViewStates.Invisible; } foreach (Negocio.Grupo g in ListaGrupos) { LinearLayout lvHijo = new LinearLayout(this); TextView txtHijo = new TextView(this); lvHijo.LayoutParameters = lvDummy.LayoutParameters; txtHijo.LayoutParameters = txtCategorias.LayoutParameters; txtHijo.Text = g.Descripcion; txtHijo.Tag = g.IdGrupo.ToString(); txtHijo.Click += TxtHijo_Click; lvHijo.AddView(txtHijo); if (g.IdGrupo == _grupo.IdGrupo) { lvHijo.SetBackgroundColor(Android.Graphics.Color.Black); } lvPadre.AddView(lvHijo); } List <Negocio.Producto> lProductos; List <Negocio.Elemento> lElementos; if (_grupo.IdGrupo == 0) { lProductos = GestorApp.myData.GetAllProductos(); lElementos = GestorApp.myData.GetAllElementos(); } else { lProductos = _grupo.GetProductos(); lElementos = _grupo.GetElementos(); } var listView = FindViewById <ExpandableListView>(Resource.Id.lLista); listView.SetAdapter(new Negocio.Adaptadores.ExpandableDataAdapter(this, lElementos, lProductos)); }
private void InitComponent() { try { NameIcon = FindViewById <TextView>(Resource.Id.Name_icon); TxtFirstName = FindViewById <EditText>(Resource.Id.FirstName_text); TxtLastName = FindViewById <EditText>(Resource.Id.LastName_text); TxtUsername = FindViewById <EditText>(Resource.Id.username_Edit); SaveTextView = FindViewById <TextView>(Resource.Id.toolbar_title); TxtAboutChannal = FindViewById <EditText>(Resource.Id.AboutChannal_Edit); TxtEmail = FindViewById <EditText>(Resource.Id.email_Edit); TxtFavCategory = FindViewById <EditText>(Resource.Id.favCategory_Edit); GenderIcon = FindViewById <TextView>(Resource.Id.gender_icon); ImageAvatarLiner = FindViewById <LinearLayout>(Resource.Id.ImageAvatarLiner); ImageCoverLiner = FindViewById <LinearLayout>(Resource.Id.ImageCoverLiner); FacebookIcon = FindViewById <TextView>(Resource.Id.facebook_icon); TxtFacebook = FindViewById <EditText>(Resource.Id.facebook_Edit); TwitterIcon = FindViewById <TextView>(Resource.Id.twitter_icon); TxtTwitter = FindViewById <EditText>(Resource.Id.twitter_Edit); GoogleIcon = FindViewById <TextView>(Resource.Id.google_icon); TxtGoogle = FindViewById <EditText>(Resource.Id.google_Edit); FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, NameIcon, IonIconsFonts.Person); NameIcon.SetTextColor(Color.ParseColor("#8c8a8a")); FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, FacebookIcon, IonIconsFonts.SocialFacebook); FacebookIcon.SetTextColor(Color.ParseColor("#3b5999")); FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, TwitterIcon, IonIconsFonts.SocialTwitter); TwitterIcon.SetTextColor(Color.ParseColor("#55acee")); FontUtils.SetTextViewIcon(FontsIconFrameWork.IonIcons, GoogleIcon, IonIconsFonts.SocialGoogle); GoogleIcon.SetTextColor(Color.ParseColor("#dd4b39")); PublisherAdView = FindViewById <PublisherAdView>(Resource.Id.multiple_ad_sizes_view); AdsGoogle.InitPublisherAdView(PublisherAdView); Methods.SetFocusable(TxtFavCategory); Methods.SetFocusable(GenderIcon); } catch (Exception e) { Console.WriteLine(e); } }
public override View GetSampleContent(Context con) { var density = con.Resources.DisplayMetrics.Density; LabelAnnotation1 = new TextView(con); LabelAnnotation1.Text = "4:55PM"; LabelAnnotation1.TextSize = 14; LabelAnnotation1.SetHeight(25); LabelAnnotation1.SetWidth(75); LabelAnnotation1.SetTextColor(Color.Black); LabelAnnotation1.TextAlignment = TextAlignment.Center; LabelAnnotation2 = new TextView(con); LabelAnnotation2.Text = "10s"; LabelAnnotation2.TextSize = 12; LabelAnnotation2.SetHeight(20); LabelAnnotation2.SetWidth(35); LabelAnnotation2.SetTextColor(Color.Black); LabelAnnotation2.TextAlignment = TextAlignment.Center; LabelAnnotation3 = new TextView(con); LabelAnnotation3.Text = "55M"; LabelAnnotation3.TextSize = 12; LabelAnnotation3.SetHeight(20); LabelAnnotation3.SetWidth(35); LabelAnnotation3.SetTextColor(Color.Black); LabelAnnotation3.TextAlignment = TextAlignment.Center; Annotation1 = new SfCircularGauge(con) { Annotations = new CircularGaugeAnnotationCollection { new GaugeAnnotation { View = LabelAnnotation2, Angle = 250, Offset = 0.7f } }, CircularScales = new ObservableCollection <CircularScale> { new CircularScale { StartAngle = 270, SweepAngle = 360, ShowLabels = false, StartValue = 0, EndValue = 60, Interval = 5, RimColor = Color.Rgb(237, 238, 239), CircularRanges = new ObservableCollection <CircularRange> { new CircularRange { StartValue = 0, EndValue = 30, Color = Color.Gray, InnerStartOffset = 0.925, OuterStartOffset = 1, InnerEndOffset = 0.925, OuterEndOffset = 1 }, }, MajorTickSettings = new TickSetting { Color = Color.Black, StartOffset = 1, EndOffset = .85, Width = 2 }, MinorTickSettings = new TickSetting { Color = Color.Black, StartOffset = 1, EndOffset = .90, Width = 0.5 }, CircularPointers = new ObservableCollection <CircularPointer> { new NeedlePointer { Type = NeedleType.Triangle, KnobRadius = 4, Width = 3, EnableAnimation = false, KnobColor = Color.Black, Color = Color.Black } } } } }; LinearLayout layout1 = new LinearLayout(con); layout1.LayoutParameters = new LinearLayout.LayoutParams((int)(80 * density), (int)(80 * density)); layout1.AddView(Annotation1); Annotation2 = new SfCircularGauge(con) { Annotations = new CircularGaugeAnnotationCollection { new GaugeAnnotation { View = LabelAnnotation3, Angle = 245, Offset = 0.7f } }, CircularScales = new ObservableCollection <CircularScale> { new CircularScale { StartAngle = 270, SweepAngle = 360, StartValue = 0, EndValue = 60, Interval = 5, ShowLabels = false, RimColor = Color.Rgb(237, 238, 239), CircularRanges = new ObservableCollection <CircularRange> { new CircularRange { StartValue = 0, EndValue = 30, Color = Color.Gray, InnerStartOffset = 0.925, OuterStartOffset = 1, InnerEndOffset = 0.925, OuterEndOffset = 1 }, }, MajorTickSettings = new TickSetting { Color = Color.Black, StartOffset = 1, EndOffset = .85, Width = 2 }, MinorTickSettings = new TickSetting { Color = Color.Black, StartOffset = 1, EndOffset = .90, Width = 0.5 }, CircularPointers = new ObservableCollection <CircularPointer> { new NeedlePointer { Type = NeedleType.Triangle, KnobRadius = 4, Width = 3, EnableAnimation = false, KnobColor = Color.Black, Color = Color.Black } } } } }; LinearLayout layout2 = new LinearLayout(con); layout2.LayoutParameters = new LinearLayout.LayoutParams((int)(80 * density), (int)(80 * density)); layout2.AddView(Annotation2); Gauge = new SfCircularGauge(con) { Annotations = new CircularGaugeAnnotationCollection { new GaugeAnnotation { View = layout1, Angle = 90, Offset = .5f }, new GaugeAnnotation { View = LabelAnnotation1, Angle = 00, Offset = .3f }, new GaugeAnnotation { View = layout2, Angle = 180, Offset = .5f }, }, CircularScales = new ObservableCollection <CircularScale> { new CircularScale { StartValue = 0, EndValue = 12, Interval = 1, MinorTicksPerInterval = 4, RimColor = Color.Rgb(237, 238, 239), LabelColor = Color.Gray, LabelOffset = .8, ScaleEndOffset = .925, StartAngle = 270, SweepAngle = 360, LabelTextSize = 14, ShowFirstLabel = false, MinorTickSettings = new TickSetting { Color = Color.Black, StartOffset = 1, EndOffset = .95, Width = 1 }, MajorTickSettings = new TickSetting { Color = Color.Black, StartOffset = 1, EndOffset = .9, Width = 3 }, CircularRanges = new ObservableCollection <CircularRange> { new CircularRange { StartValue = 0, EndValue = 3, Color = Color.Gray, InnerStartOffset = 0.925, OuterStartOffset = 1, InnerEndOffset = 0.925, OuterEndOffset = 1 }, }, CircularPointers = new ObservableCollection <CircularPointer> { new NeedlePointer { EnableAnimation = false, KnobRadius = 6, LengthFactor = .75, KnobColor = Color.White, Color = Color.Black, Width = 3.5, KnobStrokeColor = Color.Black, KnobStrokeWidth = 5, TailLengthFactor = 0.25, TailColor = Color.Black }, new NeedlePointer { EnableAnimation = false, KnobRadius = 6, LengthFactor = .4, KnobColor = Color.White, Color = Color.Black, Width = 5, Type = NeedleType.Triangle }, new NeedlePointer { EnableAnimation = false, KnobRadius = 6, LengthFactor = .65, KnobColor = Color.White, Color = Color.Black, Width = 5, Type = NeedleType.Triangle }, } } } }; DynamicUpdate(); LinearLayout linearLayout = new LinearLayout(con); linearLayout.AddView(Gauge); linearLayout.SetPadding(30, 30, 30, 30); linearLayout.SetBackgroundColor(Color.White); return(linearLayout); }