public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);

            //Current position should survive screen rotations.
            if (savedInstanceState != null)
            {
                mCategory = savedInstanceState.GetInt("category");
                mCurPosition = savedInstanceState.GetInt("listPosition");
            }

            PopulateTitles(mCategory);
            ListView lv = ListView;
            lv.ChoiceMode = ChoiceMode.Single;
            lv.CacheColorHint = Color.Transparent;
            lv.ItemLongClick += (o, e) =>
            {
                String title = (String)((TextView)e.View).Text;

                // Set up clip data with the category||entry_id format.
                String textData = String.Format("{0}||{1}", mCategory, e.Position);
                ClipData data = ClipData.NewPlainText(title, textData);
                e.View.StartDrag(data, new MyDragShadowBuilder(e.View), null, 0);
            };

            SelectPosition(mCurPosition);
        }
Пример #2
0
        public Server(Bundle b)
            : this(b.GetInt("SERVER_ID"),
				b.GetString("SERVER_NAME"),
				b.GetString("SERVER_SCHEME"),
				b.GetString("SERVER_HOSTNAME"),
				b.GetInt("SERVER_PORT"),
				b.GetString("SERVER_USER"),
				b.GetString("SERVER_PASS"),
			b.GetInt("SERVER_GID"))
        {
        }
        public override void OnCreate (Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            if (savedInstanceState != null) {
                digitsEntered = savedInstanceState.GetInt (DigitsEnteredKey, digitsEntered);
                newDuration = new Duration (
                    savedInstanceState.GetInt (NewDurationHoursKey, newDuration.Hours),
                    savedInstanceState.GetInt (NewDurationMinutesKey, newDuration.Minutes));
            }

            oldDuration = GetDuration ();
        }
        public override void OnCreate (Bundle state)
        {
            base.OnCreate (state);

            if (state != null) {
                digitsEntered = state.GetInt (DigitsEnteredKey, digitsEntered);
                newDuration = new Duration (
                    state.GetInt (NewDurationHoursKey, newDuration.Hours),
                    state.GetInt (NewDurationMinutesKey, newDuration.Minutes));
            }

            LoadData ();
        }
Пример #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            if (bundle != null)
            {
                current_theme = bundle.GetInt("theme");

                switch (current_theme)
                {
                    case Resource.Style.ThemeCurrent:
                        current_theme = Resource.Style.ThemeCurrentDialog;
                        break;
                    case Resource.Style.ThemeCurrentDialog:
                        current_theme = Resource.Style.ThemeCurrentDialogWhenLarge;
                        break;
                    case Resource.Style.ThemeCurrentDialogWhenLarge:
                        current_theme = Resource.Style.Theme;
                        break;
                    default:
                        current_theme = Resource.Style.ThemeCurrent;
                        break;
                }

                SetTheme(current_theme);
            }

            SetContentView(Resource.Layout.activity_recreate);

            // Watch for button clicks
            var button = FindViewById<Button>(Resource.Id.recreate);
            button.Click += delegate { Recreate(); };
        }
Пример #6
0
        protected override void OnRestoreInstanceState(Bundle outState)
        {
            photo_index = outState.GetInt ("photo_index");
            ShowPhoto (photo_index);

            base.OnRestoreInstanceState (outState);
        }
        //@Override
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            if (mPos == -1 && savedInstanceState != null)
                mPos = savedInstanceState.GetInt("mPos");
            TypedArray imgs = Resources.ObtainTypedArray(Resource.Array.birds_img);
            mImgRes = imgs.GetResourceId(mPos, -1);

            GridView gv = (GridView)inflater.Inflate(Resource.Layout.list_grid, null);
            gv.SetBackgroundResource(Android.Resource.Color.Black);
            gv.Adapter=new GridAdapter(this);
            //gv.setOnItemClickListener(new OnItemClickListener() {
            //    @Override
            //    public void onItemClick(AdapterView<?> parent, View view, int position,
            //            long id) {
            //        if (getActivity() == null)
            //            return;
            //        ResponsiveUIActivity activity = (ResponsiveUIActivity) getActivity();
            //        activity.onBirdPressed(mPos);
            //    }			
            //});

            gv.ItemClick += delegate { 
                 if (this.Activity == null)
                     return;
                 ResponsiveUIActivity activity = (ResponsiveUIActivity)this.Activity;
                 activity.onBirdPressed(mPos);
            };
            return gv;
        }
Пример #8
0
        protected override void OnCreate(Bundle savedInstanceState) {
            base.OnCreate(savedInstanceState);
            SetContentView(R.Layout.fragment_stack);

            // Watch for button clicks.
            Button button = (Button)FindViewById(R.Id.new_fragment); 
            button.Click += (s, x) => AddFragmentToStack();
  
            button = (Button)FindViewById(R.Id.home);
            button.Click += (s, x) =>
            {
                // If there is a back stack, pop it all.
                FragmentManager fm = GetSupportFragmentManager();
                if (fm.GetBackStackEntryCount() > 0)
                {
                    fm.PopBackStack(fm.GetBackStackEntryAt(0).GetId(),
                    Android.Support.V4.App.FragmentManager.POP_BACK_STACK_INCLUSIVE);
                }
            };

            if (savedInstanceState == null) {
                // Do first time initialization -- Add initial fragment.
                Fragment newFragment = CountingFragment.NewInstance(mStackLevel);
                FragmentTransaction ft = GetSupportFragmentManager().BeginTransaction();
                ft.Add(R.Id.simple_fragment, newFragment).Commit();
            } else {
                mStackLevel = savedInstanceState.GetInt("level");
            }
        }
Пример #9
0
        protected void logResponseCode(String method, Bundle response) 
		{
            var responseCode = (Consts.ResponseCode)(response.GetInt(Consts.BILLING_RESPONSE_RESPONSE_CODE));
            
			if (Consts.DEBUG) 
                Log.Error("BillingService", method + " received " + responseCode.ToString());            
        }
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			button = FindViewById<Button> (Resource.Id.myButton);

			button.Click += delegate {
				Log.Error(TAG, "First delegate!");
				count++;
				UpdateCountsView ();
			};

			button.Click += (sender, e) => {
				Log.Error(TAG, "Second delegate!");
			};

//			button.SetOnClickListener (this);

			if (bundle != null) {
				count = bundle.GetInt (EXTRA_COUNT, 0);
				UpdateCountsView ();
			}
		}
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);

            var detailsFrame = Activity.FindViewById<View>(Resource.Id.details);

            // If running on a tablet, then the layout in Resources/Layout-Large will be loaded.
            // That layout uses fragments, and defines the detailsFrame. We use the visiblity of
            // detailsFrame as this distinguisher between tablet and phone.
            _isDualPane = detailsFrame != null && detailsFrame.Visibility == ViewStates.Visible;

            var adapter = new ArrayAdapter<String>(Activity, Android.Resource.Layout.SimpleListItemChecked, Shakespeare.Titles);
            ListAdapter = adapter;

            if (savedInstanceState != null)
            {
                _currentPlayId = savedInstanceState.GetInt("current_play_id", 0);
            }

            if (_isDualPane)
            {
                ListView.ChoiceMode = ChoiceMode.Single;
                ShowDetails(_currentPlayId);
            }
        }
Пример #12
0
 public override void OnCreate(Bundle savedInstanceState)
 {
     base.OnCreate (savedInstanceState);
     if (savedInstanceState != null) {
         drawable_res_id = savedInstanceState.GetInt("drawable_res_id", 0);
     }
 }
Пример #13
0
		public override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			if (null != savedInstanceState) {
				scrollPosition = savedInstanceState.GetInt ("scroll_position");
			}
		}
Пример #14
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);

            Setts sett = Common.GetSettings ();
            DateTimeFormatInfo dfi = DateTimeFormatInfo.CurrentInfo;
            Calendar cal = dfi.Calendar;
            int week = (cal.GetWeekOfYear (DateTime.Today, dfi.CalendarWeekRule, dfi.FirstDayOfWeek) - sett.weekOfStart)%3;

            var choosenHospitals = HospitalManager.GetChoosenHospitals(week, DateTime.Today.DayOfWeek);

            var doctors = DoctorManager.GetDoctors ();

            docs = new List<string> ();
            chdocs = new List<Doctor> ();

            for (int d = 0; d < doctors.Count; d++) {
                for (int h = 0; h < choosenHospitals.Count; h++) {
                    if (doctors [d].HospitalID == choosenHospitals [h].ID) {
                        chdocs.Add (doctors [d]);
                        docs.Add(doctors [d].FirstName + ' ' + doctors [d].SecondName + ' ' + doctors [d].ThirdName);
                    }
                }
            }

            var detailsFrame = Activity.FindViewById<View>(Resource.Id.details);
            _isDualPane = detailsFrame != null && detailsFrame.Visibility == ViewStates.Visible;

            var adapter = new ArrayAdapter<String>(Activity, Android.Resource.Layout.SimpleListItemChecked, docs/*Shakespeare.Titles*/);
            ListAdapter = adapter;

            //progress.Dismiss();

            if (savedInstanceState != null)
            {
                _currentPlayId = savedInstanceState.GetInt("current_play_id", chdocs[0].ID);
            }

            if (_isDualPane)
            {
                ListView.ChoiceMode = ChoiceMode.Single;
                ShowDetails(chdocs[_currentPlayId].ID);
            }

            /////////////////////////////////////////////////////////////////////////////////
            if (presents == null) {
                var progress = ProgressDialog.Show (Activity, "Loading prsentations", "Please Wait (about 15 seconds)", true);

                new Thread (new ThreadStart (() => {
                    Thread.Sleep (15 * 1000);
                    Activity.RunOnUiThread (() => {
                        presents = Presentations.GetPresentations ();
                        progress.Dismiss ();
                    });
                })).Start ();
            }
            /////////////////////////////////////////////////////////////////////////////////
        }
		public override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			if (savedInstanceState != null) {
				resultCode = savedInstanceState.GetInt (STATE_RESULT_CODE);
				resultData = (Intent)savedInstanceState.GetParcelable (STATE_RESULT_DATA);
			}
		}
        /// <inheritdoc />
        public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (savedInstanceState != null)
            {
                currentSelectedPosition = savedInstanceState.GetInt(StateSelectedPosition);
            }
        }
Пример #17
0
 public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
 {
     if (null != savedInstanceState)
         _colorRes = savedInstanceState.GetInt("_colorRes");
     var color = Resources.GetColor(_colorRes);
     var v = new RelativeLayout(Activity);
     v.SetBackgroundColor(color);
     return v;
 }
Пример #18
0
 //@Override
 public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
 {
     if (savedInstanceState != null)
         mColorRes = savedInstanceState.GetInt("mColorRes");
     Color color = Resources.GetColor(mColorRes);
     // construct the RelativeLayout
     RelativeLayout v = new RelativeLayout(this.Activity);
     v.SetBackgroundColor(color);
     return v;
 }
        public void Create(Android.Support.V7.App.AppCompatActivity activity, Android.Support.V7.Widget.Toolbar toolbar, Bundle savedInstanceState)
        {
            _activity = activity;

            InitNavigation();
            InitDrawer(toolbar);

            if(null != savedInstanceState) {
                _selectedMenuItemResId = savedInstanceState.GetInt(StateSelectedResId, -1);
            }
        }
		public override void OnActivityCreated (Bundle savedInstanceState)
		{
			base.OnActivityCreated (savedInstanceState);

			var adapter = new ArrayAdapter<String> (Activity, Android.Resource.Layout.SimpleListItem1, EvolveData.SessionData.Select (session => session.Title).ToArray ());
			ListAdapter = adapter;

			if (savedInstanceState != null) {
				_currentSessionId = savedInstanceState.GetInt ("current_session_id", 0);
			}
		}
		public override void OnActivityCreated (Bundle savedInstanceState)
		{
			base.OnActivityCreated (savedInstanceState);

			var adapter = new ArrayAdapter<String> (Activity, Android.Resource.Layout.SimpleListItem1, EvolveData.AnimalData.Select (evnt => evnt.Name).ToArray ());
			ListAdapter = adapter;

			if (savedInstanceState != null) {
				_currentAnimalId = savedInstanceState.GetInt ("current_animal_id", 0);
			}
		}
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.ac_complex);

            int pagerPosition = savedInstanceState == null ? 0 : savedInstanceState.GetInt(STATE_POSITION);

            pager = FindViewById<ViewPager>(Resource.Id.pager);
            pager.Adapter = new ImagePagerAdapter(SupportFragmentManager, Resources);
            pager.CurrentItem = pagerPosition;
        }
        public IMvxViewModel GetAndClear(Bundle bundle)
        {
            var storedViewModel = _currentViewModel;
            _currentViewModel = null;

            if (bundle == null)
                return null;

            var key = bundle.GetInt(BundleCacheKey);
            var toReturn = (key == _counter) ? storedViewModel : null;
            return toReturn;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Create your application here
            SetContentView(Resource.Layout.ActionbarTab);
            this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

            AddTab("list1", Resource.Drawable.Icon, new firstFragment());
            if(bundle!=null)
                this.ActionBar.SelectTab(this.ActionBar.GetTabAt(bundle.GetInt("tab")));
        }
        public override void OnCreate(Bundle savedInstanceState) {
            base.OnCreate(savedInstanceState);

            if (savedInstanceState == null) {
                // Do first time initialization -- Add initial fragment.
                Fragment newFragment = FragmentStackSupport.CountingFragment.NewInstance(mStackLevel);
                FragmentTransaction ft = GetChildFragmentManager().BeginTransaction();
                ft.Add(R.Ids.simple_fragment, newFragment).Commit();
            } else {
                mStackLevel = savedInstanceState.GetInt("level");
            }
        }
Пример #26
0
        protected override void OnCreate (Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.AssignmentsTabsLayout);

            tabHost = FindViewById<TabHost> (Resource.Id.assingmentTabHost);
            //In order to use tabs outside of a TabActivity I have to use this local activity manager and dispatch create the savedInstanceState
            localManger = new LocalActivityManager (this, true);
            localManger.DispatchCreate (savedInstanceState);
            tabHost.Setup (localManger);

            TabHost.TabSpec assignmentsSpec = tabHost.NewTabSpec ("list");
            Intent assignmentIntent = new Intent (this, typeof (AssignmentsActivity));
            assignmentsSpec.SetContent (assignmentIntent);
            assignmentsSpec.SetIndicator ("list");

            TabHost.TabSpec mapViewSpec = tabHost.NewTabSpec ("map");
            Intent mapViewIntent = new Intent (this, typeof (MapViewActivity));
            mapViewSpec.SetContent (mapViewIntent);
            mapViewSpec.SetIndicator ("map");

            tabHost.AddTab (assignmentsSpec);
            tabHost.AddTab (mapViewSpec);

            tabHost.TabChanged += (sender, e) => {
                if (tabHost.CurrentTab == 0) {
                    MapData = null;
                }
            };

            try {
                if (savedInstanceState != null) {
                    if (savedInstanceState.ContainsKey (Constants.CurrentTab)) {
                        var currentTab = savedInstanceState.GetInt (Constants.CurrentTab, 0);
                        tabHost.CurrentTab = currentTab;
                    } else {
                        tabHost.CurrentTab = 0;
                    }
                    if (savedInstanceState.ContainsKey ("mapData")) {
                        MapData = (MapDataWrapper)savedInstanceState.GetSerializable ("mapData");
                    } else {
                        MapData = null;
                    }
                } else {
                    MapData = null;
                    tabHost.CurrentTab = 0;
                }
            } catch (Exception) {
                tabHost.CurrentTab = 0;
            }            
        }
Пример #27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Main);

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

            AddTab("Contacts", Resource.Drawable.ic_tab_white, new ContactsTabFragment());
            AddTab("Statistics", Resource.Drawable.ic_tab_white, new MeterSpirt());

            if (savedInstanceState != null)
                ActionBar.SelectTab(ActionBar.GetTabAt(savedInstanceState.GetInt("tab")));
        }
Пример #28
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.main);
            Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
            var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            _appbarLoading = FindViewById <LinearLayout>(Resource.Id.toolbar_loading_panel);
            SetSupportActionBar(toolbar);

            _drawer         = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            _navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);
            _navigationView.NavigationItemSelected += OnNavigationItemSelected;

            var toggle = new ActionBarDrawerToggle(this, _drawer, toolbar, Resource.String.open, Resource.String.close);

            _drawer.AddDrawerListener(toggle);
            _drawer.SetStatusBarBackgroundColor(ContextCompat.GetColor(this, Resource.Color.primary_dark));
            toggle.SyncState();

            _navigationView.SetCheckedItem(Resource.Id.nav_class_schedule);

            var transaction = SupportFragmentManager.BeginTransaction();

            if (SupportFragmentManager.FindFragmentByTag("class") == null)
            {
                transaction.Add(Resource.Id.schedule_fragment_container, new ClassScheduleFragment(), "class");
            }
            if (SupportFragmentManager.FindFragmentByTag("classroom") == null)
            {
                transaction.Add(Resource.Id.schedule_fragment_container, new ClassroomScheduleFragment(), "classroom");
            }
            transaction.CommitNow();

            var activeFragment = bundle?.GetInt(ActiveFragmentTag, 0) ?? 0;

            switch (activeFragment)
            {
            case ClassSchedule:
                OnClassScheduleSelected();
                break;

            case TeacherSchedule:
                OnTeacherScheduleSelected();
                break;

            case ClassroomSchedule:
                OnClassroomScheduleSelected();
                break;
            }
        }
Пример #29
0
        protected override void OnCreate (Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

            SetContentView (Resource.Layout.Main);

            ConfigureTabs ();

            // Restore the selected tab. e.g. rotation.
            if (savedInstanceState != null)
            {
                ActionBar.SelectTab (ActionBar.GetTabAt (savedInstanceState.GetInt (SELECTED_TAB_BUNDLE_KEY)));
            }
        }
Пример #30
0
		protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Tabbed);

			this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

			AddTab ("Tab 1", Resource.Drawable.Icon, new Tab1 ());
			AddTab ("Tab 2", Resource.Drawable.Icon, new Tab2 ());

			if (savedInstanceState != null)
				this.ActionBar.SelectTab(this.ActionBar.GetTabAt(savedInstanceState.GetInt("tab")));
        }
Пример #31
0
		// 打印所有的 intent extra 数据
		private static String printBundle(Bundle bundle) {
			StringBuilder sb = new StringBuilder();
			foreach (string key in bundle.KeySet()) {
				if (key.Equals(JPushInterface.ExtraNotificationId)) {
					sb.Append("\nkey:" + key + ", value:" + bundle.GetInt(key));
				}else if(key.Equals(JPushInterface.ExtraConnectionChange)){
					sb.Append("\nkey:" + key + ", value:" + bundle.GetBoolean(key));
				} 
				else {
					sb.Append("\nkey:" + key + ", value:" + bundle.GetString(key));
				}
			}
			return sb.ToString();
		}
Пример #32
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetContentView(Resource.Layout.activity_main);

            SupportToolbar toolbar = FindViewById <SupportToolbar>(Resource.Id.mainToolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            _drawerLayout   = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            _navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            if (_navigationView != null)
            {
                SetupDrawerContent(_navigationView);
            }

            var projectName      = savedInstanceState?.GetString("projectName");
            var previousMenuItem = savedInstanceState?.GetInt("menuItem");

            if (projectName != null)
            {
                CurrentProject = ProjectsLogic.DownloadProjects().Find(p => p.Name == projectName);
                CurrentProject.ProjectRules = RulesHelper.DownloadRules(Assets);
                ActivateProjectSubmenu(CurrentProject);
            }

            if (previousMenuItem != null && _navigationView != null)
            {
                _previousMenuItem = _navigationView.Menu.FindItem((int)previousMenuItem);
                _previousMenuItem.SetChecked(true);
            }

            _searchQuery = savedInstanceState?.GetString("searchQuery") ?? string.Empty;

            base.OnCreate(savedInstanceState);
            if (savedInstanceState == null)
            {
                LoadProjectsListFragment();
            }
        }
Пример #33
0
        private void InitializeTabs(Bundle savedInstanceState)
        {
            var summaryTab = ActionBar.NewTab()
                             .SetText(Resource.String.Summary);

            var expensesTab = ActionBar.NewTab()
                              .SetText(Resource.String.Expenses);

            var scheduleTab = ActionBar.NewTab()
                              .SetText(Resource.String.Schedule);

            summaryTab.TabSelected  += OnSummaryTabSelected;
            expensesTab.TabSelected += OnExpensesTabSelected;
            scheduleTab.TabSelected += OnScheduleTabSelected;

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            ActionBar.AddTab(summaryTab);
            ActionBar.AddTab(expensesTab);
            ActionBar.AddTab(scheduleTab);

            int selectedTabIndex = Math.Max(0, Math.Min(ActionBar.TabCount - 1, savedInstanceState?.GetInt(SelectedTabIndexKey) ?? 0));

            ActionBar.SelectTab(ActionBar.GetTabAt(selectedTabIndex));
        }
Пример #34
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            Log.Debug(C_LOG_TAG, "OnCreate(Bundle) called");
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_quiz);

            currentIndex = savedInstanceState?.GetInt(C_KEY_INDEX, default) ?? default;

            trueButton       = FindViewById <Button>(Resource.Id.TrueButton);
            falseButton      = FindViewById <Button>(Resource.Id.FalseButton);
            nextButton       = FindViewById <Button>(Resource.Id.NextButton);
            cheatButton      = FindViewById <Button>(Resource.Id.CheatButton);
            questionTextView = FindViewById <TextView>(Resource.Id.QuestionTextView);
            UpdateQuestion();

            trueButton.Click += (sender, e) => CheckAnswer(true);

            falseButton.Click += (sender, e) => CheckAnswer(false);

            nextButton.Click += (sender, e) =>
            {
                currentIndex = (currentIndex + 1) % questionBank.Length;
                isCheater    = false;
                UpdateQuestion();
            };

            cheatButton.Click += (sender, e) =>
            {
                bool answerIsTrue = questionBank[currentIndex].AnswerTrue;

                using (var intent = CheatActivity.NewIntent(this, answerIsTrue))
                    StartActivityForResult(intent, C_REQUEST_CODE_CHEAT);
            };
        }
Пример #35
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            RequestWindowFeature(Android.Views.WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.cropimage);

            imageView = FindViewById <CropImageView>(Resource.Id.image);

            showStorageToast(this);

            Bundle extras = Intent.Extras;

            if (extras != null)
            {
                imagePath = extras.GetString("image-path");

                saveUri = getImageUri(imagePath);
                if (extras.GetString(MediaStore.ExtraOutput) != null)
                {
                    saveUri = getImageUri(extras.GetString(MediaStore.ExtraOutput));
                }

                bitmap = getBitmap(imagePath);

                aspectX = extras.GetInt("aspectX");
                aspectY = extras.GetInt("aspectY");
                outputX = extras.GetInt("outputX");
                outputY = extras.GetInt("outputY");
                scale   = extras.GetBoolean("scale", true);
                scaleUp = extras.GetBoolean("scaleUpIfNeeded", true);

                if (extras.GetString("outputFormat") != null)
                {
                    outputFormat = Bitmap.CompressFormat.ValueOf(extras.GetString("outputFormat"));
                }
            }

            if (bitmap == null)
            {
                Finish();
                return;
            }

            Window.AddFlags(WindowManagerFlags.Fullscreen);


            FindViewById <Button>(Resource.Id.discard).Click += (sender, e) => { SetResult(Result.Canceled); Finish(); };
            FindViewById <Button>(Resource.Id.save).Click    += (sender, e) => { onSaveClicked(); };

            FindViewById <Button>(Resource.Id.rotateLeft).Click += (o, e) =>
            {
                bitmap = Util.rotateImage(bitmap, -90);
                RotateBitmap rotateBitmap = new RotateBitmap(bitmap);
                imageView.SetImageRotateBitmapResetBase(rotateBitmap, true);
                addHighlightView();
            };

            FindViewById <Button>(Resource.Id.rotateRight).Click += (o, e) =>
            {
                bitmap = Util.rotateImage(bitmap, 90);
                RotateBitmap rotateBitmap = new RotateBitmap(bitmap);
                imageView.SetImageRotateBitmapResetBase(rotateBitmap, true);
                addHighlightView();
            };

            imageView.SetImageBitmapResetBase(bitmap, true);
            addHighlightView();
        }
Пример #36
0
 protected override void OnRestoreInstanceState(Bundle savedInstanceState)
 {
     base.OnRestoreInstanceState(savedInstanceState);
     CurrStep = savedInstanceState?.GetInt(nameof(CurrStep), CurrStep) ?? CurrStep;
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            RequestWindowFeature(WindowFeatures.NoTitle);


            SetContentView(Resource.Layout.Cancelar_Orden_De_Trabajo);


            ImageButton ImgButton = FindViewById <ImageButton> (Resource.Id.BtnRegresar);
            ImageButton ImgCamara = FindViewById <ImageButton> (Resource.Id.BtnCamara);

            Medidas       = FindViewById <Button> (Resource.Id.BtnMedidas);
            Clausurado    = FindViewById <Button> (Resource.Id.BtnClausurado);
            Arrendamiento = FindViewById <Button> (Resource.Id.BtnArrendamiento);
            Arte          = FindViewById <Button> (Resource.Id.BtnArte);
            Otros         = FindViewById <Button> (Resource.Id.BtnOtros);
            Button Fotografia = FindViewById <Button> (Resource.Id.BtnFotografiaEvidencia);
            Button Cancelar   = FindViewById <Button> (Resource.Id.BtnCancelarODT);


            //label
            lblInfoFoto = FindViewById <TextView> (Resource.Id.LblInfoFoto);
            TextView lblODT = FindViewById <TextView> (Resource.Id.LblOrdenActual);



            ODTDet      = (DTOODTCustom)Utils.Deserialize(typeof(DTOODTCustom), this.Intent.GetStringExtra("CANCELAR_ODT"));
            lblODT.Text = ODTDet.Folio + " - " + ODTDet.NumeroVista;

            if (bundle != null)
            {
                if (bundle.ContainsKey("pathImagen1"))
                {
                    imageurl = bundle.GetString("pathImagen1");
                }

                if (bundle.ContainsKey("pathImagen1Id"))
                {
                    imageurlId = bundle.GetString("pathImagen1Id");
                }

                if (bundle.ContainsKey("lblDetalle"))
                {
                    lblInfoFoto.Text = bundle.GetString("lblDetalle");
                }

                if (bundle.ContainsKey("contador"))
                {
                    Contador = bundle.GetInt("contador");
                }

                if (!string.IsNullOrEmpty(imageurl))
                {
                    bitmapDetalle = ReloadFoto(imageurl);
                    if (bitmapDetalle == null)
                    {
                        Toast.MakeText(ApplicationContext, "No se cargó la fotografía de evidencia correctamente, favor de seleccionarla de nuevo", ToastLength.Long).Show();
                        return;
                    }
                }
            }



            //Eventos

            Medidas.Click       += delegate { PressMotive(5); };
            Clausurado.Click    += delegate { PressMotive(6); };
            Arrendamiento.Click += delegate { PressMotive(7); };
            Arte.Click          += delegate { PressMotive(8); };
            Otros.Click         += delegate { PressMotive(9); };
            ImgButton.Click     += delegate
            {
                Finish();
            };

            ImgCamara.Click += delegate {
                IniciarCamara();
            };
            Fotografia.Click += delegate { selectImage(2); };
            Cancelar.Click   += delegate { CancelarODT(); };


            bk.DoWork             += new DoWorkEventHandler(bk_DoWork);
            bk.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bk_RunWorkerCompleted);
            _progressDialog        = new ProgressDialog(this)
            {
                Indeterminate = true
            };
            _progressDialog.SetMessage("Por favor espere...");
            _progressDialog.SetCanceledOnTouchOutside(false);

            // Create your application here


            RequestedOrientation = Android.Content.PM.ScreenOrientation.Portrait;
        }
Пример #38
0
        protected override void OnCreate(Bundle bundle)
        {
            Android.Util.Log.Debug("Lab11Log", "Activity A - OnCreate");

            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            FindViewById <Button>(Resource.Id.StartActivity).Click += (sender, e) =>
            {
                var ActivityIntent = new Android.Content.Intent(this, typeof(SecondActivity));
                StartActivity(ActivityIntent);
            };

            var    TextResult = FindViewById <TextView>(Resource.Id.ResultView);
            string EMail      = "";
            string Password   = "";
            string Device     = Android.Provider.Settings.Secure.GetString(
                ContentResolver, Android.Provider.Settings.Secure.AndroidId);

            // Utilizar FragmentManager para recuperar el Fragmento
            Data = (Complex)this.FragmentManager.FindFragmentByTag("Data");
            if (Data == null)
            {
                // No ha sido almacenado, agregar el fragmento a la Activity
                Data = new Complex();
                var FragmentTransaction = this.FragmentManager.BeginTransaction();
                FragmentTransaction.Add(Data, "Data");
                FragmentTransaction.Commit();
            }
            // persistencia hecha con bundle
            if (bundle != null)
            {
                Counter = bundle.GetInt("CounterValue", 0);
                Result  = bundle.GetString("ResultValue", "");
                Android.Util.Log.Debug("Lab11Log", "Activity A - Recovered Instance State");
            }
            // variable global Result declarada inicialmente con "" para preguntar por este valor
            // y así verificar que se ejecute sólo una vez
            if (Result == "")
            {
                Validate();
            }

            async void Validate()
            {
                var ServiceClient = new SALLab11.ServiceClient();
                var SvcResult     = await ServiceClient.ValidateAsync(EMail, Password, Device);

                Result          = $"{SvcResult.Status}\n{SvcResult.Fullname}\n{SvcResult.Token}";
                TextResult.Text = Result;
            }

            TextResult.Text = Result;

            var ClickCounter = FindViewById <Button>(Resource.Id.ClicksCounter);

            ClickCounter.Text   = Resources.GetString(Resource.String.ClicksCounter_Text, Counter);
            ClickCounter.Text  += $"\n{Data.ToString()}";
            ClickCounter.Click += (sender, e) =>
            {
                Counter++;
                ClickCounter.Text = Resources.GetString(Resource.String.ClicksCounter_Text, Counter);

                // Modificar con cualquier valor solo para verificar la persistencia
                Data.Real++;
                Data.Imaginary++;
                // Mostrar el valor de los miembros
                ClickCounter.Text += $"\n{Data.ToString()}";
            };
        }
Пример #39
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Bundle extras = Intent.Extras;

            EddieLogger.Init(this);

            viewMode = (ViewMode)extras.GetInt("ViewMode");

            if (viewMode == ViewMode.ListView)
            {
                SetContentView(Resource.Layout.log_activity_layout);

                listLogView = FindViewById <ListView>(Resource.Id.log);
            }
            else
            {
                SetContentView(Resource.Layout.log_activity_weblayout);

                webLogView = FindViewById <WebView>(Resource.Id.logwebview);
            }

            unixEpochTime = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks / TimeSpan.TicksPerSecond;

            btnCommand = FindViewById <ImageButton>(Resource.Id.btn_command);

            btnCommand.Click += delegate
            {
                ConsoleCommand();
            };

            btnShare = FindViewById <ImageButton>(Resource.Id.btn_share);

            btnShare.Click += delegate
            {
                SimpleDateFormat dateFormatter = null;
                Date             logCurrenTimeZone = null;
                Calendar         calendar = null;
                List <string>    exportLog = null;
                string           logText = "", logSubject = "";
                long             utcTimeStamp = 0;

                calendar      = Calendar.Instance;
                dateFormatter = new SimpleDateFormat("dd MMM yyyy HH:mm:ss");

                utcTimeStamp           = (DateTime.UtcNow.Ticks / TimeSpan.TicksPerSecond) - unixEpochTime;
                calendar.TimeInMillis  = utcTimeStamp * 1000;
                logCurrenTimeZone      = (Date)calendar.Time;
                dateFormatter.TimeZone = Java.Util.TimeZone.GetTimeZone("GMT");

                logSubject = string.Format(Resources.GetString(Resource.String.log_subject), dateFormatter.Format(logCurrenTimeZone));

                logText = logSubject + "\n\nEddie for Android ";

                try
                {
                    string pkgName        = Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0).VersionName;
                    int    pkgVersionCode = Application.Context.ApplicationContext.PackageManager.GetPackageInfo(Application.Context.ApplicationContext.PackageName, 0).VersionCode;

                    logText += string.Format("{0} Version Code {1}", pkgName, pkgVersionCode);
                }
                catch
                {
                    logText += "n.d.";
                }

                logText += "\n\n";

                exportLog = GetCurrentLog(FormatType.PLAIN_TEXT, LogTime.UTC);

                if (exportLog == null)
                {
                    return;
                }

                foreach (string entry in exportLog)
                {
                    logText += entry + "\n";
                }

                Intent shareIntent = new Intent(global::Android.Content.Intent.ActionSend);

                shareIntent.SetType("text/plain");
                shareIntent.PutExtra(global::Android.Content.Intent.ExtraTitle, Resources.GetString(Resource.String.log_title));
                shareIntent.PutExtra(global::Android.Content.Intent.ExtraSubject, logSubject);
                shareIntent.PutExtra(global::Android.Content.Intent.ExtraText, logText);

                StartActivity(Intent.CreateChooser(shareIntent, Resources.GetString(Resource.String.log_share_with)));
            };

            logEntry = GetCurrentLog(FormatType.HTML, LogTime.LOCAL);

            if (viewMode == ViewMode.ListView)
            {
                logListAdapter = new LogListAdapter(this, GetSpannedLog());

                listLogView.Adapter = logListAdapter;
            }
            else
            {
                webLogView.Settings.JavaScriptEnabled = false;

                webLogView.SetWebViewClient(new WebViewClient());

                webLogView.Settings.BuiltInZoomControls = true;
                webLogView.Settings.DisplayZoomControls = false;

                LoadLogWebView();
            }
        }
Пример #40
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            //Creates Database reference, pushes it out

            //Creates, loads app w/ database
            string dbName     = "actions_db.sqlite";
            string folderPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            string fullPath   = System.IO.Path.Combine(folderPath, dbName);

            //retrieves saved date and month from bundle from last time app closed (see OnSavedInstanceState method)
            int?old = 2;
            //Hee hee mold
            int?mold = 6;
            int?yold = 2002;

            //statements inside nested if statements only execute if the app has been run before
            if (!(savedInstanceState is null))
            {
                if (!((int?)savedInstanceState.GetInt("date") is null))
                {
                    old = savedInstanceState.GetInt("date");
                }
                if (!((int?)savedInstanceState.GetInt("month") is null))
                {
                    mold = savedInstanceState.GetInt("month");
                }
                if (!((int?)savedInstanceState.GetInt("year") is null))
                {
                    yold = savedInstanceState.GetInt("year");
                }
                if (old != DateTime.Now.DayOfYear && mold != DateTime.Now.Month && yold != DateTime.Now.Year)
                {
                    StoreTodaysData();
                }
                if (mold != DateTime.Now.Month && yold != DateTime.Now.Year)
                {
                    SimplifyPrevMonth();
                }
                if (yold != DateTime.Now.Year)
                {
                    SimplifyPrevYear();
                }

                if (!(savedInstanceState.GetString("userID") is null))
                {
                    App.ThisUser.Id = savedInstanceState.GetString("userID");
                }
            }
            //loads application
            App A = new App(fullPath);

            LoadApplication(A);
            //ODate set to retrieved int value from old bundle (recorded date last destroyed)
            //Same for OMonth
            App.ODate  = old;
            App.OMonth = mold;
            App.OYear  = yold;
        }
        protected override void OnCreate(Bundle bundle)
        {
            Android.Util.Log.Debug("Lab11Log", "Activity A - OnCreate");
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            FindViewById <Button>(Resource.Id.StartActivity).Click += (sender, e) =>
            {
                var ActivityIntent =
                    new Android.Content.Intent(this, typeof(SecondActivity));
                StartActivity(ActivityIntent);
            };

            //Utilizar FragmentManager para recuperar el Fragmento
            Data = (Complex)this.FragmentManager.FindFragmentByTag("Data");
            if (Data == null)
            {
                //No ha sido almacenado, agregar el fragmento a la Activity
                Data = new Complex();
                var FragmentTransaction = this.FragmentManager.BeginTransaction();
                FragmentTransaction.Add(Data, "Data");
                FragmentTransaction.Commit();
            }

            if (bundle != null)
            {
                Counter = bundle.GetInt("CounterValue", 0);
                Android.Util.Log.Debug("Lab11Log", "Activity A - Recovered Instance State");
            }

            var ClickCounter =
                FindViewById <Button>(Resource.Id.ClicksCounter);

            ClickCounter.Text =
                Resources.GetString(Resource.String.ClicksCounter_Text, Counter);
            ClickCounter.Text  += $"\n{Data.ToString()}";
            ClickCounter.Click += (sender, e) =>
            {
                Counter++;
                ClickCounter.Text =
                    Resources.GetString(Resource.String.ClicksCounter_Text, Counter);
                //Modificar con cualquier valor solo para verificar la persistencia
                Data.Real++;
                Data.Imaginary++;
                //Mostrar el valor de los miembros
                ClickCounter.Text += $"\n{Data.ToString()}";
            };

            //Utilizar FragmentManager para recuperar el Fragmento
            ValidationData = (Validate)this.FragmentManager.FindFragmentByTag("ValidationData");
            if (ValidationData == null)
            {
                //No ha sido almacenado, agregar el fragmento a la Activity
                ValidationData = new Validate();
                var FragmentTransactionValidation = this.FragmentManager.BeginTransaction();
                FragmentTransactionValidation.Add(ValidationData, "ValidationData");
                FragmentTransactionValidation.Commit();
            }
            Validar();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            try
            {
                if (savedInstanceState != null)
                {
                    _selectedItemIndex = savedInstanceState.GetInt("selectedItemIndex");
                    _problemID         = savedInstanceState.GetInt("problemID");
                    _probText          = savedInstanceState.GetString("probText");
                }
                else
                {
                    _problemID = Intent.GetIntExtra("problemID", -1);
                    _probText  = Intent.GetStringExtra("problemText");
                }

                SetContentView(Resource.Layout.ProblemSolvingStepsLayout);
                Log.Info(TAG, "OnCreate: Set content view successfully, problemID - " + _problemID.ToString() + ", problemText - " + _probText);

                _toolbar = ToolbarHelper.SetupToolbar(this, Resource.Id.problemSolvingStepsToolbar, Resource.String.ProblemSolvingStepsToolbarTitle, Color.White);

                GetFieldComponents();

                CheckMicPermission();

                _imageLoader = ImageLoader.Instance;

                _imageLoader.LoadImage
                (
                    "drawable://" + Resource.Drawable.problemsteps,
                    new ImageLoadingListener
                    (
                        loadingComplete: (imageUri, view, loadedImage) =>
                {
                    var args = new LoadingCompleteEventArgs(imageUri, view, loadedImage);
                    ImageLoader_LoadingComplete(null, args);
                }
                    )
                );

                SetupCallbacks();

                if (_problemID != -1)
                {
                    _problemText.Text = _probText.Trim();
                }

                if (IsProblemSolved())
                {
                    InflateResolved();
                }

                UpdateAdapter();
            }
            catch (Exception e)
            {
                Log.Error(TAG, "OnCreate: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorProblemSolvingStepsActivityCreateView), "ProblemSolvingStepsActivity.OnCreate");
                }
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            bool configurationChange = false;

            SetContentView(Resource.Layout.MusicPlayListTracksLayout);
            Log.Info(TAG, "OnCreate: - checking for ReadExternalStorage permission");
            CheckReadExternalStoragePermission();

            try
            {
                if (savedInstanceState != null)
                {
                    _selectedListItemIndex = savedInstanceState.GetInt("selectedItemIndex");
                    Log.Info(TAG, "OnCreate: - savedInstanceState value - selectedItemIndex - " + _selectedListItemIndex.ToString());
                    _playListID = savedInstanceState.GetInt("playListID");
                    Log.Info(TAG, "OnCreate: - savedInstanceState value - playListID - " + _playListID.ToString());
                    _isPaused = savedInstanceState.GetBoolean("isPaused");
                    Log.Info(TAG, "OnCreate: - savedInstanceState value - isPaused - " + (_isPaused?"True":"False"));
                    _isPlaying = savedInstanceState.GetBoolean("isPlaying");
                    Log.Info(TAG, "OnCreate: - savedInstanceState value - isPlaying - " + (_isPlaying?"True":"False"));
                    if (_isPlaying || _isPaused)
                    {
                        _currentTrackPosition = savedInstanceState.GetInt("trackPosition");
                        Log.Info(TAG, "OnCreate: isPlaying, currentTrackPosition - " + _currentTrackPosition.ToString());
                    }
                    configurationChange = true;
                }
                if ((Intent != null && Intent.HasExtra("selectedIndex")))
                {
                    _selectedListItemIndex = Intent.GetIntExtra("selectedIndex", -1);
                }
                Log.Info(TAG, "OnCreate: _selectedListItemIndex is " + _selectedListItemIndex.ToString());
                GetFieldComponents();

                _imageLoader = ImageLoader.Instance;

                _imageLoader.LoadImage
                (
                    "drawable://" + Resource.Drawable.cds,
                    new ImageLoadingListener
                    (
                        loadingComplete: (imageUri, view, loadedImage) =>
                {
                    var args = new LoadingCompleteEventArgs(imageUri, view, loadedImage);
                    ImageLoader_LoadingComplete(null, args);
                }
                    )
                );

                SetupCallbacks();

                if (Intent != null && Intent.HasExtra("playListID"))
                {
                    _playListID = Intent.GetIntExtra("playListID", -1);
                    Log.Info(TAG, "OnCreate: playListID - " + _playListID.ToString());
                }

                PlayList playList = GlobalData.PlayListItems.Find(play => play.PlayListID == _playListID);
                if (playList != null)
                {
                    _playListName.Text = playList.PlayListName.Trim();
                }


                _toolbar = ToolbarHelper.SetupToolbar(this, Resource.Id.musicTrackListToolbar, Resource.String.MusicPlayListTracksToolbarTitle, Color.White);

                if (_trackProgress != null)
                {
                    //change the colour of the progressbar (primary progress is on layer 2, layer 0 is background, layer 1 is secondary progress)
                    LayerDrawable layers = (LayerDrawable)_trackProgress.ProgressDrawable;
                    layers.GetDrawable(0).SetColorFilter(Color.LightBlue, PorterDuff.Mode.SrcIn);
                    layers.GetDrawable(2).SetColorFilter(Color.DarkBlue, PorterDuff.Mode.SrcIn);
                }

                UpdateAdapter();

                SetupMediaPlayer();

                //do we have permission to play at this time?
                if (PermissionsHelper.HasPermission(this, ConstantsAndTypes.AppPermission.ReadExternalStorage))
                {
                    Log.Info(TAG, "OnCreate: Permission to read external storage is true");
                    if (_selectedListItemIndex != -1)
                    {
                        Log.Info(TAG, "OnCreate: isPlaying, calling Play_Click, selectedListItemIndex - " + _selectedListItemIndex.ToString());
                        Play_Click(null, null);
                    }
                    else
                    {
                        Log.Info(TAG, "OnCreate: No selected index (-1), configurationChange is " + (configurationChange ? "True" : "False") + ", _isPlaying is " + (_isPlaying ? "True" : "False") + ", _isPaused is " + (_isPaused ? "True" : "False"));
                        if (configurationChange && (_isPlaying || _isPaused))
                        {
                            Play_Click(null, null);
                        }
                    }
                }
                else
                {
                    Log.Info(TAG, "OnCreate: Permission to read external storage is FALSE");
                }
            }
            catch (System.Exception e)
            {
                Log.Error(TAG, "OnCreate: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorMusicPlayListTracksActivityCreate), "MusicPlayListTracksActivity.OnCreate");
                }
            }
        }
Пример #44
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            ActionBar.SetDisplayHomeAsUpEnabled(true);
            ActionBar.SetDisplayShowCustomEnabled(true);
            ActionBar.SetIcon(new ColorDrawable(Color.Transparent));
            ActionBar.SetDisplayShowTitleEnabled(false);

            LayoutInflater layoutInflater  = LayoutInflater.From(this);
            View           customActionBar = layoutInflater.Inflate(Resource.Layout.CustomActionBar, null);
            RelativeLayout imageButton     = (RelativeLayout)customActionBar.FindViewById(Resource.Id.imageButton);

            View propertyWindow = layoutInflater.Inflate(Resource.Layout.Propertywindow, null);
            View mainView       = layoutInflater.Inflate(Resource.Layout.layout, null);

            SettingsButton = imageButton;
            SetContentView(mainView);

            var popup = new PopupWindow(propertyWindow, ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

            popup.Focusable = true;

            popup.DismissEvent += (s, e) => isselected = true;
            imageButton.Click  += delegate
            {
                popup.ContentView = propertyWindow;
                if (CurrentSamplePage.PropertyView == null)
                {
                    CurrentSamplePage.PropertyView = CurrentSamplePage.GetPropertyWindowLayout(this);
                }

                var linear = (LinearLayout)propertyWindow.FindViewById(Resource.Id.container);
                linear.RemoveAllViews();
                linear.AddView(CurrentSamplePage.PropertyView);
                if (isselected)
                {
                    popup.ShowAsDropDown(imageButton, 0, 280);
                    popup.Focusable = true;
                    popup.Update();
                    isselected = false;
                }

                ImageView iconclose = (ImageView)propertyWindow.FindViewById(Resource.Id.close);
                Button    discard   = (Button)propertyWindow.FindViewById(Resource.Id.discard);
                Button    apply     = (Button)propertyWindow.FindViewById(Resource.Id.apply);

                iconclose.Click += delegate
                {
                    popup.Dismiss();
                    isselected = true;
                };

                discard.Click += delegate
                {
                    popup.Dismiss();
                    isselected = true;
                };

                apply.Click += delegate
                {
                    CurrentSamplePage.OnApplyChanges(CurrentSamplePage.SampleView);
                    popup.Dismiss();
                    isselected = true;
                };
            };

            ActionBar.CustomView = customActionBar;
            SelectedGroup        = (ControlModel)MainActivity.SelectedIntent.GetSerializableExtra("sample");
            var textView = (TextView)FindViewById(Resource.Id.title_text);

            textView.Text = SelectedGroup.Title;
            var textParent = (RelativeLayout)FindViewById(Resource.Id.textParent);

            textParent.Click += (s, e) => Finish();

            if ((SelectedGroup as ControlModel).Features.Count > 0)
            {
                ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
                AddTab("Types", new ChartFragment((SelectedGroup as ControlModel).Samples, this));
                AddTab("Features", new ChartFragment((SelectedGroup as ControlModel).Features, this));
            }
            else
            {
                ActionBar.NavigationMode = ActionBarNavigationMode.Standard;
                FrameLayout frameLayout        = (FrameLayout)mainView.FindViewById(Resource.Id.fragment_content);
                var         sampleViewActivity = new SampleViewActivity((SelectedGroup as ControlModel).Samples, frameLayout, this, 0);
                if ((SelectedGroup as ControlModel).Samples.Count > 0)
                {
                    textView.Text = (SelectedGroup as ControlModel).Samples[0].Title;
                }

                sampleViewActivity.BaseTextView = textView;
            }

            if (savedInstanceState != null && ActionBar.TabCount > 0)
            {
                ActionBar.SelectTab(this.ActionBar.GetTabAt(savedInstanceState.GetInt("tab")));
            }

            base.OnCreate(savedInstanceState);
        }
Пример #45
0
        protected override void OnCreate(Bundle bundle)
        {
            _design.ApplyTheme();
            base.OnCreate(bundle);

            //use FlagSecure to make sure the last (revealed) character of the password is not visible in recent apps
            Util.MakeSecureDisplay(this);

            _ioc = App.Kp2a.GetDbForQuickUnlock()?.Ioc;



            if (_ioc == null)
            {
                Finish();
                return;
            }

            SetContentView(Resource.Layout.QuickUnlock);

            var toolbar = FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.mytoolbar);

            SetSupportActionBar(toolbar);

            var collapsingToolbar = FindViewById <CollapsingToolbarLayout>(Resource.Id.collapsing_toolbar);

            collapsingToolbar.SetTitle(GetString(Resource.String.QuickUnlock_prefs));

            if (App.Kp2a.GetDbForQuickUnlock().KpDatabase.Name != "")
            {
                FindViewById(Resource.Id.filename_label).Visibility       = ViewStates.Visible;
                ((TextView)FindViewById(Resource.Id.filename_label)).Text = App.Kp2a.GetDbForQuickUnlock().KpDatabase.Name;
            }
            else
            {
                if (
                    PreferenceManager.GetDefaultSharedPreferences(this)
                    .GetBoolean(GetString(Resource.String.RememberRecentFiles_key),
                                Resources.GetBoolean(Resource.Boolean.RememberRecentFiles_default)))
                {
                    ((TextView)FindViewById(Resource.Id.filename_label)).Text = App.Kp2a.GetFileStorage(_ioc).GetDisplayName(_ioc);
                }
                else
                {
                    ((TextView)FindViewById(Resource.Id.filename_label)).Text = "*****";
                }
            }


            TextView txtLabel = (TextView)FindViewById(Resource.Id.QuickUnlock_label);

            _quickUnlockLength = App.Kp2a.QuickUnlockKeyLength;

            if (PreferenceManager.GetDefaultSharedPreferences(this)
                .GetBoolean(GetString(Resource.String.QuickUnlockHideLength_key), false))
            {
                txtLabel.Text = GetString(Resource.String.QuickUnlock_label_secure);
            }
            else
            {
                txtLabel.Text = GetString(Resource.String.QuickUnlock_label, new Java.Lang.Object[] { _quickUnlockLength });
            }


            EditText pwd = (EditText)FindViewById(Resource.Id.QuickUnlock_password);

            pwd.SetEms(_quickUnlockLength);
            Util.MoveBottomBarButtons(Resource.Id.QuickUnlock_buttonLock, Resource.Id.QuickUnlock_button, Resource.Id.bottom_bar, this);

            Button btnUnlock = (Button)FindViewById(Resource.Id.QuickUnlock_button);

            btnUnlock.Click += (object sender, EventArgs e) =>
            {
                OnUnlock(pwd);
            };



            Button btnLock = (Button)FindViewById(Resource.Id.QuickUnlock_buttonLock);

            btnLock.Text   = btnLock.Text.Replace("ß", "ss");
            btnLock.Click += (object sender, EventArgs e) =>
            {
                App.Kp2a.Lock(false);
                Finish();
            };
            pwd.EditorAction += (sender, args) =>
            {
                if ((args.ActionId == ImeAction.Done) || ((args.ActionId == ImeAction.ImeNull) && (args.Event.Action == KeyEventActions.Down)))
                {
                    OnUnlock(pwd);
                }
            };

            _intentReceiver = new QuickUnlockBroadcastReceiver(this);
            IntentFilter filter = new IntentFilter();

            filter.AddAction(Intents.DatabaseLocked);
            RegisterReceiver(_intentReceiver, filter);

            Util.SetNoPersonalizedLearning(FindViewById <EditText>(Resource.Id.QuickUnlock_password));

            if (bundle != null)
            {
                numFailedAttempts = bundle.GetInt(NumFailedAttemptsKey, 0);
            }
        }
Пример #46
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            OnCreate(savedInstanceState, Resource.Layout.StopActivity);

            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            // Handle bundle parameter
            Bundle extras = Intent.Extras;

            if (extras != null && extras.ContainsKey("Stop"))
            {
                int stopId = extras.GetInt("Stop");
                stop = TramUrWayApplication.GetStop(stopId);
            }
#if DEBUG
            else
            {
                stop = TramUrWayApplication.Lines.SelectMany(l => l.Stops).FirstOrDefault(s => s.Name == "Saint-Lazare");
            }
#endif
            if (stop == null)
            {
                throw new Exception("Could not find any stop matching the specified id");
            }

            if (extras != null && extras.ContainsKey("Line"))
            {
                int lineId = extras.GetInt("Line");
                line = TramUrWayApplication.GetLine(lineId);
            }
            else
            {
                line = stop.Line;
            }

            Title = stop.Name;

            // Change toolbar color
            Color color     = Utils.GetColorForLine(this, line);
            Color darkColor = new Color(color.R * 2 / 3, color.G * 2 / 3, color.B * 2 / 3);

            SupportActionBar.SetBackgroundDrawable(new ColorDrawable(color));

            if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
            {
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
                Window.ClearFlags(WindowManagerFlags.TranslucentStatus);
                Window.SetStatusBarColor(darkColor);
            }

            // Refresh widget
            swipeRefresh          = FindViewById <SwipeRefreshLayout>(Resource.Id.StopActivity_SwipeRefresh);
            swipeRefresh.Refresh += SwipeRefresh_Refresh;
            swipeRefresh.SetColorSchemeColors(color.ToArgb());

            // Initialize UI
            lineLabel      = FindViewById <TextView>(Resource.Id.StopActivity_LineLabel);
            lineLabel.Text = line.Name;
            lineLabel.SetTextColor(darkColor);

            listStopList = FindViewById <RecyclerView>(Resource.Id.StopActivity_LineStopList);
            listStopList.HasFixedSize           = true;
            listStopList.NestedScrollingEnabled = false;
            listStopList.SetLayoutManager(new WrapLayoutManager(this));
            listStopList.AddItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.Vertical));

            otherLabel = FindViewById <TextView>(Resource.Id.StopActivity_OtherLabel);
            otherLabel.SetTextColor(darkColor);

            otherStopList = FindViewById <RecyclerView>(Resource.Id.StopActivity_OtherStopList);
            otherStopList.HasFixedSize           = true;
            otherStopList.NestedScrollingEnabled = false;
            otherStopList.SetLayoutManager(new WrapLayoutManager(this));
            otherStopList.AddItemDecoration(new DividerItemDecoration(this, LinearLayoutManager.Vertical));
        }
Пример #47
0
        protected override void OnCreate(Bundle bundle)
        {
            _design.ApplyTheme();
            base.OnCreate(bundle);


            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            SetContentView(Resource.Layout.create_database);
            _appTask = AppTask.GetTaskInOnCreate(bundle, Intent);

            SetDefaultIoc();

            FindViewById(Resource.Id.keyfile_filename).Visibility = ViewStates.Gone;


            var keyfileCheckbox = FindViewById <CheckBox>(Resource.Id.use_keyfile);

            if (bundle != null)
            {
                _keyfileFilename = bundle.GetString(KeyfilefilenameBundleKey, null);
                if (_keyfileFilename != null)
                {
                    FindViewById <TextView>(Resource.Id.keyfile_filename).Text = FileSelectHelper.ConvertFilenameToIocPath(_keyfileFilename);
                    FindViewById(Resource.Id.keyfile_filename).Visibility      = ViewStates.Visible;
                    keyfileCheckbox.Checked = true;
                }

                if (bundle.GetString(Util.KeyFilename, null) != null)
                {
                    _ioc = new IOConnectionInfo
                    {
                        Path         = bundle.GetString(Util.KeyFilename),
                        UserName     = bundle.GetString(Util.KeyServerusername),
                        Password     = bundle.GetString(Util.KeyServerpassword),
                        CredSaveMode = (IOCredSaveMode)bundle.GetInt(Util.KeyServercredmode),
                    };
                }
            }

            UpdateIocView();

            keyfileCheckbox.CheckedChange += (sender, args) =>
            {
                if (keyfileCheckbox.Checked)
                {
                    if (_restoringInstanceState)
                    {
                        return;
                    }

                    Util.ShowBrowseDialog(this, RequestCodeKeyFile, false, true);
                }
                else
                {
                    FindViewById(Resource.Id.keyfile_filename).Visibility = ViewStates.Gone;
                    _keyfileFilename = null;
                }
            };


            FindViewById(Resource.Id.btn_change_location).Click += (sender, args) =>
            {
                Intent intent = new Intent(this, typeof(FileStorageSelectionActivity));
                StartActivityForResult(intent, RequestCodeDbFilename);
            };

            Button generatePassword = (Button)FindViewById(Resource.Id.generate_button);

            generatePassword.Click += (sender, e) =>
            {
                GeneratePasswordActivity.LaunchWithoutLockCheck(this);
            };

            FindViewById(Resource.Id.btn_create).Click += (sender, evt) =>
            {
                CreateDatabase(Intent.GetBooleanExtra("MakeCurrent", true));
            };

            ImageButton btnTogglePassword = (ImageButton)FindViewById(Resource.Id.toggle_password);

            btnTogglePassword.Click += (sender, e) =>
            {
                _showPassword = !_showPassword;
                MakePasswordMaskedOrVisible();
            };
            Android.Graphics.PorterDuff.Mode mMode = Android.Graphics.PorterDuff.Mode.SrcAtop;
            Android.Graphics.Color           color = new Android.Graphics.Color(224, 224, 224);
            btnTogglePassword.SetColorFilter(color, mMode);
        }
Пример #48
0
        protected override void OnCreate(Bundle bundle)
        {
            FileCache.SaveLocation = CacheDir.AbsolutePath;
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Set the ActionBar for tabbed navigation
            this.ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;

            // Set up the tab strings for easy lookup
            Dictionary <Tab, int> tabStrings = new Dictionary <Tab, int>();

            tabStrings.Add(Tab.BOX_OFFICE, Resource.String.boxoffice_tab_title);
            tabStrings.Add(Tab.UPCOMING, Resource.String.upcoming_tab_title);
            tabStrings.Add(Tab.IN_THEATERS, Resource.String.intheaters_tab_title);
            tabStrings.Add(Tab.OPENING, Resource.String.opening_tab_title);

            //List<ActionBar.Tab> tabs = new List<ActionBar.Tab> ();

            // Add those tabs
            foreach (Tab tabid in (Tab[])Enum.GetValues(typeof(Tab)))
            {
                // Create the tab
                var tab = this.ActionBar.NewTab();

                // Name the tab
                tab.SetText(tabStrings[tabid]);

                // Set the callback routine
                tab.TabSelected += delegate(object sender, ActionBar.TabEventArgs e) {
                    switch (tabid)
                    {
                    case (Tab.BOX_OFFICE):
                        e.FragmentTransaction.Replace(Resource.Id.fragmentContainer, new BoxOfficeListFragment());
                        this.Title = GetString(Resource.String.boxoffice_activity_title);
                        break;

                    case (Tab.UPCOMING):
                        e.FragmentTransaction.Replace(Resource.Id.fragmentContainer, new UpcomingListFragment());
                        this.Title = GetString(Resource.String.upcoming_activity_title);
                        break;

                    case (Tab.IN_THEATERS):
                        e.FragmentTransaction.Replace(Resource.Id.fragmentContainer, new InTheatersListFragment());
                        this.Title = GetString(Resource.String.intheatres_activity_title);
                        break;

                    case (Tab.OPENING):
                        e.FragmentTransaction.Replace(Resource.Id.fragmentContainer, new OpeningListFragment());
                        this.Title = GetString(Resource.String.opening_activity_title);
                        break;
                    }
                };

                //tab.TabUnselected += delegate(object sender, ActionBar.TabEventArgs e) {
                //	e.FragmentTransaction.Remove(this.FragmentManager.FindFragmentById(Resource.Id.fragmentContainer));
                //};

                // Finally, add the tab
                this.ActionBar.AddTab(tab);
                //tabs.Add (tab);
            }


            if (bundle != null)
            {
                this.ActionBar.SelectTab(this.ActionBar.GetTabAt(bundle.GetInt("tab")));
            }
        }
Пример #49
0
 public override void RestoreFromBundle(Bundle bundle)
 {
     base.RestoreFromBundle(bundle);
     pos = bundle.GetInt(POS);
 }
        protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);
            string text = "";

            if (null == data)
            {
                DisplayResult("Intent data is null.");
            }
            // ML_ASR_CAPTURE_CODE: request code between the current activity and speech pickup UI activity.
            if (requestCode == MlAsrCaptureCode)
            {
                switch ((int)resultCode)
                {
                // MLAsrCaptureConstants.AsrSuccess: Recognition is successful.
                case MLAsrCaptureConstants.AsrSuccess:
                    if (data != null)
                    {
                        Bundle bundle = data.Extras;
                        // Obtain the text information recognized from speech.
                        if (bundle != null && bundle.ContainsKey(MLAsrCaptureConstants.AsrResult))
                        {
                            text = bundle.GetString(MLAsrCaptureConstants.AsrResult);
                        }
                        if (text == null || "".Equals(text))
                        {
                            text = "Result is null.";
                        }
                        // Process the recognized text information.
                        DisplayResult(text);
                    }
                    break;

                // MLAsrCaptureConstants.AsrFailure: Recognition fails.
                case MLAsrCaptureConstants.AsrFailure:
                    if (data != null)
                    {
                        Bundle bundle = data.Extras;
                        // Check whether a result code is contained.
                        if (bundle != null && bundle.ContainsKey(MLAsrCaptureConstants.AsrErrorCode))
                        {
                            text = text + bundle.GetInt(MLAsrCaptureConstants.AsrErrorCode);
                            // Perform troubleshooting based on the result code.
                        }
                        // Check whether error information is contained.
                        if (bundle != null && bundle.ContainsKey(MLAsrCaptureConstants.AsrErrorMessage))
                        {
                            string errorMsg = bundle.GetString(MLAsrCaptureConstants.AsrErrorMessage);
                            // Perform troubleshooting based on the error information.
                            if (errorMsg != null && !"".Equals(errorMsg))
                            {
                                text = "[" + text + "]" + errorMsg;
                            }
                        }
                        // Check whether a sub-result code is contained.
                        if (bundle != null && bundle.ContainsKey(MLAsrCaptureConstants.AsrSubErrorCode))
                        {
                            int subErrorCode = bundle.GetInt(MLAsrCaptureConstants.AsrSubErrorCode);
                            // Process the sub-result code.
                            text = "[" + text + "]" + subErrorCode;
                        }
                    }
                    DisplayResult(text);
                    break;

                default:
                    DisplayResult("Failure.");
                    break;
                }
            }
        }
Пример #51
0
        internal static RemoteViews CreateLayout(Context context, int appWidgetId, Bundle options)
        {
            bool isLargeLayout = options.GetInt(AppWidgetManager.OptionAppwidgetMinHeight) >= 100;

            return(CreateSmallLayout(context, appWidgetId));
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            try
            {
                if (Dialog != null)
                {
                    Dialog.SetTitle(_dialogTitle);
                }

                View view = inflater.Inflate(Resource.Layout.MedicationReminderDialogFragmentLayout, container, false);

                if (view != null)
                {
                    GetFieldComponents(view);
                    Log.Info(TAG, "OnCreateView: Got field components");

                    SetupCallbacks();
                    Log.Info(TAG, "OnCreateView: Setup callbacks");

                    if (savedInstanceState != null)
                    {
                        _prescriptionType   = (ConstantsAndTypes.PRESCRIPTION_TYPE)savedInstanceState.GetInt("prescriptionType", -1);
                        _dayOfWeek          = (ConstantsAndTypes.DAYS_OF_THE_WEEK)savedInstanceState.GetInt("dayOfWeek", (int)ConstantsAndTypes.DAYS_OF_THE_WEEK.Monday);
                        _medicationSpreadID = savedInstanceState.GetInt("medicationSpreadID", -1);
                        _reminderTime       = Convert.ToDateTime(savedInstanceState.GetString("reminderTime"));
                        _dialogTitle        = savedInstanceState.GetString("dialogTitle");
                    }

                    _timeText.Text = _reminderTime.ToShortTimeString();

                    SetupSpinner();
                    Log.Info(TAG, "OnCreateView: Set up spinner");

                    if (_firstTimeView)
                    {
                        switch (_prescriptionType)
                        {
                        case ConstantsAndTypes.PRESCRIPTION_TYPE.Weekly:
                            if (_dayLabel != null)
                            {
                                _dayLabel.Visibility = ViewStates.Visible;
                            }
                            if (_daySpinner != null)
                            {
                                _daySpinner.Visibility = ViewStates.Visible;
                                _daySpinner.SetSelection((int)_dayOfWeek);
                            }
                            if (_timeText != null)
                            {
                                _timeText.Text = _reminderTime.ToShortTimeString();
                            }
                            break;

                        default:
                            if (_dayLabel != null)
                            {
                                _dayLabel.Visibility = ViewStates.Invisible;
                            }
                            if (_daySpinner != null)
                            {
                                _daySpinner.Visibility = ViewStates.Invisible;
                            }
                            if (_timeText != null)
                            {
                                _timeText.Text = _reminderTime.ToShortTimeString();
                            }
                            break;
                        }
                        _firstTimeView = false;
                    }
                }
                else
                {
                    Log.Error(TAG, "OnCreateView: View is NULL!");
                }
                return(view);
            }
            catch (Exception e)
            {
                Log.Error(TAG, "OnCreateView: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(Activity, e, Activity.GetString(Resource.String.ErrorMedListFragCreateView), "MedicationreminderDialogFragment.OnCreateView");
                }
                return(null);
            }
        }
Пример #53
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            //get player 1 name from edit text
            player1 = FindViewById <EditText>(Resource.Id.player1EditText);

            //get player 2 from edit text
            player2 = FindViewById <EditText>(Resource.Id.player2EditText);

            //Get player 1 score text field
            player1Score = FindViewById <TextView>(Resource.Id.player1ScoreText);

            //get player 2 score text field
            player2Score = FindViewById <TextView>(Resource.Id.player2ScoreText);

            currentScore = FindViewById <TextView>(Resource.Id.currentPointsText);

            currentPlayer = FindViewById <TextView>(Resource.Id.currentPlayerText);
            die           = FindViewById <ImageView>(Resource.Id.dieImage);


            newgame = new PigLogic();

            if (bundle != null)
            {
                Score1 = bundle.GetInt("Score1");
                Score2 = bundle.GetInt("Score2");

                Score1Text    = bundle.GetString("Score1Text");
                Score2Text    = bundle.GetString("Score2Text");
                CurrentPlayer = bundle.GetString("CurrentPlayer");
                PlayerTurn    = bundle.GetString("PlayerTurn");

                newgame.player1Score = Score1;
                newgame.player2Score = Score2;

                newgame.playerTurn    = PlayerTurn;
                newgame.currentPlayer = CurrentPlayer;
                newgame.player1Score  = Score1;
                newgame.player2Score  = Score2;

                player1Score.Text  = Score1Text;
                player2Score.Text  = Score2Text;
                currentPlayer.Text = CurrentPlayer;
                Toast.MakeText(this, PlayerTurn.ToString(), ToastLength.Long).Show();
            }
            else
            {
                //newgame = new PigLogic();
                newgame.newGame();
                Score1Text = newgame.player1Score.ToString();
                Score2Text = newgame.player2Score.ToString();
            }

            var newGameButton = FindViewById <Button>(Resource.Id.newGameButton);

            newGameButton.Click += delegate
            {
                newgame.newGame();
                ShowPlayer1Score();
                ShowPlayer2Score();

                newgame.player1Name = player1.Text;
                newgame.player2Name = player2.Text;

                currentPlayer.Text = newgame.getCurrentPlayer();
            };

            var rollDieButton = FindViewById <Button>(Resource.Id.rollDieButton);

            rollDieButton.Click += delegate
            {
                newgame.currentPlayer = CurrentPlayer;
                newgame.getPlayerTurn();
                currentScore.Text = newgame.RollDie().ToString();

                int roll = newgame.Roll;

                if (roll == 8)
                {
                    newgame.endTurn();
                    ShowPlayer1Score();
                    ShowPlayer2Score();
                    ShowCurrentScore();


                    currentPlayer.Text = newgame.getCurrentPlayer();
                }

                dieName = "die8side" + roll;
                int x = Resources.GetIdentifier(dieName, "drawable", PackageName);
                die.SetImageResource(x);
                currentPlayer.Text = newgame.getCurrentPlayer();
            };

            var endTurnButton = FindViewById <Button>(Resource.Id.endTurnButton);

            endTurnButton.Click += delegate
            {
                newgame.getPlayerTurn();

                newgame.endTurn();
                if (newgame.player1Score >= 100)
                {
                    player1Score.Text = "Winner";
                    player2Score.Text = "Loser";



                    ShowCurrentScore();

                    dieName = "die8side1";
                    int x = Resources.GetIdentifier(dieName, "drawable", PackageName);
                    die.SetImageResource(x);
                }
                else if (newgame.player2Score >= 100)
                {
                    player1Score.Text = "Loser";
                    player2Score.Text = "Winner";

                    ShowCurrentScore();

                    dieName = "die8side1";
                    int x = Resources.GetIdentifier(dieName, "drawable", PackageName);
                    die.SetImageResource(x);
                }
                else
                {
                    ShowPlayer1Score();
                    ShowPlayer2Score();
                    ShowCurrentScore();


                    dieName = "die8side1";
                    int x = Resources.GetIdentifier(dieName, "drawable", PackageName);
                    die.SetImageResource(x);
                }
            };
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            View view = null;

            try
            {
                if (savedInstanceState != null)
                {
                    _dialogTitle      = savedInstanceState.GetString("dialogTitle");
                    _PlayListID       = savedInstanceState.GetInt("playListID");
                    _trackListAdapter = new MusicPickerTrackListAdapter(Activity, _PlayListID);
                }

                if (Dialog != null)
                {
                    Dialog.SetTitle(_dialogTitle);
                }

                view = inflater.Inflate(Resource.Layout.MusicPickerDialogLayout, container, false);
                GetFieldComponents(view);

                if (_playListName != null)
                {
                    var playlist = GlobalData.PlayListItems.Find(play => play.PlayListID == _PlayListID);
                    if (playlist != null)
                    {
                        _playListName.Text = playlist.PlayListName.Trim();
                    }
                }
                if (_playListTracks != null)
                {
                    _playListTracks.Adapter = _trackListAdapter;
                }

                _imageLoader = ImageLoader.Instance;

                _imageLoader.LoadImage
                (
                    "drawable://" + Resource.Drawable.musicdj,
                    new ImageLoadingListener
                    (
                        loadingComplete: (imageUri, viewImg, loadedImage) =>
                {
                    var args = new LoadingCompleteEventArgs(imageUri, viewImg, loadedImage);
                    ImageLoader_LoadingComplete(null, args);
                }
                    )
                );

                SetupCallbacks();
            }
            catch (Exception e)
            {
                Log.Error(TAG, "OnCreateView: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(Activity, e, Activity.GetString(Resource.String.ErrorMusicPickerDialogFragmentCreateView), "MusicPickerDialogFragment.OnCreateView");
                }
            }
            return(view);
        }
Пример #55
0
 public void RestoreFromBundle(Bundle bundle)
 {
     Pos = bundle.GetInt(POS);
 }
Пример #56
0
 protected override void OnRestoreInstanceState(Bundle savedInstanceState)
 {
     base.OnRestoreInstanceState(savedInstanceState);
     _count         = savedInstanceState.GetInt("main_activity_click_count", _count);
     _myButton.Text = savedInstanceState.GetString("main_activity_button_text", "Nothing in state.");
 }
 protected override void OnRestoreInstanceState(Bundle savedInstanceState)
 {
     base.OnRestoreInstanceState(savedInstanceState);
     counter = savedInstanceState.GetInt("counter");
 }
Пример #58
0
 public void RestoreFromBundle(Bundle bundle)
 {
     feature = new Feature(bundle.GetString(FEATURE));
     depth   = bundle.GetInt(DEPTH);
 }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = null;

            try
            {
                if (savedInstanceState != null)
                {
                    _moodListID  = savedInstanceState.GetInt("moodListID");
                    _dialogTitle = savedInstanceState.GetString("dialogTitle");
                    _textTitle   = savedInstanceState.GetString("textTitle");
                    _moodName    = savedInstanceState.GetString("moodName");
                }

                if (Dialog != null)
                {
                    Dialog.SetTitle(_dialogTitle);
                }

                view = inflater.Inflate(Resource.Layout.MoodsAdjustDialogFragmentLayout, container, false);

                GetFieldComponents(view);
                HandleMicPermission();

                SetupCallbacks();

                if (_moodListID != -1)
                {
                    if (_moodListText != null)
                    {
                        _moodListText.Text = _moodName.Trim();
                    }
                    else
                    {
                        Log.Error(TAG, "OnCreateView: _moodListText is NULL!");
                    }
                    if (_add != null)
                    {
                        _add.Text = _activity.GetString(Resource.String.wordAcceptUpper);
                    }
                }
                else
                {
                    if (savedInstanceState != null)
                    {
                        _moodListText.Text = _moodName.Trim();
                    }
                    if (_add != null)
                    {
                        _add.Text = _activity.GetString(Resource.String.wordAddUpper);
                    }
                }

                if (_titleText != null)
                {
                    _titleText.Text = _textTitle.Trim();
                }
            }
            catch (Exception e)
            {
                Log.Error(TAG, "OnCreateView: Exception - " + e.Message);
                if (GlobalData.ShowErrorDialog)
                {
                    ErrorDisplay.ShowErrorAlert(Activity, e, Activity.GetString(Resource.String.ErrorMoodsAdjustDialogCreateView), "MoodsAdjustDialogFragment.OnCreateView");
                }
            }

            return(view);
        }
Пример #60
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            chart = new Steema.TeeChart.TChart(ApplicationContext);

            chart.Zoom.Style = Steema.TeeChart.ZoomStyles.Classic;
            var myTheme = new Steema.TeeChart.Themes.BlackIsBackTheme(chart.Chart);

            myTheme.Apply();

            Bundle extras     = Intent.Extras;
            int    seriesType = extras.GetInt("SeriesPosition");

            var tmp = Steema.TeeChart.Utils.SeriesTypesOf [seriesType];

            Steema.TeeChart.Styles.Series series;

            this.Title = tmp.ToString().Replace("Steema.TeeChart.Styles.", "");

            //Some series can not work without a parent chart due to internal structure.
            if (tmp.Name == "TreeMap")
            {
                series = new Steema.TeeChart.Styles.TreeMap(chart.Chart);
            }
            else if (tmp.Name == "PolarGrid")
            {
                series = new Steema.TeeChart.Styles.PolarGrid(chart.Chart);
            }
            else
            {
                series = chart.Series.Add(tmp);
            }

            series.FillSampleValues();

            chart.Aspect.View3D = Needs3D(chart[0]);
            //chart.Panel.Transparent = true;

            if (chart[0] is Steema.TeeChart.Styles.Circular)
            {
                (chart[0] as Steema.TeeChart.Styles.Circular).Circled = true;
            }

            if (chart[0] is Steema.TeeChart.Styles.Pie)
            {
                var pie = (Steema.TeeChart.Styles.Pie)chart[0];

                pie.BevelPercent = 25;
                pie.Pen.Visible  = false;
                pie.EdgeStyle    = Steema.TeeChart.Drawing.EdgeStyles.Flat;
                pie.Circled      = true;
                pie.FillSampleValues(6);
                chart.Legend.Visible      = true;
                chart.Legend.Font.Size    = 15;
                chart.Legend.Transparency = 30;
                chart.Legend.Alignment    = Steema.TeeChart.LegendAlignments.Bottom;
                chart.Aspect.View3D       = true;
                chart.Aspect.VertOffset   = -20;
                chart.Aspect.Elevation    = 300;

                if (!(pie is Steema.TeeChart.Styles.Donut))
                {
                    chart.Aspect.Chart3DPercent = 30;
                    pie.BevelPercent            = 15;
                    chart.Legend.Transparent    = true;
                    chart.Legend.Font.Size      = 16;
                }

                chart.Header.Text = "Touch a slice to explode it";
            }

            if (chart[0] is Steema.TeeChart.Styles.Gantt || chart[0] is Steema.TeeChart.Styles.Funnel)
            {
                chart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
            }

            if (chart[0] is Steema.TeeChart.Styles.Custom3DPalette)
            {
                if (!(chart[0] is Steema.TeeChart.Styles.Contour) &&
                    !(chart[0] is Steema.TeeChart.Styles.ColorGrid) &&
                    !(chart[0] is Steema.TeeChart.Styles.Ternary) &&
                    !(chart[0] is Steema.TeeChart.Styles.BubbleCloud))
                {
                    chart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
                    chart.Legend.Font.Size = 30;
                    chart.Legend.Visible   = false;
                    chart.Header.Text      = "Drag to rotate";
                    chart.Header.Font.Size = 30;
                    chart.Walls.Visible    = false;

                    if (chart[0] is Steema.TeeChart.Styles.TriSurface)
                    {
                        chart.Aspect.Chart3DPercent = 30;
                    }
                    else
                    {
                        chart.Axes.Bottom.Increment = 1;

                        chart.Aspect.Orthogonal     = false;
                        chart.Aspect.Chart3DPercent = 70;
                        chart.Aspect.Rotation       = 310;
                        chart.Aspect.Zoom           = 70;
                        chart.Aspect.Perspective    = 100;
                    }

                    chart.Tools.Add(new Steema.TeeChart.Tools.Rotate());
                }
                else if (chart[0] is Steema.TeeChart.Styles.Contour)
                {
                    ((Steema.TeeChart.Styles.Custom3DPalette)chart[0]).Pen.Width = 3;
                    ((Steema.TeeChart.Styles.Contour)chart[0]).FillLevels        = true;
                }
                else if (chart[0] is Steema.TeeChart.Styles.BubbleCloud)
                {
                    chart.Legend.Alignment = Steema.TeeChart.LegendAlignments.Bottom;
                }

                ((Steema.TeeChart.Styles.Custom3DPalette)chart[0]).UseColorRange = false;
                ((Steema.TeeChart.Styles.Custom3DPalette)chart[0]).UsePalette    = true;
                ((Steema.TeeChart.Styles.Custom3DPalette)chart[0]).PaletteStyle  = Steema.TeeChart.Styles.PaletteStyles.Strong;
            }

            if ((chart[0] is Steema.TeeChart.Styles.Pie) ||
                (chart[0] is Steema.TeeChart.Styles.CircularGauge) ||
                (chart[0] is Steema.TeeChart.Styles.CustomGauge))
            {
                chart.ClickSeries += chart_ClickSeries;
            }
            else
            {
                chart.ClickSeries -= chart_ClickSeries;
            }

            //if (((chart[0] is Steema.TeeChart.Styles.Line) || (chart[0] is Steema.TeeChart.Styles.Points))
            //    && !(chart[0] is Steema.TeeChart.Styles.Bubble))
            //{
            //  chart.Header.Text = "Touch series for tool tip";
            //  chart.ClickSeries += chart_ClickSeries;
            //}
            //else
            //{
            //  chart.ClickSeries -= chart_ClickSeries;
            //}

            SetContentView(chart);
        }