protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            imm = (InputMethodManager)GetSystemService(Context.InputMethodService);

            var vowelsBtn = FindViewById <Button>(Resource.Id.vowels);
            var consonBtn = FindViewById <Button>(Resource.Id.consonants);
            var edittext  = FindViewById <EditText>(Resource.Id.input);

            edittext.InputType = Android.Text.InputTypes.TextVariationPassword;

            edittext.KeyPress += (sender, e) =>
            {
                imm.HideSoftInputFromWindow(edittext.WindowToken, HideSoftInputFlags.NotAlways);
                e.Handled = true;
            };

            vowelsBtn.Click += (sender, e) =>
            {
                int    count = TextCounter.NumVowels(edittext.Text);
                string msg   = count + " vowels found.";
                Toast.MakeText(this, msg, ToastLength.Short).Show();
            };

            consonBtn.Click += (sender, e) =>
            {
                int    count = TextCounter.NumConsonants(edittext.Text);
                string msg   = count + " consonants found.";
                Toast.MakeText(this, msg, ToastLength.Short).Show();
            };
        }
Example #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            var txtIntput  = FindViewById <EditText>(Resource.Id.txtInput);
            var btnAnalyze = FindViewById <Button>(Resource.Id.btnAnalyze);

            btnAnalyze.Click += (sender, e) =>
            {
                int vowelCount     = TextCounter.NumVowels(txtIntput.Text);
                int consonantCount = TextCounter.NumConsonants(txtIntput.Text);
                Toast.MakeText(this, $"Vowels : {vowelCount}, Consonants : {consonantCount}", ToastLength.Long).Show();
            };
        }
Example #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(toolbar);

            FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab);

            fab.Click += FabOnClick;

            SetContentView(Resource.Layout.content_main);

            imm = (InputMethodManager)GetSystemService(Context.InputMethodService);

            var vowelsBtn = FindViewById <Button>(Resource.Id.vowels);
            var consonBtn = FindViewById <Button>(Resource.Id.consonants);
            var edittext  = FindViewById <EditText>(Resource.Id.input);

            edittext.InputType = Android.Text.InputTypes.TextVariationPassword;

            edittext.KeyPress += (sender, e) =>
            {
                imm.HideSoftInputFromWindow(edittext.WindowToken, HideSoftInputFlags.NotAlways);
                e.Handled = true;
            };

            vowelsBtn.Click += (sender, e) =>
            {
                int    count = TextCounter.NumVowels(edittext.Text);
                string msg   = count + " vowels found.";
                Toast.MakeText(this, msg, ToastLength.Short).Show();
            };

            consonBtn.Click += (sender, e) =>
            {
                int    count = TextCounter.NumConsonants(edittext.Text);
                string msg   = count + " consonants found.";
                Toast.MakeText(this, msg, ToastLength.Short).Show();
            };
        }
Example #4
0
        //private const int _blockSize = 4096 * 1024;

        public ImmediateBuffer(File file) : base(file)
        {
            Counter = new TextCounter();
        }