protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Localise.SetLayoutDirectionByPreference(this); SetContentView(Resource.Layout.FirstDebriefActivity); SupportActionBar.Title = StringResources.debriefing_activity_title; var emojiTextView = (EmojiAppCompatTextView)FindViewById(Resource.Id.emoji_text_view); emojiTextView.Text = EmojiCompat.Get().Process("\uD83C\uDF89"); FindViewById <TextView>(Resource.Id.CongratsTitle).Text = StringResources.debriefing_congrats_title; FindViewById <TextView>(Resource.Id.CongratsBody).Text = string.Format( StringResources.debriefing_congrats_body, GabberPCL.Config.PRINT_URL); FindViewById <TextView>(Resource.Id.ConsentTitle).Text = StringResources.debriefing_consent_title; FindViewById <TextView>(Resource.Id.ConsentBody1).Text = StringResources.debriefing_consent_body1; FindViewById <TextView>(Resource.Id.ConsentBody2).Text = StringResources.debriefing_consent_body2; FindViewById <TextView>(Resource.Id.ConsentBody3).Text = StringResources.debriefing_consent_body3; AppCompatButton finishButton = FindViewById <AppCompatButton>(Resource.Id.finishButton); finishButton.Text = StringResources.debriefing_finish_button; finishButton.Click += FinishButton_Click; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Localise.SetLayoutDirectionByPreference(this); SetContentView(Resource.Layout.consent_research); SupportActionBar.Title = StringResources.consent_research_toolbar_title; SupportActionBar.SetDisplayHomeAsUpEnabled(true); var researchConsentTitle = FindViewById <TextView>(Resource.Id.researchConsentTitle); researchConsentTitle.Text = StringResources.consent_research_title; var _prefs = Android.Preferences.PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); var SelectedProjectID = _prefs.GetInt("SelectedProjectID", 0); var selectedProject = Queries.ProjectById(SelectedProjectID); // If there is no organisation then the project was created by an individual. var IsOrg = selectedProject.Organisation.Name.ToLower() == "individual"; var org = IsOrg ? selectedProject.Creator.Name : selectedProject.Organisation.Name; var researchConsentDesc = FindViewById <TextView>(Resource.Id.researchConsentDesc); var title = LanguageChoiceManager.ContentByLanguage(selectedProject).Title; researchConsentDesc.Text = string.Format(StringResources.consent_research_body, org, title); var researchConsentForm = FindViewById <TextView>(Resource.Id.researchConsentForm); researchConsentForm.Text = StringResources.consent_research_form; AppCompatButton moreInfoBtn = FindViewById <AppCompatButton>(Resource.Id.consentInfoButton); moreInfoBtn.Text = StringResources.consent_research_details_button; moreInfoBtn.Click += ViewConsentDetails; var submit = FindViewById <AppCompatButton>(Resource.Id.researchConsentSubmit); submit.Text = StringResources.consent_research_submit; submit.Enabled = false; submit.Click += (s, e) => { StartActivity(new Intent(this, typeof(ConversationConsent))); }; var isConsented = FindViewById <CheckBox>(Resource.Id.researchConsentProvided); isConsented.Click += (s, e) => { submit.Enabled = isConsented.Checked; }; var form = FindViewById <LinearLayout>(Resource.Id.researchConsentFormLayout); form.Click += (s, e) => { isConsented.Toggle(); submit.Enabled = isConsented.Checked; }; }
protected override void OnCreate(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(ApplicationContext); base.OnCreate(savedInstanceState); Localise.SetLayoutDirectionByPreference(this); SetContentView(Resource.Layout.record); SupportActionBar.Title = StringResources.recording_ui_title; SupportActionBar.SetDisplayHomeAsUpEnabled(true); var instructionsHeader = FindViewById <TextView>(Resource.Id.recordInstructionsHeader); instructionsHeader.Text = StringResources.recording_ui_instructions_header; InterviewSessionID = Guid.NewGuid().ToString(); var _prefs = Android.Preferences.PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); ConsentType = _prefs.GetString("SESSION_CONSENT", ""); SelectedProjectID = _prefs.GetInt("SelectedProjectID", 0); langId = _prefs.GetInt("SESSION_LANG", 1); var selectedProject = Queries.ProjectById(SelectedProjectID); RecyclerView promptRecyclerView = FindViewById <RecyclerView>(Resource.Id.prompts); promptRecyclerView.SetLayoutManager(new GridLayoutManager(this, 1)); Content project = LanguageChoiceManager.ContentByLanguage(selectedProject, langId); List <Topic> activeTopics = project.Topics.Where((p) => p.IsActive).ToList(); themes = activeTopics; adapter = new TopicAdapter(themes); adapter.ProjectClicked += CheckRecPerm; promptRecyclerView.SetAdapter(adapter); record = FindViewById <FloatingActionButton>(Resource.Id.start); FindViewById <TextView>(Resource.Id.themeTitle).Text = project.Title; Color highlightColor = new Color(ContextCompat.GetColor(this, Resource.Color.colorControlHighlight)); ViewCompat.SetBackgroundTintList(record, Android.Content.Res.ColorStateList.ValueOf(highlightColor)); record.Enabled = false; timer = FindViewById <TextView>(Resource.Id.timer); timer.SetTextColor(highlightColor); record.Click += HandleRecordClick; }
private void AppLangPrefChanged(object sender, Preference.PreferenceChangeEventArgs e) { int newLangVal = -1; int.TryParse((string)e.NewValue, out newLangVal); LanguageChoice chosen = allLangs.FirstOrDefault((lang) => lang.Id == newLangVal); if (newLangVal != -1 && chosen != null && chosen.Code != StringResources.Culture?.TwoLetterISOLanguageName) { StringResources.Culture = new CultureInfo(chosen.Code); Session.ActiveUser.AppLang = chosen.Id; Queries.SaveActiveUser(); // Refreshing the fragment we are in does not change text, so must be set manually. ((ListPreference)FindPreference("convoLanguagePref")).Title = StringResources.settings_chooseConvoLanguage; ((ListPreference)FindPreference("appLanguagePref")).Title = StringResources.settings_chooseAppLanguage; FindPreference("logOutPref").Title = StringResources.settings_logout; ((MainActivity)Activity).RefreshFragments(); ((MainActivity)Activity).LoadNavigationTitles(); Localise.SetLayoutDirectionByPreference(this.Activity); } }
protected override void OnCreate(Bundle savedInstanceState) { firebaseAnalytics = FirebaseAnalytics.GetInstance(ApplicationContext); base.OnCreate(savedInstanceState); Localise.SetLayoutDirectionByPreference(this); SetContentView(Resource.Layout.preparation); SupportActionBar.Title = StringResources.participants_ui_title; SupportActionBar.SetDisplayHomeAsUpEnabled(true); var partsInstructs = FindViewById <TextView>(Resource.Id.participantsInstructions); partsInstructs.Text = StringResources.participants_ui_instructions; // Required to access existing gabbers for a given user var prefs = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); participants = Queries.AllParticipantsUnSelected(); var participantsView = FindViewById <RecyclerView>(Resource.Id.participants); participantsView.SetLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.Vertical, false)); adapter = new ParticipantAdapter(participants); adapter.ParticipantClicked += ParticipantSelected; participantsView.SetAdapter(adapter); UpdateParticipantsSelectedLabel(); new LinearSnapHelper().AttachToRecyclerView(participantsView); var startRecording = FindViewById <Button>(Resource.Id.startRecording); startRecording.Text = StringResources.participants_ui_startrecording_button; startRecording.Click += delegate { if (adapter.SelectedParticipantsCount == 0) { LOG_EVENT_WITH_ACTION("NO_PARTICIPANTS_SELECTED", "TOAST"); Toast.MakeText(this, StringResources.participants_ui_validation_noneselected, ToastLength.Long).Show(); } else if (adapter.SelectedParticipantsCount == 1) { LOG_EVENT_WITH_ACTION("ONE_PARTICIPANT_MODAL", "DISPLAYED"); var alert = new Android.Support.V7.App.AlertDialog.Builder(this); alert.SetTitle(StringResources.participants_ui_validation_oneselected_title); alert.SetMessage(StringResources.participants_ui_validation_oneselected_message); alert.SetIcon(Android.Resource.Drawable.IcDialogAlert); alert.SetPositiveButton(StringResources.participants_ui_validation_oneselected_continue, (dialog, id) => { LOG_EVENT_WITH_ACTION("ONE_PARTICIPANT_MODAL", "CONTINUE"); StartActivity(new Intent(this, typeof(Activities.ResearchConsent))); }); alert.SetNegativeButton(StringResources.participants_ui_validation_oneselected_cancel, (dialog, id) => { LOG_EVENT_WITH_ACTION("ONE_PARTICIPANT_MODAL", "DISMISSED"); ((Android.Support.V7.App.AlertDialog)dialog).Dismiss(); }); alert.Create().Show(); } else { LOG_EVENT_WITH_ACTION("NAVIGATE_TO_RECORD", "NAVIGATE"); StartActivity(new Intent(this, typeof(Activities.ResearchConsent))); } }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Localise.SetLayoutDirectionByPreference(this); SetContentView(Resource.Layout.consent_conversation); SupportActionBar.Title = StringResources.consent_gabber_toolbar_title; SupportActionBar.SetDisplayHomeAsUpEnabled(true); ISharedPreferences _prefs = PreferenceManager.GetDefaultSharedPreferences(ApplicationContext); Project selectedProject = Queries.ProjectById(_prefs.GetInt("SelectedProjectID", 0)); FindViewById <TextView>(Resource.Id.GabberConsentDecisionTitle).Text = StringResources.consent_gabber_title_decision; FindViewById <TextView>(Resource.Id.GabberConsentDecisionDesc).Text = string.Format(StringResources.consent_gabber_body_decision, Config.PRINT_URL); FindViewById <TextView>(Resource.Id.chooseLanguageTitle).Text = StringResources.conversation_language_prompt; RadioButton consentTypePublic = FindViewById <RadioButton>(Resource.Id.GabberConsentTypePublic); consentTypePublic.Text = StringResources.consent_gabber_consent_type_public_brief; FindViewById <TextView>(Resource.Id.GabberConsentTypePublicFull).Text = StringResources.consent_gabber_consent_type_public_full; RadioButton consentTypeMembers = FindViewById <RadioButton>(Resource.Id.GabberConsentTypeMembers); var title = LanguageChoiceManager.ContentByLanguage(selectedProject).Title; consentTypeMembers.Text = string.Format(StringResources.consent_gabber_consent_type_members_brief, title); TextView consentTypeMembersFull = FindViewById <TextView>(Resource.Id.GabberConsentTypeMembersFull); consentTypeMembersFull.Text = string.Format(StringResources.consent_gabber_consent_type_members_full, selectedProject.Members.Count, (selectedProject.Members.Count > 1) ? StringResources.consent_gabber_consent_type_members_full_plural : StringResources.consent_gabber_consent_type_members_full_singular); if (selectedProject.IsPublic) { consentTypeMembers.Visibility = ViewStates.Gone; consentTypeMembersFull.Visibility = ViewStates.Gone; } var consentTypePrivate = FindViewById <RadioButton>(Resource.Id.GabberConsentTypePrivate); consentTypePrivate.Text = StringResources.consent_gabber_consent_type_private_brief; var consentTypePrivateFull = FindViewById <TextView>(Resource.Id.GabberConsentTypePrivateFull); var participants = BuildParticipants(Queries.SelectedParticipants().ToList()); consentTypePrivateFull.TextFormatted = Html.FromHtml(string.Format(StringResources.consent_gabber_consent_type_private_full, participants)); var isConsented = FindViewById <RadioGroup>(Resource.Id.GabberConsentProvided); submitButton = FindViewById <AppCompatButton>(Resource.Id.GabberConsentSubmit); submitButton.Text = StringResources.consent_gabber_submit; submitButton.Enabled = false; submitButton.Click += (s, e) => { var consent = ""; if (consentTypePublic.Checked) { consent = "public"; } if (consentTypeMembers.Checked) { consent = "members"; } if (consentTypePrivate.Checked) { consent = "private"; } // This is used then deleted when saving the recording session _prefs.Edit().PutString("SESSION_CONSENT", consent).Commit(); LanguageChoice chosenLang = languageChoices.FirstOrDefault((arg) => arg.Endonym == selectedLanguage); _prefs.Edit().PutInt("SESSION_LANG", chosenLang.Id).Commit(); StartActivity(new Intent(this, typeof(RecordStoryActivity))); }; isConsented.CheckedChange += (s, e) => { consentChecked = true; CheckIfCanSubmit(); }; languageSpinner = FindViewById <Spinner>(Resource.Id.chooseLanguageSpinner); languageSpinner.ItemSelected += LanguageSpinner_ItemSelected; LoadLanguages(); }