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); } }
public override View GetView(int position, View convertView, ViewGroup parent) { var result = results[position]; if (position % 2 == 0) { // Try to reuse convertView if it's not null, otherwise inflate it from our item layout FrameLayout view = (convertView is FrameLayout ? convertView : context.Inflate(Resource.Layout.ItemListItem, parent, false)) as FrameLayout; var captionAccent = view.FindViewById <TextView>(Resource.Id.captionAccent); var text = view.FindViewById <TextView>(Resource.Id.text); captionAccent.SetText(result.CaptionAccent, TextView.BufferType.Normal); text.SetText(result.Text, TextView.BufferType.Normal); return(view); } else { // Try to reuse convertView if it's not null, otherwise inflate it from our item layout LinearLayout view = (convertView is LinearLayout ? convertView : context.Inflate(Resource.Layout.EntryListItem, parent, false)) as LinearLayout; var itemText = view.FindViewById <TextView>(Resource.Id.itemText); var summary = view.FindViewById <TextView>(Resource.Id.summary); itemText.SetText(result.CaptionAccent, TextView.BufferType.Normal); summary.SetText(result.Text, TextView.BufferType.Normal); return(view); } }
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); } } }
private void BindHeader(bool forh1, JournalViewHeaderVM header) { if (forh1) { h1.FindViewById <TextView> (Resource.Id.Header).Text = header.Header; h1.FindViewById <TextView> (Resource.Id.SubHeader).Text = header.SubHeader; h1.FindViewById <TextView> (Resource.Id.Value).Text = header.Value; } else { h2.FindViewById <TextView> (Resource.Id.Header).Text = header.Header; h2.FindViewById <TextView> (Resource.Id.SubHeader).Text = header.SubHeader; h2.FindViewById <TextView> (Resource.Id.Value).Text = header.Value; } }
public static HoleCutView ShowOverlay(Context context, string title, string description, bool showalways = false) { //return config: //ISharedPreferences preferences = PreferenceManager.GetDefaultSharedPreferences(context); var settings = context.GetSharedPreferences(WhiteLabelConfig.BUILD_VARIANT + "_HelpOverlay", FileCreationMode.Private); //settings.GetInt("IHELP_" + title, -88); if (!showalways) { showalways = !settings.GetBoolean("HELP_" + title, false); } Dialog dialog = new Dialog(context, Android.Resource.Style.ThemeBlackNoTitleBarFullScreen); FrameLayout v = new FrameLayout(context); v.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); v.SetBackgroundColor(Color.Transparent); var hc = new HoleCutView(context, dialog); hc.OnClose += () => { dialog.Cancel(); }; hc.SetBackgroundColor(Color.Transparent); hc.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); v.AddView(hc); var inf = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService); v.AddView(inf.Inflate(Resource.Layout.help_cutout, null)); v.FindViewById <TextView>(Resource.Id.title).Text = title; v.FindViewById <TextView>(Resource.Id.desc).Text = description; v.FindViewById <Button>(Resource.Id.closebtn).Click += (o, e) => dialog.Cancel(); dialog.SetContentView(v); dialog.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent)); if (showalways) { dialog.Show(); } //ISharedPreferencesEditor editor = preferences.Edit(); var editor = settings.Edit(); editor.PutBoolean("HELP_" + title, true); //editor.PutInt("IHELP_" + title, 0); editor.Commit(); return(hc); }
private void Init() { _favButton = (Context as Activity).LayoutInflater.Inflate(Resource.Layout.FavButton, null) as FrameLayout; _favButtonIcon = _favButton.FindViewById <ImageView>(Resource.Id.FavButtonIcon); _favButton.Click += FavButtonOnClick; AddView(_favButton); _initialized = true; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar> (Resource.Id.toolbar); SetSupportActionBar(toolbar); mainCoordinator = FindViewById <CoordinatorLayout> (Resource.Id.coordinatorLayout); // SETUP NOTIFICATION FRAME notificationFrame = FindViewById <FrameLayout> (Resource.Id.notifFrame); notificationFrame.Visibility = ViewStates.Invisible; var title = notificationFrame.FindViewById <TextView> (Resource.Id.notifTitle); title.Typeface = Typeface.CreateFromAsset(Resources.Assets, "DancingScript.ttf"); /* Assign notification behavior (aka swipe-to-dismiss) */ var lp = (CoordinatorLayout.LayoutParams)notificationFrame.LayoutParameters; var nb = new NotificationBehavior(); nb.Dismissed += (sender, e) => AddNewBuzzEntry(wasOpened: false); lp.Behavior = nb; notificationFrame.LayoutParameters = lp; // SETUP FLOATING ACTION BUTTON fab = FindViewById <CheckableFab> (Resource.Id.fabBuzz); fab.Click += OnFabBuzzClick; /* Craft curved motion into FAB */ lp = (CoordinatorLayout.LayoutParams)fab.LayoutParameters; lp.Behavior = new FabMoveBehavior(); fab.LayoutParameters = lp; /* Spice up the FAB icon story */ if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop) { fab.SetImageResource(Resource.Drawable.ic_fancy_fab_icon); } recycler = FindViewById <RecyclerView> (Resource.Id.recycler); recycler.HasFixedSize = true; adapter = new BuzzHistoryAdapter(this); recycler.SetLayoutManager(new LinearLayoutManager(this)); recycler.SetItemAnimator(new DefaultItemAnimator()); recycler.SetAdapter(adapter); InitializeAdapter(); }
public CompassRenderer(IMvxService service) : base(service) { try { _onChangedListener = new OnChangedListener(this); var inflater = LayoutInflater.From((Service)service); _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); } catch (Exception e) { Log.Debug("Exception", e.Message); Log.Debug("Exception", e.InnerException.Message); } }
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); } } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Words); SetActionBar(); _words = FileWorker.GetWords(); _activeCard = FindViewById <FrameLayout>(Resource.Id.ActiveCard); _nonActiveCard = FindViewById <FrameLayout>(Resource.Id.NonActiveCard); _activeEditText = _activeCard.FindViewById <EditText>(Resource.Id.editText1); _nonActiveEditText = _nonActiveCard.FindViewById <EditText>(Resource.Id.editText1); _statusText = FindViewById <TextView>(Resource.Id.textView1); _activeCard.TranslationX = _clampRight; _nonActiveCard.TranslationX = _clampRight; Start(); }
public override void OnStatusUpdated() { base.OnStatusUpdated(); Console.WriteLine("&Stauts Updated"); if (MusicPlayer.RemotePlayer.IsBuffering) { Player.instance?.Buffering(); } else { Player.instance?.Ready(); } if (MusicPlayer.RemotePlayer.IsPaused) { MusicPlayer.isRunning = false; FrameLayout smallPlayer = MainActivity.instance.FindViewById <FrameLayout>(Resource.Id.smallPlayer); smallPlayer?.FindViewById <ImageButton>(Resource.Id.spPlay)?.SetImageResource(Resource.Drawable.Play); if (Player.instance != null) { MainActivity.instance?.FindViewById <ImageButton>(Resource.Id.playButton)?.SetImageResource(Resource.Drawable.Play); Player.instance.handler?.PostDelayed(Player.instance.UpdateSeekBar, 1000); } } else { MusicPlayer.isRunning = true; FrameLayout smallPlayer = MainActivity.instance.FindViewById <FrameLayout>(Resource.Id.smallPlayer); smallPlayer?.FindViewById <ImageButton>(Resource.Id.spPlay)?.SetImageResource(Resource.Drawable.Pause); if (Player.instance != null) { MainActivity.instance?.FindViewById <ImageButton>(Resource.Id.playButton)?.SetImageResource(Resource.Drawable.Pause); Player.instance.handler?.PostDelayed(Player.instance.UpdateSeekBar, 1000); } } Queue.instance?.RefreshCurrent(); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: public LoadingLayout(android.content.Context context, final PullToRefresh.PullMode mode, final PullToRefresh.ScrollOrientation scrollDirection, android.content.res.TypedArray attrs) public LoadingLayout(Context context, PullMode mode, ScrollOrientation scrollDirection, TypedArray attrs) : base(context) { mMode = mode; mScrollDirection = scrollDirection; switch (scrollDirection) { case ScrollOrientation.HORIZONTAL: LayoutInflater.From(context).Inflate(Resource.Layout.pull_to_refresh_header_horizontal, this); break; case ScrollOrientation.VERTICAL: default: LayoutInflater.From(context).Inflate(Resource.Layout.pull_to_refresh_header_vertical, this); break; } mInnerLayout = (FrameLayout)FindViewById(Resource.Id.fl_inner); mHeaderText = (TextView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_text); mHeaderProgress = (ProgressBar)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_progress); mSubHeaderText = (TextView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_sub_text); mHeaderImage = (ImageView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_image); LayoutParams lp = (LayoutParams)mInnerLayout.LayoutParameters; switch (mode) { case PullMode.PULL_FROM_END: lp.Gravity = scrollDirection == ScrollOrientation.VERTICAL ? GravityFlags.Top : GravityFlags.Left; // Load in labels mPullLabel = context.GetString(Resource.String.pull_to_refresh_pull_label); mRefreshingLabel = context.GetString(Resource.String.pull_to_refresh_refreshing_label); mReleaseLabel = context.GetString(Resource.String.pull_to_refresh_release_label); break; case PullMode.PULL_FROM_START: default: lp.Gravity = scrollDirection == ScrollOrientation.VERTICAL ? GravityFlags.Bottom : GravityFlags.Right; // Load in labels mPullLabel = context.GetString(Resource.String.pull_to_refresh_pull_label); mRefreshingLabel = context.GetString(Resource.String.pull_to_refresh_refreshing_label); mReleaseLabel = context.GetString(Resource.String.pull_to_refresh_release_label); break; } if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderBackground)) { Drawable background = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrHeaderBackground); if (null != background) { ViewCompat.setBackground(this, background); } } if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderTextAppearance)) { TypedValue styleID = new TypedValue(); attrs.GetValue(Resource.Styleable.PullToRefresh_ptrHeaderTextAppearance, styleID); TextAppearance = styleID.Data; } if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrSubHeaderTextAppearance)) { TypedValue styleID = new TypedValue(); attrs.GetValue(Resource.Styleable.PullToRefresh_ptrSubHeaderTextAppearance, styleID); SubTextAppearance = styleID.Data; } // Text Color attrs need to be set after TextAppearance attrs if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderTextColor)) { ColorStateList colors = attrs.GetColorStateList(Resource.Styleable.PullToRefresh_ptrHeaderTextColor); if (null != colors) { TextColor = colors; } } if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderSubTextColor)) { ColorStateList colors = attrs.GetColorStateList(Resource.Styleable.PullToRefresh_ptrHeaderSubTextColor); if (null != colors) { SubTextColor = colors; } } // Try and get defined drawable from Attrs Drawable imageDrawable = null; if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawable)) { imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawable); } // Check Specific Drawable from Attrs, these overrite the generic // drawable attr above switch (mode) { case PullMode.PULL_FROM_START: default: if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableStart)) { imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableStart); } else if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableTop)) { Utils.warnDeprecation("ptrDrawableTop", "ptrDrawableStart"); imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableTop); } break; case PullMode.PULL_FROM_END: if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableEnd)) { imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableEnd); } else if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableBottom)) { Utils.warnDeprecation("ptrDrawableBottom", "ptrDrawableEnd"); imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableBottom); } break; } // If we don't have a user defined drawable, load the default if (null == imageDrawable) { imageDrawable = context.Resources.GetDrawable(DefaultDrawableResId); } // Set Drawable, and save width/height LoadingDrawable = imageDrawable; reset(); }
internal StampSelectionView(Context context, CustomToolBarPdfViewerDemo mainPage) : base(context) { this.mainPage = mainPage; LayoutInflater inflater = (LayoutInflater)context.GetSystemService(Context.LayoutInflaterService); root = (FrameLayout)inflater.Inflate(Resources.GetLayout(Resource.Layout.StampViewList), this, true); linear = root.FindViewById <LinearLayout>(Resource.Id.linearView); backButton = root.FindViewById <Button>(Resource.Id.backButton); stampTitle = root.FindViewById <LinearLayout>(Resource.Id.stampTitlebar); bottomBar = root.FindViewById <LinearLayout>(Resource.Id.bottomBar); closeButton = root.FindViewById <Button>(Resource.Id.closeBtn); closeButton.Click += CloseButton_Click; closeButton.SetBackgroundColor(Color.Transparent); closeButton.SetTextColor(mainPage.fontColor); backButton.Typeface = mainPage.bookmarkFont; backButton.Click += BackButton_Click; title = root.FindViewById <TextView>(Resource.Id.title); linear.SetBackgroundColor(Color.White); if (mainPage.IsDeviceTablet) { LayoutParams newParams = new LayoutParams(600, 350); newParams.Gravity = GravityFlags.Center; backButton.Visibility = ViewStates.Gone; LayoutParams titleLayoutParams = new LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); titleLayoutParams.Gravity = GravityFlags.Center; title.LayoutParameters = titleLayoutParams; linear.LayoutParameters = newParams; title.SetTextColor(Color.Black); title.Text = "Choose Stamp"; } else { bottomBar.Visibility = ViewStates.Invisible; stampTitle.LayoutParameters = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, 150); title.SetTextColor(mainPage.fontColor); } approved = root.FindViewById <ImageButton>(Resource.Id.approved); approved.SetBackgroundColor(Color.Transparent); approved.Click += StampChosen; notApproved = root.FindViewById <ImageButton>(Resource.Id.notapproved); notApproved.SetBackgroundColor(Color.Transparent); notApproved.Click += StampChosen; draft = root.FindViewById <ImageButton>(Resource.Id.draft); draft.SetBackgroundColor(Color.Transparent); draft.Click += StampChosen; expired = root.FindViewById <ImageButton>(Resource.Id.expired); expired.SetBackgroundColor(Color.Transparent); expired.Click += StampChosen; confidential = root.FindViewById <ImageButton>(Resource.Id.confidential); confidential.SetBackgroundColor(Color.Transparent); confidential.Click += StampChosen; }
public async void RefreshPlayer() { while (MainActivity.instance == null || MusicPlayer.CurrentID() == -1) { await Task.Delay(100); } Song current = await MusicPlayer.GetItem(); if (current == null || (current.IsYt && current.Album == null)) { return; } FrameLayout smallPlayer = MainActivity.instance.FindViewById <FrameLayout>(Resource.Id.smallPlayer); smallPlayer.FindViewById <TextView>(Resource.Id.spTitle).Text = current.Title; smallPlayer.FindViewById <TextView>(Resource.Id.spArtist).Text = current.Artist; smallPlayer.FindViewById <ImageView>(Resource.Id.spPlay).SetImageResource(Resource.Drawable.Pause); ImageView art = smallPlayer.FindViewById <ImageView>(Resource.Id.spArt); if (!current.IsYt) { var songCover = Android.Net.Uri.Parse("content://media/external/audio/albumart"); var nextAlbumArtUri = ContentUris.WithAppendedId(songCover, current.AlbumArt); Picasso.With(Application.Context).Load(nextAlbumArtUri).Placeholder(Resource.Drawable.noAlbum).Resize(400, 400).CenterCrop().Into(art); } else { Picasso.With(Application.Context).Load(current.Album).Placeholder(Resource.Drawable.noAlbum).Transform(new RemoveBlackBorder(true)).Into(art); } TextView title = MainActivity.instance.FindViewById <TextView>(Resource.Id.playerTitle); TextView artist = MainActivity.instance.FindViewById <TextView>(Resource.Id.playerArtist); albumArt = MainActivity.instance.FindViewById <ImageView>(Resource.Id.playerAlbum); SpannableString titleText = new SpannableString(current.Title); titleText.SetSpan(new BackgroundColorSpan(Color.ParseColor("#BF000000")), 0, current.Title.Length, SpanTypes.InclusiveInclusive); title.TextFormatted = titleText; SpannableString artistText = new SpannableString(current.Artist); artistText.SetSpan(new BackgroundColorSpan(Color.ParseColor("#BF000000")), 0, current.Artist.Length, SpanTypes.InclusiveInclusive); artist.TextFormatted = artistText; if (!errorState) { if (MusicPlayer.isRunning) { MainActivity.instance.FindViewById <ImageButton>(Resource.Id.playButton).SetImageResource(Resource.Drawable.Pause); smallPlayer.FindViewById <ImageButton>(Resource.Id.spPlay).SetImageResource(Resource.Drawable.Pause); } else { MainActivity.instance.FindViewById <ImageButton>(Resource.Id.playButton).SetImageResource(Resource.Drawable.Play); smallPlayer.FindViewById <ImageButton>(Resource.Id.spPlay).SetImageResource(Resource.Drawable.Play); } } Bitmap drawable = null; if (current.AlbumArt == -1) { await Task.Run(() => { try { drawable = Picasso.With(Application.Context).Load(current.Album).Error(Resource.Drawable.noAlbum).Placeholder(Resource.Drawable.noAlbum).Transform(new RemoveBlackBorder(true)).Get(); } catch { drawable = Picasso.With(Application.Context).Load(Resource.Drawable.noAlbum).Get(); } }); } else { Android.Net.Uri songCover = Android.Net.Uri.Parse("content://media/external/audio/albumart"); Android.Net.Uri iconURI = ContentUris.WithAppendedId(songCover, current.AlbumArt); await Task.Run(() => { try { drawable = Picasso.With(Application.Context).Load(iconURI).Error(Resource.Drawable.noAlbum).Placeholder(Resource.Drawable.noAlbum).NetworkPolicy(NetworkPolicy.Offline).Get(); } catch { drawable = Picasso.With(Application.Context).Load(Resource.Drawable.noAlbum).Get(); } }); } albumArt.SetImageBitmap(drawable); Palette.From(drawable).MaximumColorCount(28).Generate(this); if (await SongManager.IsFavorite(current)) { MainActivity.instance?.FindViewById <ImageButton>(Resource.Id.fav)?.SetImageResource(Resource.Drawable.Unfav); } else { MainActivity.instance?.FindViewById <ImageButton>(Resource.Id.fav)?.SetImageResource(Resource.Drawable.Fav); } if (albumArt.Width > 0) { try { //k is the coeficient to convert ImageView's size to Bitmap's size //We want to take the lower coeficient because if we take the higher, we will have a final bitmap larger than the initial one and we can't create pixels float k = Math.Min((float)drawable.Height / albumArt.Height, (float)drawable.Width / albumArt.Width); int width = (int)(albumArt.Width * k); int height = (int)(albumArt.Height * k); int dX = (int)((drawable.Width - width) * 0.5f); int dY = (int)((drawable.Height - height) * 0.5f); Console.WriteLine("&Drawable Info: Width: " + drawable.Width + " Height: " + drawable.Height); Console.WriteLine("&AlbumArt Info: Width: " + albumArt.Width + " Height: " + albumArt.Height); Console.WriteLine("&Blur Creation: Width: " + width + " Height: " + height + " dX: " + dX + " dY: " + dY); //The width of the view in pixel (we'll multiply this by 0.75f because the drawer has a width of 75%) Bitmap blured = Bitmap.CreateBitmap(drawable, dX, dY, (int)(width * 0.75f), height); Console.WriteLine("&BLured bitmap created"); RenderScript rs = RenderScript.Create(MainActivity.instance); Allocation input = Allocation.CreateFromBitmap(rs, blured); Allocation output = Allocation.CreateTyped(rs, input.Type); ScriptIntrinsicBlur blurrer = ScriptIntrinsicBlur.Create(rs, Element.U8_4(rs)); blurrer.SetRadius(13); blurrer.SetInput(input); blurrer.ForEach(output); output.CopyTo(blured); MainActivity.instance.FindViewById <ImageView>(Resource.Id.queueBackground).SetImageBitmap(blured); Console.WriteLine("&Bitmap set to image view"); } catch (Exception ex) { Console.WriteLine("&Queue background error: " + ex.Message); } } if (bar != null) { if (spBar == null) { spBar = MainActivity.instance.FindViewById <ProgressBar>(Resource.Id.spProgress); } if (current.IsLiveStream) { bar.Max = 1; bar.Progress = 1; spBar.Max = 1; spBar.Progress = 1; timer.Text = "🔴 LIVE"; } else { int duration = await MusicPlayer.Duration(); bar.Max = duration; timer.Text = string.Format("{0} | {1}", DurationToTimer((int)MusicPlayer.CurrentPosition), DurationToTimer(duration)); spBar.Max = duration; spBar.Progress = (int)MusicPlayer.CurrentPosition; handler.PostDelayed(UpdateSeekBar, 1000); int LoadedMax = (int)await MusicPlayer.LoadDuration(); bar.Max = LoadedMax; spBar.Max = LoadedMax; timer.Text = string.Format("{0} | {1}", DurationToTimer((int)MusicPlayer.CurrentPosition), DurationToTimer(LoadedMax)); } } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = (FrameLayout)inflater.Inflate(Resource.Layout.math_with_answers_fragment, container, false); answer1 = rootView.FindViewById <FButton>(Resource.Id.answer1); answer2 = rootView.FindViewById <FButton>(Resource.Id.answer2); answer3 = rootView.FindViewById <FButton>(Resource.Id.answer3); answer4 = rootView.FindViewById <FButton>(Resource.Id.answer4); igrajPonovo = rootView.FindViewById <FButton>(Resource.Id.igrajPonovo); izlaz = rootView.FindViewById <FButton>(Resource.Id.izlaz); start = rootView.FindViewById <FButton>(Resource.Id.start); startLayout = rootView.FindViewById <LinearLayout>(Resource.Id.startLayout); number1TW = rootView.FindViewById <TextView>(Resource.Id.number1); number2TW = rootView.FindViewById <TextView>(Resource.Id.number2); vreme = rootView.FindViewById <TextView>(Resource.Id.vreme); redniBrojZadatka = rootView.FindViewById <TextView>(Resource.Id.redniBrojZadatka); operacijaTW = rootView.FindViewById <TextView>(Resource.Id.operacija); tacnihOdgovoraTW = rootView.FindViewById <TextView>(Resource.Id.tacnihOdgovora); brojTacnihNaKraju = rootView.FindViewById <TextView>(Resource.Id.brojTacnihNaKraju); vremeNaKraju = rootView.FindViewById <TextView>(Resource.Id.vremeNaKraju); igrajPonovoLayout = rootView.FindViewById <LinearLayout>(Resource.Id.igrajPonovoLayout); questionLayout = rootView.FindViewById <LinearLayout>(Resource.Id.questionLayout); Init(); start.Click += delegate { Start(); }; izlaz.Click += delegate { //Activity.FragmentManager.PopBackStack(); PlayFragment pf = new PlayFragment(); Activity.FragmentManager.BeginTransaction().Replace(App.fragmentContainer.Id, pf, "play").Commit(); App.CurrentFragment = pf; }; igrajPonovo.Click += delegate { Start(); }; return(rootView); }
private void SyncLines() { if (syncing) { return; } syncing = true; string extra = ""; try { var inflater = table.Context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; int i = 0; FrameLayout nextRow = null; foreach (var period in vm.Periods) { // first, remove all next rows that are not Period Rows extra = "remove"; while (i < table.ChildCount) { nextRow = table.GetChildAt(i) as FrameLayout; if (nextRow.Tag == Row) { break; } var value = nextRow.FindViewById <TextView> (Resource.Id.value); if (value != null) { animvalues.Remove(value); } var bar = nextRow.FindViewById <View> (Resource.Id.bar); if (bar != null) { animvalues.Remove(bar); } table.RemoveViewAt(i); nextRow = null; } var periodRow = nextRow; // if no next row, inflate a new one extra = "inflate"; if (periodRow == null) { periodRow = inflater.Inflate(Resource.Layout.PeriodRow, null) as FrameLayout; periodRow.Tag = Row; periodRow.Click += (object sender, EventArgs e) => { PeriodTap(period); }; (periodRow as ViewGroup).SetClipChildren(false); animvalues.Add(periodRow.FindViewById <TextView> (Resource.Id.value)); animvalues.Add(periodRow.FindViewById <View> (Resource.Id.bar)); table.AddView(periodRow, i); } // sync the row texts extra = "synctext"; int screenwidth = table.Context.Resources.DisplayMetrics.WidthPixels; periodRow.FindViewById <View> (Resource.Id.bar).LayoutParameters.Width = (period.BarWidth * screenwidth / JournalDayVM.GoalWidth); periodRow.FindViewById <TextView> (Resource.Id.text).Text = period.Text; periodRow.FindViewById <TextView> (Resource.Id.value).Text = period.Value; i++; foreach (var line in period.Lines) { nextRow = (i < table.ChildCount) ? table.GetChildAt(i) as FrameLayout : null; var lineRow = nextRow; if (nextRow != null && nextRow.Tag != Line) { nextRow = null; } if (lineRow != null) { // 05/30/2015: we were getting lots of "settext" exceptions on object null (not sure why). This is the workaround: if (lineRow.FindViewById <TextView> (Resource.Id.text) == null) { lineRow = null; } if (lineRow.FindViewById <TextView> (Resource.Id.value) == null) { lineRow = null; } } // if none to re-use, inflate a new one extra = "inflaterow"; if (lineRow == null) { lineRow = inflater.Inflate(Resource.Layout.LineRow, null) as FrameLayout; lineRow.Tag = Line; lineRow.Click += (object sender, EventArgs e) => { PeriodTap(period); }; (lineRow as ViewGroup).SetClipChildren(false); animvalues.Add(lineRow.FindViewById <TextView> (Resource.Id.value)); table.AddView(lineRow, i); } // set the texts extra = "settext"; lineRow.FindViewById <TextView> (Resource.Id.text).Text = line.Text; lineRow.FindViewById <TextView> (Resource.Id.value).Text = line.Value; i++; } // add margin if next row isnt margin extra = "addmargin"; nextRow = (i < table.ChildCount) ? table.GetChildAt(i) as FrameLayout : null; if (nextRow == null || nextRow.Tag != Space) { var marginview = inflater.Inflate(Resource.Layout.PeriodRowMargin, null) as FrameLayout; marginview.Tag = Space; table.AddView(marginview, i); } i++; } // remove all subsequent rows extra = "removetherest"; while (i < table.ChildCount) { nextRow = table.GetChildAt(i) as FrameLayout; var value = nextRow.FindViewById <TextView> (Resource.Id.value); if (value != null) { animvalues.Remove(value); } var bar = nextRow.FindViewById <TextView> (Resource.Id.bar); if (bar != null) { animvalues.Remove(bar); } table.RemoveViewAt(i); } } catch (Exception ex) { LittleWatson.ReportException(ex, extra); } syncing = false; }
public LoadingLayout(Context context, Mode mode, PtrOrientation scrollDirection, TypedArray attrs) : base(context) { //base(context); mMode = mode; mScrollDirection = scrollDirection; switch (scrollDirection) { case PtrOrientation.HORIZONTAL: LayoutInflater.From(context).Inflate(Resource.Layout.pull_to_refresh_header_horizontal, this); break; case PtrOrientation.VERTICAL: default: LayoutInflater.From(context).Inflate(Resource.Layout.pull_to_refresh_header_vertical, this); break; } mInnerLayout = (FrameLayout)FindViewById(Resource.Id.fl_inner); mHeaderText = (TextView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_text); mHeaderProgress = (ProgressBar)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_progress); mSubHeaderText = (TextView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_sub_text); mHeaderImage = (ImageView)mInnerLayout.FindViewById(Resource.Id.pull_to_refresh_image); FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams)mInnerLayout.LayoutParameters; switch (mode) { case Mode.PULL_FROM_END: lp.Gravity = scrollDirection == PtrOrientation.VERTICAL ? GravityFlags.Top : GravityFlags.Left; // Load in labels mPullLabel = context.GetString(Resource.String.pull_to_refresh_from_bottom_pull_label); mRefreshingLabel = context.GetString(Resource.String.pull_to_refresh_from_bottom_refreshing_label); mReleaseLabel = context.GetString(Resource.String.pull_to_refresh_from_bottom_release_label); break; case Mode.PULL_FROM_START: default: lp.Gravity = scrollDirection == PtrOrientation.VERTICAL ? GravityFlags.Bottom : GravityFlags.Right; // Load in labels mPullLabel = context.GetString(Resource.String.pull_to_refresh_pull_label); mRefreshingLabel = context.GetString(Resource.String.pull_to_refresh_refreshing_label); mReleaseLabel = context.GetString(Resource.String.pull_to_refresh_release_label); break; } if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderBackground)) { Drawable background = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrHeaderBackground); if (null != background) { ViewCompat.setBackground(this, background); } } if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderTextAppearance)) { TypedValue styleID = new TypedValue(); attrs.GetValue(Resource.Styleable.PullToRefresh_ptrHeaderTextAppearance, styleID); setTextAppearance(styleID.Data); } if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrSubHeaderTextAppearance)) { TypedValue styleID = new TypedValue(); attrs.GetValue(Resource.Styleable.PullToRefresh_ptrSubHeaderTextAppearance, styleID); setSubTextAppearance(styleID.Data); } // Text Color attrs need to be set after TextAppearance attrs if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderTextColor)) { ColorStateList colors = attrs.GetColorStateList(Resource.Styleable.PullToRefresh_ptrHeaderTextColor); if (null != colors) { setTextColor(colors); } } if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrHeaderSubTextColor)) { ColorStateList colors = attrs.GetColorStateList(Resource.Styleable.PullToRefresh_ptrHeaderSubTextColor); if (null != colors) { setSubTextColor(colors); } } // Try and get defined drawable from Attrs Drawable imageDrawable = null; if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawable)) { imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawable); } // Check Specific Drawable from Attrs, these overrite the generic // drawable attr above switch (mode) { case Mode.PULL_FROM_START: default: if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableStart)) { imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableStart); } else if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableTop)) { Utils.warnDeprecation("ptrDrawableTop", "ptrDrawableStart"); imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableTop); } break; case Mode.PULL_FROM_END: if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableEnd)) { imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableEnd); } else if (attrs.HasValue(Resource.Styleable.PullToRefresh_ptrDrawableBottom)) { Utils.warnDeprecation("ptrDrawableBottom", "ptrDrawableEnd"); imageDrawable = attrs.GetDrawable(Resource.Styleable.PullToRefresh_ptrDrawableBottom); } break; } // If we don't have a user defined drawable, load the default if (null == imageDrawable) { imageDrawable = context.Resources.GetDrawable(getDefaultDrawableResId()); } // Set Drawable, and save width/height setLoadingDrawable(imageDrawable); reset(); }
public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent) { try { var inflater = _context.GetSystemService(Context.LayoutInflaterService) as LayoutInflater; switch (groupPosition) { case 0: if (vm.EntryList.Count == 0) { try { var view4 = inflater.Inflate(Resource.Layout.NothingSelected, parent, false); return(view4); } catch (Exception ex) { var m = ex.Message; } } var result = vm.EntryList [childPosition]; bool isexisting = convertView is LinearLayout; if (isexisting && (convertView as LinearLayout).FindViewById <TextView> (Resource.Id.itemText) == null) { isexisting = false; } LinearLayout view = (isexisting ? convertView : inflater.Inflate(Resource.Layout.EntryListItem, parent, false)) as LinearLayout; var itemText = view.FindViewById <TextView> (Resource.Id.itemText); var summary = view.FindViewById <TextView> (Resource.Id.summary); SessionLog.Debug(string.Format("ItemText: {0} = {1} ({2})", vm.Period, itemText, isexisting)); itemText.SetText(result.ItemText, TextView.BufferType.Normal); summary.SetText(result.Summary, TextView.BufferType.Normal); return(view); case 1: try { bool isexisting2 = convertView is LinearLayout; if (isexisting2 && (convertView as LinearLayout).FindViewById <Button> (Resource.Id.hidead) == null) { isexisting2 = false; } LinearLayout view3 = isexisting2 ? (LinearLayout)convertView : (LinearLayout)inflater.Inflate(Resource.Layout.Ad, parent, false); if (!isexisting2) { view3.FindViewById <Button> (Resource.Id.hidead).Click += (object sender, EventArgs e) => { FoodJournal.Runtime.Navigate.ToBuyNowPage(); }; } // show moved to DayPivot // if (ad.Parent != null) // (ad.Parent as LinearLayout).RemoveView (ad); // // (view3 as LinearLayout).AddView (ad); AllAds.Add(view3); if (daypivot == null) { daypivot = FoodJournal.Runtime.Navigate.navigationContext as DayPivot; } daypivot.SetAd(vm.Period, view3); // } else { // var requestbuilder = new AdRequest.Builder (); // ad.LoadAd (requestbuilder.Build ()); // } // // //var layout = FindViewById<LinearLayout>(Resource.Id.mainlayout); // //layout.AddView(ad); // // //AdRequest re; // // //AdRequest re = new AdRequest(); // //re. // //view3.FindViewById<AdView>(Resource.Id.ad).LoadAd(re); return(view3); } catch (Exception ex) { var m = ex.Message; } return(new Button(parent.Context)); case 2: var item = vm.ItemList [childPosition]; if (convertView != null && convertView.Tag != null) { convertView = null; } // Try to reuse convertView if it's not null, otherwise inflate it from our item layout FrameLayout view2 = (convertView is FrameLayout ? convertView : inflater.Inflate(Resource.Layout.ItemListItem, parent, false)) as FrameLayout; var captionA = item.CaptionAccent; if (captionA != null) { captionA = captionA.ToUpper(); } if (captionA != null) { view2 = inflater.Inflate(Resource.Layout.ItemListSection, parent, false) as FrameLayout; view2.Tag = "this"; } var captionAccent = view2.FindViewById <TextView> (Resource.Id.captionAccent); var text = view2.FindViewById <TextView> (Resource.Id.text); // if (childPosition % 2 == 0) // { // var d = _context.Resources.GetDrawable(Resource.Drawable.divider); // view2.SetBackgroundDrawable(d); // } captionAccent.SetText(captionA, TextView.BufferType.Normal); text.SetText(item.Text, TextView.BufferType.Normal); return(view2); } } catch (Exception ex) { var ex2 = ex.Message; } return(convertView); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { _calc = (FrameLayout)inflater.Inflate(Resource.Layout.Calc, container, false); int[] numBtnsId = new[] { Resource.Id.num1_btn, Resource.Id.num2_btn, Resource.Id.num3_btn, Resource.Id.num4_btn, Resource.Id.num5_btn, Resource.Id.num6_btn, Resource.Id.num7_btn, Resource.Id.num8_btn, Resource.Id.num9_btn, Resource.Id.num0_btn }; List <Button> numBtns = new List <Button>(); foreach (int btnID in numBtnsId) { numBtns.Add(_calc.FindViewById <Button>(btnID)); } foreach (Button btn in numBtns) { btn.Click += (sender, args) => buttonNum_Click(sender, args); } Button btnPlus = _calc.FindViewById <Button>(Resource.Id.add_btn); Button btnMinus = _calc.FindViewById <Button>(Resource.Id.sub_btn); Button btnMult = _calc.FindViewById <Button>(Resource.Id.mul_btn); Button btnDiv = _calc.FindViewById <Button>(Resource.Id.div_btn); Button btnEq = _calc.FindViewById <Button>(Resource.Id.equals_btn); Button btnBalls = _calc.FindViewById <Button>(Resource.Id.add_balls_btn); Button btnClear = _calc.FindViewById <Button>(Resource.Id.clear_btn); Button btnTimer = _calc.FindViewById <Button>(Resource.Id.timer_btn); _textView = _calc.FindViewById <TextView>(Resource.Id.textView1); if (Arguments != null) { Bundle args = Arguments; _textView.Text = args.GetString("res"); } btnPlus.Click += new System.EventHandler(buttonOP_Click); btnMinus.Click += new System.EventHandler(buttonOP_Click); btnMult.Click += new System.EventHandler(buttonOP_Click); btnDiv.Click += new System.EventHandler(buttonOP_Click); btnEq.Click += new System.EventHandler(buttonEq_Click); btnTimer.Click += delegate { Task.Factory.StartNew(() => { Thread.Sleep(2000); Bitmap imageBitmap = null; using (var webClient = new WebClient()) { var imageBytes = webClient.DownloadData("http://www.123software.ru/wp-content/uploads/2015/10/Bez-imeni-2.png"); if (imageBytes != null && imageBytes.Length > 0) { imageBitmap = BitmapFactory.DecodeByteArray(imageBytes, 0, imageBytes.Length); _calc.FindViewById <ImageView>(Resource.Id.imgView).SetImageBitmap(imageBitmap); } } }); }; btnBalls.Click += delegate { FragmentTransaction ft = FragmentManager.BeginTransaction(); Fragment ballsFr = new BallsFragment(); Bundle bndl = new Bundle(); bndl.PutString("res", _textView.Text == "" ? "0" : _textView.Text); ballsFr.Arguments = bndl; ft.Add(Resource.Id.calcLayout, ballsFr, "ballsFr"); ft.AddToBackStack(this.Tag); ft.Commit(); }; btnClear.Click += delegate { _a = 0; _b = 0; _op = ""; _fl = false; _textView.Text = ""; FragmentManager.PopBackStack(); _calc.FindViewById <ImageView>(Resource.Id.imgView).SetImageBitmap(Bitmap.CreateBitmap(1, 1, Bitmap.Config.Argb8888)); }; return(_calc); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { rootView = (FrameLayout)inflater.Inflate(Resource.Layout.math_fragment, container, false); TransitionManager.BeginDelayedTransition((ViewGroup)rootView, new ChangeText().SetChangeBehavior(ChangeText.ChangeBehaviorOutIn)); igrajPonovo = rootView.FindViewById <FButton>(Resource.Id.igrajPonovo); izlaz = rootView.FindViewById <FButton>(Resource.Id.izlaz); number1Btn = rootView.FindViewById <FButton>(Resource.Id.number1); number2Btn = rootView.FindViewById <FButton>(Resource.Id.number2); number3Btn = rootView.FindViewById <FButton>(Resource.Id.number3); number4Btn = rootView.FindViewById <FButton>(Resource.Id.number4); number5Btn = rootView.FindViewById <FButton>(Resource.Id.number5); number6Btn = rootView.FindViewById <FButton>(Resource.Id.number6); number7Btn = rootView.FindViewById <FButton>(Resource.Id.number7); number8Btn = rootView.FindViewById <FButton>(Resource.Id.number8); number9Btn = rootView.FindViewById <FButton>(Resource.Id.number9); number0Btn = rootView.FindViewById <FButton>(Resource.Id.number0); delete = rootView.FindViewById <FButton>(Resource.Id.delete); start = rootView.FindViewById <FButton>(Resource.Id.start); startLayout = rootView.FindViewById <LinearLayout>(Resource.Id.startLayout); number1TW = rootView.FindViewById <TextView>(Resource.Id.number1TW); number2TW = rootView.FindViewById <TextView>(Resource.Id.number2TW); solutionTW = rootView.FindViewById <TextView>(Resource.Id.solutionTW); vreme = rootView.FindViewById <TextView>(Resource.Id.vreme); redniBrojZadatka = rootView.FindViewById <TextView>(Resource.Id.redniBrojZadatka); operacijaTW = rootView.FindViewById <TextView>(Resource.Id.operacija); tacnihOdgovoraTW = rootView.FindViewById <TextView>(Resource.Id.tacnihOdgovora); brojTacnihNaKraju = rootView.FindViewById <TextView>(Resource.Id.brojTacnihNaKraju); vremeNaKraju = rootView.FindViewById <TextView>(Resource.Id.vremeNaKraju); igrajPonovoLayout = rootView.FindViewById <LinearLayout>(Resource.Id.igrajPonovoLayout); questionLayout = rootView.FindViewById <LinearLayout>(Resource.Id.questionLayout); Init(); start.Click += delegate { Start(); }; izlaz.Click += delegate { //Activity.FragmentManager.PopBackStack(); PlayFragment pf = new PlayFragment(); Activity.FragmentManager.BeginTransaction().Replace(App.fragmentContainer.Id, pf, "play").Commit(); App.CurrentFragment = pf; }; igrajPonovo.Click += delegate { Start(); }; return(rootView); }
public void SetValues() { switch (operacija) { case Operacije.Plus: { number1 = rand.Next(maxValue); number2 = rand.Next(maxValue - number1); correctAnswer = number1 + number2; break; } case Operacije.Minus: { number1 = rand.Next(maxValue); number2 = rand.Next(number1); correctAnswer = number1 - number2; break; } case Operacije.Mnozenje: { number1 = rand.Next(maxValue); number2 = rand.Next(maxValue); while (number1 * number2 > App.preferences.mnozenje) { number2 = rand.Next(maxValue); } correctAnswer = number1 * number2; break; } case Operacije.Deljenje: { number1 = rand.Next(maxValue); number2 = rand.Next(1, maxValue); while (number1 * number2 > App.preferences.deljenje) { number2 = rand.Next(maxValue); } correctAnswer = number1; number1 = number1 * number2; break; } } number1TW.Text = number1.ToString(); number2TW.Text = number2.ToString(); int j = rand.Next(1, 4); String idCorrect = "answer" + j; int btnIdCorrect = Resources.GetIdentifier(idCorrect, "id", Activity.PackageName); FButton btnCorrect = rootView.FindViewById <FButton>(btnIdCorrect); //TransitionManager.BeginDelayedTransition((ViewGroup)rootView, // new ChangeText().SetChangeBehavior(ChangeText.ChangeBehaviorOutIn)); btnCorrect.Text = correctAnswer.ToString(); for (int i = 1; i <= 4; i++) { if (!i.Equals(j)) { String id = "answer" + i; int btnID = Resources.GetIdentifier(id, "id", Activity.PackageName); FButton btn = rootView.FindViewById <FButton>(btnID); int fakeAnswer = GenerateFakeAnswer(); //TransitionManager.BeginDelayedTransition((ViewGroup)rootView, // new ChangeText().SetChangeBehavior(ChangeText.ChangeBehaviorOutIn)); btn.Text = fakeAnswer.ToString(); } } }