public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var ignore = base.OnCreateView(inflater, container, savedInstanceState); var view = this.BindingInflate(FragmentId, null); _toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar); if (_toolbar != null) { ParentActivity.SetSupportActionBar(_toolbar); ParentActivity.SupportActionBar.SetDisplayHomeAsUpEnabled(true); var drawerLayout = (ParentActivity as INavigationActivity).GetDrawerLayout(); _drawerToggle = new MvxActionBarDrawerToggle( Activity, // host Activity drawerLayout, // DrawerLayout object _toolbar, // nav drawer icon to replace 'Up' caret Resource.String.drawer_open, // "open drawer" description Resource.String.drawer_close // "close drawer" description ); //_drawerToggle.DrawerOpened += (object sender, ActionBarDrawerEventArgs e) => ((INavigationActivity)Activity).HideSoftKeyboard(); drawerLayout.AddDrawerListener(_drawerToggle); } return(view); }
public override void OnResume() { base.OnResume(); ParentActivity.Title = Title; ParentActivity.EnableBackButton(true); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View ignore = base.OnCreateView(inflater, container, savedInstanceState); View view = this.BindingInflate(FragmentId, null); _toolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar); if (_toolbar != null) { ParentActivity.SetSupportActionBar(_toolbar); ParentActivity.SupportActionBar.SetDisplayHomeAsUpEnabled(true); _drawerToggle = new MvxActionBarDrawerToggle( Activity, ((MainActivity)ParentActivity).DrawerLayout, _toolbar, Resource.String.drawer_open, Resource.String.drawer_close ); _drawerToggle.DrawerOpened += (object sender, ActionBarDrawerEventArgs e) => ((MainActivity)Activity)?.HideSoftKeyboard(); ((MainActivity)ParentActivity).DrawerLayout.AddDrawerListener(_drawerToggle); } return(view); }
void BtNext_Click(object sender, EventArgs e) { if (StringCheckUtil.isEmpty(txtEmail.EditText)) { return; } if (!StringCheckUtil.isEmailAddress(txtEmail.EditText)) { return; } if (StringCheckUtil.isEmpty(txtPassword.EditText)) { return; } if (StringCheckUtil.isLength(txtPassword.EditText, 8)) { return; } ParentActivity.RegisterModel.EMAIL = txtEmail.EditText.Text; ParentActivity.RegisterModel.USERPASSWORD = txtPassword.EditText.Text; ParentActivity.RegisterModel.IMEI = PhoneIMEI.GetImei(ParentActivity); ParentActivity.SetFragment(RegisterActvity.PROFILE_FRAGMENT); }
void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (string.Equals(e.PropertyName, nameof(LoginViewModel.IsBusy))) { if (ParentActivity.ViewModel.IsBusy) { ShowLoadingDialog("Submit E-mail"); } else { HideLoadingDialog(); } } else if (string.Equals(e.PropertyName, nameof(LoginViewModel.AskPasswordResult))) { if (ParentActivity.ViewModel.AskPasswordResult != null && ParentActivity.ViewModel.AskPasswordResult.RESULT) { ParentActivity.SetFragment(ForgotPasswordActivity.NEW_PASSWORD_FRAGMENT); } else { DialogUtils.ShowOKDialog(this.ParentActivity, @"Warning", @"Failed to submit E-mail."); } } }
private void Controllers_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { int hardware_id = ParentActivity.Hardwares.Keys.ElementAt(e.Position); if (Command != null && Command.Execution != hardware_id) { CommandText.Text = Command.ExecutionParametr; Controllers.SetSelection(ParentActivity.Hardwares.Keys.ToList().IndexOf(Command.Execution)); return; } Command = null; ParentActivity.command_executer_id = hardware_id; HardwareModel hw = null; if (ParentActivity.command_executer_id > 0) { lock (DatabaseContext.DbLocker) { using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase)) { hw = db.Hardwares.Find(ParentActivity.command_executer_id); } } } if (hw == null) { Log.Error(TAG, $"{ParentActivity.GetString(Resource.String.err_selected_device_was_not_found_title)} - ControllerCommand_SpinnerItemSelected({ParentActivity.command_executer_id}) - Position:{e.Position}"); } else { Log.Debug(TAG, $"ControllerCommand_SpinnerItemSelected(hw:{hw}) - Position:{e.Position}"); } }
void ImgProfile_Click(object sender, EventArgs e) { var photoOptions = new string[] { @"From Gallery", @"Take Photo" }; new Android.Support.V7.App.AlertDialog.Builder(this.Context) .SetTitle("Choose Options") .SetItems(photoOptions, (sender1, e1) => { if (e1.Which == 0) { ParentActivity.RunOnUiThread(() => { OpenGallery(); }); } else { ParentActivity.RunOnUiThread(() => { OpenCamera(); }); } }) .Create() .Show(); }
protected override bool Setup() { _ProgressDialog = ProgressDialog.Show(ParentActivity, "", ParentActivity.GetString(Utils.Resource.String.progress_message)); return(true); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = this.BindingInflate(FragmentLayout, null); _toolbar = view.FindViewById <Toolbar>(ToolbarLayout); ParentActivity.SetSupportActionBar(_toolbar); ParentActivity.SupportActionBar.Title = ViewModel.Title; ParentActivity.SupportActionBar.SetDisplayHomeAsUpEnabled(true); var drawerActivity = (IDrawerActivity)ParentActivity; _drawerToggle = new MvxActionBarDrawerToggle( Activity, // host Activity drawerActivity.DrawerLayout, // DrawerLayout object _toolbar, // nav drawer icon to replace 'Up' caret Resource.String.drawer_open, // "open drawer" description Resource.String.drawer_close // "close drawer" description ); drawerActivity.DrawerLayout.AddDrawerListener(_drawerToggle); return(view); }
void GotoLoginScreen() { PreferenceUtils.saveString(this.ParentActivity, PreferenceUtils.TOKEN, @""); var intent = new Intent(ParentActivity, typeof(LoginActivity)); ParentActivity.StartActivity(intent); ParentActivity.Finish(); }
public override void OnStart() { base.OnStart(); ParentActivity.SetPrimaryTextContent("New Group"); ParentActivity.SetSecondaryTextContent("Add subject"); txtParticipants.Text = $"Participants : {ViewModel.ChoosedContactList.Count}"; ViewModel.PropertyChanged += ViewModel_PropertyChanged; }
private void OnGoogleLoginButtonClicked(object sender, EventArgs e) { // Display the activity handling the authentication var authenticator = Auth.GetAuthenticator(); var intent = authenticator.GetUI(this.Context); intent.SetFlags(ActivityFlags.NoHistory); StartActivity(intent); ParentActivity.Finish(); }
public override void OnStateChanged(View bottomSheet, int newState) { base.OnStateChanged(bottomSheet, newState); if (newState == BottomSheetBehavior.StateCollapsed) { ParentActivity.SwitchPage(); ParentActivity.bottomSheetBehavior.SetBottomSheetCallback(new CustomBottomSheetCallback(ParentActivity)); } }
} // end of Trigger #endregion #region ToString /// <summary> /// ToString method that uses representation of parent activity and strings whether it /// is the start or end event of the activity /// </summary> /// <returns></returns> public override string ToString() { if (EventType == EventType.Start) { return(ParentActivity.ToString() + ".Start"); } else { return(ParentActivity.ToString() + ".End"); } // end if } // end of
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = base.OnCreateView(inflater, container, savedInstanceState); _mToolbar = view.FindViewById <Toolbar>(Resource.Id.toolbar1); ParentActivity.SetSupportActionBar(_mToolbar); _recyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.recyclerView); _layoutManager = new LinearLayoutManager(this.Context); _recyclerView.SetLayoutManager(_layoutManager); _mAdapter = new TasksItemAdapter((IMvxAndroidBindingContext)BindingContext); _recyclerView.Adapter = _mAdapter; return(view); }
public void ControllerSelect(object sender, AdapterView.ItemSelectedEventArgs e) { int hardware_id = ParentActivity.Hardwares.Keys.ElementAt(e.Position); if (Command != null) { PortModel port = null; lock (DatabaseContext.DbLocker) { using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase)) { port = db.Ports.FirstOrDefault(x => x.Id == Command.Execution); } } if (port.HardwareId != hardware_id) { Controllers.SetSelection(ParentActivity.Hardwares.Keys.ToList().IndexOf(port.HardwareId)); return; } } PortsList = new Dictionary <int, string>(); HardwareModel hw = null; if (hardware_id > 0) { lock (DatabaseContext.DbLocker) { using (DatabaseContext db = new DatabaseContext(gs.DatabasePathBase)) { hw = db.Hardwares.Include(x => x.Ports).FirstOrDefault(x => x.Id == hardware_id); } } } if (hw == null) { Log.Error(TAG, $"{ParentActivity.GetString(Resource.String.err_selected_device_was_not_found_title)}; ControllerSelect(); hardware_id:{hardware_id}; Position:{e.Position};"); return; } else { Log.Debug(TAG, $"ControllerSelect(); for command; hw:{hw}; Position:{e.Position};"); } hw.Ports.ForEach(portHardware => { PortsList.Add(portHardware.Id, portHardware.ToString()); }); // ArrayAdapter <string> adapterPorts = new ArrayAdapter <string>(ParentActivity, Android.Resource.Layout.SimpleSpinnerItem, PortsList.Values.ToList()); adapterPorts.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); Ports.Adapter = adapterPorts; }
void BtNext_Click(object sender, EventArgs e) { if (StringCheckUtil.isEmpty(txtName)) { return; } if (ProfileImageFile != null) { ParentActivity.RegisterModel.FILE_PATH = ProfileImageFile.Path; ParentActivity.RegisterModel.FILE_NAME = Path.GetFileName(ProfileImageFile.Path); ParentActivity.RegisterModel.FILE_STREAM = ProfileImageFile.GetStream(); } ParentActivity.RegisterModel.USERNAME = txtName.Text; ParentActivity.DoRegister(); }
public void IsActionBarBackButtonEnabled(bool isBackEnabled) { _drawerToggle.DrawerIndicatorEnabled = !isBackEnabled; _drawerToggle.ToolbarNavigationClickListener = new ClickListener((v) => { ParentActivity.OnSupportNavigateUp(); }); //ParentActivity.SupportActionBar.Title = title; ParentActivity.SupportActionBar.SetDisplayHomeAsUpEnabled(isBackEnabled); ParentActivity.SupportActionBar.SetHomeButtonEnabled(isBackEnabled); //this will reset the clicklistener and the original icon if (!isBackEnabled) { _drawerToggle.SyncState(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = base.OnCreateView(inflater, container, savedInstanceState); HasOptionsMenu = true; _recyclerView = view.FindViewById <MvxRecyclerView>(Resource.Id.RecyclerView); _layoutManager = new GridLayoutManager(this.Context, 2); _recyclerView.SetLayoutManager(_layoutManager); var recyclerAdapter = new TaskListAdapter((IMvxAndroidBindingContext)this.BindingContext); _recyclerView.Adapter = recyclerAdapter; var toolbar = view.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); ParentActivity.SetSupportActionBar(toolbar); ParentActivity.SupportActionBar.Title = ""; ViewModel.ShowMenuViewModelCommand.Execute(null); return(view); }
public void StateSelect(object sender, AdapterView.ItemSelectedEventArgs e) { string selected_state = ParentActivity.Resources.GetStringArray(Resource.Array.script_trigger_port_states_array)[e.Position]; Log.Debug(TAG, $"StateSelect(); for command; selected_state:{selected_state}; Position:{e.Position};"); if (selected_state == ParentActivity.GetString(Resource.String.abc_capital_on)) { ParentActivity.command_executer_parameter = true; } else if (selected_state == ParentActivity.GetString(Resource.String.abc_capital_off)) { ParentActivity.command_executer_parameter = false; } else { ParentActivity.command_executer_parameter = null; } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = base.OnCreateView(inflater, container, savedInstanceState); _mToolBar = view.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar2); ParentActivity.SetSupportActionBar(_mToolBar); _recordingAudio = view.FindViewById <Button>(Resource.Id.recording); _linearLayout = view.FindViewById <LinearLayout>(Resource.Id.item_Layout2); _recordingAudio.Click += CheckPermission; _linearLayout.Click += delegate { HideSoftKeyboard(); }; _mToolBar.Click += delegate { HideSoftKeyboard(); }; _editText = view.FindViewById <Android.Widget.EditText>(Resource.Id.name_text); Typeface type = Typeface.CreateFromAsset(Activity.Assets, "13159.otf"); _editText.SetTypeface(type, TypefaceStyle.Normal); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = base.OnCreateView(inflater, container, savedInstanceState); _audioPlayerTitleText = view.FindViewById <TextView>(Resource.Id.audio_player_title_text); if (_audioPlayerTitleText != null) { //_audioPlayerTitleText.Selected = true; } if (savedInstanceState == null) { var rootDirectory = Path.Combine(Android.OS.Environment.GetExternalStoragePublicDirectory(string.Empty).AbsolutePath, ".MS"); ViewModel.Queue.Clear(); var mediaUrls = new[] { Path.Combine(rootDirectory, "01.mp3"), Path.Combine(rootDirectory, "02.mp3"), Path.Combine(rootDirectory, "03.mp3"), Path.Combine(rootDirectory, "04.mp3"), Path.Combine(rootDirectory, "05.mp3") }; foreach (var mediaUrl in mediaUrls) { //Local перевіряє наявність файлів, якщо не існує, видаляє з черги //Remote не перевіряж наявність файлів, якщо не існує, намагається відтврити, якщо дійшла її черга ViewModel.Queue.Add(new MediaFile(mediaUrl, Plugin.MediaManager.Abstractions.Enums.MediaFileType.Audio, Plugin.MediaManager.Abstractions.Enums.ResourceAvailability.Local)); } //ViewModel.Queue.Repeat = RepeatType.RepeatAll; ParentActivity?.RunOnUiThread(() => ViewModel.RaiseAllPropertiesChanged()); ParentActivity?.RunOnUiThread(() => ViewModel.MediaPlayer.Play(ViewModel.CurrentTrack)); } return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = this.BindingInflate(FragmentId, null); _toolbar = view.FindViewById <Toolbar>(Toolbar); if (_toolbar != null) { ParentActivity.SetSupportActionBar(_toolbar); ParentActivity.SupportActionBar.SetHomeButtonEnabled(true); ParentActivity.SupportActionBar.SetDisplayHomeAsUpEnabled(true); _drawerToggle = new MvxActionBarDrawerToggle( Activity, // host Activity (ParentActivity as INavigationActivity).DrawerLayout, // DrawerLayout object // nav drawer icon to replace 'Up' caret Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); } SetHomeAsUp(ParentActivity.SupportFragmentManager.BackStackEntryCount == 0 ? false : true); return(view); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (EngineService.EngineInstance.ChatListViewModel == null) { EngineService.EngineInstance.ChatListViewModel = new ChatListViewModel(); } ChatListViewModel = EngineService.EngineInstance.ChatListViewModel; var rootView = inflater.Inflate(Resource.Layout.fragment_chat, container, false); recycler = rootView.FindViewById <RecyclerView>(Resource.Id.recycleChatHistory); fabAdd = rootView.FindViewById <FloatingActionButton>(Resource.Id.fabAddChat); swipeRefresh = rootView.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeRefresh); InitSwipeRefreshLayout(swipeRefresh); recycler.HasFixedSize = true; recycler.SetLayoutManager(new LinearLayoutManager(this.Context, LinearLayoutManager.Vertical, false)); recycler.SetItemAnimator(new DefaultItemAnimator()); Adapter = new ChatListAdapter(Activity, ChatListViewModel); recycler.SetAdapter(Adapter); InitRecyclerScrollListener(recycler, (e) => { if (e && fabAdd.IsShown) { fabAdd.Hide(); } else if (!e && !fabAdd.IsShown) { fabAdd.Show(); } }); fabAdd.Click += (sender, e) => { ParentActivity.SetTabAndFragment(MainActivity.FRAGMENT_TYPE.FRAGMENT_CONTACT); }; return(rootView); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { HasOptionsMenu = true; var view = base.OnCreateView(inflater, container, savedInstanceState); _topNavigationView = view.FindViewById <Toolbar>(Resource.Id.top_navigation_view); _homeIconPropertyHelper = new TopNavigationViewIconPropertyHelper(); _actionIconPropertyHelper = new TopNavigationViewIconPropertyHelper(); ParentActivity?.SetSupportActionBar(_topNavigationView); ParentActivity?.SupportActionBar?.SetDisplayShowTitleEnabled(false); ParentActivity?.SupportActionBar?.SetDisplayHomeAsUpEnabled(true); ParentActivity?.SupportActionBar?.SetDisplayShowHomeEnabled(true); _homeIconPropertyHelper.OnTypeChanged -= HomeIconTypeChanged; _homeIconPropertyHelper.OnTypeChanged += HomeIconTypeChanged; HomeIconTypeChanged(_homeIconPropertyHelper, EventArgs.Empty); var bindingSet = this.CreateBindingSet <TopNavigationView, TopNavigationViewModel>(); bindingSet.Bind(_homeIconPropertyHelper).For(h => h.Type).To(vm => vm.HomeIconType); bindingSet.Bind(_homeIconPropertyHelper).For(h => h.Action).To(vm => vm.HomeIconCommand); bindingSet.Bind(_actionIconPropertyHelper).For(h => h.Type).To(vm => vm.ActionIconType); bindingSet.Bind(_actionIconPropertyHelper).For(h => h.Action).To(vm => vm.ActionIconCommand); bindingSet.Bind(this).For(h => h.IsSearch).To(vm => vm.IsSearch); bindingSet.Apply(); if (savedInstanceState == null) { } return(view); }
void MyProfileViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (string.Equals(e.PropertyName, nameof(ProfileViewModel.IsBusy))) { if (MyProfileViewModel.IsBusy) { ShowLoadingDialog("Update Language"); } else { HideLoadingDialog(); } } if (string.Equals(e.PropertyName, nameof(ProfileViewModel.ME))) { this.ParentActivity.RunOnUiThread(() => { ParentActivity.MyApplication.Me = MyProfileViewModel.ME; ParentActivity.ChangeLanguage(); }); } }
void ViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { switch (e.PropertyName) { case nameof(ChatListViewModel.IsBusy): Activity.RunOnUiThread(() => { if (ChatListViewModel.IsBusy && !swipeRefresh.Refreshing) { swipeRefresh.Refreshing = true; } else if (!ChatListViewModel.IsBusy) { swipeRefresh.Refreshing = false; } }); break; case nameof(ChatListViewModel.NotificationCount): ParentActivity.UpdateChatTabLayout(ChatListViewModel.NotificationCount); break; } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); var view = this.BindingInflate(FragmentId, null); _toolbar = view.FindViewById <Toolbar>(Resource.Id.AppToolbar); if (_toolbar != null) { _toolbar.ShowOverflowMenu(); _toolbar.ShowContextMenu(); ParentActivity.SetSupportActionBar(_toolbar); var drawerLayout = ((MainActivity)ParentActivity).DrawerLayout; _drawerToggle = new MvxActionBarDrawerToggle( Activity, drawerLayout, _toolbar, Resource.String.Open, Resource.String.Close); // Set the drawer toggle as the DrawerListener drawerLayout.AddDrawerListener(_drawerToggle); ParentActivity.SupportActionBar.SetDisplayHomeAsUpEnabled(false); ParentActivity.SupportActionBar.SetHomeButtonEnabled(true); _drawerToggle.DrawerOpened += (sender, args) => MainActivity?.HideSoftKeyboard(); MainActivity.DrawerLayout.AddDrawerListener(_drawerToggle); _drawerToggle.SyncState(); } return(view); }
void FabNext_Click(object sender, EventArgs e) { ParentActivity.SetFragment(AddGroupActivity.FragmentSetGroupName); }
void ChoosedContactList_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { ParentActivity.SetSecondaryTextContent(GroupListViewModel.ChoosedContactList.Count == 0 ? "Choose contact items" : $"{GroupListViewModel.ChoosedContactList.Count} of {GroupListViewModel.ChoosableContactList.Count} Selected"); }