private void UpdateBackgroundSize() { ViewGroup.LayoutParams @params = mBackgroundLayout.LayoutParameters; @params.Width = Helper.DpToPixel(mWidth, Context); @params.Height = Helper.DpToPixel(mHeight, Context); mBackgroundLayout.LayoutParameters = @params; }
public void UpdateUi(ViewCell viewCell, object dataContext, HorizontalViewNative view) { var contentLayout = (FrameLayout)ItemView; viewCell.BindingContext = dataContext; viewCell.Parent = view; var metrics = Resources.System.DisplayMetrics; var height = (int)((view.ItemHeight + viewCell.View.Margin.Top + viewCell.View.Margin.Bottom) * metrics.Density); var width = (int)((view.ItemWidth + viewCell.View.Margin.Left + viewCell.View.Margin.Right) * metrics.Density); viewCell.View.Layout(new Rectangle(0, 0, view.ItemWidth, view.ItemHeight)); // Layout Android View var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent) { Height = height, Width = width }; if (Platform.GetRenderer(viewCell.View) == null) { Platform.SetRenderer(viewCell.View, Platform.CreateRenderer(viewCell.View)); } var renderer = Platform.GetRenderer(viewCell.View); var viewGroup = renderer.View; viewGroup.LayoutParameters = layoutParams; viewGroup.Layout(0, 0, width, height); contentLayout.RemoveAllViews(); contentLayout.AddView(viewGroup); }
public void setGridViewHeightBasedOnChildren(GridView gridView, int columns) { IListAdapter listAdapter = gridView.Adapter; if (listAdapter == null) { // pre-condition return; } int totalHeight = 0; int items = listAdapter.Count; int rows = 0; View listItem = listAdapter.GetView(0, null, gridView); listItem.Measure(0, 0); totalHeight = listItem.MeasuredHeight; float x = 1; if (items > columns) { x = items / columns; rows = (int)(x + 1); totalHeight *= rows; } ViewGroup.LayoutParams parameters = gridView.LayoutParameters; parameters.Height = totalHeight; gridView.LayoutParameters = parameters; }
private void ConfigurarAlturaListView() { var listAdapter = _listView.Adapter; if (listAdapter == null) { return; } int desiredWidth = View.MeasureSpec.MakeMeasureSpec(_listView.Width, MeasureSpecMode.Unspecified); int totalHeight = 0; View view = null; for (int i = 0; i < listAdapter.Count; i++) { view = listAdapter.GetView(i, view, _listView); if (i == 0) { view.LayoutParameters = (new ViewGroup.LayoutParams(desiredWidth, WindowManagerLayoutParams.WrapContent)); } view.Measure(desiredWidth, (int)MeasureSpecMode.Unspecified); totalHeight += view.MeasuredHeight; } ViewGroup.LayoutParams prm = _listView.LayoutParameters; prm.Height = totalHeight + (_listView.DividerHeight * (listAdapter.Count - 1)); _listView.LayoutParameters = prm; }
public void setListViewHeightBasedOnChildren1(ListView listView1) { reviewAdapter listAdapter = (reviewAdapter)listView1.Adapter; if (listAdapter == null) { return; } int desiredWidth = View.MeasureSpec.MakeMeasureSpec(listView1.Width, MeasureSpecMode.Unspecified); int heightMeasureSpec = View.MeasureSpec.MakeMeasureSpec(ViewGroup.LayoutParams.WrapContent, MeasureSpecMode.Exactly); int totalHeight = 0; View view = null; for (int i = 0; i < listAdapter.Count; i++) { view = listAdapter.GetView(i, view, listView1); if (i == 0) { view.LayoutParameters = new ViewGroup.LayoutParams(desiredWidth, WindowManagerLayoutParams.WrapContent); } view.Measure(desiredWidth, heightMeasureSpec); totalHeight += view.MeasuredHeight; } ViewGroup.LayoutParams params1 = listView1.LayoutParameters; params1.Height = totalHeight + (listView1.DividerHeight * (listAdapter.Count - 1)); listView1.LayoutParameters = params1; }
/// <summary> /// This method initiates the bottomNavigationBar and handles layout related values /// </summary> private void init() { // MarginLayoutParams marginParams = new ViewGroup.MarginLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, (int) getContext().getResources().GetDimension(Resource.Dimension.bottom_navigation_padded_height))); // marginParams.setMargins(0, (int) getContext().getResources().GetDimension(Resource.Dimension.bottom_navigation_top_margin_correction), 0, 0); LayoutParameters = new ViewGroup.LayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); LayoutInflater inflater = LayoutInflater.From(Context); View parentView = inflater.Inflate(Resource.Layout.bottom_navigation_bar_container, this, true); mBackgroundOverlay = (FrameLayout)parentView.FindViewById(Resource.Id.bottom_navigation_bar_overLay); mContainer = (FrameLayout)parentView.FindViewById(Resource.Id.bottom_navigation_bar_container); mTabContainer = (LinearLayout)parentView.FindViewById(Resource.Id.bottom_navigation_bar_item_container); if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { this.OutlineProvider = ViewOutlineProvider.Bounds; } else { //to do } ViewCompat.SetElevation(this, mElevation); SetClipToPadding(false); }
/** * Add a fixed view to appear at the top of the grid. If addHeaderView is * called more than once, the views will appear in the order they were * added. Views added using this call can take focus if they want. * <p/> * NOTE: Call this before calling setAdapter. This is so HeaderGridView can wrap * the supplied cursor with one that will also account for header views. * * @param v The view to add. * @param data Data to associate with this view * @param isSelectable whether the item is selectable */ public void AddHeaderView(View v, Object data, bool isSelectable) { IListAdapter adapter = Adapter; if (adapter != null && !(adapter is HeaderViewGridAdapter)) { throw new Java.Lang.IllegalStateException( "Cannot add header view to grid -- setAdapter has already been called."); } ViewGroup.LayoutParams lyp = v.LayoutParameters; FixedViewInfo info = new FixedViewInfo(); FrameLayout fl = new FullWidthFixedViewLayout(Context,this); if (lyp == null) { lyp = new ViewGroup.LayoutParams (WindowManagerLayoutParams.MatchParent,WindowManagerLayoutParams.MatchParent); } if (lyp != null) { v.LayoutParameters=new FrameLayout.LayoutParams(lyp.Width, lyp.Height); fl.LayoutParameters=new AbsListView.LayoutParams(lyp.Width, lyp.Height); } fl.AddView(v); info.view = v; info.viewContainer = fl; info.data = data; info.isSelectable = isSelectable; _headerViewInfos.Add(info); // in the case of re-adding a header view, or adding one later on, // we need to notify the observer if (adapter != null) { ((HeaderViewGridAdapter) adapter).notifyDataSetChanged(); } }
private void InitActionMenu() { _actionMenu?.Close(true); _actionMenu?.Dispose(); var param = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(45), DimensionsHelper.DpToPx(45)); var builder = new FloatingActionMenu.Builder(Activity) .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_filter)) .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_sort)) .AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_shuffle)); switch (ViewModel.WorkMode) { case AnimeListWorkModes.SeasonalAnime: builder.AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_calendar)); builder.SetRadius(DimensionsHelper.DpToPx(95)); break; case AnimeListWorkModes.TopAnime: builder.AddSubActionView(BuildFabActionButton(param, Resource.Drawable.icon_fav_outline)); builder.SetRadius(DimensionsHelper.DpToPx(95)); break; default: builder.SetRadius(DimensionsHelper.DpToPx(75)); break; } _actionMenu = builder.AttachTo(AnimeListPageActionButton).Build(); }
private MediaModel _photo; //TODO:KOA: Already contained in _post public PostPhotosPagerAdapter(Context context, ViewGroup.LayoutParams layoutParams, Action <Post> photoAction) { _context = context; _layoutParams = layoutParams; _photoAction = photoAction; _photoHolders = new List <CardView>(Enumerable.Repeat <CardView>(null, CachedPagesCount)); }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { mAdapter.OnBindViewHolder(holder, position); View itemView = holder.ItemView; ViewGroup.LayoutParams lp; if (itemView.LayoutParameters == null) { lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent , ViewGroup.LayoutParams.MatchParent); } else { lp = itemView.LayoutParameters; if (mViewPager.GetLayoutManager().CanScrollHorizontally()) { lp.Width = ViewGroup.LayoutParams.MatchParent; } else { lp.Height = ViewGroup.LayoutParams.MatchParent; } } itemView.LayoutParameters = lp; }
public ProgressView(Context context, string title) : base(context) { Orientation = Orientation.Vertical; LayoutParameters = new ViewGroup.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); var padding = (int)(_paddingDp * Resources.DisplayMetrics.Density); var progressBar = new ProgressBar(context); progressBar.SetPadding(padding, padding, padding, padding); AddView(progressBar); if (title != null) { var titleText = new TextView(context) { Text = title, TextAlignment = TextAlignment.Center, TextSize = _paddingDp, }; titleText.SetPadding(padding, 0, padding, padding); titleText.Gravity = GravityFlags.Center; AddView(titleText); } }
public static void SetListViewHeightBasedOnChildren2(ListView listView) { try { var listAdapter = listView.Adapter; if (listAdapter == null) { return; } int desiredWidth = Android.Views.View.MeasureSpec.MakeMeasureSpec(listView.Width, MeasureSpecMode.AtMost); int totalHeight = 0; View view = null; for (int i = 0; i < listAdapter.Count; i++) { view = listAdapter.GetView(i, view, listView); if (i == 0) { view.LayoutParameters = new AbsListView.LayoutParams(desiredWidth, ViewGroup.LayoutParams.WrapContent); } else { view.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); } view.Measure(desiredWidth, (int)MeasureSpecMode.Unspecified); totalHeight += view.MeasuredHeight; } ViewGroup.LayoutParams p = listView.LayoutParameters; p.Height = totalHeight + (listView.DividerHeight * (listAdapter.Count - 1)); listView.LayoutParameters = p; listView.RequestLayout(); } catch (Exception e) { } }
/// <summary> /// Finds all of the controls in the layout and assigns them to variables so they /// can be referenced later and subscribes buttons to events /// </summary> void setLayoutResources() { btnForward = FindViewById<Button>(Resource.Id.btnForward); btnBack = FindViewById<Button>(Resource.Id.btnBack); btnClassInfo1 = FindViewById<Button>(Resource.Id.btnClassInfo1); btnClassInfo2 = FindViewById<Button>(Resource.Id.btnClassInfo2); btnClassInfo3 = FindViewById<Button>(Resource.Id.btnClassInfo3); btnMealInfo = FindViewById<Button>(Resource.Id.btnMealInfo); btnCourseInfo = FindViewById<Button>(Resource.Id.btnCourseInfo); btnBack.Click += btnBack_Click; btnForward.Click += btnForward_Click; btnClassInfo1.Click += btnClassInfo1_Click; btnClassInfo2.Click += btnClassInfo2_Click; btnClassInfo3.Click += btnClassInfo3_Click; btnMealInfo.Click += btnMealInfo_Click; btnCourseInfo.Click += btnCourseInfo_Click; row1 = FindViewById<LinearLayout>(Resource.Id.row1); row2 = FindViewById<LinearLayout>(Resource.Id.row2); row3 = FindViewById<LinearLayout>(Resource.Id.row3); row4 = FindViewById<LinearLayout>(Resource.Id.row4); row5 = FindViewById<LinearLayout>(Resource.Id.row5); row6 = FindViewById<LinearLayout>(Resource.Id.row6); row7 = FindViewById<LinearLayout>(Resource.Id.row7); txtDisplay = FindViewById<TextView>(Resource.Id.txtDisplay); txtMonth = FindViewById<TextView>(Resource.Id.txtMonth); btnParams = FindViewById(Resource.Id.btn1).LayoutParameters;//buttons created for the calendar will copy the parameters of this button }
public void setListViewHeightBasedOnChildren(ListView listView) { try { ArrayAdapter listAdapter = (ArrayAdapter)listView.Adapter; if (listAdapter == null) { // pre-condition return; } int totalHeight = 0; for (int i = 0; i < listAdapter.Count; i++) { View listItem = listAdapter.GetView(i, null, listView); listItem.Measure(0, 0); totalHeight += listItem.MeasuredHeight; } ViewGroup.LayoutParams _params = listView.LayoutParameters; _params.Height = totalHeight + (listView.DividerHeight * (listAdapter.Count - 1)); if (_params.Height < 250) //to have min height { _params.Height = 250; //to have min height } listView.LayoutParameters = _params; listView.RequestLayout(); } catch (Exception ex) { } }
/// <summary> /// レイアウトパラメータを初期化します。 /// </summary> private void InitializeLayoutParams() { trainDataLayoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); trainTypeIconlayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent) { Height = 50, Width = 50, Gravity = GravityFlags.Center, }; MP_WP_LayoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); trainDestLayoutParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WrapContent) { Weight = 1 }; trainTimeLayoutParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WrapContent) { Weight = 1, }; trainNameLayoutParams = new LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WrapContent) { Weight = 2 }; }
private void AddProperty(object sender, EventArgs e) { var builder = new AlertDialog.Builder(Activity); builder.SetTitle(Resource.String.add_property_dialog_title); builder.SetMessage(Resource.String.add_property_dialog_message); var layoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); var keyText = new EditText(Activity) { LayoutParameters = layoutParameters, Hint = "Property Name" }; var valueText = new EditText(Activity) { LayoutParameters = layoutParameters, Hint = "Property Value" }; var view = new LinearLayout(Activity) { Orientation = Orientation.Vertical }; view.AddView(keyText); view.AddView(valueText); builder.SetView(view); builder.SetPositiveButton(Resource.String.add_property_dialog_add_button, delegate { mEventProperties.Add(keyText.Text, valueText.Text); PropertiesCountLabel.Text = mEventProperties.Count.ToString(); }); builder.SetNegativeButton(Resource.String.add_property_dialog_cancel_button, delegate { }); builder.Create().Show(); }
private void SetViewProperties() { var height = ViewUtils.DpToPx(Context, 40); var width = ViewGroup.LayoutParams.MatchParent; LayoutParameters = new ViewGroup.LayoutParams(width, height); }
protected override void OnAnimatorAttached() { base.OnAnimatorAttached(); mHeaderText = Header.FindViewById(Resource.Id.header_text_layout); var tv = new TypedValue(); int actionBarHeight = 0; if (mContext.Theme.ResolveAttribute(Android.Resource.Attribute.ActionBarSize, tv, true)) { actionBarHeight = TypedValue.ComplexToDimensionPixelSize(tv.Data, mContext.Resources.DisplayMetrics); } mMinHeightTextHeader = mContext.Resources.GetDimensionPixelSize(Resource.Dimension.min_height_textheader_materiallike); mHeightStartAnimation = actionBarHeight + mMinHeightTextHeader; valueAnimator = ValueAnimator.OfInt(0); valueAnimator.SetDuration(mContext.Resources.GetInteger(Android.Resource.Integer.ConfigShortAnimTime)); valueAnimator.Update += (sender, e) => { ViewGroup.LayoutParams layoutParams = mHeaderText.LayoutParameters; layoutParams.Height = (int)e.Animation.AnimatedValue; mHeaderText.LayoutParameters = layoutParams; }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); LinearLayout linLayout = new LinearLayout(this); linLayout.Orientation = Orientation.Vertical; linLayout.SetBackgroundColor(Color.Black); ImageView imgView = new ImageView(this); if (Resources.Configuration.Orientation.ToString() == "Landscape") { imgView.SetImageResource(Resource.Drawable.bgLand); } else { imgView.SetImageResource(Resource.Drawable.bg); } LinearLayout.LayoutParams imgParams = new LinearLayout.LayoutParams(WindowManagerLayoutParams.WrapContent, WindowManagerLayoutParams.WrapContent); imgParams.Gravity = GravityFlags.Center; linLayout.AddView(imgView, imgParams); ViewGroup.LayoutParams linLayoutParam = new ViewGroup.LayoutParams(WindowManagerLayoutParams.MatchParent, WindowManagerLayoutParams.MatchParent); this.SetContentView(linLayout, linLayoutParam); t = new System.Timers.Timer(); t.Interval = 6000; t.Elapsed += new System.Timers.ElapsedEventHandler(t_Elapsed); t.Start(); //System.Threading.Thread.Sleep(3000); //Aguarda 3 segundos this.StartActivity(typeof(MainActivity)); //Inicia próxima Activity // Create your application here }
public View InflateViews() { mScrollView = new ScrollView(Activity); ViewGroup.LayoutParams scrollParams = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); mScrollView.LayoutParameters = scrollParams; mLogView = new LogView(Activity); ViewGroup.LayoutParams logParams = new ViewGroup.LayoutParams(scrollParams); logParams.Height = ViewGroup.LayoutParams.WrapContent; mLogView.LayoutParameters = logParams; mLogView.Clickable = true; mLogView.Focusable = true; mLogView.Typeface = Typeface.Monospace; // Want to set padding as 16 dips, setPadding takes pixels. Hooray math! int paddingDips = 16; float scale = Resources.DisplayMetrics.Density; int paddingPixels = (int)((paddingDips * (scale)) + .5); mLogView.SetPadding(paddingPixels, paddingPixels, paddingPixels, paddingPixels); mLogView.CompoundDrawablePadding = paddingPixels; mLogView.Gravity = GravityFlags.Bottom; mLogView.SetTextAppearance(Activity, Android.Resource.Style.TextAppearanceMedium); mScrollView.AddView(mLogView); return(mScrollView); }
public void AddFooterView(View v, Object data, bool isSelectable) { IListAdapter mAdapter = Adapter; if (mAdapter != null && !(mAdapter is HeaderViewGridAdapter)) { throw new Java.Lang.IllegalStateException( "Cannot add header view to grid -- setAdapter has already been called."); } ViewGroup.LayoutParams lyp = v.LayoutParameters; FixedViewInfo info = new FixedViewInfo(); FrameLayout fl = new FullWidthFixedViewLayout(Context,this); if (lyp != null) { v.LayoutParameters=new FrameLayout.LayoutParams(lyp.Width, lyp.Height); fl.LayoutParameters=new AbsListView.LayoutParams(lyp.Width, lyp.Height); } fl.AddView(v); info.view = v; info.viewContainer = fl; info.data = data; info.isSelectable = isSelectable; _footerViewInfos.Add(info); if (mAdapter != null) { ((HeaderViewGridAdapter) mAdapter).notifyDataSetChanged(); } }
public void RegisterAboveContentView(View v, ViewGroup.LayoutParams layoutParams) { if (_broadcasting) { _viewAbove = v; } }
private void InitAndroidView(int width, int height) { captureCamera = new Org.Linphone.Mediastream.Video.Display.GL2JNIView(Context); var displayMetrics = new DisplayMetrics(); var ctx = Application.Context; var windowManager = ctx.GetSystemService(Context.WindowService).JavaCast <IWindowManager>(); windowManager.DefaultDisplay.GetMetrics(displayMetrics); int width_android = (int)(width / (1f / displayMetrics.Density)); int height_android = (int)(height / (1f / displayMetrics.Density)); captureCamera.Holder.SetFixedSize(width_android, height_android); ViewGroup.LayoutParams cparams = new ViewGroup.LayoutParams(width_android, height_android); captureCamera.LayoutParameters = cparams; androidView = new AndroidVideoWindowImpl(captureCamera, null, null); androidVideoWindowListener = new AndroidVideoWindowListener(); androidVideoWindowListener.OnVideoRenderingSurfaceReadyEvent += OnVideoRenderingSurfaceReady; androidVideoWindowListener.OnVideoRenderingSurfaceDestroyedEvent += OnVideoRenderingSurfaceDestroyed; androidView.SetListener(androidVideoWindowListener); captureCamera.SetZOrderOnTop(false); captureCamera.SetZOrderMediaOverlay(true); }
public static void setListViewHeightBasedOnChildren(ListView listView) { IListAdapter listAdapter = listView.Adapter; if (listAdapter == null) { // pre-condition return; } int totalHeight = 0; int desiredWidth = View.MeasureSpec.MakeMeasureSpec(listView.Width, View.MeasureSpec.AT_MOST); for (int i = 0; i < listAdapter.GetCount(); i++) { View listItem = listAdapter.GetView(i, null, listView); listItem.Measure(1000, 0); totalHeight += listItem.MeasuredHeight; } ViewGroup.LayoutParams parameters = listView.GetLayoutParams(); parameters.Height = totalHeight + (listView.DividerHeight * (listAdapter.GetCount() - 1)) + 10; listView.SetLayoutParams(parameters); listView.RequestLayout(); }
protected override void onLoadingDrawableSet(Drawable imageDrawable) { if (null != imageDrawable) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int dHeight = imageDrawable.getIntrinsicHeight(); int dHeight = imageDrawable.IntrinsicHeight; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int dWidth = imageDrawable.getIntrinsicWidth(); int dWidth = imageDrawable.IntrinsicWidth; /// <summary> /// We need to set the width/height of the ImageView so that it is /// square with each side the size of the largest drawable dimension. /// This is so that it doesn't clip when rotated. /// </summary> ViewGroup.LayoutParams lp = mHeaderImage.LayoutParameters; lp.Width = lp.Height = Math.Max(dHeight, dWidth); mHeaderImage.RequestLayout(); /// <summary> /// We now rotate the Drawable so that is at the correct rotation, /// and is centered. /// </summary> mHeaderImage.SetScaleType(ImageView.ScaleType.Matrix); Matrix matrix = new Matrix(); matrix.PostTranslate((lp.Width - dWidth) / 2f, (lp.Height - dHeight) / 2f); matrix.PostRotate(DrawableRotationAngle, lp.Width / 2f, lp.Height / 2f); mHeaderImage.ImageMatrix = matrix; } }
public static DroppyMenuPopup BuildForAnimeSortingSelection(Context context, View parent, Action <SortOptions> callback, SortOptions currentOption) { ParamRelativeLayout = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(150), DimensionsHelper.DpToPx(38)); var droppyBuilder = new DroppyMenuPopup.Builder(context, parent); InjectAnimation(droppyBuilder); var listener = new Action <int>(i => callback.Invoke((SortOptions)i)); foreach (SortOptions value in Enum.GetValues(typeof(SortOptions))) { if (value == currentOption) { droppyBuilder.AddMenuItem( new DroppyMenuCustomItem(BuildItem(context, value.GetDescription(), listener, (int)value, ResourceExtension.BrushSelectedDialogItem, ResourceExtension.AccentColour))); } else //highlighted { droppyBuilder.AddMenuItem( new DroppyMenuCustomItem(BuildItem(context, value.GetDescription(), listener, (int)value))); } } droppyBuilder.SetYOffset(DimensionsHelper.DpToPx(30)); return(droppyBuilder.Build()); }
private void InitializeViews() { _isTabletMode = !_ignoreTabletLayout && _context.Resources.GetBoolean(Resource.Boolean.bb_bottom_bar_is_tablet_mode); ViewCompat.SetElevation(this, MiscUtils.DpToPixel(_context, 8)); View rootView = Inflate(_context, _isTabletMode ? Resource.Layout.bb_bottom_bar_item_container_tablet : Resource.Layout.bb_bottom_bar_item_container, this); _tabletRightBorder = rootView.FindViewById(Resource.Id.bb_tablet_right_border); UserContainer = (ViewGroup)rootView.FindViewById(Resource.Id.bb_user_content_container); _shadowView = rootView.FindViewById(Resource.Id.bb_bottom_bar_shadow); OuterContainer = (ViewGroup)rootView.FindViewById(Resource.Id.bb_bottom_bar_outer_container); ItemContainer = (ViewGroup)rootView.FindViewById(Resource.Id.bb_bottom_bar_item_container); _backgroundView = rootView.FindViewById(Resource.Id.bb_bottom_bar_background_view); _backgroundOverlay = rootView.FindViewById(Resource.Id.bb_bottom_bar_background_overlay); if (PendingUserContentView != null) { var param = PendingUserContentView.LayoutParameters; if (param == null) { param = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); } UserContainer.AddView(PendingUserContentView, 0, param); PendingUserContentView = null; } }
public static DroppyMenuPopup BuildForAnimeListDisplayModeSelection(Context context, View parent, IEnumerable <Tuple <AnimeListDisplayModes, string> > items, Action <AnimeListDisplayModes> callback, AnimeListDisplayModes currentMode) { ParamRelativeLayout = new ViewGroup.LayoutParams(DimensionsHelper.DpToPx(150), DimensionsHelper.DpToPx(38)); var droppyBuilder = new DroppyMenuPopup.Builder(context, parent); InjectAnimation(droppyBuilder); var listener = new Action <int>(i => callback.Invoke((AnimeListDisplayModes)i)); foreach (var item in items) { if (item.Item1 == currentMode) { droppyBuilder.AddMenuItem( new DroppyMenuCustomItem(BuildItem(context, item.Item2, listener, (int)item.Item1, ResourceExtension.BrushSelectedDialogItem, ResourceExtension.AccentColour))); } else //highlighted { droppyBuilder.AddMenuItem( new DroppyMenuCustomItem(BuildItem(context, item.Item2, listener, (int)item.Item1))); } } droppyBuilder.SetYOffset(DimensionsHelper.DpToPx(30)); return(droppyBuilder.Build()); }
private void BeginRefresh(View viewToUpdate, IRefreshListener refreshAction) { ViewGroup.LayoutParams layoutParams = viewToUpdate.LayoutParameters; layoutParams.Height = (int)PullElementStandbyHeight; viewToUpdate.LayoutParameters = layoutParams; //UITrace.Trace("PullDown:refreshing"); State = new RefreshingState(); ThreadPool.QueueUserWorkItem((ignored) => { try { //var start = DateTime.UtcNow; refreshAction.DoRefresh(); //var finish = DateTime.UtcNow; //long difference = finish - start; //try //{ // Thread.Sleep(Math.Max(difference, 1500)); //} //catch (InterruptedException e) //{ //} } catch (RuntimeException e) { //UITrace.Trace("Error: {0}", e.ToLongString()); throw e; } finally { RunOnUiThread(() => RefreshFinished(refreshAction)); } }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetCanceledOnTouchOutside(true); _layout.Orientation = Orientation.Vertical; using (var layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FillParent, ViewGroup.LayoutParams.FillParent)) SetContentView(_layout, layoutParams); if (_arguments.Destruction != null) { AButton destruct = AddButton(_arguments.Destruction); destruct.Background.SetColorFilter(new Color(1, 0, 0, 1).ToAndroid(), PorterDuff.Mode.Multiply); } foreach (string button in _arguments.Buttons) { AddButton(button); } if (_arguments.Cancel != null) { AButton cancel = AddButton(_arguments.Cancel); cancel.Background.SetColorFilter(new Color(0.5, 0.5, 0.5, 1).ToAndroid(), PorterDuff.Mode.Multiply); } SetTitle(_arguments.Title); }