public static WordsFilterHelper NewInstance(GenerateOrCreateTestLogic testLogic, string language, WordsAdapter adapter) { WordsFilterHelper.testLogic = testLogic; WordsFilterHelper.language = language; WordsFilterHelper.adapter = adapter; return(new WordsFilterHelper()); }
private void StartTest() { buttonStartTest.Enabled = false; testLogic = wordsAdapter.GetTestLogic(); if (testLogic.GetCountSelectWords() == 0) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Предупреждение"); alert.SetMessage("Тест должен состоять минимум из одного слова!"); alert.SetPositiveButton("Ок", (senderAlert, args) => { buttonStartTest.Enabled = true; }); Dialog zeroWordsDialog = alert.Create(); zeroWordsDialog.Show(); zeroWordsDialog.SetCanceledOnTouchOutside(false); } else { testLogic.CreateWordsForTest(); Intent intent = new Intent(this, typeof(SolutionTestActivity)); intent.PutStringArrayListExtra("WordsForTest", testLogic.GetWordsForTest()); StartActivity(intent); Finish(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.creating_test_view); testLogic = new GenerateOrCreateTestLogic(); searchViewWords = FindViewById <SearchView>(Resource.Id.sv_word_search); recyclerViewWords = FindViewById <RecyclerView>(Resource.Id.rv_words); buttonRu = FindViewById <Button>(Resource.Id.btn_ru); buttonEn = FindViewById <Button>(Resource.Id.btn_en); buttonStartTest = FindViewById <Button>(Resource.Id.btn_start_creating_test); LinearLayoutManager layoutManager = new LinearLayoutManager(this); recyclerViewWords.SetLayoutManager(layoutManager); wordsAdapter = new WordsAdapter(testLogic, "ru"); recyclerViewWords.SetAdapter(wordsAdapter); buttonRu.Enabled = false; buttonRu.SetBackgroundResource(Resource.Drawable.background_ru_disenabled_button); searchViewWords.QueryTextChange += (sender, e) => TextChange(e.NewText); buttonRu.Click += (sender, e) => SelectRuWords(); buttonEn.Click += (sender, e) => SelectEnWords(); buttonStartTest.Click += (sender, e) => StartTest(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); testLogic = new GenerateOrCreateTestLogic(); SetContentView(Resource.Layout.generation_test_view); radioButtonOnlyRu = FindViewById <RadioButton>(Resource.Id.rb_only_ru); radioButtonAllRu = FindViewById <RadioButton>(Resource.Id.rb_all_ru); radioButtonOnlyEn = FindViewById <RadioButton>(Resource.Id.rb_only_en); radioButtonAllEn = FindViewById <RadioButton>(Resource.Id.rb_all_en); radioButtonRandom = FindViewById <RadioButton>(Resource.Id.rb_random); radioButtonAll = FindViewById <RadioButton>(Resource.Id.rb_all); editTextCountWords = FindViewById <EditText>(Resource.Id.et_count_words); buttonStartTest = FindViewById <Button>(Resource.Id.btn_start_generation_test); textViewWaiting = FindViewById <TextView>(Resource.Id.tv_waiting); editTextCountWords.Visibility = Android.Views.ViewStates.Gone; buttonStartTest.Enabled = false; textViewWaiting.Visibility = Android.Views.ViewStates.Gone; radioButtonOnlyRu.Click += (sender, e) => SetOnlyRu(); radioButtonAllRu.Click += (sender, e) => SetAllRu(); radioButtonOnlyEn.Click += (sender, e) => SetOnlyEn(); radioButtonAllEn.Click += (sender, e) => SetAllEn(); radioButtonRandom.Click += (sender, e) => SetRandom(); radioButtonAll.Click += (sender, e) => SetAll(); buttonStartTest.Click += (sender, e) => StartGenerationTest(); }
public MyWordsViewHolder(View itemView, GenerateOrCreateTestLogic testLogic, string language) : base(itemView) { textViewWord = itemView.FindViewById <TextView>(Resource.Id.tv_word); checkBoxWord = itemView.FindViewById <CheckBox>(Resource.Id.cb_word); this.testLogic = testLogic; this.language = language; checkBoxWord.Click += (o, e) => SelectWord(); }
private void SelectEnWords() { buttonRu.Enabled = true; buttonRu.SetBackgroundResource(Resource.Drawable.background_ru_button); buttonEn.Enabled = false; buttonEn.SetBackgroundResource(Resource.Drawable.background_en_disenabled_button); testLogic = wordsAdapter.GetTestLogic(); wordsAdapter = new WordsAdapter(testLogic, "en"); recyclerViewWords.SetAdapter(wordsAdapter); TextChange(""); }
protected override FilterResults PerformFiltering(ICharSequence constraint) { FilterResults filterResults = new FilterResults(); if (constraint != null) { string searchText = constraint.ToString().ToLower(); if (language == "ru") { testLogic.LoadDataRu(searchText); } else { testLogic.LoadDataEn(searchText); } } testLogicUpdate = testLogic; return(filterResults); }
public void SetTestLogic(GenerateOrCreateTestLogic testLogic) { this.testLogic = testLogic; }
public WordsAdapter(GenerateOrCreateTestLogic testLogic, string language) { this.testLogic = testLogic; this.language = language; }