protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ActivityControllInterfaceLayout); _joystickFragment = FragmentManager.FindFragmentById <JoystickFragment>(Resource.Id.fragmentJoystick); _tabLayout = FindViewById <TabLayout>(Resource.Id.controlTxtTabLayout); _viewPager = FindViewById <ViewPager>(Resource.Id.controlTxtViewPager); ExtractExtraData(); SetupToolbar(); SetupTabs(); if (savedInstanceState == null) { // When this is the initial startup where we hide the joystick fragment HideJoystick(false); } else { RetreiveSavedState(savedInstanceState); } }
protected override void OnCreate(Bundle savedInstanceState) { RequestWindowFeature(WindowFeatures.NoTitle); base.OnCreate(savedInstanceState); //clsock.Connect(); SetContentView(Resource.Layout.activity_main); //Android.Support.V7.Widget.Toolbar toolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); //SetSupportActionBar(toolbar); Android.Support.V4.App.FragmentManager fm = SupportFragmentManager; Android.Support.V4.App.Fragment fragment = fm.FindFragmentById(Resource.Id.main_act_fragment); if (fragment == null) { fragment = new MainActivityFragmentHolder(); fm.BeginTransaction() .Add(Resource.Id.main_act_fragment, fragment) .Commit(); } if (savedInstanceState == null || !savedInstanceState.ContainsKey("message") || !savedInstanceState.ContainsKey("reply")) { return; } //textbox_send.Text = savedInstanceState.GetString("message"); //textbox_server.Text = savedInstanceState.GetString("server"); //textbox_receive.Text = savedInstanceState.GetString("reply"); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.MainLayout); Android.Support.V4.App.FragmentManager fm = SupportFragmentManager; Android.Support.V4.App.Fragment fragment = fm.FindFragmentById(Resource.Id.fragmentContainer); if (fragment == null) { fragment = new NewsListFragment(); fm.BeginTransaction().Add(Resource.Id.fragmentContainer, fragment).Commit(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.WebLayout); Android.Support.V4.App.FragmentManager fm = SupportFragmentManager; Android.Support.V4.App.Fragment fragment = fm.FindFragmentById(Resource.Id.webLayout); if (fragment == null) { fragment = new ContentWebFragment(); fm.BeginTransaction().Add(Resource.Id.webLayout, fragment).Commit(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); global::Xamarin.Forms.Forms.Init(this, savedInstanceState); SetContentView(Resource.Layout.ActivityMain); Android.Support.V4.App.FragmentManager fm = SupportFragmentManager; playFragment = (PlayFragment)fm.FindFragmentById(Resource.Layout.FragmentPlay); if (playFragment == null) { playFragment = new PlayFragment(); Android.Support.V4.App.FragmentTransaction ft = fm.BeginTransaction(); ft.Add(Resource.Id.main_container, playFragment); ft.Commit(); } toolbarFragment = (ToolBarFragment)fm.FindFragmentById(Resource.Layout.FragmentToolBar); if (toolbarFragment == null) { toolbarFragment = new ToolBarFragment(); Android.Support.V4.App.FragmentTransaction ft = fm.BeginTransaction(); ft.Add(Resource.Id.toolbar_container, toolbarFragment); ft.Commit(); } chordRecognizer = new ChordRecognizer(); MIDIStyle midiStyle = new MIDIStyle(); midiStyle.LoadStyle("ddd"); mplayer = new MIDIPlayer(/*this,*/ midiStyle); mplayer.OnTactEvent += (object sender, OnTactEventArgs e) => playFragment.SetTempoAndTact(e.CurrentTempo, e.CurrentTact); mplayer.OnChordChangeEvent += () => OnChordChanged(); mplayer.OnSectionChangeEvent += () => OnSectionChanged(); mplayer.Tracks = midiStyle.MidiSection.Tracks; mplayer.Start(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_sounds); folderIndex = Intent.GetIntExtra("folder", -1); Android.Support.V4.App.FragmentManager fm = SupportFragmentManager; Android.Support.V4.App.Fragment fragment = fm.FindFragmentById(Resource.Id.sound_act_fragments); if (fragment == null) { fragment = new SoundActivityFragmentHolder(folderIndex); fm.BeginTransaction() .Add(Resource.Id.sound_act_fragments, fragment) .Commit(); } }
private void OpenFragment(Fragment fragment) { var old = FragmentManager.FindFragmentById(Resource.Id.ContentFrameLayout); if (old == null) { FragmentManager.BeginTransaction() .Add(Resource.Id.ContentFrameLayout, fragment) .Commit(); } else if (old != fragment) { // The detach/attach is a workaround for https://code.google.com/p/android/issues/detail?id=42601 FragmentManager.BeginTransaction() .Detach(old) .Replace(Resource.Id.ContentFrameLayout, fragment) .Attach(fragment) .Commit(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); uiHelper = new UiLifecycleHelper(this, callback); uiHelper.OnCreate(savedInstanceState); if (savedInstanceState != null) { string name = savedInstanceState.GetString(PENDING_ACTION_BUNDLE_KEY); pendingAction = (PendingAction)Enum.Parse(typeof(PendingAction), name); } SetContentView(Resource.Layout.main); loginButton = (LoginButton)FindViewById(Resource.Id.login_button); loginButton.UserInfoChangedCallback = new MyUserInfoChangedCallback(this); profilePictureView = FindViewById <ProfilePictureView> (Resource.Id.profilePicture); greeting = FindViewById <TextView> (Resource.Id.greeting); postStatusUpdateButton = FindViewById <Button> (Resource.Id.postStatusUpdateButton); postStatusUpdateButton.Click += delegate { OnClickPostStatusUpdate(); }; postPhotoButton = (Button)FindViewById(Resource.Id.postPhotoButton); postPhotoButton.Click += delegate { OnClickPostPhoto(); }; pickFriendsButton = (Button)FindViewById(Resource.Id.pickFriendsButton); pickFriendsButton.Click += delegate { OnClickPickFriends(); }; pickPlaceButton = (Button)FindViewById(Resource.Id.pickPlaceButton); pickPlaceButton.Click += delegate { OnClickPickPlace(); }; controlsContainer = (ViewGroup)FindViewById(Resource.Id.main_ui_container); Android.Support.V4.App.FragmentManager fm = SupportFragmentManager; Android.Support.V4.App.Fragment fragment = fm.FindFragmentById(Resource.Id.fragment_container); if (fragment != null) { // If we're being re-created and have a fragment, we need to a) hide the main UI controls and // b) hook up its listeners again. controlsContainer.Visibility = ViewStates.Gone; if (fragment is FriendPickerFragment) { SetFriendPickerListeners((FriendPickerFragment)fragment); } else if (fragment is PlacePickerFragment) { SetPlacePickerListeners((PlacePickerFragment)fragment); } } fm.BackStackChanged += delegate { if (fm.BackStackEntryCount == 0) { // We need to re-show our UI. controlsContainer.Visibility = ViewStates.Visible; } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); _uiHelper = new UiLifecycleHelper(this, callback); _uiHelper.OnCreate(savedInstanceState); if (savedInstanceState != null) { string name = savedInstanceState.GetString(PENDING_ACTION_BUNDLE_KEY); _pendingAction = (PendingAction)Enum.Parse(typeof(PendingAction), name); } SetContentView(Resource.Layout.FacebookScreen); //_googlePlayLink = "http://play.google.com/store/apps/details?id=" + this.PackageName; _ID = Intent.GetIntExtra("ID", 0); _Item = MainActivity._BDDB.SelectItem(_ID); TimeSpan ts = _Item._EndDate.Subtract(DateTime.Now); string DaysTo = String.Format("{0:0000}", ts.Days); string HoursTo = String.Format("{0:00}", ts.Hours); string MinTo = String.Format("{0:00}", ts.Minutes); string SecTo = String.Format("{0:00}", ts.Seconds); _message = string.Format("{0} {1} {2} days, {3} hours, {4} minutes, {5} seconds {6}", _Item._Name, _Item._EndDate < DateTime.Now ? "was" : "is coming in", DaysTo, HoursTo, MinTo, SecTo, _Item._EndDate < DateTime.Now ? " ago" : ""); _textFacebookDescription = (TextView)FindViewById(Resource.Id.textFacebookDescription); _textFacebookDescription.Text = _message; _textMessage = (EditText)FindViewById(Resource.Id.txtMessage); _loginButton = (LoginButton)FindViewById(Resource.Id.facebook_login_button); _loginButton.UserInfoChangedCallback = new MyUserInfoChangedCallback(this); _postStatusUpdateButton = FindViewById <Button> (Resource.Id.postStatusUpdateButton); _postStatusUpdateButton.Click += delegate { OnClickPostStatusUpdate(); }; _controlsContainer = (ViewGroup)FindViewById(Resource.Id.main_ui_container); Android.Support.V4.App.FragmentManager fm = SupportFragmentManager; Android.Support.V4.App.Fragment fragment = fm.FindFragmentById(Resource.Id.fragment_container); if (fragment != null) { // If we're being re-created and have a fragment, we need to a) hide the main UI controls and // b) hook up its listeners again. _controlsContainer.Visibility = ViewStates.Gone; } fm.BackStackChanged += delegate { if (fm.BackStackEntryCount == 0) { // We need to re-show our UI. _controlsContainer.Visibility = ViewStates.Visible; } }; }