public CompassRenderer( Context context, OrientationManager orientationManager, Landmarks landmarks) { _orientationManager = orientationManager; _landmarks = landmarks; try { _renderingCallbackWrapper = new RenderingCallbackWrapper(this); _onChangedListener = new OnChangedListener(this); var inflater = LayoutInflater.From(context); _layout = (FrameLayout)inflater.Inflate(Resource.Layout.compass, null); _layout.SetWillNotDraw(false); _compassView = (CompassView)_layout.FindViewById(Resource.Id.compass); _tipsContainer = (RelativeLayout)_layout.FindViewById(Resource.Id.tips_container); _tipsView = (TextView) _layout.FindViewById(Resource.Id.tips_view); _compassView.OrientationManager = _orientationManager; } catch (Exception e) { Log.Debug("Exception", e.Message); } }
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); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var mLayout = new FrameLayout(this); surface = UrhoSurface.CreateSurface(this, typeof(MySample)); //surface.Background.SetAlpha(10); TextView txtView = new TextView(this); txtView.SetBackgroundColor(Color.Violet); txtView.SetWidth(10); txtView.SetHeight(10); txtView.Text = "HAHAH"; //txtView.Text = surface.Background.ToString(); Button btn = new Button(this); btn.SetBackgroundColor(Color.Transparent); btn.Text = "Button"; btn.SetHeight(100); btn.SetWidth(100); btn.SetX(30); btn.SetY(30); btn.TextAlignment = TextAlignment.Center; mLayout.AddView(txtView); mLayout.AddView(btn); mLayout.AddView(surface); SetContentView(mLayout); }
/** * Build and add "sessions" tab. */ private void SetupSessionsTab () { // TODO: this is very inefficient and messy, clean it up FrameLayout fragmentContainer = new FrameLayout (this); fragmentContainer.Id = Resource.Id.fragment_sessions; fragmentContainer.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent); FindViewById<ViewGroup> (Android.Resource.Id.TabContent).AddView (fragmentContainer); Intent intent = new Intent (Intent.ActionView, ScheduleContract.Sessions.CONTENT_STARRED_URI); var fm = SupportFragmentManager; mSessionsFragment = (SessionsFragment)fm.FindFragmentByTag ("sessions"); if (mSessionsFragment == null) { mSessionsFragment = new SessionsFragment (); mSessionsFragment.Arguments = IntentToFragmentArguments (intent); fm.BeginTransaction () .Add (Resource.Id.fragment_sessions, mSessionsFragment, "sessions") .Commit (); } // Sessions content comes from reused activity mTabHost.AddTab (mTabHost.NewTabSpec (TAG_SESSIONS) .SetIndicator (BuildIndicator (Resource.String.starred_sessions)) .SetContent (Resource.Id.fragment_sessions)); }
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; }
protected override void OnCreateActivity (Bundle state) { base.OnCreateActivity (state); var actionBarView = CreateDoneActionBarView (); DoneFrameLayout = actionBarView.FindViewById<FrameLayout> (Resource.Id.DoneFrameLayout); DoneFrameLayout.Click += OnDoneFrameLayoutClick; ActionBar.SetDisplayOptions ( ActionBarDisplayOptions.ShowCustom, (ActionBarDisplayOptions)((int)ActionBarDisplayOptions.ShowCustom | (int)ActionBarDisplayOptions.ShowHome | (int)ActionBarDisplayOptions.ShowTitle)); ActionBar.CustomView = actionBarView; SetContentView (Resource.Layout.EditTimeEntryActivity); if (state == null) { model = GetModelFromIntent (); if (model == null) { Finish (); } else { FragmentManager.BeginTransaction () .Add (Resource.Id.FrameLayout, new EditTimeEntryFragment (model)) .Commit (); } } }
public MapFragmentBinding(LayoutInflater inflater, ViewGroup root, bool attachToRoot) { Root = inflater.Inflate(Resource.Layout.fragment_map, root, attachToRoot); mapSearchView = Root.FindViewById<MapSearchView>(Resource.Id.map_search_view); loadingView = Root.FindViewById<FrameLayout>(Resource.Id.loading_view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // return inflater.Inflate(Resource.Layout.YourFragment, container, false); View View = inflater.Inflate(Resource.Layout.MainWindow,container,false); PopUpContainer = View.FindViewById<FrameLayout>(Resource.Id.PopUpContainer); var transaction = Activity.SupportFragmentManager.BeginTransaction(); transaction.Add(PopUpContainer.Id,new InventorySlideIn(),"InventorySlideIn"); transaction.Commit(); ImageButton PopUpButton = View.FindViewById<ImageButton>(Resource.Id.button_stats); PopUpButton.Click+= (object sender, EventArgs e) => { //erstellen des Statistiken Popups StatsPopUp optionPopUp = new StatsPopUp(); Android.App.FragmentTransaction popuptransaction = Activity.FragmentManager.BeginTransaction(); optionPopUp.Show(popuptransaction, "StatsPopUp"); }; PopUpContainer.SetOnTouchListener(this); Button PlayButton = View.FindViewById<Button>(Resource.Id.button_play); PlayButton.Click += (object sender, EventArgs e) => { if(startGameEvent != null) startGameEvent(this, new EventArgs()); //bindet den "Spielen" Button an die Spielen Anwendung //(Variablen) }; return View; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource. SetContentView(Resource.Layout.Main); // Check if we're using a layout with a navigation drawer. If yes, set it up. this.drawerLayout = this.FindViewById<DrawerLayout>(Resource.Id.drawer_layout); if (this.drawerLayout != null) { this.drawerMenu = this.FindViewById<FrameLayout>(Resource.Id.mainContainer); this.ActionBar.SetDisplayHomeAsUpEnabled(true); this.ActionBar.SetHomeButtonEnabled(true); this.drawerToggle = new ActionBarDrawerToggle(this, this.drawerLayout, Resource.Drawable.ic_drawer_light, Resource.String.DrawerOpen, Resource.String.DrawerClose); this.drawerLayout.SetDrawerListener(this.drawerToggle); this.drawerLayout.OpenDrawer (this.drawerMenu); } // Populate the menu with a fragment. This can either be the full screen (phone), the left part (10 inch tablet) // or the content of the navigation drawer (7 inch tablet). var fragment = new CountryListFragment(); var transaction = this.FragmentManager.BeginTransaction(); transaction.Replace(Resource.Id.mainContainer, fragment); transaction.Commit(); }
protected override async 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); selectedAssignmentLayout = FindViewById<LinearLayout> (Resource.Id.selectedAssignment); phoneButton.Click += (sender, e) => { AndroidExtensions.MakePhoneCall (this, phone.Text); }; mapButton.Click += (sender, e) => { var navFragment = FragmentManager.FindFragmentById<NavigationFragment> (Resource.Id.navigationFragmentContainer); var index = Constants.HistoryNavigation.IndexOf ("Map"); navFragment.SetNavigation (index); }; selectedAssignmentLayout.SetBackgroundColor (Resources.GetColor (Resource.Color.historycolor)); await historyViewModel.LoadAssignmentFromHistory (assignmentHistory); RunOnUiThread (() => { //setting up default fragments var transaction = FragmentManager.BeginTransaction (); navigationFragment = new NavigationFragment (); navigationFragment.Assignment = historyViewModel.PastAssignment; transaction.SetTransition (FragmentTransit.FragmentOpen); transaction.Replace (Resource.Id.navigationFragmentContainer, navigationFragment); transaction.Commit (); if (historyViewModel.PastAssignment != null) { ActionBar.Title = string.Format ("#{0} {1} {2}", assignmentHistory.JobNumber, "Summary", historyViewModel.PastAssignment.StartDate.ToShortDateString ()); number.Text = historyViewModel.PastAssignment.Priority.ToString (); name.Text = assignmentHistory.ContactName; phone.Text = assignmentHistory.ContactPhone; address.Text = string.Format ("{0}\n{1}, {2} {3}", assignmentHistory.Address, assignmentHistory.City, assignmentHistory.State, assignmentHistory.Zip); } navigationFragment.NavigationSelected += NavigationSelected; }); items.Visibility = addItems.Visibility = ViewStates.Invisible; addLabor.Visibility = ViewStates.Gone; ActionBar.SetLogo (Resource.Drawable.XamarinTitle); ActionBar.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.actionbar)); ActionBar.SetDisplayHomeAsUpEnabled (true); }
void Init(IAttributeSet attrs) { _headerContainer = new FrameLayout(Context); if (attrs != null) { LayoutInflater layoutInflater = LayoutInflater.From(Context); //初始化状态View TypedArray a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.PullToZoomListView); int headViewResId = a.GetResourceId(Resource.Styleable.PullToZoomListView_listHeadView, 0); if (headViewResId > 0) { _headerView = layoutInflater.Inflate(headViewResId, null, false); _headerContainer.AddView(_headerView); _isHideHeader = false; } else { _isHideHeader = true; } _isParallax = a.GetBoolean(Resource.Styleable.PullToZoomListView_isHeadParallax, true); a.Recycle(); } DisplayMetrics localDisplayMetrics = new DisplayMetrics(); ((Activity) Context).WindowManager.DefaultDisplay.GetMetrics(localDisplayMetrics); _screenHeight = localDisplayMetrics.HeightPixels; _screenWidth = localDisplayMetrics.WidthPixels; if (_headerView != null) { SetHeaderViewSize(_screenWidth, (int) (9.0F * (_screenWidth / 16.0F))); AddHeaderView(_headerContainer); } _scalingRunnable = new ScalingRunnable(this); base.SetOnScrollListener(this); }
public override Android.Views.View OnCreateView (Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Bundle savedInstanceState) { var ignored = base.OnCreateView (inflater,container,savedInstanceState); var view = (ViewGroup)inflater.Inflate (Resource.Layout.layout_news, null); var viewGroup = (ViewGroup)inflater.Inflate (Resource.Layout.layout_group, null); string string_key = "41f579fc-1445-4065-ab10-c06d50e724d3"; //NewsDetail = new NewsFragmentDetail (); //var mFragmentItemContainer = viewGroup.FindViewById<FrameLayout> (Resource.Id.fragment4Container); Button button = viewGroup.FindViewById<Button> (Resource.Id.btnDetalle); mFrameLayoutContainer = view.FindViewById<FrameLayout> (Resource.Id.RelativeLay); var trans = Activity.SupportFragmentManager.BeginTransaction (); //trans.Add (mFragmentItemContainer.Id, new NewsFragmentDetail (), "Detail"); //trans.Add (Resource.Id.layout_content, NewsDetail); //trans.Hide (NewsDetail); mCurrentFragment = this; trans.Commit (); mRecyclerView = view.FindViewById<RecyclerView> (Resource.Id.RecyclerViewer); //Pruebas //cocoservices.tinnova.mx.COCOService cliente = new Navigation_View.cocoservices.tinnova.mx.COCOService (); //Navigation_View.cocoservices.tinnova.mx.PublicationDTO[] mPublicacion = new Navigation_View.cocoservices.tinnova.mx.PublicationDTO[5]; //Produccion services_911consumidor_com.COCOService cliente = new Navigation_View.services_911consumidor_com.COCOService(); Navigation_View.services_911consumidor_com.PublicationDTO[] mPublicacion = new Navigation_View.services_911consumidor_com.PublicationDTO[5]; mPublicacion = cliente.GetActivePublications (string_key); mPublicaciones = new List<Publicaciones> (); foreach (PublicationDTO value in mPublicacion) { mPublicaciones.Add (new Publicaciones { Titulo = value.Tittle, FechaPublicacion = value.PublicationDate, Subtitulo = value.SubTittle, Imagen = value.ImageUrl, IdPublicacion = value.Id, Contenido = value.Content }); } mLayoutManager = new LinearLayoutManager (view.Context); mRecyclerView.SetLayoutManager (mLayoutManager); mAdapter = new adapter_listview (mPublicaciones, mRecyclerView, view.Context); mRecyclerView.SetAdapter (mAdapter); return view; // Create your fragment here }
private void Init() { RemoveAllViews(); Orientation = Orientation.Horizontal; LayoutParams lp = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); lp.Gravity = GravityFlags.CenterVertical; LayoutParameters = lp; cardImageLayout = new FrameLayout(Context); LayoutParams cardImageLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); cardImageLayoutParams.Gravity = GravityFlags.CenterVertical; cardImageLayout.LayoutParameters = cardImageLayoutParams; cardImageLayout.SetPadding(0, 0, UiUtils.ToPixels(Context, 8), 0); SetCardImageWithoutAnimation(Resource.Drawable.ic_card_cv2); cv2TextView = new CV2TextView(Context); LayoutParams parameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); parameters.Weight = 1; parameters.Gravity = GravityFlags.Center; cv2TextView.LayoutParameters = parameters; cv2TextView.OnEntryComplete += cardNumber => { if (OnCreditCardEntered != null) { OnCreditCardEntered(cardNumber); } }; LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent); textViewLayoutParams.Gravity = GravityFlags.Center; last4CCNosTextView = new TextView(Context); last4CCNosTextView.Gravity = GravityFlags.Center; last4CCNosTextView.Text = "0000"; last4CCNosTextView.LayoutParameters = textViewLayoutParams; last4CCNosTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal); last4CCNosTextView.TextSize = 18; last4CCNosTextView.SetTextColor(Resources.GetColor(Resource.Color.normal_text)); last4CCNosTextView.Focusable = false; last4CCNosTextView.Enabled = false; last4CCNosTextView.SetSingleLine(); last4CCNosTextView.SetBackgroundDrawable(null); AddView(cardImageLayout); AddView(last4CCNosTextView); AddView(cv2TextView); }
public HSVColorPickerDialog(Context context, Color initialColor, Action<Color> listener) : base(context) { this.selectedColor = initialColor; this.listener = listener; colorWheel = new HSVColorWheel(context); valueSlider = new HSVValueSlider(context); var padding = (int)(context.Resources.DisplayMetrics.Density * PADDING_DP); var borderSize = (int)(context.Resources.DisplayMetrics.Density * BORDER_DP); var layout = new RelativeLayout(context); var lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, RelativeLayout.LayoutParams.MatchParent); lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP); colorWheel.setListener((color) => valueSlider.SetColor(color, true)); colorWheel.setColor(initialColor); colorWheel.Id = (1); layout.AddView(colorWheel, lp); int selectedColorHeight = (int)(context.Resources.DisplayMetrics.Density * SELECTED_COLOR_HEIGHT_DP); var valueSliderBorder = new FrameLayout(context); valueSliderBorder.SetBackgroundColor(BORDER_COLOR); valueSliderBorder.SetPadding(borderSize, borderSize, borderSize, borderSize); valueSliderBorder.Id = (2); lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize); lp.BottomMargin = (int)(context.Resources.DisplayMetrics.Density * CONTROL_SPACING_DP); lp.AddRule(LayoutRules.Below, 1); layout.AddView(valueSliderBorder, lp); valueSlider.SetColor(initialColor, false); valueSlider.SetListener((color) => { selectedColor = color; selectedColorView.SetBackgroundColor(color); }); valueSliderBorder.AddView(valueSlider); var selectedColorborder = new FrameLayout(context); selectedColorborder.SetBackgroundColor(BORDER_COLOR); lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MatchParent, selectedColorHeight + 2 * borderSize); selectedColorborder.SetPadding(borderSize, borderSize, borderSize, borderSize); lp.AddRule(LayoutRules.Below, 2); layout.AddView(selectedColorborder, lp); selectedColorView = new View(context); selectedColorView.SetBackgroundColor(selectedColor); selectedColorborder.AddView(selectedColorView); SetButton((int)DialogButtonType.Negative, context.GetString(Android.Resource.String.Cancel), ClickListener); SetButton((int)DialogButtonType.Positive, context.GetString(Android.Resource.String.Ok), ClickListener); SetView(layout, padding, padding, padding, padding); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); var game = new Game1(); var frameLayout = new FrameLayout(this); frameLayout.AddView((View)game.Services.GetService(typeof(View))); this.SetContentView(frameLayout); game.Run(GameRunBehavior.Asynchronous); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.SearchFragmentLayout, null); MapView = view.FindViewById<MapView>(Resource.Id.mapView); ShowPois = view.FindViewById<Button>(Resource.Id.getAllPois); FragmentContainer= view.FindViewById<FrameLayout>(Resource.Id.poisContainer); ProgressBar = view.FindViewById<ProgressBar>(Resource.Id.progressBar1); MapView.OnCreate(savedInstanceState); ShowPois.Click += OnClickEventHandler; return view; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Game1.Activity = this; var game = new Game1(); var frameLayout = new FrameLayout(this); frameLayout.AddView(game.Window); this.SetContentView(frameLayout); //SetContentView(game.Window); game.Run(GameRunBehavior.Asynchronous); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); Game1.Activity = this; var g = new Game1(); FrameLayout fl = new FrameLayout(this); fl.AddView(g.Window); adView = AdMobHelper.CreateAdView(this,"publisherid"); //AdMobHelper.AddTestDevice(adView,"deviceid"); fl.AddView(adView); AdMobHelper.RequestFreshAd(adView); SetContentView (fl); g.Run(); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Home); supportToolbar = FindViewById<SupportToolbar> (Resource.Layout.action_menu); SetSupportActionBar (supportToolbar); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetDisplayShowTitleEnabled (true); SupportActionBar.Title = "TapTap Coffee"; controls = GetDrawerOptions (); changingFragment = FindViewById<FrameLayout> (Resource.Id.variable_frlayout); }
void Init(IAttributeSet attrs) { _headerContainer = new FrameLayout(Context); _zoomContainer = new FrameLayout(Context); _contentContainer = new FrameLayout(Context); _rootContainer = new LinearLayout(Context); _rootContainer.Orientation = Android.Widget.Orientation.Vertical; if (attrs != null) { LayoutInflater layoutInflater = LayoutInflater.From(Context); //初始化状态View TypedArray a = Context.ObtainStyledAttributes(attrs, Resource.Styleable.PullToZoomScrollView); int zoomViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollZoomView, 0); if (zoomViewResId > 0) { _zoomView = layoutInflater.Inflate(zoomViewResId, null, false); _zoomContainer.AddView(_zoomView); _headerContainer.AddView(_zoomContainer); } int headViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollHeadView, 0); if (headViewResId > 0) { _headView = layoutInflater.Inflate(headViewResId, null, false); _headerContainer.AddView(_headView); } int contentViewResId = a.GetResourceId(Resource.Styleable.PullToZoomScrollView_scrollContentView, 0); if (contentViewResId > 0) { _contentView = layoutInflater.Inflate(contentViewResId, null, false); _contentContainer.AddView(_contentView); } a.Recycle(); } DisplayMetrics localDisplayMetrics = new DisplayMetrics(); ((Activity) Context).WindowManager.DefaultDisplay.GetMetrics(localDisplayMetrics); _screenHeight = localDisplayMetrics.HeightPixels; _zoomWidth = localDisplayMetrics.WidthPixels; _scalingRunnable = new ScalingRunnable(this); _rootContainer.AddView(_headerContainer); _rootContainer.AddView(_contentContainer); _rootContainer.SetClipChildren(false); _headerContainer.SetClipChildren(false); AddView(_rootContainer); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT); FrameLayout frame = new FrameLayout(this); frame.SetId(R.Id.simple_fragment); SetContentView(frame, lp); if (savedInstanceState == null) { // Do first time initialization -- Add fragment. Fragment newFragment = new ReceiveResultFragment(); FragmentTransaction ft = GetSupportFragmentManager().BeginTransaction(); ft.Add(R.Id.simple_fragment, newFragment).Commit(); } }
protected override void OnCreateActivity (Bundle bundle) { base.OnCreateActivity (bundle); SetContentView (Resource.Layout.MainDrawerActivity); DrawerListView = FindViewById<ListView> (Resource.Id.DrawerListView); DrawerListView.Adapter = drawerAdapter = new DrawerListAdapter (); DrawerListView.ItemClick += OnDrawerListViewItemClick; DrawerLayout = FindViewById<DrawerLayout> (Resource.Id.DrawerLayout); DrawerToggle = new ActionBarDrawerToggle (this, DrawerLayout, Resource.Drawable.IcDrawer, Resource.String.EntryName, Resource.String.EntryName); DrawerLayout.SetDrawerShadow (Resource.Drawable.drawershadow, (int)GravityFlags.Start); DrawerLayout.SetDrawerListener (DrawerToggle); Timer.OnCreate (this); var lp = new ActionBar.LayoutParams (ActionBar.LayoutParams.WrapContent, ActionBar.LayoutParams.WrapContent); lp.Gravity = GravityFlags.Right | GravityFlags.CenterVertical; var bus = ServiceContainer.Resolve<MessageBus> (); drawerSyncStarted = bus.Subscribe<SyncStartedMessage> (SyncStarted); drawerSyncFinished = bus.Subscribe<SyncFinishedMessage> (SyncFinished); DrawerSyncView = FindViewById<FrameLayout> (Resource.Id.DrawerSyncStatus); syncRetryButton = DrawerSyncView.FindViewById<ImageButton> (Resource.Id.SyncRetryButton); syncRetryButton.Click += OnSyncRetryClick; syncStatusText = DrawerSyncView.FindViewById<TextView> (Resource.Id.SyncStatusText); ActionBar.SetCustomView (Timer.Root, lp); ActionBar.SetDisplayShowCustomEnabled (true); ActionBar.SetDisplayHomeAsUpEnabled (true); ActionBar.SetHomeButtonEnabled (true); if (bundle == null) { OpenPage (DrawerListAdapter.TimerPageId); } else { // Restore page stack pageStack.Clear (); var arr = bundle.GetIntArray (PageStackExtra); if (arr != null) { pageStack.AddRange (arr); } } }
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate (Resource.Layout.LogTimeEntriesListFragment, container, false); view.FindViewById<TextView> (Resource.Id.EmptyTitleTextView).SetFont (Font.Roboto); view.FindViewById<TextView> (Resource.Id.EmptyTextTextView).SetFont (Font.RobotoLight); emptyMessageView = view.FindViewById<View> (Resource.Id.EmptyMessageView); emptyMessageView.Visibility = ViewStates.Gone; recyclerView = view.FindViewById<RecyclerView> (Resource.Id.LogRecyclerView); recyclerView.SetLayoutManager (new LinearLayoutManager (Activity)); undoBar = view.FindViewById<FrameLayout> (Resource.Id.UndoBar); undoButton = view.FindViewById<Button> (Resource.Id.UndoButton); undoButton.Click += UndoBtnClicked; return view; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); Title = "Без преград"; if (AuthData.AuthResult == null) { StartActivity(typeof (LoginActivity)); FinishActivity(0); return; } try { ReadPoint(); SetContentView(Resource.Layout.EditItemMainActivity); nextButton = FindViewById<Button>(Resource.Id.next_button); backButton = FindViewById<Button>(Resource.Id.back_button); objectsButton = FindViewById<Button>(Resource.Id.objects_button); saveButton = FindViewById<Button>(Resource.Id.save_button); contentLayout = FindViewById<FrameLayout>(Resource.Id.content); saveButton.Click += saveButton_Click; objectsButton.Click += objectsButton_Click; nextButton.Click += nextButton_Click; backButton.Click += backButton_Click; CreateViews(); foreach (var screen in views) { contentLayout.AddView(screen.View); } UpdateViewAndButtons(); } catch (Throwable t) { MessageBox.ShowMessage(t.Message, this); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar.Hide(); SetContentView(Resource.Layout.Memories); prmList = new List<FrameLayout.LayoutParams>(); fl = FindViewById<FrameLayout>(Resource.Id.memFrame); voiceButtons = new List<Button>(); textButtons = new List<Button>(); vidButtons = new List<Button>(); var randInt = (int)RandomNumber(1, 5); CreateButtons(randInt); }
protected internal override void onCreate(Bundle savedInstanceState) { // When extending the BrightcovePlayer, we must assign the BrightcoveVideoView // before entering the superclass. This allows for some stock video player lifecycle // management. ContentView = R.layout.freewheel_activity_main; brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view); base.onCreate(savedInstanceState); adFrame = (FrameLayout) findViewById(R.id.ad_frame); eventEmitter = brightcoveVideoView.EventEmitter; setupFreeWheel(); setupWidevine(); Catalog catalog = new Catalog("FqicLlYykdimMML7pj65Gi8IHl8EVReWMJh6rLDcTjTMqdb5ay_xFA.."); catalog.findVideoByID("2142114984001", new VideoListenerAnonymousInnerClassHelper(this)); }
protected internal override void onCreate(Bundle savedInstanceState) { // When extending the BrightcovePlayer, we must assign the BrightcoveVideoView // before entering the superclass. This allows for some stock video player lifecycle // management. ContentView = R.layout.freewheel_activity_main; brightcoveVideoView = (BrightcoveVideoView) findViewById(R.id.brightcove_video_view); base.onCreate(savedInstanceState); adFrame = (FrameLayout) findViewById(R.id.ad_frame); eventEmitter = brightcoveVideoView.EventEmitter; setupFreeWheel(); // Add a test video to the BrightcoveVideoView. Catalog catalog = new Catalog("ErQk9zUeDVLIp8Dc7aiHKq8hDMgkv5BFU7WGshTc-hpziB3BuYh28A.."); catalog.findPlaylistByReferenceID("stitch", new PlaylistListenerAnonymousInnerClassHelper(this)); }
public override View GetSampleContent (Context con) { int height = con.Resources.DisplayMetrics.HeightPixels/2; LinearLayout linearLayout = new LinearLayout(con); linearLayout.SetGravity (Android.Views.GravityFlags.CenterHorizontal); linearLayout.Orientation = Android.Widget.Orientation.Vertical; linearLayout.SetBackgroundColor(Color.White); img = new ImageView(con); img.SetImageResource (Resource.Drawable.mount); linearLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); linearLayout.SetPadding(20, 20, 20, 20); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(height+(height/3.5)),GravityFlags.Center); img.SetPadding(12, 0, 10, 0); img.LayoutParameters = (layoutParams); range=new SfRangeSlider(con); range.Minimum = 0;range.Maximum = 100; range.Value = 100; range.ShowRange = false; range.SnapsTo = SnapsTo.None; range.Orientation = Com.Syncfusion.Sfrangeslider.Orientation.Horizontal; range.TickPlacement = TickPlacement.BottomRight; range.ShowValueLabel = true; range.TickFrequency = 20; range.ValuePlacement = ValuePlacement.BottomRight; range.LayoutParameters = (new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, 150)); range.ValueChanged += ValueChanged ; linearLayout.AddView(img); TextView text1 = new TextView(con); text1.Text = " Opacity"; text1.TextSize=20; text1.Gravity = GravityFlags.Left; range.SetY(-30); linearLayout.AddView(text1); linearLayout.AddView(range); FrameLayout frame = new FrameLayout(con); frame.SetBackgroundColor (Color.White); frame.LayoutParameters = ( new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent,GravityFlags.Center)); frame.AddView(linearLayout); return frame; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); var lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,ViewGroup.LayoutParams.MatchParent); var frame = new FrameLayout(this); frame.Id = Resource.Id.simple_fragment; SetContentView(frame, lp); if (savedInstanceState == null) { // Do first time initialization -- add fragment. var newFragment = new ReceiveResultFragment(); var ft = SupportFragmentManager.BeginTransaction(); ft.Add(Resource.Id.simple_fragment, newFragment).Commit(); } // Create your application here }
void Initialize () { DefaultTranslation = 208.ToPixels (); var inflater = Context.GetSystemService (Context.LayoutInflaterService).JavaCast<LayoutInflater> (); inflater.Inflate (Resource.Layout.ArtistItemLayout, this, true); artistImage = FindViewById<ImageView> (Resource.Id.ArtistBgImage); artistName = FindViewById<TextView> (Resource.Id.artistName); questionButton = FindViewById<ImageButton> (Resource.Id.questionBtn); libraryHeader = FindViewById<TextView> (Resource.Id.libraryHeaderText); drawer = FindViewById<FrameLayout> (Resource.Id.ArtistDrawer); artistImageLoading = FindViewById<ProgressBar> (Resource.Id.artistImageLoading); artistScore = FindViewById<TextView> (Resource.Id.ArtistScore); questionButton.SetImageResource (Resource.Drawable.question_btn); questionButton.Click += (s, e) => Opened = !Opened; similarArtistList = FindViewById<ListView> (Resource.Id.similarArtistsList); similarArtistAdapter = new ArrayAdapter (Context, Resource.Layout.SimilarArtistItem); similarArtistList.Adapter = similarArtistAdapter; }
public void PlayVideo(bool isEndOfList, Holders.VideoAdapterViewHolder holderVideoPlayer = null, PostsObject item = null) { try { if (VideoPlayer == null) { SetPlayer(); } int targetPosition; if (!isEndOfList) { var startPosition = ((LinearLayoutManager)GetLayoutManager()).FindFirstVisibleItemPosition(); var endPosition = ((LinearLayoutManager)GetLayoutManager()).FindLastVisibleItemPosition(); if (endPosition - startPosition > 1) { endPosition = startPosition + 1; } if (startPosition < 0 || endPosition < 0) { return; } if (startPosition != endPosition) { var startPositionVideoHeight = GetVisibleVideoSurfaceHeight(startPosition); var endPositionVideoHeight = GetVisibleVideoSurfaceHeight(endPosition); targetPosition = startPositionVideoHeight > endPositionVideoHeight ? startPosition : endPosition; } else { targetPosition = startPosition; } } else { targetPosition = GetAdapter().ItemCount - 1; } if (targetPosition == PlayPosition) { return; } // set the position of the list-item that is to be played PlayPosition = targetPosition; if (VideoSurfaceView == null) { return; } VideoSurfaceView.Visibility = ViewStates.Invisible; RemoveVideoView(VideoSurfaceView); var currentPosition = targetPosition - ((LinearLayoutManager)GetLayoutManager()).FindFirstVisibleItemPosition(); var child = GetChildAt(currentPosition); if (child == null) { return; } dynamic holder; if (holderVideoPlayer != null) { holder = holderVideoPlayer; targetPosition = holderVideoPlayer.LayoutPosition; } else { Holders.VideoAdapterViewHolder holderChild = (Holders.VideoAdapterViewHolder)child.Tag; if (holderChild == null) { PlayPosition = -1; return; } else { targetPosition = holderChild.LayoutPosition; holder = holderChild; } } if (!(holder is Holders.VideoAdapterViewHolder holderVideo)) { return; } MediaContainerLayout = holderVideo.MediaContainerLayout; Thumbnail = holderVideo.VideoImage; ViewHolderParent = holderVideo.ItemView; PlayControl = holderVideo.PlayControl; if (!IsVideoViewAdded) { AddVideoView(); } holderVideo.VideoProgressBar.Visibility = ViewStates.Visible; VideoSurfaceView.Player = VideoPlayer; var controlView = VideoSurfaceView.FindViewById <PlayerControlView>(Resource.Id.exo_controller); Uri videoUrl = Uri.Parse(item != null ? item.MediaSet[0].File : NativeFeedAdapter.PixelNewsFeedList[targetPosition].MediaSet[0].File); //>> Old Code //===================== Exo Player ======================== var lis = new ExoPlayerRecyclerEvent(controlView, this, holderVideo); IMediaSource videoSource = GetMediaSourceFromUrl(videoUrl, "normal"); var dataSpec = new DataSpec(videoUrl); //0, 1000 * 1024, null if (Cache == null) { CacheVideosFiles(videoUrl); } //Cache = new SimpleCache(new Java.IO.File(MainContext.FilesDir, "media"), new NoOpCacheEvictor()); if (CacheDataSourceFactory == null) { CacheDataSourceFactory = new CacheDataSourceFactory(Cache, DefaultDataSourceFac); } var counters = new CacheUtil.CachingCounters(); CacheUtil.GetCached(dataSpec, Cache, counters); if (counters.ContentLength == counters.TotalCachedBytes()) { videoSource = new ExtractorMediaSource.Factory(CacheDataSourceFactory).CreateMediaSource(videoUrl); } else if (counters.TotalCachedBytes() == 0) { videoSource = new ExtractorMediaSource.Factory(CacheDataSourceFactory).CreateMediaSource(videoUrl); // not cached at all Task.Run(() => { try { var cacheDataSource = new CacheDataSource(Cache, CacheDataSourceFactory.CreateDataSource()); CacheUtil.Cache(dataSpec, Cache, cacheDataSource, counters, new AtomicBoolean()); double downloadPercentage = counters.TotalCachedBytes() * 100d / counters.ContentLength; Console.WriteLine(downloadPercentage); } catch (Exception e) { Console.WriteLine(e); } }); } else { // partially cached videoSource = new ExtractorMediaSource.Factory(CacheDataSourceFactory).CreateMediaSource(videoUrl); } lis.mFullScreenButton.SetOnClickListener(new NewClicker(lis.mFullScreenButton, videoUrl.ToString(), this)); VideoPlayer.Prepare(videoSource); VideoPlayer.AddListener(lis); VideoPlayer.PlayWhenReady = true; } catch (Exception e) { Console.WriteLine(e); } }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { var deviceDensity = (int)context.Resources.DisplayMetrics.Density; // Set our view from the "main" layout resource var layoutInflater = LayoutInflater.From(context); view = layoutInflater.Inflate(Resource.Layout.EditorCustomization, null); FrameLayout mainLayout = view.FindViewById <FrameLayout> (Resource.Id.CustomizationMain); editor = new SfImageEditor(context); editor.Bitmap = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.Customize); editor.ItemSelected += Editor_ItemSelected; editor.ToolbarSettings.IsVisible = false; editor.SetBackgroundColor(Color.Black); editor.ToolbarSettings.SubItemToolbarHeight = 0; var bottomview = layoutInflater.Inflate(Resource.Layout.BottomView, mainLayout, true); var topview = layoutInflater.Inflate(Resource.Layout.TopView, mainLayout, true); var rightview = layoutInflater.Inflate(Resource.Layout.RightView, mainLayout, true); //Bottom View------------------------------------ var bottomView = bottomview.FindViewById <LinearLayout>(Resource.Id.bottomView); bottomView.SetGravity(GravityFlags.Bottom); var bParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, 50 * deviceDensity, GravityFlags.Bottom); bottomView.SetBackgroundColor(Color.Transparent); bParams.SetMargins(0, 0, 0, 10 * deviceDensity); bottomView.LayoutParameters = bParams; //Top View------------------------------------ var topView = topview.FindViewById <LinearLayout>(Resource.Id.topView); var tParams = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MatchParent, 50 * deviceDensity, GravityFlags.Top); tParams.SetMargins(0, 10 * deviceDensity, 0, 0); topView.LayoutParameters = tParams; //Right View------------------------------------ var rightView = rightview.FindViewById <LinearLayout>(Resource.Id.rightView); var rParams = new FrameLayout.LayoutParams(65 * deviceDensity, FrameLayout.LayoutParams.MatchParent, GravityFlags.Right); rParams.SetMargins(0, 250, 0, 250); rightView.SetBackgroundColor(Color.Transparent); rightView.SetPadding(0, 0, 15 * deviceDensity, 15 * deviceDensity); rightView.LayoutParameters = rParams; rightView.Visibility = ViewStates.Invisible; topView.Visibility = ViewStates.Invisible; mainLayout.RemoveAllViews(); (mainLayout.Parent as ViewGroup)?.RemoveAllViews(); mainLayout.AddView(editor); mainLayout.AddView(topView); mainLayout.AddView(bottomView); mainLayout.AddView(rightView); Button dummyLayout = new Button(context); dummyLayout.SetBackgroundColor(Color.Transparent); dummyLayout.Alpha = 0.5F; mainLayout.AddView(dummyLayout); dummyLayout.Click += (sender, e) => { topView.Visibility = ViewStates.Visible; dummyLayout.Visibility = ViewStates.Invisible; }; //Top view var reset = topView.FindViewById <ImageButton>(Resource.Id.resetButton); var undo = topView.FindViewById <ImageButton>(Resource.Id.undoButton); var rect = topView.FindViewById <ImageButton>(Resource.Id.rectButton); var text = topView.FindViewById <ImageButton>(Resource.Id.textButton); var path = topView.FindViewById <ImageButton>(Resource.Id.pathButton); reset.Click += (sender, e) => { if (editor.IsImageEdited) { editor.Reset(); } rightView.Visibility = ViewStates.Invisible; topView.Visibility = ViewStates.Invisible; dummyLayout.Visibility = ViewStates.Visible; isPath = false; isText = false; isRect = false; }; undo.Click += (sender, e) => { if (editor.IsImageEdited) { editor.Undo(); } }; rect.Click += (sender, e) => { isPath = false; isText = false; isRect = true; AddShapes(); rightView.Visibility = ViewStates.Visible; }; text.Click += (sender, e) => { isPath = false; isRect = false; isText = true; AddShapes(); rightView.Visibility = ViewStates.Visible; }; path.Click += (sender, e) => { isPath = true; isRect = false; isText = false; rightView.Visibility = ViewStates.Visible; editor.AddShape(); }; // colorLayout var firstBut = rightview.FindViewById <Button>(Resource.Id.firstButton); var secondBut = rightview.FindViewById <Button>(Resource.Id.secondButton); var thirdBut = rightview.FindViewById <Button>(Resource.Id.thirdButton); var fourthBut = rightview.FindViewById <Button>(Resource.Id.fourthButton); var fifthBut = rightview.FindViewById <Button>(Resource.Id.fifthButton); var sixthBut = rightview.FindViewById <Button>(Resource.Id.sixthButton); var seventhBut = rightview.FindViewById <Button>(Resource.Id.seventhButton); var eightBut = rightview.FindViewById <Button>(Resource.Id.eightButton); var ninthBut = rightview.FindViewById <Button>(Resource.Id.ninthButton); var tenthBut = rightview.FindViewById <Button>(Resource.Id.tenthButton); firstBut.Click += (sender, e) => { var color = Color.ParseColor("#4472c4"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; secondBut.Click += (sender, e) => { var color = Color.ParseColor("#ed7d31"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; thirdBut.Click += (sender, e) => { var color = Color.ParseColor("#ffc000"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; fourthBut.Click += (sender, e) => { var color = Color.ParseColor("#70ad47"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; fifthBut.Click += (sender, e) => { var color = Color.ParseColor("#5b9bd5"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; sixthBut.Click += (sender, e) => { var color = Color.ParseColor("#c1c1c1"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; seventhBut.Click += (sender, e) => { var color = Color.ParseColor("#6f6fe2"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; eightBut.Click += (sender, e) => { var color = Color.ParseColor("#e269ae"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; ninthBut.Click += (sender, e) => { var color = Color.ParseColor("#9e480e"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; tenthBut.Click += (sender, e) => { var color = Color.ParseColor("#997300"); setting(Settings, color); if (isPath) { editor.AddShape(Syncfusion.SfImageEditor.Android.ShapeType.Path, new PenSettings() { Color = color }); } }; //Share var share = bottomView.FindViewById <ImageButton>(Resource.Id.sharecustomization); editText = bottomView.FindViewById <EditText>(Resource.Id.captionText); share.Click += async(sender, e) => { await ShareImageAsync(); }; return(mainLayout); }
public static void getTiles(Android.Widget.ScrollView parent) { parent.RemoveAllViewsInLayout(); if (UserTiles != null) { UserTiles.Clear(); } UserTiles = new List <LinearLayout>(); int pixelDensity = (int)Android.Content.Res.Resources.System.DisplayMetrics.Density; ContextThemeWrapper mainContext = new ContextThemeWrapper(parent.Context, Resource.Style.MainLinearForUserTiles); LinearLayout MainLinear = new LinearLayout(mainContext); MainLinear.Orientation = Orientation.Vertical; parent.AddView(MainLinear); LinearLayout currentRow = null; int i = 0; foreach (User user in Controller._users) { if (i % 2 == 0) { ContextThemeWrapper rowContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserTileRowLayoutStyle); currentRow = new LinearLayout(rowContext); currentRow.Orientation = Orientation.Horizontal; } ContextThemeWrapper userTileContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserTileLayoutStyle); LinearLayout currentUser = new LinearLayout(userTileContext); currentUser.Orientation = Orientation.Vertical; currentUser.Id = i; ContextThemeWrapper userNameContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserNameCenteredText); TextView userName = new TextView(userNameContext); userName.Text = user.Name.FirstName; ContextThemeWrapper relativeLayoutStyle = new ContextThemeWrapper(parent.Context, Resource.Style.ProgressBorderStyle); FrameLayout currentUserBar = new FrameLayout(relativeLayoutStyle); ContextThemeWrapper PgBarFillContext = new ContextThemeWrapper(parent.Context, Resource.Style.ProgressBarFillStyle); Android.Widget.ProgressBar currentUserBarMask = new Android.Widget.ProgressBar(PgBarFillContext, null, Resource.Style.ProgressBarFillStyle); try { double progress = (1 - ((double)user.Used / user.Allocated)) * 100; currentUserBarMask.Progress = (int)(progress); } catch (DivideByZeroException) { double progress = (1 - ((double)user.Used / Controller._totalRemainder)) * 100; currentUserBarMask.Progress = (int)(progress); } currentUserBar.AddView(currentUserBarMask); currentUser.AddView(userName); currentUser.AddView(currentUserBar); UserTiles.Add(currentUser); currentRow.AddView(currentUser); MainLinear.RemoveView(currentRow); MainLinear.AddView(currentRow); i++; } }
protected override async 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); selectedAssignmentLayout = FindViewById <LinearLayout> (Resource.Id.selectedAssignment); phoneButton.Click += (sender, e) => { AndroidExtensions.MakePhoneCall(this, phone.Text); }; mapButton.Click += (sender, e) => { var navFragment = FragmentManager.FindFragmentById <NavigationFragment> (Resource.Id.navigationFragmentContainer); var index = Constants.HistoryNavigation.IndexOf("Map"); navFragment.SetNavigation(index); }; selectedAssignmentLayout.SetBackgroundColor(Resources.GetColor(Resource.Color.historycolor)); await historyViewModel.LoadAssignmentFromHistory(assignmentHistory); RunOnUiThread(() => { //setting up default fragments var transaction = FragmentManager.BeginTransaction(); navigationFragment = new NavigationFragment(); navigationFragment.Assignment = historyViewModel.PastAssignment; transaction.SetTransition(FragmentTransit.FragmentOpen); transaction.Replace(Resource.Id.navigationFragmentContainer, navigationFragment); transaction.Commit(); if (historyViewModel.PastAssignment != null) { ActionBar.Title = string.Format("#{0} {1} {2}", assignmentHistory.JobNumber, "Summary", historyViewModel.PastAssignment.StartDate.ToShortDateString()); number.Text = historyViewModel.PastAssignment.Priority.ToString(); name.Text = assignmentHistory.ContactName; phone.Text = assignmentHistory.ContactPhone; address.Text = string.Format("{0}\n{1}, {2} {3}", assignmentHistory.Address, assignmentHistory.City, assignmentHistory.State, assignmentHistory.Zip); } navigationFragment.NavigationSelected += NavigationSelected; }); items.Visibility = addItems.Visibility = ViewStates.Invisible; addLabor.Visibility = ViewStates.Gone; ActionBar.SetLogo(Resource.Drawable.XamarinTitle); ActionBar.SetBackgroundDrawable(Resources.GetDrawable(Resource.Drawable.actionbar)); ActionBar.SetDisplayHomeAsUpEnabled(true); }
public static RelativeLayout CreateRoot(this BottomTabbedRenderer renderer, int barId, int pageContainerId, out FrameLayout pageContainer) { var rootLayout = new RelativeLayout(renderer.Context) { LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent), }; var pageParams = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); pageParams.AddRule(LayoutRules.Above, barId); pageContainer = new FrameLayout(renderer.Context) { LayoutParameters = pageParams, Id = pageContainerId }; rootLayout.AddView(pageContainer, 0, pageParams); return(rootLayout); }
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 View GetSampleContent(Context context) { mainLayout = new LinearLayout(context); mainLayout.Orientation = Orientation.Vertical; mainLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); con = context; density = con.Resources.DisplayMetrics.Density; TextView about = new TextView(context); about.Text = "About Syncfusion"; if (IsTabletDevice(context)) { about.SetPadding(0, 10, 0, 40); about.Gravity = GravityFlags.Center; } about.SetTextColor(Color.Black); about.SetBackgroundColor(Color.Transparent); about.TextSize = 10 * density; //TypedValue.ApplyDimension(ComplexUnitType.Pt, 5, context.Resources.DisplayMetrics); mainLayout.AddView(about); TextView desc = new TextView(context); if (density > 2) { mainLayout.SetPadding(10, 10, 10, 10); about.TextSize = 20; } else { about.TextSize = 17; mainLayout.SetPadding(5, 5, 5, 5); } if (IsTabletDevice(context)) { desc.Text = "\tSyncfusion is the enterprise technology partner of choice for software development, delivering \n \n a broad range of web, mobile, and desktop controls coupled with a service-oriented approach \n \n throughout the entire application lifecycle. Syncfusion has established itself as the trusted\n\n partner worldwide for use in applications."; } else { desc.Text = "\tSyncfusion is the enterprise technology partner of choice for software development, delivering a broad range of web, mobile, and desktop controls coupled with a service-oriented approach throughout the entire application lifecycle. Syncfusion has established itself as the trusted partner worldwide for use in applications."; } desc.SetTextColor(Color.Black); desc.SetBackgroundColor(Color.Transparent); //desc.TextSize =5 * density; //TypedValue.ApplyDimension(ComplexUnitType.Pt, 3.5f, context.Resources.DisplayMetrics); mainLayout.AddView(desc); FrameLayout backFrame = new FrameLayout(context); backFrame.SetBackgroundColor(Color.Gray); mainLayout.AddView(backFrame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); FrameLayout frontFrame = new FrameLayout(context); frontFrame.SetBackgroundColor(Color.White); frontFrame.SetPadding(5, 5, 5, 5); touchDraw = new Button(context); touchDraw.Text = "Tap here to follow us"; touchDraw.SetTextColor(Color.Blue); touchDraw.SetBackgroundColor(Color.Transparent); //touchDraw.TextSize = 10 * density; //TypedValue.ApplyDimension(ComplexUnitType.Pt, 3, context.Resources.DisplayMetrics); frontFrame.AddView(touchDraw, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.Center)); Typeface typeface = Typeface.CreateFromAsset(context.Assets, "socialicons.ttf"); radialMenu = new SfRadialMenu(context); radialMenu.RimColor = Color.Transparent; radialMenu.SelectionColor = Color.Transparent; FrameLayout facebookLayout = new FrameLayout(context); facebookLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView facebookImage = new ImageView(context); facebookImage.LayoutParameters = facebookLayout.LayoutParameters; facebookImage.SetImageResource(Resource.Drawable.facebook); facebookImage.SetScaleType(ImageView.ScaleType.FitXy); TextView facebookText = new TextView(context); facebookText.LayoutParameters = facebookLayout.LayoutParameters; facebookText.Text = "\uE700"; facebookText.Typeface = typeface; facebookText.TextSize = 20; facebookText.TextAlignment = TextAlignment.Center; facebookText.Gravity = GravityFlags.Center; facebookText.SetTextColor(Color.White); facebookLayout.AddView(facebookImage); facebookLayout.AddView(facebookText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem facebookItem = new SfRadialMenuItem(context) { View = facebookLayout, ItemWidth = 50, ItemHeight = 50 }; facebookItem.ItemTapped += FacebookItem_ItemTapped; facebookItem.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(facebookItem); FrameLayout gplusLayout = new FrameLayout(context); gplusLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView gplusImage = new ImageView(context); gplusImage.LayoutParameters = gplusLayout.LayoutParameters; gplusImage.SetImageResource(Resource.Drawable.gplus); gplusImage.SetScaleType(ImageView.ScaleType.FitXy); TextView gplusText = new TextView(context); gplusText.LayoutParameters = gplusLayout.LayoutParameters; gplusText.Text = "\uE707"; gplusText.Typeface = typeface; gplusText.TextSize = 20; gplusText.TextAlignment = TextAlignment.Center; gplusText.Gravity = GravityFlags.Center; gplusText.SetTextColor(Color.White); gplusLayout.AddView(gplusImage); gplusLayout.AddView(gplusText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem gplusItem = new SfRadialMenuItem(context) { View = gplusLayout, ItemWidth = 50, ItemHeight = 50 }; gplusItem.ItemTapped += GplusItem_ItemTapped; gplusItem.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(gplusItem); FrameLayout twitterLayout = new FrameLayout(context); twitterLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView twitterImage = new ImageView(context); twitterImage.LayoutParameters = twitterLayout.LayoutParameters; twitterImage.SetImageResource(Resource.Drawable.twitter); twitterImage.SetScaleType(ImageView.ScaleType.FitXy); TextView twitterText = new TextView(context); twitterText.LayoutParameters = twitterLayout.LayoutParameters; twitterText.Text = "\uE704"; twitterText.Typeface = typeface; twitterText.TextSize = 20; twitterText.TextAlignment = TextAlignment.Center; twitterText.Gravity = GravityFlags.Center; twitterText.SetTextColor(Color.White); twitterLayout.AddView(twitterImage); twitterLayout.AddView(twitterText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem twitterItem = new SfRadialMenuItem(context) { View = twitterLayout, ItemWidth = 50, ItemHeight = 50 }; twitterItem.ItemTapped += TwitterItem_ItemTapped; twitterItem.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(twitterItem); FrameLayout pinterestLayout = new FrameLayout(context); pinterestLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView pinterestImage = new ImageView(context); pinterestImage.LayoutParameters = pinterestLayout.LayoutParameters; pinterestImage.SetImageResource(Resource.Drawable.pinterest); pinterestImage.SetScaleType(ImageView.ScaleType.FitXy); TextView pinterestText = new TextView(context); pinterestText.LayoutParameters = pinterestLayout.LayoutParameters; pinterestText.Text = "\uE705"; pinterestText.Typeface = typeface; pinterestText.TextSize = 20; pinterestText.TextAlignment = TextAlignment.Center; pinterestText.Gravity = GravityFlags.Center; pinterestText.SetTextColor(Color.White); pinterestLayout.AddView(pinterestImage); pinterestLayout.AddView(pinterestText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem pinterestItem = new SfRadialMenuItem(context) { View = pinterestLayout, ItemWidth = 50, ItemHeight = 50 }; pinterestItem.ItemTapped += PinterestItem_ItemTapped; pinterestItem.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(pinterestItem); FrameLayout linkedInLayout = new FrameLayout(context); linkedInLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView linkedInImage = new ImageView(context); linkedInImage.LayoutParameters = linkedInLayout.LayoutParameters; linkedInImage.SetImageResource(Resource.Drawable.linkedin); linkedInImage.SetScaleType(ImageView.ScaleType.FitXy); TextView linkedInText = new TextView(context); linkedInText.LayoutParameters = linkedInLayout.LayoutParameters; linkedInText.Text = "\uE706"; linkedInText.Typeface = typeface; linkedInText.TextSize = 20; linkedInText.TextAlignment = TextAlignment.Center; linkedInText.Gravity = GravityFlags.Center; linkedInText.SetTextColor(Color.White); linkedInLayout.AddView(linkedInImage); linkedInLayout.AddView(linkedInText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem linkedInItem = new SfRadialMenuItem(context) { View = linkedInLayout, ItemWidth = 50, ItemHeight = 50 }; linkedInItem.ItemTapped += LinkedInItem_ItemTapped; linkedInItem.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(linkedInItem); FrameLayout instagramLayout = new FrameLayout(context); instagramLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView instagramImage = new ImageView(context); instagramImage.LayoutParameters = instagramLayout.LayoutParameters; instagramImage.SetImageResource(Resource.Drawable.instagram); instagramImage.SetScaleType(ImageView.ScaleType.FitXy); TextView instagramText = new TextView(context); instagramText.LayoutParameters = instagramLayout.LayoutParameters; instagramText.Text = "\uE708"; instagramText.Typeface = typeface; instagramText.TextSize = 20; instagramText.TextAlignment = TextAlignment.Center; instagramText.Gravity = GravityFlags.Center; instagramText.SetTextColor(Color.White); instagramLayout.AddView(instagramImage); instagramLayout.AddView(instagramText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem instagramItem = new SfRadialMenuItem(context) { View = instagramLayout, ItemWidth = 50, ItemHeight = 50 }; instagramItem.ItemTapped += InstagramItem_ItemTapped; instagramItem.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(instagramItem); backFrame.AddView(frontFrame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); TextView menuIcon = new TextView(context); menuIcon.Text = "\uE703"; menuIcon.TextSize = 20; menuIcon.Typeface = typeface; menuIcon.SetTextColor(Color.White); menuIcon.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); menuIcon.Gravity = GravityFlags.Center; radialMenu.Visibility = ViewStates.Invisible; radialMenu.CenterButtonView = menuIcon; radialMenu.IsDragEnabled = false; radialMenu.EnableRotation = false; radialMenu.OuterRimColor = Color.Transparent; radialMenu.CenterButtonBackground = Color.Rgb(41, 146, 247); radialMenu.CenterButtonRadius = 25; radialMenu.RimRadius = 100; radialMenu.Closed += RadialMenu_Closed; frontFrame.AddView(radialMenu); touchDraw.Click += (sender, e) => { radialMenu.Visibility = ViewStates.Visible; touchDraw.Visibility = ViewStates.Invisible; radialMenu.Show(); }; return(mainLayout); }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { FrameLayout frame = new FrameLayout(context); linear = new LinearLayout(context); linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); linear.Orientation = Orientation.Horizontal; TextView swipeViewUndo = new TextView(context); swipeViewUndo.Text = "UNDO"; swipeViewUndo.SetTypeface(swipeViewUndo.Typeface, TypefaceStyle.Bold); swipeViewUndo.Gravity = GravityFlags.Center; swipeViewUndo.SetTextColor(Color.White); swipeViewUndo.SetBackgroundColor(Color.ParseColor("#1AAA87")); swipeViewUndo.Click += swipeViewUndo_Click; TextView swipeViewText = new TextView(context); swipeViewText.SetPadding((int)(25 * context.Resources.DisplayMetrics.Density), 0, 0, 0); swipeViewText.Text = "Deleted"; swipeViewText.Gravity = GravityFlags.CenterVertical | GravityFlags.Left; swipeViewText.SetTextColor(Color.White); swipeViewText.SetBackgroundColor(Color.ParseColor("#1AAA87")); linear.SetBackgroundColor(Color.ParseColor("#1AAA87")); viewModel = new SwipingViewModel(); viewModel.SetRowstoGenerate(100); sfGrid = new SfDataGrid(context); sfGrid.AutoGenerateColumns = false; sfGrid.ItemsSource = (viewModel.OrdersInfo); sfGrid.AllowSwiping = true; sfGrid.ColumnSizer = ColumnSizer.Star; DisplayMetrics metrics = context.Resources.DisplayMetrics; int width = metrics.WidthPixels; sfGrid.MaxSwipeOffset = width; swipe = new SwipeView(context); var undoWidth = (int)(100 * context.Resources.DisplayMetrics.Density); linear.AddView(swipeViewText, (sfGrid.MaxSwipeOffset - undoWidth), (int)sfGrid.RowHeight); linear.AddView(swipeViewUndo, undoWidth, (int)sfGrid.RowHeight); swipe.SetBackgroundColor(Color.ParseColor("#1AAA87")); swipe.AddView(linear); sfGrid.LeftSwipeView = swipe; sfGrid.RightSwipeView = swipe; sfGrid.SwipeEnded += sfGrid_SwipeEnded; sfGrid.SwipeStarted += sfGrid_SwipeStarted; GridTextColumn CustomerID = new GridTextColumn(); CustomerID.MappingName = "CustomerID"; CustomerID.HeaderText = "Customer ID"; GridTextColumn OrderID = new GridTextColumn(); OrderID.MappingName = "OrderID"; OrderID.HeaderText = "Order ID"; GridTextColumn EmployeeID = new GridTextColumn(); EmployeeID.MappingName = "EmployeeID"; EmployeeID.HeaderText = "Employee ID"; GridTextColumn Name = new GridTextColumn(); Name.MappingName = "FirstName"; Name.HeaderText = "Name"; sfGrid.Columns.Add(OrderID); sfGrid.Columns.Add(CustomerID); sfGrid.Columns.Add(EmployeeID); sfGrid.Columns.Add(Name); frame.AddView(sfGrid); return(frame); }
public override View GetSampleContent(Context context) { height = context.Resources.DisplayMetrics.HeightPixels; width = context.Resources.DisplayMetrics.WidthPixels; con = context; density = con.Resources.DisplayMetrics.Density; ImageView image = new ImageView(context); image.SetImageResource(Resource.Drawable.Font); FrameLayout frame = new FrameLayout(context); frame.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(400, 400); mainLayout = new LinearLayout(con); mainLayout.Orientation = Android.Widget.Orientation.Vertical; mainLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); FrameLayout radialFrame = new FrameLayout(con); radialFrame.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(height * 0.60)); radialMenu = new SfRadialMenu(con); ///radialMenu.MenuIcon = image; ImageView back = new ImageView(con); back.SetImageResource(Resource.Drawable.Previous); //radialMenu.BackIcon = back; radialMenu.RimColor = Color.LightGray; radialMenu.OuterRimColor = Color.Transparent; Typeface tf = Typeface.CreateFromAsset(con.Assets, "Segoe_MDL2_Assets.ttf"); for (int i = 0; i < 6; i++) { SfRadialMenuItem item = new SfRadialMenuItem(con) { IconFont = tf, FontIconSize = 20, FontIconText = layer[i], FontIconColor = Color.Black, ItemWidth = 45, ItemHeight = 45 }; item.ItemTapped += Item_ItemTapped; radialMenu.Items.Add(item); } for (int i = 0; i < 4; i++) { SfRadialMenuItem item = new SfRadialMenuItem(con) { IconFont = tf, FontIconSize = 20, FontIconText = wifi[i], FontIconColor = Color.Black }; item.ItemTapped += Item_ItemTapped; (radialMenu.Items[0] as SfRadialMenuItem).Items.Add(item); } for (int i = 0; i < 4; i++) { SfRadialMenuItem item = new SfRadialMenuItem(con) { IconFont = tf, FontIconSize = 20, FontIconText = wifi[i], FontIconColor = Color.Black }; item.ItemTapped += Item_ItemTapped; (radialMenu.Items[1] as SfRadialMenuItem).Items.Add(item); } for (int i = 0; i < 3; i++) { SfRadialMenuItem item = new SfRadialMenuItem(con) { IconFont = tf, FontIconSize = 20, FontIconText = profile[i], FontIconColor = Color.Black }; item.ItemTapped += Item_ItemTapped; (radialMenu.Items[2] as SfRadialMenuItem).Items.Add(item); } for (int i = 0; i < 3; i++) { SfRadialMenuItem item = new SfRadialMenuItem(con) { IconFont = tf, FontIconSize = 20, FontIconText = brightness[i], FontIconColor = Color.Black }; item.ItemTapped += Item_ItemTapped; (radialMenu.Items[3] as SfRadialMenuItem).Items.Add(item); } for (int i = 0; i < 3; i++) { SfRadialMenuItem item = new SfRadialMenuItem(con) { IconFont = tf, FontIconSize = 20, FontIconText = battery[i], FontIconColor = Color.Black, ItemWidth = 45, ItemHeight = 45 }; item.ItemTapped += Item_ItemTapped; (radialMenu.Items[4] as SfRadialMenuItem).Items.Add(item); } for (int i = 0; i < 3; i++) { SfRadialMenuItem item = new SfRadialMenuItem(con) { IconFont = tf, FontIconSize = 20, FontIconText = power[i], FontIconColor = Color.Black, ItemWidth = 45, ItemHeight = 45 }; item.ItemTapped += Item_ItemTapped; (radialMenu.Items[5] as SfRadialMenuItem).Items.Add(item); } radialMenu.RimRadius = radialRadius; radialMenu.CenterButtonRadius = 30; radialMenu.Opening += RadialMenu_Opening; radialMenu.Opened += RadialMenu_Opened; radialMenu.Closing += RadialMenu_Closing; radialMenu.Closed += RadialMenu_Closed; radialMenu.Navigating += RadialMenu_Navigating; radialMenu.Navigated += RadialMenu_Navigated; radialMenu.CenterButtonBackTapped += RadialMenu_CenterButtonBackTapped; radialFrame.AddView(radialMenu); mainLayout.AddView(radialFrame); scrollviewer = new ScrollView(con); textFrame = new LinearLayout(con); TextView menuIcon = new TextView(con); menuIcon.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); menuIcon.Text = "\uE713"; menuIcon.Typeface = tf; menuIcon.TextSize = 30; menuIcon.SetTextColor(Color.White); menuIcon.Gravity = GravityFlags.Center; radialMenu.CenterButtonView = menuIcon; TextView backIcon = new TextView(con); backIcon.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); backIcon.Text = "\uE72B"; backIcon.TextSize = 25; backIcon.Typeface = tf; backIcon.SetTextColor(Color.White); backIcon.Gravity = GravityFlags.Center; radialMenu.CenterButtonBackIcon = backIcon; 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); } mainLayout.AddView(textview); textFrame.Orientation = Android.Widget.Orientation.Vertical; textFrame.SetScrollContainer(true); scrollviewer.AddView(textFrame); scrollviewer.VerticalScrollBarEnabled = true; FrameLayout bottomFrame = new FrameLayout(con); bottomFrame.SetScrollContainer(true); 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); mainLayout.AddView(bottomFrame); mainLayout.SetBackgroundColor(Color.White); radialMenu.EnableRotation = rotate; radialMenu.IsDragEnabled = drag; return(mainLayout); }
private void FindViews() { externalMapButton = FindViewById <Button>(Resource.Id.externalMapButton); mapFrameLayout = FindViewById <FrameLayout>(Resource.Id.mapFrameLayout); }
private void InitView() { string title = builder.title; string message = builder.message; string negativeBtnText = builder.negativeBtnText; string positiveBtnText = builder.positiveBtnText; IDialogInterfaceOnClickListener positiveListener = builder.positiveListener; IDialogInterfaceOnClickListener negativeListner = builder.negativeListner; View contentView = builder.contentView; bool showTitleDivider = builder.showTitleDivider; int titleBgResId = builder.titleBgResId; int titleTextColor = builder.titleTextColor; TextView titleView = FindViewById <TextView>(Resource.Id.title); if (title != null && title.Length > 0) { titleView.Text = title; } else { FindViewById(Resource.Id.popup_header).Visibility = ViewStates.Gone; } if (titleBgResId > 0) { titleView.SetBackgroundResource(titleBgResId); } if (titleTextColor > 0) { titleView.SetTextColor(titleView.Context.Resources.GetColor(titleTextColor)); } ImageView titleDivider = FindViewById <ImageView>(Resource.Id.divide); if (showTitleDivider) { titleDivider.Visibility = ViewStates.Visible; } else { titleDivider.Visibility = ViewStates.Gone; } TextView messageView = FindViewById <TextView>(Resource.Id.content); if (message != null && message.Length > 0) { messageView.Text = message; messageView.MovementMethod = new ScrollingMovementMethod(); } else { messageView.Visibility = ViewStates.Gone; } if (contentView != null) { FrameLayout container = FindViewById <FrameLayout>(Resource.Id.content_group); container.Visibility = ViewStates.Visible; container.AddView(contentView); } Button positiveBtn = FindViewById <Button>(Resource.Id.bt_right); if (positiveBtnText != null && positiveBtnText.Length > 0) { positiveBtn.Text = positiveBtnText; } else { positiveBtn.Visibility = ViewStates.Gone; } Button negativeBtn = FindViewById <Button>(Resource.Id.bt_left); if (negativeBtnText != null && negativeBtnText.Length > 0) { negativeBtn.Text = negativeBtnText; } else { negativeBtn.Visibility = ViewStates.Gone; } if (positiveBtn.Visibility == ViewStates.Visible && negativeBtn.Visibility == ViewStates.Gone) { positiveBtn.SetBackgroundResource(Resource.Drawable.popup_btn_c); } negativeBtn.Click += (s, e) => { if (negativeListner != null) { negativeListner.OnClick(this, 0); } Dismiss(); }; positiveBtn.Click += (s, e) => { if (positiveListener != null) { positiveListener.OnClick(this, 0); } Dismiss(); }; FindViewById(Resource.Id.root).Click += (s, e) => { Dismiss(); }; FindViewById(Resource.Id.popup).Click += (s, e) => { // skip }; }
public abstract void createAndAttachView(int arg0, FrameLayout arg1);
public override View OnCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { frame = (FrameLayout)layoutInflater.Inflate(Resource.Layout.zxingscannerfragmentlayout, viewGroup, false); return(frame); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.firsttimemain); var builder = new Android.Support.V7.App.AlertDialog.Builder(this); Android.Views.LayoutInflater layoutInflater = this.LayoutInflater; Android.Views.View view = layoutInflater.Inflate(Resource.Layout.firsttimelaunch, null, false); RadioGroup rg = view.FindViewById <RadioGroup>(Resource.Id.firstTimeRadioGroup); frameLayout = view.FindViewById <FrameLayout>(Resource.Id.firstTimeFrameLayout); errorText = view.FindViewById <TextView>(Resource.Id.errorTextView); rg.CheckedChange += (s, e) => { switch (e.CheckedId) { case (Resource.Id.newWalletButton): ShowFrameLayout(ViewStates.Gone); break; case (Resource.Id.recoverWalletButton): ShowFrameLayout(ViewStates.Visible); break; default: break; } }; builder.SetTitle("No Wallet Found"); builder.SetView(view); CreateDataTable(); frameLayout.AddView(dataGrid); builder.SetPositiveButton(Resource.String.next, (System.EventHandler <DialogClickEventArgs>)null); builder.SetNegativeButton(Resource.String.cancel, (senderAlert, args) => { Finish(); }); builder.SetNeutralButton(Resource.String.prev, (senderAlert, args) => { StartActivity(new Intent(Application.Context, typeof(AccountSetupActivity))); }); var dialog = builder.Create(); dialog.Show(); var nextBtn = dialog.GetButton((int)DialogButtonType.Positive); nextBtn.Click += (sender, args) => { if ((selectedRowIndex == -1) && (frameLayout.Visibility == ViewStates.Visible)) { errorText.Visibility = ViewStates.Visible; errorText.Text = "A wallet must be selected!"; return; } else if ((selectedRowIndex != -1) && (frameLayout.Visibility == ViewStates.Visible)) { //@@todo: write current wallet to database StartActivity(new Intent(Application.Context, typeof(MainActivity))); return; } StartActivity(new Intent(Application.Context, typeof(WalletSetupActivity))); }; }
public NewClicker(FrameLayout fullScreenButton, string videoUrl, PRecyclerView wRecyclerViewController) { WRecyclerViewController = wRecyclerViewController; FullScreenButton = fullScreenButton; VideoUrl = videoUrl; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); CreateDevice(); LinearLayout layout = FindViewById <LinearLayout>(Resource.Id.linearLayout1); FrameLayout frame1 = FindViewById <FrameLayout>(Resource.Id.frameLayout1); frame1.Click += Frame1_Click; FrameLayout frame2 = FindViewById <FrameLayout>(Resource.Id.frameLayout2); frame2.Click += Frame2_Click; FrameLayout frame3 = FindViewById <FrameLayout>(Resource.Id.frameLayout3); frame3.Click += Frame3_Click; FrameLayout frame4 = FindViewById <FrameLayout>(Resource.Id.frameLayout4); frame4.Click += Frame4_Click; FrameLayout frame5 = FindViewById <FrameLayout>(Resource.Id.frameLayout5); frame5.Click += Frame5_Click; FrameLayout frame6 = FindViewById <FrameLayout>(Resource.Id.frameLayout6); frame5.Click += Frame6_Click; FrameLayout frame7 = FindViewById <FrameLayout>(Resource.Id.frameLayout7); frame5.Click += Frame7_Click; ImageButton imgButton1 = FindViewById <ImageButton>(Resource.Id.imageButton1); imgButton1.Click += Frame1_Click; ImageButton imgButton2 = FindViewById <ImageButton>(Resource.Id.imageButton2); imgButton2.Click += Frame2_Click; ImageButton imgButton3 = FindViewById <ImageButton>(Resource.Id.imageButton3); imgButton3.Click += Frame3_Click; ImageButton imgButton4 = FindViewById <ImageButton>(Resource.Id.imageButton4); imgButton4.Click += Frame4_Click; ImageButton imgButton5 = FindViewById <ImageButton>(Resource.Id.imageButton5); imgButton5.Click += Frame5_Click; ImageButton imgButton6 = FindViewById <ImageButton>(Resource.Id.imageButton6); imgButton6.Click += Frame6_Click; ImageButton imgButton7 = FindViewById <ImageButton>(Resource.Id.imageButton7); imgButton7.Click += Frame7_Click; TextView txtView1 = FindViewById <TextView>(Resource.Id.textView1); txtView1.Click += Frame1_Click; TextView txtView2 = FindViewById <TextView>(Resource.Id.textView2); txtView2.Click += Frame2_Click; TextView txtView3 = FindViewById <TextView>(Resource.Id.textView3); txtView3.Click += Frame3_Click; TextView txtView4 = FindViewById <TextView>(Resource.Id.textView4); txtView4.Click += Frame4_Click; TextView txtView5 = FindViewById <TextView>(Resource.Id.textView5); txtView5.Click += Frame5_Click; TextView txtView6 = FindViewById <TextView>(Resource.Id.textView6); txtView6.Click += Frame6_Click; TextView txtView7 = FindViewById <TextView>(Resource.Id.textView7); txtView7.Click += Frame7_Click; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Texture2D back = new Texture2D(graphics.GraphicsDevice, 1, 1); UInt32[] pixel = { 0xAA000000 }; back.SetData <UInt32>(pixel, 0, back.Width * back.Height); sl = new ScreenLayout(this, spriteBatch); var frame = new FrameLayout(this, spriteBatch); frame.LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Start, 0, 0, LayoutFilling.MatchViewport, LayoutFilling.MatchViewport); frame.Background = back; var frame2 = new FrameLayout(this, spriteBatch); frame2.LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Start, 0, 0, LayoutFilling.MatchViewport, LayoutFilling.WrapContent); frame2.Background = back; var b = new Button(this, spriteBatch) { LayoutParameters = new LayoutParameters(Gravity.Center, Gravity.Start) { Height = 300, Wight = 300 }, Background = back, Text = "ERTre", SpriteFont = Content.Load <SpriteFont>("sp") }; frame2.Views.Add(b); frame2.Views.Add(new Button(this, spriteBatch) { LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Start) { Wight = 100, Height = 100 }, Background = back, Text = "ERTre2", SpriteFont = Content.Load <SpriteFont>("sp") }); frame2.Views.Add(new Button(this, spriteBatch) { LayoutParameters = new LayoutParameters(Gravity.End, Gravity.Start) { Wight = 100, Height = 100 }, Background = back, Text = "ERTre2", SpriteFont = Content.Load <SpriteFont>("sp") }); var frame3 = new FrameLayout(this, spriteBatch); frame3.LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Center, 0, 0, LayoutFilling.MatchViewport, LayoutFilling.WrapContent) { Wight = 100, Height = 100 }; frame3.Background = back; frame3.Views.Add(new Button(this, spriteBatch) { LayoutParameters = new LayoutParameters(Gravity.Center, Gravity.Start) { Wight = 100, Height = 100 }, Background = back, Text = "ERTre", SpriteFont = Content.Load <SpriteFont>("sp") }); frame3.Views.Add(new Button(this, spriteBatch) { LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.Start) { Wight = 100, Height = 100 }, Background = back, Text = "ERTre2", SpriteFont = Content.Load <SpriteFont>("sp") }); frame3.Views.Add(new Button(this, spriteBatch) { LayoutParameters = new LayoutParameters(Gravity.End, Gravity.Start) { Wight = 100, Height = 100 }, Background = back, Text = "ERTre2", SpriteFont = Content.Load <SpriteFont>("sp") }); frame.Views.Add(frame2); frame.Views.Add(frame3); var hl = new ScrollView(this, spriteBatch) { LayoutParameters = new LayoutParameters(Gravity.Start, Gravity.End) { Height = 1000, LayoutFillingX = LayoutFilling.MatchViewport }, Background = back }; var bbb2 = new Button(this, spriteBatch) { Text = "test-", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15 }, SpriteFont = Content.Load <SpriteFont>("sp") }; bbb2.Click += (v) => { //hl.ContentOffestX -= 50; //hl.ApplyChanges(Point.Zero); }; hl.Views.Add(bbb2); var bbb = new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15 }, SpriteFont = Content.Load <SpriteFont>("sp") }; bbb.Click += (v) => { //hl.ContentOffestX += 50; //hl.ApplyChanges(Point.Zero); }; hl.Views.Add(bbb); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15, PaddingUp = 30 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 15, PaddingRight = 15 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5 }, SpriteFont = Content.Load <SpriteFont>("sp") }); hl.Views.Add(new Button(this, spriteBatch) { Text = "test+", Background = back, LayoutParameters = new LayoutParameters() { Wight = 200, Height = 200, PaddingLeft = 5, PaddingRight = 5 }, SpriteFont = Content.Load <SpriteFont>("sp") }); frame.Views.Add(hl); b.Click += button => { hl.Direction = hl.Direction == Direction.Horizontal ? Direction.Vertical : Direction.Horizontal; hl.ApplyChanges(Point.Zero); }; sl.Views.Add(frame); sl.ApplyChanges(Point.Zero); }
public override View GetSampleContent(Context context) { mainLayout = new LinearLayout(context); mainLayout.Orientation = Orientation.Vertical; mainLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); LinearLayout colorPalatte1 = new LinearLayout(context); height = context.Resources.DisplayMetrics.HeightPixels; width = context.Resources.DisplayMetrics.WidthPixels; density = context.Resources.DisplayMetrics.Density; dd = new DoodleDraw(context); TextView pickColor = new TextView(context); pickColor.Text = "Pick Color"; pickColor.TextSize = 20; pickColor.Left = (int)(5 * density); pickColor.SetTextColor(Color.Black); //mainLayout.AddView(pickColor); buttonCount = (int)(width / (35 * density)); for (int i = 0; i < buttonCount; i++) { RoundButton btn = new RoundButton(context, (30 * density), (30 * density), GetRandomColor(), dd); btn.LayoutParameters = new ViewGroup.LayoutParams((int)(30 * density), (int)(30 * density)); colorPalatte1.AddView(new TextView(context), new ViewGroup.LayoutParams((int)(5 * density), ViewGroup.LayoutParams.MatchParent)); colorPalatte1.AddView(btn); } colorPalatte1.SetBackgroundColor(Color.LightGray); colorPalatte1.SetPadding((int)(10 * density), (int)(10 * density), (int)(10 * density), (int)(10 * density)); colorPalatte1.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); mainLayout.AddView(colorPalatte1); dd.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); FrameLayout frame = new FrameLayout(context); frame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(0.80 * height)); frame.AddView(dd); mainLayout.AddView(frame); Typeface typeface = Typeface.CreateFromAsset(context.Assets, "Android.ttf"); Button touchDraw = new Button(context); touchDraw.Text = "Touch to draw"; touchDraw.SetTextColor(Color.Blue); touchDraw.SetBackgroundColor(Color.Transparent); touchDraw.TextSize = TypedValue.ApplyDimension(ComplexUnitType.Pt, 3, context.Resources.DisplayMetrics); frame.AddView(touchDraw, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.Center)); radialMenu = new SfRadialMenu(context); radialMenu.RimColor = Color.Transparent; FrameLayout penLayout = new FrameLayout(context); penLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView penImage = new ImageView(context); penImage.LayoutParameters = penLayout.LayoutParameters; penImage.SetImageResource(Resource.Drawable.green); penImage.SetScaleType(ImageView.ScaleType.FitXy); TextView penText = new TextView(context); penText.LayoutParameters = penLayout.LayoutParameters; penText.Text = "L"; penText.Typeface = typeface; penText.TextSize = 20; penText.TextAlignment = TextAlignment.Center; penText.Gravity = GravityFlags.Center; penText.SetTextColor(Color.White); penLayout.AddView(penImage); penLayout.AddView(penText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem pen = new SfRadialMenuItem(context) { View = penLayout, ItemWidth = 70, ItemHeight = 70 }; pen.ItemTapped += Pen_ItemTapped; radialMenu.Items.Add(pen); FrameLayout brushLayout = new FrameLayout(context); brushLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView brushImage = new ImageView(context); brushImage.LayoutParameters = brushLayout.LayoutParameters; brushImage.SetImageResource(Resource.Drawable.green); brushImage.SetScaleType(ImageView.ScaleType.FitXy); TextView brushText = new TextView(context); brushText.LayoutParameters = brushLayout.LayoutParameters; brushText.Text = "A"; brushText.Typeface = typeface; brushText.TextSize = 20; brushText.TextAlignment = TextAlignment.Center; brushText.Gravity = GravityFlags.Center; brushText.SetTextColor(Color.White); brushLayout.AddView(brushImage); brushLayout.AddView(brushText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem brush = new SfRadialMenuItem(context) { View = brushLayout, ItemWidth = 70, ItemHeight = 70 }; brush.SetBackgroundColor(Color.Transparent); brush.ItemTapped += Brush_ItemTapped;; radialMenu.Items.Add(brush); FrameLayout eraserLayout = new FrameLayout(context); eraserLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView eraserImage = new ImageView(context); eraserImage.LayoutParameters = eraserLayout.LayoutParameters; eraserImage.SetImageResource(Resource.Drawable.green); eraserImage.SetScaleType(ImageView.ScaleType.FitXy); TextView eraserText = new TextView(context); eraserText.LayoutParameters = eraserLayout.LayoutParameters; eraserText.Text = "R"; eraserText.Typeface = typeface; eraserText.TextSize = 20; eraserText.TextAlignment = TextAlignment.Center; eraserText.Gravity = GravityFlags.Center; eraserText.SetTextColor(Color.White); eraserLayout.AddView(eraserImage); eraserLayout.AddView(eraserText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem eraser = new SfRadialMenuItem(context) { View = eraserLayout, ItemWidth = 70, ItemHeight = 70 }; eraser.ItemTapped += Eraser_ItemTapped; eraser.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(eraser); FrameLayout clearLayout = new FrameLayout(context); clearLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView clearImage = new ImageView(context); clearImage.LayoutParameters = clearLayout.LayoutParameters; clearImage.SetImageResource(Resource.Drawable.green); clearImage.SetScaleType(ImageView.ScaleType.FitXy); TextView clearText = new TextView(context); clearText.LayoutParameters = clearLayout.LayoutParameters; clearText.Text = "Q"; clearText.Typeface = typeface; clearText.TextSize = 20; clearText.TextAlignment = TextAlignment.Center; clearText.Gravity = GravityFlags.Center; clearText.SetTextColor(Color.White); clearLayout.AddView(clearImage); clearLayout.AddView(clearText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem clear = new SfRadialMenuItem(context) { View = clearLayout, ItemWidth = 70, ItemHeight = 70 }; clear.ItemTapped += Clear_ItemTapped; clear.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(clear); FrameLayout thickLayout = new FrameLayout(context); thickLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView thickImage = new ImageView(context); thickImage.LayoutParameters = thickLayout.LayoutParameters; thickImage.SetImageResource(Resource.Drawable.green); thickImage.SetScaleType(ImageView.ScaleType.FitXy); TextView thickText = new TextView(context); thickText.LayoutParameters = thickLayout.LayoutParameters; thickText.Text = "G"; thickText.Typeface = typeface; thickText.TextSize = 20; brushText.TextAlignment = TextAlignment.Center; thickText.Gravity = GravityFlags.Center; thickText.SetTextColor(Color.White); thickLayout.AddView(thickImage); thickLayout.AddView(thickText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem thickBrush = new SfRadialMenuItem(context) { View = thickLayout, ItemWidth = 70, ItemHeight = 70 }; thickBrush.ItemTapped += ThickBrush_ItemTapped; thickBrush.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(thickBrush); FrameLayout paintBoxLayout = new FrameLayout(context); paintBoxLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView paintBoxImage = new ImageView(context); paintBoxImage.LayoutParameters = paintBoxLayout.LayoutParameters; paintBoxImage.SetImageResource(Resource.Drawable.green); paintBoxImage.SetScaleType(ImageView.ScaleType.FitXy); TextView paintBoxText = new TextView(context); paintBoxText.LayoutParameters = paintBoxLayout.LayoutParameters; paintBoxText.Text = "V"; paintBoxText.Typeface = typeface; paintBoxText.TextSize = 20; paintBoxText.TextAlignment = TextAlignment.Center; paintBoxText.Gravity = GravityFlags.Center; paintBoxText.SetTextColor(Color.White); paintBoxLayout.AddView(paintBoxImage); paintBoxLayout.AddView(paintBoxText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); SfRadialMenuItem paintBox = new SfRadialMenuItem(context) { View = paintBoxLayout, ItemWidth = 70, ItemHeight = 70 }; paintBox.ItemTapped += PaintBox_ItemTapped; paintBox.SetBackgroundColor(Color.Transparent); radialMenu.Items.Add(paintBox); FrameLayout menuLayout = new FrameLayout(context); menuLayout.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); ImageView menuImage = new ImageView(context); menuImage.LayoutParameters = menuLayout.LayoutParameters; menuImage.SetImageResource(Resource.Drawable.blue); menuImage.SetScaleType(ImageView.ScaleType.FitXy); TextView menuText = new TextView(context); menuText.LayoutParameters = new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent); menuText.Text = "U"; menuText.Typeface = typeface; menuText.TextSize = 40; menuText.TextAlignment = TextAlignment.Center; menuText.Gravity = GravityFlags.Center; menuText.SetTextColor(Color.White); menuLayout.AddView(menuImage); menuLayout.AddView(menuText, new ViewGroup.LayoutParams(FrameLayout.LayoutParams.MatchParent, FrameLayout.LayoutParams.MatchParent)); radialMenu.CenterButtonView = menuLayout; radialMenu.IsDragEnabled = false; radialMenu.OuterRimColor = Color.Transparent; radialMenu.CenterButtonRadius = 30; radialMenu.RimRadius = 100; radialMenu.SelectionColor = Color.Transparent; radialMenu.CenterButtonBackground = Color.Transparent; frame.AddView(radialMenu, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.Center)); radialMenu.Point = new Point(0, (int)(context.Resources.DisplayMetrics.HeightPixels / context.Resources.DisplayMetrics.Density / 3.5)); touchDraw.Click += (sender, e) => { touchDraw.Visibility = ViewStates.Gone; }; return(mainLayout); }
public static void Init(MaterialDialog dialog) { MaterialDialog.Builder builder = dialog.mBuilder; // Check if default library fonts should be used if (!builder.useCustomFonts) { if (builder.mediumFont == null) { builder.mediumFont = TypefaceHelper.Get(dialog.Context, "Roboto-Medium"); } if (builder.regularFont == null) { builder.regularFont = TypefaceHelper.Get(dialog.Context, "Roboto-Regular"); } } // Set cancelable flag and dialog background color dialog.SetCancelable(builder.cancelable); if (builder.backgroundColor == 0) { builder.backgroundColor = DialogUtils.ResolveColor(builder.context, Resource.Attribute.md_background_color); } if (builder.backgroundColor != 0) { dialog.view.SetBackgroundColor(builder.backgroundColor); } // Retrieve action button colors From theme attributes or the Builder builder.positiveColor = DialogUtils.ResolveColor(builder.context, Resource.Attribute.md_positive_color, builder.positiveColor); builder.neutralColor = DialogUtils.ResolveColor(builder.context, Resource.Attribute.md_neutral_color, builder.neutralColor); builder.negativeColor = DialogUtils.ResolveColor(builder.context, Resource.Attribute.md_negative_color, builder.negativeColor); // Retrieve references to views dialog.title = (TextView)dialog.view.FindViewById(Resource.Id.title); dialog.icon = (ImageView)dialog.view.FindViewById(Resource.Id.icon); dialog.titleFrame = dialog.view.FindViewById(Resource.Id.titleFrame); dialog.content = (TextView)dialog.view.FindViewById(Resource.Id.content); dialog.listView = (ListView)dialog.view.FindViewById(Resource.Id.contentListView); // Setup icon if (builder.icon != null) { dialog.icon.Visibility = ViewStates.Visible; dialog.icon.SetImageDrawable(builder.icon); } else { Drawable d = DialogUtils.ResolveDrawable(builder.context, Resource.Attribute.md_icon); if (d != null) { dialog.icon.Visibility = ViewStates.Visible; dialog.icon.SetImageDrawable(d); } else { dialog.icon.Visibility = ViewStates.Gone; } } // Setup icon size limiting int maxIconSize = builder.maxIconSize; if (maxIconSize == -1) { maxIconSize = DialogUtils.ResolveDimension(builder.context, Resource.Attribute.md_icon_max_size); } if (builder.limitIconToDefaultSize || DialogUtils.ResolveBoolean(builder.context, Resource.Attribute.md_icon_limit_icon_to_default_size)) { maxIconSize = builder.context.Resources.GetDimensionPixelSize(Resource.Dimension.md_icon_max_size); } if (maxIconSize > -1) { dialog.icon.SetAdjustViewBounds(true); dialog.icon.SetMaxHeight(maxIconSize); dialog.icon.SetMaxWidth(maxIconSize); dialog.icon.RequestLayout(); } // Setup title and title frame if (builder.title == null) { dialog.titleFrame.Visibility = ViewStates.Gone; } else { dialog.title.Text = builder.title; dialog.SetTypeface(dialog.title, builder.mediumFont); if (builder.titleColorSet) { dialog.title.SetTextColor(builder.titleColor); } else { int fallback = DialogUtils.ResolveColor(dialog.Context, Android.Resource.Attribute.TextColorPrimary); dialog.title.SetTextColor(DialogUtils.ResolveColor(dialog.Context, Resource.Attribute.md_title_color, fallback)); } dialog.title.Gravity = MaterialDialog.GravityIntToGravity(builder.titleGravity); } // Setup content if (dialog.content != null) { dialog.content.Text = builder.content; dialog.content.MovementMethod = new LinkMovementMethod(); dialog.SetTypeface(dialog.content, builder.regularFont); dialog.content.SetLineSpacing(0f, builder.contentLineSpacingMultiplier); if (builder.positiveColor == 0) { dialog.content.SetLinkTextColor(DialogUtils.ResolveColor(dialog.Context, Android.Resource.Attribute.TextColorPrimary)); } else { dialog.content.SetLinkTextColor(builder.positiveColor); } dialog.content.Gravity = MaterialDialog.GravityIntToGravity(builder.contentGravity); if (builder.contentColorSet) { dialog.content.SetTextColor(builder.contentColor); } else { int fallback = DialogUtils.ResolveColor(dialog.Context, Android.Resource.Attribute.TextColorSecondary); Color contentColor = DialogUtils.ResolveColor(dialog.Context, Resource.Attribute.md_content_color, fallback); dialog.content.SetTextColor(contentColor); } } // Load default list item text color if (builder.itemColorSet) { dialog.defaultItemColor = builder.itemColor; } else if (builder.theme == DialogTheme.LIGHT) { dialog.defaultItemColor = Color.Black; } else { dialog.defaultItemColor = Color.White; } // Setup list dialog stuff if (builder.listCallbackMultiChoice != null) { dialog.selectedIndicesList = new List <int>(); } if (dialog.listView != null && (builder.items != null && builder.items.Length > 0 || builder.adapter != null)) { dialog.listView.Selector = dialog.ListSelector; if (builder.title != null) { // Cancel out top padding if there's a title dialog.listView.SetPadding(dialog.listView.PaddingLeft, 0, dialog.listView.PaddingRight, dialog.listView.PaddingBottom); } if (dialog.HasActionButtons()) { // No bottom padding if there's action buttons dialog.listView.SetPadding(dialog.listView.PaddingLeft, 0, dialog.listView.PaddingRight, 0); } // No custom adapter specified, setup the list with a MaterialDialogAdapter. // Which supports regular lists and single/multi choice dialogs. if (builder.adapter == null) { // Determine list type if (builder.listCallbackSingleChoice != null) { dialog.listType = ListType.SINGLE; } else if (builder.listCallbackMultiChoice != null) { dialog.listType = ListType.MULTI; if (builder.selectedIndices != null) { dialog.selectedIndicesList = builder.selectedIndices.ToList(); } } else { dialog.listType = ListType.REGULAR; } builder.adapter = new MaterialDialogAdapter(dialog, GetLayoutForType(dialog.listType), Resource.Id.title, builder.items); } } // Setup progress dialog stuff if needed SetupProgressDialog(dialog); if (builder.customView != null) { dialog.InvalidateCustomViewAssociations(); FrameLayout frame = (FrameLayout)dialog.view.FindViewById(Resource.Id.customViewFrame); dialog.customViewFrame = frame; View innerView = builder.customView; if (builder.wrapCustomViewInScroll) { /* Apply the frame padding to the content, this allows the ScrollView to draw it's * overscroll glow without clipping */ Resources r = dialog.Context.Resources; int framePadding = r.GetDimensionPixelSize(Resource.Dimension.md_dialog_frame_margin); ScrollView sv = new ScrollView(dialog.Context); int paddingTop; int paddingBottom; if (dialog.titleFrame.Visibility != ViewStates.Gone) { paddingTop = r.GetDimensionPixelSize(Resource.Dimension.md_content_vertical_padding); } else { paddingTop = r.GetDimensionPixelSize(Resource.Dimension.md_dialog_frame_margin); } if (dialog.HasActionButtons()) { paddingBottom = r.GetDimensionPixelSize(Resource.Dimension.md_content_vertical_padding); } else { paddingBottom = r.GetDimensionPixelSize(Resource.Dimension.md_dialog_frame_margin); } sv.SetClipToPadding(false); if (innerView is EditText) { // Setting padding to an EditText causes visual errors, set it to the parent instead sv.SetPadding(framePadding, paddingTop, framePadding, paddingBottom); } else { // Setting padding to scroll view pushes the scroll bars out, don't do it if not necessary (like above) sv.SetPadding(0, paddingTop, 0, paddingBottom); innerView.SetPadding(framePadding, 0, framePadding, 0); } sv.AddView(innerView, new ScrollView.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); innerView = sv; } frame.AddView(innerView, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); } else { dialog.InvalidateCustomViewAssociations(); } // Setup user listeners if (builder.showListener != null) { dialog.SetOnShowListener(builder.showListener); } if (builder.cancelListener != null) { dialog.SetOnCancelListener(builder.cancelListener); } if (builder.dismissListener != null) { dialog.SetOnDismissListener(builder.dismissListener); } if (builder.keyListener != null) { dialog.SetOnKeyListener(builder.keyListener); } // Other internal initialization dialog.UpdateFramePadding(); dialog.InvalidateActions(); dialog._setOnShowListenerInternal(); dialog._setViewInternal(dialog.view); dialog.view.ViewTreeObserver.GlobalLayout += (sender, e) => { if (dialog.view.MeasuredWidth > 0) { dialog.InvalidateCustomViewAssociations(); } }; // Gingerbread compatibility stuff if (builder.theme == DialogTheme.LIGHT && Build.VERSION.SdkInt <= BuildVersionCodes.GingerbreadMr1) { try { dialog.SetInverseBackgroundForced(true); if (!builder.titleColorSet) { dialog.title.SetTextColor(Color.Black); } if (!builder.contentColorSet) { dialog.content.SetTextColor(Color.Black); } } catch (System.Exception e) { Console.WriteLine(e.Message); } } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (FrameLayout)inflater.Inflate(Resource.Layout.photogallery_example, container, false); int viewCount = ROWS * COLS; for (int i = 0; i < viewCount; i++) { int j = i; // Create the View. ImageView imageView = new ImageView(this.Activity); mImageViews.Add(imageView); mRootView.AddView(imageView); imageView.Alpha = 1f; imageView.SetBackgroundColor(randomColor()); imageView.SetLayerType(LayerType.Hardware, null); // Add an image for each view. int res = Resources.GetIdentifier("d" + (i % 11 + 1), "drawable", Activity.ApplicationContext.PackageName); imageView.SetScaleType(ImageView.ScaleType.CenterCrop); imageView.SetImageResource(res); // Add a click listener to handle scaling up the view. imageView.Click += (sender, e) => { int endValue = mSpring.EndValue == 0 ? 1 : 0; imageView.BringToFront(); mActiveIndex = j; mSpring.SetEndValue(endValue); }; } //mSpring.AddListener(new SpringImitator(mSpring)); //mRootView.ViewTreeObserver.GlobalLayout += (sender, e) => //{ // layout(mRootView); // mRootView.ViewTreeObserver.GlobalLayout += null; //}; float width = mRootView.Width; float height = mRootView.Height; // Determine the size for each image given the screen dimensions. mPadding = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 3, Resources.DisplayMetrics); int colWidth = (int)Math.Ceiling((width - 2 * mPadding) / COLS) - 2 * mPadding; int rowHeight = (int)Math.Ceiling((height - 2 * mPadding) / ROWS) - 2 * mPadding; // Determine the resting position for each view. int k = 0; int py = 0; for (int ii = 0; ii < ROWS; ii++) { int px = 0; py += mPadding * 2; for (int jj = 0; jj < COLS; jj++) { px += mPadding * 2; ImageView iv = mImageViews[k]; // imageView.LayoutParameters = new ViewGroup.MarginLayoutParams(colWidth, rowHeight); iv.LayoutParameters = new FrameLayout.LayoutParams(colWidth, rowHeight); mPositions.Add(new Point(px, py)); px += colWidth; k++; } py += rowHeight; } render(); // // Wait for layout. // getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { // @Override // public void onGlobalLayout() // { // layout(); // getViewTreeObserver().removeOnGlobalLayoutListener(this); // postOnAnimationDelayed(new Runnable() { // @Override // public void run() // { // mSpringChain.setControlSpringIndex(0).getControlSpring().setEndValue(1); // } //}, 500); // } //}); // Add a spring to the SpringChain to do an entry animation. // mSpringChain.addSpring(new SimpleSpringListener() // { // @Override // public void onSpringUpdate(Spring spring) // { // render(); // } //}); return(mRootView); }
protected override void OnCreate(Bundle savedInstanceState) { SetTheme(Resource.Style.AppThemeClearStatusBar); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_camera); //CrashLytics Fabric.Fabric.With(this, new Crashlytics.Crashlytics()); Crashlytics.Crashlytics.HandleManagedExceptions(); RequestPermissions(permissions, 0); if (Resources.Configuration.Orientation == Android.Content.Res.Orientation.Landscape) { RequestedOrientation = ScreenOrientation.Portrait; } toggleFlashButton = FindViewById <ImageButton>(Resource.Id.toggleFlashButton); takePictureButton = FindViewById <Button>(Resource.Id.takePictureButton); openGalleryButton = FindViewById <ImageButton>(Resource.Id.openGalleryButton); openDefaultCameraButton = FindViewById <ImageButton>(Resource.Id.openDefaultCamera); cameraPreview = FindViewById <FrameLayout>(Resource.Id.cameraView); imageManager = new ImageManager(); imageManager.AddOnImageResultListener(delegate(Bitmap bitmap, string path, Exception ex) { if (path != null) { StopCamera(); Intent intent = new Intent(this, typeof(MainViewActivity)); intent.PutExtra("image", path); StartActivity(intent); } else if (ex != null) { Toast.MakeText(Application.Context, ex.Message, ToastLength.Short).Show(); StartCamera(); } else { StartCamera(); } }); //Выбор режима activity на весь экран if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Kitkat) { Window w = Window; w.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); } takePictureButton.Click += delegate { TakePicture(); }; toggleFlashButton.Click += delegate { ToggleFlash(); }; openGalleryButton.Click += delegate { imageManager.PickPhoto(); }; openDefaultCameraButton.Click += delegate { StopCamera(); imageManager.TakePhoto(); }; //Отслеживание смены угла экрана orientationListener = new OrientationListener(this, delegate(int angle) { if (lastAngle != angle) { if (lastAngle == -90 && angle == 180) { angle = -180; } toggleFlashButton.Animate().Rotation(angle).Start(); openGalleryButton.Animate().Rotation(angle).Start(); openDefaultCameraButton.Animate().Rotation(angle).Start(); if (angle == -180) { lastAngle = 180; } else { lastAngle = angle; } } }); }
public static void getTiles(LinearLayout parent) { UserTiles = new List <LinearLayout>(); int pixelDensity = (int)Android.Content.Res.Resources.System.DisplayMetrics.Density; _seekbars = new List <SeekBar>(); foreach (User user in Controller._users) { _currentUser = user; ContextThemeWrapper allocationUserTileContext = new ContextThemeWrapper(parent.Context, Resource.Style.AllocationUserTileLayoutStyle); LinearLayout User = new LinearLayout(allocationUserTileContext); User.Orientation = Orientation.Vertical; User.Id = Int32.Parse(user.UID); ContextThemeWrapper TextLayoutContext = new ContextThemeWrapper(parent.Context, Resource.Style.UserTextLayoutStyle); FrameLayout UserDetailsTextLayout = new FrameLayout(TextLayoutContext); ContextThemeWrapper userNameContext = new ContextThemeWrapper(UserDetailsTextLayout.Context, Resource.Style.UserTextLeftAlignText); TextView UserName = new TextView(userNameContext); UserName.Text = user.Name.FirstName; ContextThemeWrapper userAllocatedContext = new ContextThemeWrapper(UserDetailsTextLayout.Context, Resource.Style.UserTextRightAlignText); TextView Allocated = new TextView(userAllocatedContext); Allocated.Text = string.Format(StringConstants.Localizable.DataAmount, Math.Round(user.Allocated, 2)); ContextThemeWrapper userAllocatedSliderContext = new ContextThemeWrapper(UserDetailsTextLayout.Context, Resource.Style.UserAllocationSliderStyle); SeekBar userAllocationSlider = new SeekBar(userAllocatedSliderContext, null, Resource.Style.UserAllocationSliderStyle); userAllocationSlider.Max = ((int)Controller._planDataPool + (int)Controller._addOns) * 10; userAllocationSlider.Id = Int32.Parse(user.UID); userAllocationSlider.SecondaryProgress = (int)((user.Used / (Controller._planDataPool + Controller._addOns)) * userAllocationSlider.Max); _seekbars.Add(userAllocationSlider); _seekbars.ForEach(x => totalAllocated += (((double)x.Progress / userAllocationSlider.Max) * Controller._planDataPool)); unallocated = Controller._planDataPool - totalAllocated + Controller._addOns; double progress = (user.Allocated / (Controller._planDataPool + Controller._addOns)) * userAllocationSlider.Max; userAllocationSlider.Progress = (int)(progress); userAllocationSlider.ProgressChanged += (object sender, SeekBar.ProgressChangedEventArgs e) => { if (e.FromUser) { userAllocationSlider.Max = ((int)Controller._planDataPool + (int)Controller._addOns) * 10; userAllocationSlider.SecondaryProgress = (int)((user.Used / (Controller._planDataPool + Controller._addOns)) * userAllocationSlider.Max); totalAllocated = unallocated = 0; _seekbars.ForEach(x => totalAllocated += (((double)x.Progress / userAllocationSlider.Max) * (Controller._planDataPool + Controller._addOns))); unallocated = Controller._planDataPool - totalAllocated + Controller._addOns; double progressChanged = ((double)e.Progress / userAllocationSlider.Max) * (Controller._planDataPool + Controller._addOns); List <double> allocatedInProportion = new List <double>(); _seekbars.ForEach(x => allocatedInProportion.Add(x.Progress)); List <double> allocatedInGB = new List <double>(); allocatedInProportion.ForEach(x => allocatedInGB.Add((x / userAllocationSlider.Max) * (Controller._planDataPool + Controller._addOns))); double sumAllocatedInGB = allocatedInGB.Sum(); double reservedData = (Controller._planDataPool - sumAllocatedInGB) + Controller._addOns; reservedData = Math.Round(reservedData, 2); double reservedToProgress = ((reservedData / (Controller._planDataPool + Controller._addOns)) * userAllocationSlider.Max); double max = e.Progress + reservedToProgress; if (progressChanged <= user.Used) { progressChanged = user.Used; Allocated.Text = string.Format(StringConstants.Localizable.DataAmount, Math.Round(progressChanged, 2)); _seekbars[_seekbars.IndexOf(userAllocationSlider)].Progress = (int)(Math.Round((user.Used / (Controller._planDataPool + Controller._addOns)) * userAllocationSlider.Max, 2)); } else if (e.Progress >= max) { progressChanged = ((double)(e.Progress + reservedToProgress) / userAllocationSlider.Max) * (Controller._planDataPool + Controller._addOns); Allocated.Text = string.Format(StringConstants.Localizable.DataAmount, Math.Round(progressChanged, 2)); _seekbars[_seekbars.IndexOf(userAllocationSlider)].Progress = (int)(Math.Round((progressChanged / (Controller._planDataPool + Controller._addOns)) * userAllocationSlider.Max, 2)); } else { Allocated.Text = string.Format(StringConstants.Localizable.DataAmount, Math.Round(progressChanged, 2)); _seekbars[_seekbars.IndexOf(userAllocationSlider)].Progress = e.Progress; } totalAllocated = unallocated = 0; _seekbars.ForEach(x => totalAllocated += (((double)x.Progress / userAllocationSlider.Max) * (Controller._planDataPool + Controller._addOns))); unallocated = Controller._planDataPool - totalAllocated + Controller._addOns; allocatedInProportion.Clear(); _seekbars.ForEach(x => allocatedInProportion.Add(x.Progress)); allocatedInGB.Clear(); allocatedInProportion.ForEach(x => allocatedInGB.Add((x / userAllocationSlider.Max) * (Controller._planDataPool + Controller._addOns))); sumAllocatedInGB = allocatedInGB.Sum(); reservedData = Controller._planDataPool - sumAllocatedInGB + Controller._addOns; AllocationPageView._remainingDataAmount.Text = String.Format(StringConstants.Localizable.DataAmount, Math.Round(reservedData, 2)); unallocated = (int)Controller._planDataPool - (int)sumAllocatedInGB + Controller._addOns; } }; parent.AddView(User); User.AddView(UserDetailsTextLayout); UserDetailsTextLayout.AddView(UserName); UserDetailsTextLayout.AddView(Allocated); User.AddView(userAllocationSlider); UserTiles.Add(User); } }
private void MainLayout() { ArrayAdapter <String> experienceAdapter = new ArrayAdapter <String>(con, Android.Resource.Layout.SimpleListItem1, Experience); experienceSpinner.Adapter = experienceAdapter; experienceSpinner.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, con.Resources.GetDimensionPixelSize(Resource.Dimension.auto_picker_ht)); //mainLayout LinearLayout mainLayout = new LinearLayout(con); mainLayout.SetPadding(20, 20, 20, 30); mainLayout.SetBackgroundColor(Color.White); mainLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.6), GravityFlags.Top | GravityFlags.CenterHorizontal); mainLayout.Orientation = Orientation.Vertical; mainLayout.AddView(jobSearchLabel); mainLayout.AddView(jobSearchLabelSpacing); mainLayout.AddView(countryLabel); mainLayout.AddView(countryLabelSpacing); mainLayout.AddView(countryNameAutoComplete); mainLayout.AddView(countryAutoCompleteSpacing); mainLayout.AddView(jobFieldLabel); mainLayout.AddView(jobFieldLabelSpacing); mainLayout.AddView(jobFieldAutoComplete); mainLayout.AddView(jobFieldAutoCompleteSpacing); mainLayout.AddView(experienceLabel); mainLayout.AddView(experienceLabelSpacing); mainLayout.AddView(experienceSpinner); mainLayout.AddView(experienceSpinnerSpacing); mainLayout.AddView(searchButtonSpacing); mainLayout.AddView(searchButton); mainLayout.Touch += (object sender, View.TouchEventArgs e) => { if (countryNameAutoComplete.IsFocused || jobFieldAutoComplete.IsFocused) { Rect outRect = new Rect(); countryNameAutoComplete.GetGlobalVisibleRect(outRect); jobFieldAutoComplete.GetGlobalVisibleRect(outRect); if (!outRect.Contains((int)e.Event.RawX, (int)e.Event.RawY)) { countryNameAutoComplete.ClearFocus(); jobFieldAutoComplete.ClearFocus(); } } hideSoftKeyboard((Activity)con); }; frame.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); frame.SetBackgroundColor(Color.White); frame.SetPadding(10, 10, 10, 10); //scrollView1 ScrollView scrollView1 = new ScrollView(con); scrollView1.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.6), GravityFlags.Top | GravityFlags.CenterHorizontal); scrollView1.AddView(mainLayout); frame.AddView(scrollView1); //buttomButtonLayout buttomButtonLayout = new FrameLayout(con); buttomButtonLayout.SetBackgroundColor(Color.Transparent); buttomButtonLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.1), GravityFlags.Bottom | GravityFlags.CenterHorizontal); //propertyButton propertyButton = new Button(con); propertyButton.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent, GravityFlags.Bottom | GravityFlags.CenterHorizontal); propertyButton.Text = "OPTIONS"; propertyButton.Gravity = GravityFlags.Start; propertyFrameLayout = new FrameLayout(con); propertyFrameLayout.SetBackgroundColor(Color.Rgb(236, 236, 236)); propertyFrameLayout.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.4), GravityFlags.CenterHorizontal); propertyFrameLayout.AddView(GetPropertyLayout(con)); //propertyButton Click Listener propertyButton.Click += (object sender, EventArgs e) => { buttomButtonLayout.RemoveAllViews(); propertyFrameLayout.RemoveAllViews(); countryNameAutoComplete.ClearFocus(); jobFieldAutoComplete.ClearFocus(); scrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.4), GravityFlags.Bottom | GravityFlags.CenterHorizontal); propertyFrameLayout.AddView(GetPropertyLayout(con)); }; //scrollView scrollView = new ScrollView(con); scrollView.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int)(totalHeight * 0.4), GravityFlags.Bottom | GravityFlags.CenterHorizontal); scrollView.AddView(propertyFrameLayout); frame.AddView(scrollView); frame.AddView(buttomButtonLayout); frame.FocusableInTouchMode = true; }
private void Init() { RemoveAllViews(); Orientation = Orientation.Horizontal; LayoutParams lp = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); lp.Gravity = GravityFlags.CenterVertical; LayoutParameters = lp; cardImageLayout = new FrameLayout(Context); LayoutParams cardImageLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); cardImageLayoutParams.Gravity = GravityFlags.CenterVertical; cardImageLayout.LayoutParameters = cardImageLayoutParams; cardImageLayout.SetPadding(0, 0, UiUtils.ToPixels(Context, 8), 0); SetCardImageWithoutAnimation(Resource.Drawable.ic_card_cv2); cv2TextView = new CV2TextView(Context); LayoutParams parameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); parameters.Weight = 1; parameters.Gravity = GravityFlags.Center; NeededCVTwoLength = (CurrentCard != CardType.AMEX ? 3 : 4); cv2TextView.LayoutParameters = parameters; cv2TextView.OnEntryComplete += cardNumber => { Complete = true; if (OnCreditCardEntered != null) { OnCreditCardEntered(cardNumber); } }; cv2TextView.OnProgress += position => { if (position < (NeededCVTwoLength + 6)) { if (Complete) { Complete = false; } } }; LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent); textViewLayoutParams.Gravity = GravityFlags.Center; last4CCNosTextView = new TextView(Context); last4CCNosTextView.Gravity = GravityFlags.Center; last4CCNosTextView.Text = "0000"; last4CCNosTextView.LayoutParameters = textViewLayoutParams; last4CCNosTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal); last4CCNosTextView.TextSize = 18; last4CCNosTextView.SetTextColor(Resources.GetColor(Resource.Color.normal_text)); last4CCNosTextView.Focusable = false; last4CCNosTextView.Enabled = false; last4CCNosTextView.SetSingleLine(); last4CCNosTextView.SetBackgroundDrawable(null); AddView(cardImageLayout); AddView(last4CCNosTextView); AddView(cv2TextView); }
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); 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 FlashBarController(View parentView) { layout = parentView.FindViewById <FrameLayout> (Resource.Id.FlashBarLayout); text = parentView.FindViewById <TextView> (Resource.Id.FlashBarText); }
public Task <string> DisplayPromptAync(string title = null, string description = null, string text = null, string okButtonText = null, string cancelButtonText = null, bool numericKeyboard = false, bool autofocus = true, bool password = false) { var activity = (MainActivity)CrossCurrentActivity.Current.Activity; if (activity == null) { return(Task.FromResult <string>(null)); } var alertBuilder = new AlertDialog.Builder(activity); alertBuilder.SetTitle(title); alertBuilder.SetMessage(description); var input = new EditText(activity) { InputType = InputTypes.ClassText }; if (text == null) { text = string.Empty; } if (numericKeyboard) { input.InputType = InputTypes.ClassNumber | InputTypes.NumberFlagDecimal | InputTypes.NumberFlagSigned; #pragma warning disable CS0618 // Type or member is obsolete input.KeyListener = DigitsKeyListener.GetInstance(false, false); #pragma warning restore CS0618 // Type or member is obsolete } if (password) { input.InputType = InputTypes.TextVariationPassword | InputTypes.ClassText; } input.ImeOptions = input.ImeOptions | (ImeAction)ImeFlags.NoPersonalizedLearning | (ImeAction)ImeFlags.NoExtractUi; input.Text = text; input.SetSelection(text.Length); var container = new FrameLayout(activity); var lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.MatchParent); lp.SetMargins(25, 0, 25, 0); input.LayoutParameters = lp; container.AddView(input); alertBuilder.SetView(container); okButtonText = okButtonText ?? AppResources.Ok; cancelButtonText = cancelButtonText ?? AppResources.Cancel; var result = new TaskCompletionSource <string>(); alertBuilder.SetPositiveButton(okButtonText, (sender, args) => result.TrySetResult(input.Text ?? string.Empty)); alertBuilder.SetNegativeButton(cancelButtonText, (sender, args) => result.TrySetResult(null)); var alert = alertBuilder.Create(); alert.Window.SetSoftInputMode(Android.Views.SoftInput.StateVisible); alert.Show(); if (autofocus) { input.RequestFocus(); } return(result.Task); }
public void Dispose() { if (calendar != null) { calendar.DrawMonthCell -= Calendar_DrawMonthCell; calendar.Dispose(); calendar = null; } if (viewModetxt != null) { viewModetxt.Dispose(); viewModetxt = null; } if (modeSpinner != null) { modeSpinner.Dispose(); modeSpinner = null; } if (spaceAdder1 != null) { spaceAdder1.Dispose(); spaceAdder1 = null; } if (spaceAdder2 != null) { spaceAdder2.Dispose(); spaceAdder2 = null; } if (minDate != null) { minDate.Dispose(); minDate = null; } if (maxDate != null) { maxDate.Dispose(); maxDate = null; } if (minPick != null) { minPick.Dispose(); minPick = null; } if (maxPick != null) { maxPick.Dispose(); maxPick = null; } if (minDateButton != null) { minDateButton.Dispose(); minDateButton = null; } if (maxDateButton != null) { maxDateButton.Dispose(); maxDateButton = null; } if (mainView != null) { mainView.Dispose(); mainView = null; } if (propertylayout != null) { propertylayout.Dispose(); propertylayout = null; } if (minDatePicker != null) { minDatePicker.Dispose(); minDatePicker = null; } if (maxDatePicker != null) { maxDatePicker.Dispose(); maxDatePicker = null; } if (underMaxSeparatorLayoutParam != null) { underMaxSeparatorLayoutParam.Dispose(); underMaxSeparatorLayoutParam = null; } if (minMaxSeparatorLayoutParam != null) { minMaxSeparatorLayoutParam.Dispose(); minMaxSeparatorLayoutParam = null; } if (dataAdapter != null) { dataAdapter.Dispose(); dataAdapter = null; } if (underMaxSeparator != null) { underMaxSeparator.Dispose(); underMaxSeparator = null; } if (minMaxSeparator != null) { minMaxSeparator.Dispose(); minMaxSeparator = null; } }
public View GetSampleContent(Context con) { SamplePageContent(con); FrameLayout mainFrameLayout = new FrameLayout(con); FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, GravityFlags.FillVertical); mainFrameLayout.LayoutParameters = layoutParams; //PrincipalAmountNumericTextBox principalAmountNumericTextBox = new SfNumericTextBox(con); principalAmountNumericTextBox.FormatString = "C"; principalAmountNumericTextBox.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight); principalAmountNumericTextBox.Value = 1000; principalAmountNumericTextBox.AllowNull = true; principalAmountNumericTextBox.Watermark = "Principal Amount"; principalAmountNumericTextBox.MaximumNumberDecimalDigits = 2; var culture = new Java.Util.Locale("en", "US"); principalAmountNumericTextBox.CultureInfo = culture; principalAmountNumericTextBox.ValueChangeMode = ValueChangeMode.OnKeyFocus; //InterestNumericTextBox interestNumericTextBox = new SfNumericTextBox(con); interestNumericTextBox.FormatString = "P"; interestNumericTextBox.Value = 0.1; interestNumericTextBox.PercentDisplayMode = PercentDisplayMode.Compute; interestNumericTextBox.MaximumNumberDecimalDigits = 2; interestNumericTextBox.ValueChangeMode = ValueChangeMode.OnKeyFocus; interestNumericTextBox.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight); interestNumericTextBox.Watermark = "Rate of Interest"; interestNumericTextBox.AllowNull = true; interestNumericTextBox.CultureInfo = culture; //PeriodValueNumericTextBox periodValueNumericTextBox = new SfNumericTextBox(con); periodValueNumericTextBox.FormatString = " years"; periodValueNumericTextBox.Value = 20; periodValueNumericTextBox.MaximumNumberDecimalDigits = 0; periodValueNumericTextBox.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight); periodValueNumericTextBox.Watermark = "Period (in years)"; periodValueNumericTextBox.ValueChangeMode = ValueChangeMode.OnKeyFocus; periodValueNumericTextBox.CultureInfo = culture; periodValueNumericTextBox.AllowNull = true; //OutputNumberTextBox outputNumberTextBox = new SfNumericTextBox(con); outputNumberTextBox.FormatString = "c"; outputNumberTextBox.MaximumNumberDecimalDigits = 0; outputNumberTextBox.AllowNull = true; outputNumberTextBox.CultureInfo = culture; outputNumberTextBox.Watermark = "Enter Values"; outputNumberTextBox.Clickable = false; outputNumberTextBox.Value = (float)(1000 * 0.1 * 20); outputNumberTextBox.Enabled = false; outputNumberTextBox.LayoutParameters = new ViewGroup.LayoutParams(width / 2, numerHeight); outputNumberTextBox.ValueChangeMode = ValueChangeMode.OnLostFocus; //Numerictextbox Value Changed Listener principalAmountNumericTextBox.ValueChanged += (object sender, ValueChangedEventArgs e) => { if (e.Value != null && periodValueNumericTextBox.Value != null && interestNumericTextBox.Value != null) { outputNumberTextBox.Value = Double.Parse(e.Value.ToString()) * Double.Parse(periodValueNumericTextBox.Value.ToString()) * Double.Parse(interestNumericTextBox.Value.ToString()); } }; periodValueNumericTextBox.ValueChanged += (object sender, ValueChangedEventArgs e) => { if (e.Value != null && principalAmountNumericTextBox.Value != null && interestNumericTextBox.Value != null) { outputNumberTextBox.Value = Double.Parse(e.Value.ToString()) * Double.Parse(principalAmountNumericTextBox.Value.ToString()) * Double.Parse(interestNumericTextBox.Value.ToString()); } }; interestNumericTextBox.ValueChanged += (object sender, ValueChangedEventArgs e) => { if (e.Value != null && principalAmountNumericTextBox.Value != null && periodValueNumericTextBox.Value != null) { outputNumberTextBox.Value = Double.Parse(e.Value.ToString()) * Double.Parse(principalAmountNumericTextBox.Value.ToString()) * Double.Parse(periodValueNumericTextBox.Value.ToString()); } }; mainFrameLayout.AddView(GetView(con)); ScrollView mainScrollView = new ScrollView(con); mainScrollView.AddView(mainFrameLayout); return(mainScrollView); }