protected void PortsList_UpdateSpinner(int hardware_id, ref AppCompatSpinner portsSpinner, int selected_port_id = 0) { Log.Debug(TAG, $"PortsList_UpdateSpinner(hardware_id={hardware_id})"); if (portsSpinner.SelectedItemPosition > -1 && selected_port_id == 0 && Ports?.Count > 0) { selected_port_id = Ports.Keys.ToList()[portsSpinner.SelectedItemPosition]; } Ports = new Dictionary <int, string>(); lock (DatabaseContext.DbLocker) { using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase)) { foreach (PortModel portHardware in db.Ports.Where(x => x.HardwareId == hardware_id)) { Ports.Add(portHardware.Id, portHardware.ToString()); } } } ArrayAdapter <string> adapterPorts = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, Ports.Values.ToList()); adapterPorts.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); portsSpinner.Adapter = adapterPorts; if (selected_port_id > 0) { portsSpinner.SetSelection(Ports.Keys.ToList().IndexOf(selected_port_id)); } }
private void SetupTypeSpinner(AppCompatSpinner typeSpinner, MediaType selectedType) { var types = AniListEnum.GetEnumValues <MediaType>(); var displayTypes = types.Select(x => x.DisplayValue).Prepend("All").ToList(); typeSpinner.Adapter = new ArrayAdapter <string>(Activity, Resource.Layout.View_SpinnerDropDownItem, displayTypes); if (selectedType != null) { typeSpinner.SetSelection(selectedType.Index + 1); } typeSpinner.SetTag(Resource.Id.Object_Position, typeSpinner.SelectedItemPosition); typeSpinner.ItemSelected += (sender, args) => { var previousPos = (int)typeSpinner.GetTag(Resource.Id.Object_Position); if (previousPos != args.Position) { var position = args.Position - 1; var type = position >= 0 ? AniListEnum.GetEnum <MediaType>(position) : null; typeSpinner.SetTag(Resource.Id.Object_Position, typeSpinner.SelectedItemPosition); SetupFormatSpinner(_formatSpinner, type, null); } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); root = FindViewById <RelativeLayout>(Resource.Id.root); root.RequestFocus(); sourceBankSpinner = FindViewById <AppCompatSpinner>(Resource.Id.sourceBankSpinner); targetBankSpinner = FindViewById <AppCompatSpinner>(Resource.Id.targetBankSpinner); sourceBankSpinner.ItemSelected += SourceBankSpinner_ItemSelected; targetBankSpinner.ItemSelected += TargetBankSpinner_ItemSelected; timePickerButton = FindViewById <Button>(Resource.Id.timePickerButton); timePickerButton.Click += TimePickerButton_Click; calculateButton = FindViewById <Button>(Resource.Id.calculateButton); calculateButton.Click += CalculateButton_Click; sourceIbanEditText = FindViewById <EditText>(Resource.Id.sourceBankIbanEdit); targetIbanEditText = FindViewById <EditText>(Resource.Id.targetBankIbanEdit); sourceIbanEditText.TextChanged += IbanEditText_TextChanged; targetIbanEditText.TextChanged += IbanEditText_TextChanged; viewModel = new MainViewModel(); viewModel.PropertyChanged += Vm_PropertyChanged; viewModel.Initialize(); SetSendTime(DateTime.Now); }
public SettingsManagePort(CommandAddActivity command_add_activity, AppCompatSpinner controllers, AppCompatSpinner ports, AppCompatSpinner states) { Log.Debug(TAG, "~ constructor"); command_add_activity.HardwaresListSpinnerLoad(ref controllers); ParentActivity = command_add_activity; Controllers = controllers; Ports = ports; States = states; string[] script_trigger_port_states_array = ParentActivity.Resources.GetStringArray(Resource.Array.script_trigger_port_states_array); ArrayAdapter adapterPortStatuses = new ArrayAdapter <string>(ParentActivity, Android.Resource.Layout.SimpleSpinnerItem, script_trigger_port_states_array); adapterPortStatuses.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); States.Adapter = adapterPortStatuses; if (Command != null) { if (Command.ExecutionParametr == "true") { States.SetSelection(Array.IndexOf(script_trigger_port_states_array, ParentActivity.GetString(Resource.String.abc_capital_on))); } else if (Command.ExecutionParametr == "false") { States.SetSelection(Array.IndexOf(script_trigger_port_states_array, ParentActivity.GetString(Resource.String.abc_capital_off))); } else { States.SetSelection(Array.IndexOf(script_trigger_port_states_array, ParentActivity.GetString(Resource.String.abc_capital_switch))); } } OnResume(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // if the presenter is null, we are probably trying to recreate the fragment after it has been removed from memory. // don't allow that to happen if (_presenter == null) { DismissAllowingStateLoss(); return(null); } var view = Activity.LayoutInflater.Inflate(Resource.Layout.Fragment_EditMediaListItem, container, false); _coordLayout = view.FindViewById <CoordinatorLayout>(Resource.Id.EditMediaListItem_CoordLayout); SetupToolbar(view.FindViewById <Toolbar>(Resource.Id.EditMediaListItem_Toolbar)); SetupScore(_scorePicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_ScorePicker), view.FindViewById <Button>(Resource.Id.EditMediaListItem_CustomScoringButton)); SetupStatus(_statusSpinner = view.FindViewById <AppCompatSpinner>(Resource.Id.EditMediaListItem_StatusSpinner)); SetupProgress(_progressPicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_ProgressPicker), view.FindViewById <TextView>(Resource.Id.EditMediaListItem_ProgressLabel)); SetupVolumeProgress(view.FindViewById(Resource.Id.EditMediaListItem_VolumeProgressContainer), _progressVolumesPicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_VolumeProgressPicker)); SetupRepeat(_repeatPicker = view.FindViewById <Picker>(Resource.Id.EditMediaListItem_RewatchedPicker), view.FindViewById <TextView>(Resource.Id.EditMediaListItem_RewatchedLabel)); SetupNotes(_notesView = view.FindViewById <EditText>(Resource.Id.EditMediaListItem_Notes)); SetupCustomLists(view.FindViewById(Resource.Id.EditMediaListItem_CustomListsContainer), view.FindViewById <LinearLayout>(Resource.Id.EditMediaListItem_CustomLists)); SetupStartDate(_startDateView = view.FindViewById <DatePickerTextView>(Resource.Id.EditMediaListItem_StartDate)); SetupFinishDate(_finishDateView = view.FindViewById <DatePickerTextView>(Resource.Id.EditMediaListItem_FinishDate)); SetupDeleteButton(view.FindViewById(Resource.Id.EditMediaListItem_DeleteButton)); return(view); }
public SettingsManageTransfer(CommandAddActivity commandAddActivity, AppCompatSpinner scriptes, AppCompatSpinner steps) { Log.Debug(TAG, "~ constructor"); ParentActivity = commandAddActivity; Scriptes = scriptes; Steps = steps; ScriptsList = new Dictionary <int, string>() { { 0, ParentActivity.GetString(Resource.String.completing_the_script_title) } }; lock (DatabaseContext.DbLocker) { using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase)) { db.Scripts.ToList().ForEach(x => { ScriptsList.Add(x.Id, $"{(x.Id == Command?.Script.Id ? "→ " : "")}{x}"); }); } } ArrayAdapter <string> adapterScriptes = new ArrayAdapter <string>(ParentActivity, Android.Resource.Layout.SimpleSpinnerItem, ScriptsList.Values.ToList()); adapterScriptes.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); Scriptes.Adapter = adapterScriptes; OnResume(); }
protected override void OnCreate(Bundle savedInstanceState) { Log.Debug(TAG, "OnCreate"); base.OnCreate(savedInstanceState); CardTitle = FindViewById <AppCompatTextView>(Resource.Id.script_card_title); CardSubtitle = FindViewById <AppCompatTextView>(Resource.Id.script_card_subtitle); ScriptName = FindViewById <AppCompatEditText>(Resource.Id.editTextScriptName); AutorunTrigger = FindViewById <SwitchCompat>(Resource.Id.switchAutorunTriggerScript); // HardwareTrigger = FindViewById <AppCompatSpinner>(Resource.Id.spinnerScriptTriggerHardware); PortTrigger = FindViewById <AppCompatSpinner>(Resource.Id.spinnerScriptTriggerPort); StateTrigger = FindViewById <AppCompatSpinner>(Resource.Id.spinnerScriptTriggerState); AutorunTrigger.Checked = false; // HardwareTrigger.Enabled = false; PortTrigger.Enabled = false; StateTrigger.Enabled = false; ButtonOk = FindViewById <AppCompatButton>(Resource.Id.script_button_ok); HardwaresListSpinnerLoad(ref HardwareTrigger); // ArrayAdapter adapterPortStatuses = ArrayAdapter <string> .CreateFromResource(this, Resource.Array.script_trigger_port_states_array, Android.Resource.Layout.SimpleSpinnerItem); adapterPortStatuses.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); StateTrigger.Adapter = adapterPortStatuses; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_blood_sugar_add); _level = FindViewById <AppCompatEditText>(Resource.Id.blood_sugar_add_reading); _mealName = FindViewById <AppCompatEditText>(Resource.Id.blood_sugar_add_meal_name); _readingType = FindViewById <AppCompatSpinner>(Resource.Id.blood_sugar_reading_type); _mealType = FindViewById <AppCompatSpinner>(Resource.Id.meal_type); _carbs = FindViewById <AppCompatEditText>(Resource.Id.blood_sugar_add_carbs); _carbs.Visibility = ViewStates.Gone; _mealName.Visibility = ViewStates.Gone; _mealType.Visibility = ViewStates.Gone; ArrayAdapter <ReadingType> adapter = new ArrayAdapter <ReadingType>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, (ReadingType[])Enum.GetValues(typeof(ReadingType))); _readingType.Adapter = adapter; AppCompatButton bloodSugarAddButton = FindViewById <AppCompatButton>(Resource.Id.blood_sugar_add_button); bloodSugarAddButton.Click += async delegate { bloodSugarAddButton.Enabled = false; string status = await OnBloodSugarAddButtonPressed(); if (status == "Success") { Finish(); } else { bloodSugarAddButton.Enabled = true; RunOnUiThread(() => { Toast.MakeText(this, status, ToastLength.Long).Show(); }); } }; Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar_blood_sugar_add); toolbar.Title = "Add A Blood Sugar Reading"; SetSupportActionBar(toolbar); DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view_blood_sugar_add); navigationView.SetNavigationItemSelectedListener(this); }
public void HardwaresListSpinnerLoad(ref AppCompatSpinner appCompatSpinnerHardwares, int selected_hardware_id = 0) { Log.Debug(TAG, $"HardwaresListSpinnerLoad(selected_hardware_id={selected_hardware_id})"); ArrayAdapter <string> adapterHardwares = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerItem, Hardwares.Values.ToList()); adapterHardwares.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); appCompatSpinnerHardwares.Adapter = adapterHardwares; if (selected_hardware_id > 0) { appCompatSpinnerHardwares.SetSelection(Hardwares.Keys.ToList().IndexOf(selected_hardware_id)); } }
private void SetupCountrySpinner(AppCompatSpinner countrySpinner, MediaCountry selectedCountry) { var countries = AniListEnum.GetEnumValues <MediaCountry>(); var displayCountries = countries.Select(x => x.DisplayValue).ToList(); countrySpinner.Adapter = new ArrayAdapter <string>(Activity, Resource.Layout.View_SpinnerDropDownItem, displayCountries); if (selectedCountry != null) { countrySpinner.SetSelection(countries.FindIndex(x => x.Value == selectedCountry.Value)); } }
private void SetupSourceSpinner(AppCompatSpinner sourceSpinner, MediaSource selectedSource) { var sources = AniListEnum.GetEnumValues <MediaSource>(); var displaySources = sources.Select(x => x.DisplayValue).Prepend("All").ToList(); sourceSpinner.Adapter = new ArrayAdapter <string>(Activity, Resource.Layout.View_SpinnerDropDownItem, displaySources); if (selectedSource != null) { sourceSpinner.SetSelection(sources.FindIndex(x => x.Value == selectedSource.Value) + 1); } }
private void SetupSeasonSpinner(AppCompatSpinner seasonSpinner, MediaType selectedType, MediaSeason selectedSeason) { var seasons = AniListEnum.GetEnumValues <MediaSeason>(); var displaySeasons = seasons.Select(x => x.DisplayValue).Prepend("All").ToList(); seasonSpinner.Adapter = new ArrayAdapter <string>(Activity, Resource.Layout.View_SpinnerDropDownItem, displaySeasons); if (selectedSeason != null) { seasonSpinner.SetSelection(seasons.FindIndex(x => x.Value == selectedSeason.Value) + 1); } seasonSpinner.Enabled = MediaType.Anime.Equals(selectedType); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = Activity.LayoutInflater.Inflate(Resource.Layout.Fragment_BrowseFilterDialog, container, false); SetupToolbar(_toolbar = view.FindViewById <Toolbar>(Resource.Id.BrowseFilterDialog_Toolbar)); SetupTypeSpinner(_typeSpinner = view.FindViewById <AppCompatSpinner>(Resource.Id.BrowseFilterDialog_TypeSpinner), _browseModel.Type); SetupFormatSpinner( _formatSpinner = view.FindViewById <AppCompatSpinner>(Resource.Id.BrowseFilterDialog_FormatSpinner), _browseModel.Type, _browseModel.Format); SetupStatusSpinner( _statusSpinner = view.FindViewById <AppCompatSpinner>(Resource.Id.BrowseFilterDialog_StatusSpinner), _browseModel.Status); SetupCountrySpinner( _countrySpinner = view.FindViewById <AppCompatSpinner>(Resource.Id.BrowseFilterDialog_CountrySpinner), _browseModel.Country); SetupSourceSpinner( _sourceSpinner = view.FindViewById <AppCompatSpinner>(Resource.Id.BrowseFilterDialog_SourceSpinner), _browseModel.Source); SetupSeasonSpinner( _seasonSpinner = view.FindViewById <AppCompatSpinner>(Resource.Id.BrowseFilterDialog_SeasonSpinner), _browseModel.Type, _browseModel.Season); SetupYearPicker(_yearPicker = view.FindViewById <Picker>(Resource.Id.BrowseFilterDialog_YearPicker), _browseModel.Year); _selectedGenres = _browseModel.IncludedGenres; SetupGenresButton(_genresButton = view.FindViewById <AppCompatButton>(Resource.Id.BrowseFilterDialog_GenresButton)); _selectedTags = _browseModel.IncludedTags; SetupTagsButton(_tagsButton = view.FindViewById <AppCompatButton>(Resource.Id.BrowseFilterDialog_TagsButton)); _selectedStreamingOn = _browseModel.LicensedBy; SetupStreamingOnButton(_streamingOnButton = view.FindViewById <AppCompatButton>(Resource.Id.BrowseFilterDialog_StreamingOnButton)); return(view); }
private void SetupFormatSpinner(AppCompatSpinner formatSpinner, MediaType selectedType, MediaFormat selectedFormat) { var formats = AniListEnum.GetEnumValues <MediaFormat>() .Where(x => selectedType == null || x.MediaType == selectedType) .ToList(); var displayFormats = formats.Select(x => x.DisplayValue).Prepend("All").ToList(); formatSpinner.Adapter = new ArrayAdapter <string>(Activity, Resource.Layout.View_SpinnerDropDownItem, displayFormats); if (selectedFormat != null && selectedFormat.MediaType.Equals(selectedType)) { formatSpinner.SetSelection(formats.FindIndex(x => x.Value == selectedFormat.Value) + 1); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_blood_sugar_add); _level = FindViewById <AppCompatEditText>(Resource.Id.blood_sugar_add_reading); _mealName = FindViewById <AppCompatEditText>(Resource.Id.blood_sugar_add_meal_name); _readingType = FindViewById <AppCompatSpinner>(Resource.Id.blood_sugar_reading_type); _mealType = FindViewById <AppCompatSpinner>(Resource.Id.meal_type); _carbs = FindViewById <AppCompatEditText>(Resource.Id.blood_sugar_add_carbs); //Assign Passed Values _carbs.Text = Intent.GetStringExtra("Carbs"); _mealName.Text = Intent.GetStringExtra("MealName"); ArrayAdapter <ReadingType> adapter = new ArrayAdapter <ReadingType>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, (ReadingType[])Enum.GetValues(typeof(ReadingType))); _readingType.Adapter = adapter; ArrayAdapter <MealType> adapter2 = new ArrayAdapter <MealType>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, (MealType[])Enum.GetValues(typeof(MealType))); _mealType.Adapter = adapter2; AppCompatButton bloodSugarAddButton = FindViewById <AppCompatButton>(Resource.Id.blood_sugar_add_button); bloodSugarAddButton.Click += async delegate { bloodSugarAddButton.Enabled = false; await OnBloodSugarAddButtonPressed(); Finish(); }; Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar_blood_sugar_add); toolbar.Title = "Add A Blood Sugar Reading"; SetSupportActionBar(toolbar); DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view_blood_sugar_add); navigationView.SetNavigationItemSelectedListener(this); }
public SettingsManageController(CommandAddActivity command_add_activity, AppCompatSpinner controllers, EditText commandText) { Log.Debug(TAG, "~ constructor"); command_add_activity.HardwaresListSpinnerLoad(ref controllers); ParentActivity = command_add_activity; Controllers = controllers; CommandText = commandText; if (Command != null) { CommandText.Text = Command.ExecutionParametr; } OnResume(); }
protected override void OnCreate(Bundle savedInstanceState) { Log.Debug(TAG, "OnCreate"); base.OnCreate(savedInstanceState); ScriptId = Intent.Extras.GetInt(nameof(ScriptModel.Id), 0); CardTitle = FindViewById <AppCompatTextView>(Resource.Id.command_card_title); CardSubtitle = FindViewById <AppCompatTextView>(Resource.Id.command_card_subtitle); HiddenCommandCheckBox = FindViewById <AppCompatCheckBox>(Resource.Id.checkBoxHiddenCommand); PauseSecondsBeforeStarting = FindViewById <AppCompatEditText>(Resource.Id.editTextPauseSecBeforeExecuting); FooterLayout = FindViewById <LinearLayoutCompat>(Resource.Id.command_footer_layout); RequiredCondition = FindViewById <SwitchCompat>(Resource.Id.switchCondition); HardwareCondition = FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandHardwareCondition); PortCondition = FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandPortCondition); StateCondition = FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandStateCondition); RequiredCondition.Checked = false; // HardwareCondition.Enabled = false; PortCondition.Enabled = false; StateCondition.Enabled = false; TypesCommand = FindViewById <AppCompatSpinner>(Resource.Id.spinnerTypeCommand); about_selected_command = FindViewById <AppCompatTextView>(Resource.Id.about_selected_command); CommandConfigForm = FindViewById <LinearLayoutCompat>(Resource.Id.command_config_form); ButtonOk = FindViewById <AppCompatButton>(Resource.Id.command_button_ok); HardwaresListSpinnerLoad(ref HardwareCondition); ArrayAdapter adapterPortStatusesCondition = ArrayAdapter <string> .CreateFromResource(this, Resource.Array.required_condition_port_states_array, Android.Resource.Layout.SimpleSpinnerItem); adapterPortStatusesCondition.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); StateCondition.Adapter = adapterPortStatusesCondition; ArrayAdapter adapterTypesCommands = ArrayAdapter <string> .CreateFromResource(this, Resource.Array.commands_types_array, Android.Resource.Layout.SimpleSpinnerItem); adapterTypesCommands.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); TypesCommand.Adapter = adapterTypesCommands; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { _view = Activity.LayoutInflater.Inflate(Resource.Layout.Fragment_MediaListFilterDialog, container, false); SetupToolbar(_toolbar = _view.FindViewById <Toolbar>(Resource.Id.MediaListFilterDialog_Toolbar)); SetupFormatSpinner( _formatSpinner = _view.FindViewById <AppCompatSpinner>(Resource.Id.MediaListFilterDialog_FormatSpinner), _type, _mediaListFilterModel.Format); SetupStatusSpinner( _statusSpinner = _view.FindViewById <AppCompatSpinner>(Resource.Id.MediaListFilterDialog_StatusSpinner), _mediaListFilterModel.Status); SetupSourceSpinner( _sourceSpinner = _view.FindViewById <AppCompatSpinner>(Resource.Id.MediaListFilterDialog_SourceSpinner), _mediaListFilterModel.Source); SetupSeasonSpinner( _seasonSpinner = _view.FindViewById <AppCompatSpinner>(Resource.Id.MediaListFilterDialog_SeasonSpinner), _type, _mediaListFilterModel.Season); SetupYearPicker(_yearPicker = _view.FindViewById <Picker>(Resource.Id.MediaListFilterDialog_YearPicker), _mediaListFilterModel.Year); _selectedGenres = _mediaListFilterModel.IncludedGenres; SetupGenresButton(_genresButton = _view.FindViewById <AppCompatButton>(Resource.Id.MediaListFilterDialog_GenresButton)); _selectedTags = _mediaListFilterModel.IncludedTags; SetupTagsButton(_tagsButton = _view.FindViewById <AppCompatButton>(Resource.Id.MediaListFilterDialog_TagsButton)); _selectedStreamingOn = _mediaListFilterModel.LicensedBy; SetupStreamingOnButton(_streamingOnButton = _view.FindViewById <AppCompatButton>(Resource.Id.MediaListFilterDialog_StreamingOnButton)); SetupTitleEditText( _titleEditText = _view.FindViewById <EditText>(Resource.Id.MediaListFilterDialog_Title)); return(_view); }
private void InitializePlayback(StreamingUri itemToPlay) { if (mediaStreams == null) { mediaStreams = JsonConvert.DeserializeObject <List <StreamingUri> >(Intent.GetStringExtra("mediaStreams")) .Where(a => a.StreamingUrl.OriginalString.Contains(".mp4")).ToList(); } if (player is null) { mediaSourceFactory = new DefaultDataSourceFactory(this, Util.GetUserAgent(this, Application.PackageName)); trackSelectorFactory = new AdaptiveTrackSelection.Factory(); var renderersFactory = new DefaultRenderersFactory(this); player = ExoPlayerFactory.NewSimpleInstance(this, renderersFactory, new DefaultTrackSelector(trackSelectorFactory)); playerView = FindViewById <PlayerView>(Resource.Id.playerView); playerView.Player = player; playerView.RequestFocus(); playerView.SetControllerVisibilityListener(this); linksSpinner = FindViewById <AppCompatSpinner>(Resource.Id.linksSpinner); player.PlayWhenReady = true; playerView.ControllerShowTimeoutMs = 3000; if (mediaStreams != null && mediaStreams.Count > 0) { var titles = new List <string>() { }; mediaStreams.ForEach(a => titles.Add(a.StreamingQuality + " - MP4")); linksSpinner.Adapter = new ArrayAdapter(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, titles); linksSpinner.ItemSelected += LinksSpinner_ItemSelected; linksSpinner.SetSelection(0); } } if (itemToPlay != null) { player.Prepare(CreateMediaSource(itemToPlay)); playerView.KeepScreenOn = true; } }
public override void OnViewCreated(View view, Bundle savedInstanceState) { base.OnViewCreated(view, savedInstanceState); _appBar = view.FindViewById <AppBarLayout>(Resource.Id.login_AppBar); _loginInputLayout = view.FindViewById <TextInputLayout>(Resource.Id.login_text_input); _passwordInputLayout = view.FindViewById <TextInputLayout>(Resource.Id.password_text_input); _loginEditText = view.FindViewById <AppCompatEditText>(Resource.Id.login_edit_text); _passwordEditText = view.FindViewById <AppCompatEditText>(Resource.Id.password_edit_text); _saveCheckBox = view.FindViewById <AppCompatCheckBox>(Resource.Id.login_save_checkbox); _restPassButton = view.FindViewById <TextView>(Resource.Id.login_reset_password); _langSpinnerLabel = view.FindViewById <TextView>(Resource.Id.login_lang_spinner_label); _langSpinner = view.FindViewById <AppCompatSpinner>(Resource.Id.login_lang_spinner); _guestLoginButton = view.FindViewById <MaterialButton>(Resource.Id.login_guest_button); _loginButton = view.FindViewById <TextView>(Resource.Id.login_button); _loginStatus = view.FindViewById <TextView>(Resource.Id.login_status); _progressBarContainer = view.FindViewById <FrameLayout>(Resource.Id.login_progress_container); _loginEditText.FocusChange += (sender, args) => { if (args.HasFocus) { _appBar.SetExpanded(false, true); } }; _passwordEditText.FocusChange += (sender, args) => { if (args.HasFocus) { _appBar.SetExpanded(false, true); } }; _passwordEditText.EditorAction += (sender, args) => OnLoginClick(); _loginButton.Click += (sender, args) => OnLoginClick(); _restPassButton.Click += (sender, args) => ShowResetPasswordDialog(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_modify); _carbs = FindViewById <AppCompatSpinner>(Resource.Id.spinner); _foodCarbs = FindViewById <AppCompatEditText>(Resource.Id.top_field); _middleField = FindViewById <AppCompatEditText>(Resource.Id.middle_field); _mealName = FindViewById <AppCompatEditText>(Resource.Id.bottom_field); _mealType = FindViewById <AppCompatSpinner>(Resource.Id.mealtype_spinner); _middleField.Visibility = ViewStates.Gone; AppCompatButton carbEditButton = FindViewById <AppCompatButton>(Resource.Id.submit_button); AppCompatButton carbDeleteButton = FindViewById <AppCompatButton>(Resource.Id.delete_button); ArrayAdapter <MealType> adapter = new ArrayAdapter <MealType>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, (MealType[])Enum.GetValues(typeof(MealType))); _mealType.Adapter = adapter; _foodCarbs.Hint = "Food Carbs"; _mealName.Hint = "Meal Name"; _foodCarbs.Visibility = ViewStates.Gone; _mealName.Visibility = ViewStates.Gone; carbEditButton.Click += async delegate { carbEditButton.Enabled = false; carbDeleteButton.Enabled = false; string status = await OnCarbEditButtonPressed(); if (status == "Success") { Finish(); } else { carbEditButton.Enabled = true; carbDeleteButton.Enabled = true; RunOnUiThread(() => { Toast.MakeText(this, status, ToastLength.Long).Show(); }); } }; carbDeleteButton.Click += async delegate { carbEditButton.Enabled = false; carbDeleteButton.Enabled = false; string status = await Task.Run(() => OnCarbDeleteButtonPressed()); if (status == "Success") { Finish(); } else { carbEditButton.Enabled = true; carbDeleteButton.Enabled = true; RunOnUiThread(() => { Toast.MakeText(this, status, ToastLength.Long).Show(); }); } }; Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar_modify); toolbar.Title = "Modify A Carb Measurement"; SetSupportActionBar(toolbar); DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); _carbs.ItemSelected += delegate { _foodCarbs.Visibility = ViewStates.Visible; _mealName.Visibility = ViewStates.Visible; PatientCarbohydrate pc = _carbs.SelectedItem.Cast <PatientCarbohydrate>(); _foodCarbs.Text = pc.FoodCarbs.ToString(); _mealName.Text = pc.Meal.FoodName; _mealType.SetSelection((Enum.GetValues(typeof(MealType)).Cast <MealType>()).ToList().IndexOf(pc.Meal.MealTime)); }; NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view_modify); navigationView.SetNavigationItemSelectedListener(this); }
private void SetupStatus(AppCompatSpinner statusSpinner) { statusSpinner.Adapter = new ArrayAdapter <string>(Activity, Resource.Layout.View_SpinnerDropDownItem, _mediaStatusList); if (_completeMedia) { statusSpinner.SetSelection(MediaListStatus.Completed.Index); } else if (_mediaList?.Status != null) { statusSpinner.SetSelection(_mediaList.Status.Index); } else if (_media.Status == MediaStatus.Releasing || _media.Status == MediaStatus.Cancelled) { statusSpinner.SetSelection(MediaListStatus.Current.Index); } else { statusSpinner.SetSelection(MediaListStatus.Planning.Index); } _initialStatus = statusSpinner.SelectedItemPosition; statusSpinner.ItemSelected += (sender, args) => { var statusEnum = AniListEnum.GetEnum <MediaListStatus>(args.Position); var initialStatusEnum = AniListEnum.GetEnum <MediaListStatus>(_initialStatus); if (statusEnum.Equals(MediaListStatus.Completed)) { if (!_initialProgress.HasValue) { _initialProgress = (int?)_progressPicker.GetValue(); } if (!_finishDateView.SelectedDate.HasValue && Activity.Settings.AutoFillDateForMediaListItem) { _finishDateView.SelectedDate = DateTime.Now; } _progressPicker.SetValue(_media.Episodes); } else if (statusEnum.Equals(MediaListStatus.Current)) { if (!_startDateView.SelectedDate.HasValue && Activity.Settings.AutoFillDateForMediaListItem) { _startDateView.SelectedDate = DateTime.Now; _finishDateView.SelectedDate = null; } if (_initialProgress.HasValue) { _progressPicker.SetValue(_initialProgress); _initialProgress = null; } } else if (statusEnum.Equals(MediaListStatus.Planning) && _mediaList == null) { _startDateView.SelectedDate = null; _finishDateView.SelectedDate = null; _scorePicker.SetValue(null); } else if (statusEnum.Equals(MediaListStatus.Repeating) && initialStatusEnum.Equals(MediaListStatus.Completed)) { _progressPicker.SetValue(null); } else if (statusEnum.EqualsAny(MediaListStatus.Paused, MediaListStatus.Dropped, MediaListStatus.Repeating, MediaListStatus.Planning)) { if (_initialProgress.HasValue) { _progressPicker.SetValue(_initialProgress); _initialProgress = null; } } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_modify); _entries = FindViewById <AppCompatSpinner>(Resource.Id.spinner); _hours = FindViewById <AppCompatEditText>(Resource.Id.top_field); _middleField = FindViewById <AppCompatEditText>(Resource.Id.middle_field); _bottomField = FindViewById <AppCompatEditText>(Resource.Id.bottom_field); _mealType = FindViewById <AppCompatSpinner>(Resource.Id.mealtype_spinner); _hours.InputType = Android.Text.InputTypes.NumberFlagDecimal; _middleField.Visibility = ViewStates.Gone; _bottomField.Visibility = ViewStates.Gone; AppCompatButton bloodSugarEditButton = FindViewById <AppCompatButton>(Resource.Id.submit_button); AppCompatButton bloodSugarDeleteButton = FindViewById <AppCompatButton>(Resource.Id.delete_button); _hours.Hint = "Hours Exercised"; _hours.Visibility = ViewStates.Gone; _mealType.Visibility = ViewStates.Gone; bloodSugarEditButton.Click += async delegate { bloodSugarDeleteButton.Enabled = false; bloodSugarEditButton.Enabled = false; string status = await OnExerciseEditButtonPressed(); if (status == "Success") { Finish(); } else { bloodSugarDeleteButton.Enabled = true; bloodSugarEditButton.Enabled = true; RunOnUiThread(() => { Toast.MakeText(this, status, ToastLength.Long).Show(); }); } }; bloodSugarDeleteButton.Click += async delegate { bloodSugarDeleteButton.Enabled = false; bloodSugarEditButton.Enabled = false; string status = await Task.Run(() => OnExerciseDeleteButtonPressed()); if (status == "Success") { Finish(); } else { bloodSugarDeleteButton.Enabled = true; bloodSugarEditButton.Enabled = true; RunOnUiThread(() => { Toast.MakeText(this, status, ToastLength.Long).Show(); }); } }; Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar_modify); toolbar.Title = "Modify An Exercise"; SetSupportActionBar(toolbar); DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.AddDrawerListener(toggle); toggle.SyncState(); _entries.ItemSelected += delegate { _hours.Visibility = ViewStates.Visible; PatientExercise pe = _entries.SelectedItem.Cast <PatientExercise>(); _hours.Text = pe.HoursExercised.ToString(); }; NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view_modify); navigationView.SetNavigationItemSelectedListener(this); }
protected void TypesCommand_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { //command_executer_id = -1; //command_executer_parameter = null; int Position = TypesCommand.SelectedItemPosition; selected_type_command_name = Resources.GetStringArray(Resource.Array.commands_types_array)[Position]; string command_type_array_item_port = GetString(Resource.String.command_type_array_item_port); string command_type_array_item_controller = GetString(Resource.String.command_type_array_item_controller); string command_type_array_item_transfer = GetString(Resource.String.command_type_array_item_transit); //if (AbstractSettingsManage.Command != null) //{ // switch (AbstractSettingsManage.Command.TypeCommand) // { // case TypesCommands.Port: // command_type_array_item_port = GetString(Resource.String.command_type_array_item_port); // if (selected_type_command_name != command_type_array_item_port) // { // return; // } // break; // case TypesCommands.Controller: // if (selected_type_command_name != command_type_array_item_controller) // { // return; // } // break; // case TypesCommands.Exit: // if (selected_type_command_name != command_type_array_item_transfer) // { // return; // } // break; // } //} Log.Debug(TAG, $"TypesCommand_ItemSelected({selected_type_command_name}) - Position:{Position}"); CommandConfigForm.RemoveAllViews(); if (selected_type_command_name == command_type_array_item_port) { SelectedTypeCommand = TypesCommands.Port; about_selected_command.Text = GetString(Resource.String.about_selected_command_port_title); CommandConfigFormBody = LayoutInflater.Inflate(Resource.Layout.FormPortCommand, CommandConfigForm, false) as LinearLayoutCompat; AppCompatSpinner Controllers = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerControllerPortCommand); AppCompatSpinner Ports = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerPortCommand); AppCompatSpinner States = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerStateCommand); SettingsManageKit = new SettingsManagePort(this, Controllers, Ports, States); } else if (selected_type_command_name == command_type_array_item_controller) { SelectedTypeCommand = TypesCommands.Controller; about_selected_command.Text = GetString(Resource.String.about_selected_command_controller_title); CommandConfigFormBody = LayoutInflater.Inflate(Resource.Layout.FormControllerCommand, CommandConfigForm, false) as LinearLayoutCompat; AppCompatSpinner Controllers = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerControllerCommand); EditText CommandText = CommandConfigFormBody.FindViewById <EditText>(Resource.Id.editTextParametrControllerCommand); SettingsManageKit = new SettingsManageController(this, Controllers, CommandText); } else if (selected_type_command_name == command_type_array_item_transfer) { SelectedTypeCommand = TypesCommands.Exit; about_selected_command.Text = GetString(Resource.String.about_selected_command_transit_title); CommandConfigFormBody = LayoutInflater.Inflate(Resource.Layout.FormTransferCommand, CommandConfigForm, false) as LinearLayoutCompat; AppCompatSpinner Scriptes = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandScript); AppCompatSpinner Steps = CommandConfigFormBody.FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandStepScript); SettingsManageKit = new SettingsManageTransfer(this, Scriptes, Steps); } else { } CommandConfigForm.AddView(CommandConfigFormBody); }