public void RestoreState(Bundle icicle) { SetMode(GameMode.Paused); apples = Coordenadas.ArrayToList(icicle.GetIntArray("mCheeseList")); mDireccion = (Direccion)icicle.GetInt("mDireccion"); mSig_Direccion = (Direccion)icicle.GetInt("mSig_Direccion"); mMoveDelay = icicle.GetInt("mMoveDelay"); mPuntos = icicle.GetLong("mPuntos"); snake_campo = Coordenadas.ArrayToList(icicle.GetIntArray("mSnakeTrail")); }
// Restore game state if our process is being relaunched public void RestoreState(Bundle icicle) { SetMode(GameMode.Paused); apples = Coordinate.ArrayToList(icicle.GetIntArray("mAppleList")); mDirection = (Direction)icicle.GetInt("mDirection"); mNextDirection = (Direction)icicle.GetInt("mNextDirection"); mMoveDelay = icicle.GetInt("mMoveDelay"); mScore = icicle.GetLong("mScore"); snake_trail = Coordinate.ArrayToList(icicle.GetIntArray("mSnakeTrail")); }
protected override void OnCreateActivity(Bundle state) { base.OnCreateActivity(state); SetContentView(Resource.Layout.MainDrawerActivity); MainToolbar = FindViewById <Toolbar> (Resource.Id.MainToolbar); DrawerListView = FindViewById <ListView> (Resource.Id.DrawerListView); DrawerUserView = LayoutInflater.Inflate(Resource.Layout.MainDrawerListHeader, null); DrawerUserName = DrawerUserView.FindViewById <TextView> (Resource.Id.TitleTextView); DrawerImage = DrawerUserView.FindViewById <ProfileImageView> (Resource.Id.IconProfileImageView); DrawerListView.AddHeaderView(DrawerUserView); DrawerListView.Adapter = drawerAdapter = new DrawerListAdapter(); DrawerListView.ItemClick += OnDrawerListViewItemClick; var authManager = ServiceContainer.Resolve <AuthManager> (); authManager.PropertyChanged += OnUserChangedEvent; DrawerLayout = FindViewById <DrawerLayout> (Resource.Id.DrawerLayout); DrawerToggle = new ActionBarDrawerToggle(this, DrawerLayout, MainToolbar, Resource.String.EntryName, Resource.String.EntryName); DrawerLayout.SetDrawerShadow(Resource.Drawable.drawershadow, (int)GravityFlags.Start); DrawerLayout.SetDrawerListener(DrawerToggle); var drawerFrameLayout = FindViewById <FrameLayout> (Resource.Id.DrawerFrameLayout); drawerFrameLayout.Touch += (sender, e) => { // Do nothing, just absorb the event // TODO: Improve this dirty solution? }; Timer.OnCreate(this); var lp = new Android.Support.V7.App.ActionBar.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, (int)GravityFlags.Right); MainToolbar.SetNavigationIcon(Resource.Drawable.ic_menu_black_24dp); SetSupportActionBar(MainToolbar); SupportActionBar.SetTitle(Resource.String.MainDrawerTimer); SupportActionBar.SetCustomView(Timer.Root, lp); SupportActionBar.SetDisplayShowCustomEnabled(true); if (state == null) { OpenPage(DrawerListAdapter.TimerPageId); } else { // Restore page stack pageStack.Clear(); var arr = state.GetIntArray(PageStackExtra); if (arr != null) { pageStack.AddRange(arr); } } // Make sure that the user will see newest data when they start the activity ServiceContainer.Resolve <ISyncManager> ().Run(); }
public override void RestoreFromBundle(Bundle bundle) { base.RestoreFromBundle(bundle); var data = bundle.GetIntArray(CUR); if (data != null) { var start = bundle.GetInt(START); for (var i = 0; i < data.Length; i++) { Cur[i + start] = data[i]; Volume += data[i]; } } if (!levels.Level.resizingNeeded) { return; } var cur = new int[levels.Level.Length]; Arrays.Fill(cur, 0); var loadedMapSize = levels.Level.loadedMapSize; for (var i = 0; i < loadedMapSize; i++) { Array.Copy(this.Cur, i * loadedMapSize, cur, i * levels.Level.Width, loadedMapSize); } Cur = cur; }
/// <inheritdoc /> public int[]? GetIntArray([CallerMemberName] string?key = null) { if (key == null) { throw new ArgumentNullException(nameof(key)); } return(_bundle.GetIntArray(key)); }
public int[]? GetIntArray(int[]?defaultValue = default, string?key = null) { if (string.IsNullOrWhiteSpace(key)) { throw new ArgumentException("Value cannot be null or whitespace.", nameof(key)); } return(_bundle.GetIntArray(key) ?? defaultValue); }
protected override void OnRestoreInstanceState(Bundle savedInstanceState) { base.OnRestoreInstanceState(savedInstanceState); if (savedInstanceState != null) { _passcodeEntered = savedInstanceState.GetIntArray(KEY_PASSCODE_ENTERED); _numbersEntered = savedInstanceState.GetInt(KEY_PASSCODE_COUNT); UpdateFilledCircles(); } }
public override void OnCreate(Bundle bundle) { base.OnCreate(bundle); HasOptionsMenu = true; if (bundle != null) { updateCiudades(bundle.GetStringArray("CIUDADES"), bundle.GetIntArray("LOGOS"), bundle.GetStringArray("INFO")); } // Create your fragment here }
protected override void OnReceiveResult(int resultCode, Bundle resultData) { base.OnReceiveResult(resultCode, resultData); var permissions = resultData.GetStringArray(PermissionsHelper.KeyPermissions); var grantResults = resultData.GetIntArray(PermissionsHelper.KeyGrants); var permissionState = permissions.Select((t, i) => new PermissionState(t, grantResults[i] == (int)Permission.Granted)).ToList(); _tcs.SetResult(permissionState); }
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); Log.Debug(Tag, "onCreate(Bundle) called"); SetContentView(Resource.Layout.Main); if (savedInstanceState != null) { answeredQuestions = savedInstanceState.GetIntArray(KeyArray).ToList(); cheatedQuestions = savedInstanceState.GetIntArray(KeyCheatedArray).ToList(); score = savedInstanceState.GetInt(KeyScore); currentIndex = savedInstanceState.GetInt(KeyIndex); availableCheats = savedInstanceState.GetInt(KeyCheats); } InitFields(); SetListeners(); UpdateQuestion(); _cheatsTextView.Text = string.Format(GetString(Resource.String.remaining_cheats), availableCheats); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Game); Init(); if (bundle == null) { ShowQuestion(); } else { currentQuestion = bundle.GetInt(nameof(currentQuestion)); answered = bundle.GetInt(nameof(answered)); timeLeft = bundle.GetInt(nameof(timeLeft)); askedEasy.AddRange(bundle.GetIntArray(nameof(askedEasy))); askedMedium.AddRange(bundle.GetIntArray(nameof(askedMedium))); ShowQuestion(currentQuestion); fifty50Used = bundle.GetBoolean(nameof(fifty50Used)); doubleDipUsed = bundle.GetBoolean(nameof(doubleDipUsed)); audiencePollUsed = bundle.GetBoolean(nameof(audiencePollUsed)); changeQuestionUsed = bundle.GetBoolean(nameof(changeQuestionUsed)); } UpdateLifelineButtons(); if (cashView == null) { InitMoneyTreeFragment(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn); _friendWordMode = Intent.GetBooleanExtra(nameof(_friendWordMode), false); if (_friendWordMode) { _currentWord = Intent.GetStringExtra(nameof(_currentWord)) ?? string.Empty; } var currentLanguage = Locale.Default.Language; _currentLocale = currentLanguage == "es" ? Locales.Spain : currentLanguage == "ru" ? Locales.Russian : Locales.English; _alphabetIntArray = new int[GameHelper.GetAlphabet(_currentLocale).Length]; for (int i = 0; i < GameHelper.GetAlphabet(_currentLocale).Length; i++) { _alphabetIntArray[i] = 1; } if (savedInstanceState != null) { _friendWordMode = savedInstanceState.GetBoolean(nameof(_friendWordMode)); _currentWord = savedInstanceState.GetString(nameof(_currentWord)); _alphabetIntArray = savedInstanceState.GetIntArray(nameof(_alphabetIntArray)); } _progressDialog = new ProgressDialog(this, Resource.Style.ProgressDialogTheme) { Indeterminate = true }; _progressDialog.SetCancelable(false); _progressDialog.SetProgressStyle(ProgressDialogStyle.Spinner); _progressDialog.SetMessage("Загрузка..."); SetContentView(Resource.Layout.game); }
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; 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); } } }
// Restore game state if our process is being relaunched public void RestoreState(Bundle icicle) { SetMode (GameMode.Paused); apples = Coordinate.ArrayToList (icicle.GetIntArray ("mAppleList")); mDirection = (Direction)icicle.GetInt ("mDirection"); mNextDirection = (Direction)icicle.GetInt ("mNextDirection"); mMoveDelay = icicle.GetInt ("mMoveDelay"); mScore = icicle.GetLong ("mScore"); snake_trail = Coordinate.ArrayToList (icicle.GetIntArray ("mSnakeTrail")); }
protected override void OnCreateActivity (Bundle state) { base.OnCreateActivity (state); SetContentView (Resource.Layout.MainDrawerActivity); MainToolbar = FindViewById<Toolbar> (Resource.Id.MainToolbar); DrawerListView = FindViewById<ListView> (Resource.Id.DrawerListView); DrawerUserView = LayoutInflater.Inflate (Resource.Layout.MainDrawerListHeader, null); DrawerUserName = DrawerUserView.FindViewById<TextView> (Resource.Id.TitleTextView); DrawerImage = DrawerUserView.FindViewById<ProfileImageView> (Resource.Id.IconProfileImageView); DrawerListView.AddHeaderView (DrawerUserView); DrawerListView.Adapter = drawerAdapter = new DrawerListAdapter (); DrawerListView.ItemClick += OnDrawerListViewItemClick; var authManager = ServiceContainer.Resolve<AuthManager> (); authManager.PropertyChanged += OnUserChangedEvent; DrawerLayout = FindViewById<DrawerLayout> (Resource.Id.DrawerLayout); DrawerToggle = new ActionBarDrawerToggle (this, DrawerLayout, MainToolbar, Resource.String.EntryName, Resource.String.EntryName); DrawerLayout.SetDrawerShadow (Resource.Drawable.drawershadow, (int)GravityFlags.Start); DrawerLayout.SetDrawerListener (DrawerToggle); Timer.OnCreate (this); var lp = new Android.Support.V7.App.ActionBar.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, (int)GravityFlags.Right); MainToolbar.SetNavigationIcon (Resource.Drawable.ic_menu_black_24dp); SetSupportActionBar (MainToolbar); SupportActionBar.SetTitle (Resource.String.MainDrawerTimer); SupportActionBar.SetCustomView (Timer.Root, lp); SupportActionBar.SetDisplayShowCustomEnabled (true); 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); if (state == null) { OpenPage (DrawerListAdapter.TimerPageId); } else { // Restore page stack pageStack.Clear (); var arr = state.GetIntArray (PageStackExtra); if (arr != null) { pageStack.AddRange (arr); } } // Make sure that the user will see newest data when they start the activity ServiceContainer.Resolve<ISyncManager> ().Run (); }
protected override void OnRestoreInstanceState(Bundle savedInstanceState) { base.OnRestoreInstanceState(savedInstanceState); if(savedInstanceState != null) { _passcodeEntered = savedInstanceState.GetIntArray(KEY_PASSCODE_ENTERED); _numbersEntered = savedInstanceState.GetInt(KEY_PASSCODE_COUNT); UpdateFilledCircles(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); // changing CultureInfo to en-GB to show decimal point as "." instead of "," Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-GB"); // creating an array of 36 TextViews used for storing every cell from TableLayout int textViewCount = 36; textViewArray = new TextView[textViewCount]; // assigning resources to local variables Spinner spinner = FindViewById <Spinner>(Resource.Id.spinnerPrimaryType); Spinner spinner2 = FindViewById <Spinner>(Resource.Id.spinnerSecondaryType); Button showDmgButton = FindViewById <Button>(Resource.Id.showDmgButton); TableLayout tableLayout1 = FindViewById <TableLayout>(Resource.Id.tableLayout1); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); // filling textViewArray with TextViews from TableLayout int y = 0; for (int i = 1; i < tableLayout1.ChildCount; i++) { View child = tableLayout1.GetChildAt(i); if (child is TableRow row) { for (int x = 0; x < row.ChildCount; x++) { View view = row.GetChildAt(x); textViewArray[y] = (TextView)view; ++y; } } } // restoring saved data when screen orientation is changed if (savedInstanceState != null) { string[] temp = savedInstanceState.GetStringArray("savedArray"); int[] tempColors = savedInstanceState.GetIntArray("savedColors"); selectedSorting = savedInstanceState.GetInt("savedSorting"); for (int d = 0; d < 36; d++) { textViewArray[d].Text = temp[d]; Android.Graphics.Color backgroundColor = new Android.Graphics.Color(tempColors[d]); textViewArray[d].SetBackgroundColor(backgroundColor); } if (temp[0] != "") { tableLayout1.SetColumnCollapsed(0, false); tableLayout1.SetColumnCollapsed(1, false); } } // creating 2 custom spinner adapters and assigning them to the primary and secondary pokemon type spinners ColorfulSpinnerAdapter adapter = new ColorfulSpinnerAdapter(this, Resource.Array.pokemonType, Resource.Layout.spinner_item); ColorfulSpinnerAdapter adapter2 = new ColorfulSpinnerAdapter(this, Resource.Array.pokemonType, Resource.Layout.spinner_item); spinner.Adapter = adapter; spinner2.Adapter = adapter2; // creating local variables used for filling TextViews string type1 = string.Empty; string type2 = string.Empty; TypeCalculator dmgCalc = new TypeCalculator(); PkmnType[] typez; PkmnType[] typez2; showDmgButton.Click += (sender, e) => { // checks spinner content type1 = spinner.SelectedItem.ToString(); type2 = spinner2.SelectedItem.ToString(); // check if one of chosen types is (none) if (string.Equals(type1, Resources.GetString(Resource.String.notype))) { if (string.Equals(type2, Resources.GetString(Resource.String.notype))) { // fill TextViews of TableLayout with empty strings if both chosen types are (none) for (int d = 0; d < textViewCount; d++) { textViewArray[d].Text = ""; } // hide table tableLayout1.SetColumnCollapsed(0, true); tableLayout1.SetColumnCollapsed(1, true); } else { // if the secondary type is not (none) check type and start filling table with sorted values typez = dmgCalc.CheckType(type2); // check selected sorting option if (selectedSorting == menu.GetItem(2).ItemId) { typez = dmgCalc.SortPkmnTypes(typez); } else if (selectedSorting == menu.GetItem(1).ItemId) { typez = dmgCalc.SortPkmnTypesByName(typez); } for (int d = 0, t = 0; d < textViewCount - 1; d += 2, t++) { textViewArray[d].Text = typez[t].TypeName; textViewArray[d].SetBackgroundColor(typez[t].TypeColor); textViewArray[d + 1].SetBackgroundColor(typez[t].TypeColor); textViewArray[d + 1].Text = typez[t].DmgTaken.ToString() + "x"; } // show table tableLayout1.SetColumnCollapsed(0, false); tableLayout1.SetColumnCollapsed(1, false); } } else { // if secondary type equals (none) or both types are the same check only primary type dmg multipliers if (string.Equals(type2, Resources.GetString(Resource.String.notype)) || string.Equals(type2, type1)) { typez = dmgCalc.CheckType(type1); // check selected sorting option if (selectedSorting == menu.GetItem(2).ItemId) { typez = dmgCalc.SortPkmnTypes(typez); } else if (selectedSorting == menu.GetItem(1).ItemId) { typez = dmgCalc.SortPkmnTypesByName(typez); } for (int d = 0, t = 0; d < textViewCount - 1; d += 2, t++) { textViewArray[d].Text = typez[t].TypeName; textViewArray[d].SetBackgroundColor(typez[t].TypeColor); textViewArray[d + 1].SetBackgroundColor(typez[t].TypeColor); textViewArray[d + 1].Text = typez[t].DmgTaken.ToString() + "x"; } } else { // if both types are different and none of them equals (none) check both types and // multiply primary type multipliers by secondary type multipliers typez = dmgCalc.CheckType(type1); typez2 = dmgCalc.CheckType(type2); for (int i = 0; i < 18; ++i) { typez[i].DmgTaken *= typez2[i].DmgTaken; } // check selected sorting option if (selectedSorting == menu.GetItem(2).ItemId) { typez = dmgCalc.SortPkmnTypes(typez); } else if (selectedSorting == menu.GetItem(1).ItemId) { typez = dmgCalc.SortPkmnTypesByName(typez); } for (int d = 0, t = 0; d < textViewCount - 1; d += 2, t++) { textViewArray[d].Text = typez[t].TypeName; textViewArray[d].SetBackgroundColor(typez[t].TypeColor); textViewArray[d + 1].SetBackgroundColor(typez[t].TypeColor); textViewArray[d + 1].Text = typez[t].DmgTaken.ToString() + "x"; } } tableLayout1.SetColumnCollapsed(0, false); tableLayout1.SetColumnCollapsed(1, false); } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Bundle extras = Intent.Extras; spriteName = extras.GetString(GetString(Resource.String.bundle_sprite_name)); int[] dimensions = extras.GetIntArray( GetString(Resource.String.bundle_sprite_dimensions)); w = dimensions[0]; h = dimensions[1]; //SetContentView(Resource.Layout.make_sprite); SetContentView(Resource.Layout.activity_make_sprite); // Drawer layout drawButton = FindViewById <Button>(Resource.Id.drawButton); drawButton.GetLocationOnScreen(buttonLocs); drawButton.Touch += OnbuttonPush; //// Setup Drawer drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_make_sprite); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, null, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawerLayout.AddDrawerListener(toggle); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view_create_sprite); navigationView.SetNavigationItemSelectedListener(this); canvasView = FindViewById <ImageView>(Resource.Id.imageView); cursorView = FindViewById <ImageView>(Resource.Id.cursorView); SetUpImage(ref this.canvas, ref this.mainSpriteDisplay, ref this.sourceBitmap, canvasView, w, h); commandHistory = new CommandHistory(); //Seems redundant for now tools = new Tool[4]; tools[0] = new PencilTool(commandHistory, sourceBitmap); tools[1] = new EraserTool(commandHistory, sourceBitmap); tools[2] = new FillTool(commandHistory, sourceBitmap); tools[3] = new ColorPickerTool(commandHistory, sourceBitmap); currentTool = tools[0]; FrameLayout spriteMainLayout = FindViewById <FrameLayout>(Resource.Id.make_sprite_main_layout); spriteMainLayout.Touch += OnSpriteCanvasTouched; SetupSideImageViews(Resource.Id.imageViewLeft, sourceBitmap); SetupSideImageViews(Resource.Id.imageViewTop, sourceBitmap); SetupSideImageViews(Resource.Id.imageViewRight, sourceBitmap); SetupSideImageViews(Resource.Id.imageViewBottom, sourceBitmap); canvas.DrawARGB(255, 255, 0, 255); curX = cursorView.GetX(); curY = cursorView.GetY(); SetupButtons(); }
private bool InnerExtractValues(Bundle bundle, IList <ClarifiedError <int> > entity) { int[] errors = bundle.GetIntArray(ErrorsKey); int[] clarifications = bundle.GetIntArray(ClarificationsLey); return(MergeArrays(errors, clarifications, entity)); }
public void RestoreState(Bundle icicle) { SetMode (GameMode.Paused); apples = Coordenadas.ArrayToList (icicle.GetIntArray ("mCheeseList")); mDireccion = (Direccion)icicle.GetInt ("mDireccion"); mSig_Direccion = (Direccion)icicle.GetInt ("mSig_Direccion"); mMoveDelay = icicle.GetInt ("mMoveDelay"); mPuntos = icicle.GetLong ("mPuntos"); snake_campo = Coordenadas.ArrayToList (icicle.GetIntArray ("mSnakeTrail")); }
public virtual void RestoreFromBundle(Bundle bundle) { mobs = new HashSet <Mob>(); heaps = new SparseArray <Heap>(); Blobs = new Dictionary <Type, Blob>(); plants = new SparseArray <Plant>(); map = bundle.GetIntArray(MAP); visited = bundle.GetBooleanArray(VISITED); mapped = bundle.GetBooleanArray(MAPPED); entrance = bundle.GetInt(ENTRANCE); exit = bundle.GetInt(EXIT); weakFloorCreated = false; AdjustMapSize(); var collection = bundle.GetCollection(HEAPS); foreach (var h in collection) { var heap = (Heap)h; if (resizingNeeded) { heap.Pos = AdjustPos(heap.Pos); } heaps.Add(heap.Pos, heap); } collection = bundle.GetCollection(PLANTS); foreach (var p in collection) { var plant = (Plant)p; if (resizingNeeded) { plant.Pos = AdjustPos(plant.Pos); } plants.Add(plant.Pos, plant); } collection = bundle.GetCollection(MOBS); foreach (var m in collection) { var mob = (Mob)m; if (mob == null) { continue; } if (resizingNeeded) { mob.pos = AdjustPos(mob.pos); } mobs.Add(mob); } collection = bundle.GetCollection(BLOBS); foreach (var blob in collection.OfType <Blob>()) { Blobs.Add(blob.GetType(), blob); } BuildFlagMaps(); CleanWalls(); }
protected override void OnCreateActivity (Bundle state) { base.OnCreateActivity (state); SetContentView (Resource.Layout.MainDrawerActivity); MainToolbar = FindViewById<Toolbar> (Resource.Id.MainToolbar); DrawerListView = FindViewById<ListView> (Resource.Id.DrawerListView); DrawerUserView = LayoutInflater.Inflate (Resource.Layout.MainDrawerListHeader, null); DrawerUserName = DrawerUserView.FindViewById<TextView> (Resource.Id.TitleTextView); DrawerEmail = DrawerUserView.FindViewById<TextView> (Resource.Id.EmailTextView); DrawerImage = DrawerUserView.FindViewById<ProfileImageView> (Resource.Id.IconProfileImageView); if (!ServiceContainer.Resolve<AuthManager>().OfflineMode) { DrawerListView.AddHeaderView (DrawerUserView); } DrawerListView.Adapter = drawerAdapter = new DrawerListAdapter (); DrawerListView.ItemClick += OnDrawerListViewItemClick; authManager = ServiceContainer.Resolve<AuthManager> (); authManager.PropertyChanged += OnUserChangedEvent; DrawerLayout = FindViewById<DrawerLayout> (Resource.Id.DrawerLayout); DrawerToggle = new ActionBarDrawerToggle (this, DrawerLayout, MainToolbar, Resource.String.EntryName, Resource.String.EntryName); DrawerLayout.SetDrawerShadow (Resource.Drawable.drawershadow, (int)GravityFlags.Start); DrawerLayout.SetDrawerListener (DrawerToggle); var drawerFrameLayout = FindViewById<FrameLayout> (Resource.Id.DrawerFrameLayout); drawerFrameLayout.Touch += (sender, e) => { // Do nothing, just absorb the event // TODO: Improve this dirty solution? }; Timer.OnCreate (this); var lp = new Android.Support.V7.App.ActionBar.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent, (int)GravityFlags.Right); MainToolbar.SetNavigationIcon (Resource.Drawable.ic_menu_black_24dp); SetSupportActionBar (MainToolbar); SupportActionBar.SetTitle (Resource.String.MainDrawerTimer); SupportActionBar.SetCustomView (Timer.Root, lp); SupportActionBar.SetDisplayShowCustomEnabled (true); if (state == null) { OpenPage (DrawerListAdapter.TimerPageId); } else { // Restore page stack pageStack.Clear (); var arr = state.GetIntArray (PageStackExtra); if (arr != null) { pageStack.AddRange (arr); } } // Make sure that the user will see newest data when they start the activity ServiceContainer.Resolve<ISyncManager> ().Run (); }