Beispiel #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            _preferencesHelper = new PreferencesHelper();
            _preferencesHelper.InitHepler(this);
            _firstStarted = _preferencesHelper.GetFirstStarted();

            _needShowWhatsNew = BwConfig.NeedShowWhatsNew;

            if (_firstStarted)
            {
                ShowGreetingsAlert();
                _firstStarted = false;
                _preferencesHelper.PutFirstStarted(this, _firstStarted);
                _preferencesHelper.PutLastVersion(this, PackageManager.GetPackageInfo(PackageName, PackageInfoFlags.Configurations).VersionName);
            }
            else
            if (!_preferencesHelper.GetLastVersion().Equals(PackageManager.GetPackageInfo(PackageName, PackageInfoFlags.Configurations).VersionName))
            {
                if (_needShowWhatsNew)
                {
                    ShowWhatsNewAlert();
                }
                _preferencesHelper.PutLastVersion(this, PackageManager.GetPackageInfo(PackageName, PackageInfoFlags.Configurations).VersionName);
            }

            ApplyCulture();
            SetContentView(Resource.Layout.main);
            this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);

            InitViews();
        }
Beispiel #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.contacts);

            _preferencesHelper = new PreferencesHelper();
            _preferencesHelper.InitHepler(this);

            _version      = FindViewById <TextView>(Resource.Id.appVersion);
            _lessons      = FindViewById <TextView>(Resource.Id.lessons);
            _contactUs    = FindViewById <TextView>(Resource.Id.contactUs);
            _supportUs    = FindViewById <TextView>(Resource.Id.supportUs);
            _thanksButton = FindViewById <ImageButton>(Resource.Id.thanksButton);

            _lessonsLayout   = FindViewById <View>(Resource.Id.lessonsLayout);
            _contactUsLayout = FindViewById <View>(Resource.Id.contactUsLayout);
            _supportUsLayout = FindViewById <View>(Resource.Id.supportUsLayout);

            _version.Text = $"{Resources.GetString(Resource.String.AppVersionLabel)} {PackageManager.GetPackageInfo(PackageName, PackageInfoFlags.Configurations).VersionName}";

            _thanksButton.Click += OnThanksButtonClicked;

            var localizedPart = $"<font>{Resources.GetString(Resource.String.HaveQuestionsLabel)}</font><br>" +
                                $"<font>{Resources.GetString(Resource.String.WriteUsLabel)} </font>";

            string text = localizedPart + "<font color=#616161>[email protected]</font>";

            _contactUs.SetText(Html.FromHtml(text), TextView.BufferType.Spannable);

            var selectedLocaleIndex = _preferencesHelper.GetSelectedLanguage();

            if (selectedLocaleIndex != 0)
            {
                switch (selectedLocaleIndex)
                {
                case 1:
                    _lessons.Text = "Language: English";
                    break;

                case 2:
                    _lessons.Text = "Язык: Русский";
                    break;

                case 3:
                    _lessons.Text = "Idioma: Español";
                    break;
                }
            }
            else
            {
                var currentLocale = Locale.Default;
                var enLocale      = new Locale("en");
                var ruLocale      = new Locale("ru");
                var esLocale      = new Locale("es");

                if (currentLocale.Language == enLocale.Language)
                {
                    _lessons.Text = "Language: English";
                }
                if (currentLocale.Language == ruLocale.Language)
                {
                    _lessons.Text = "Язык: Русский";
                }
                if (currentLocale.Language == esLocale.Language)
                {
                    _lessons.Text = "Idioma: Español";
                }
            }

            _supportUs.Text = Resources.GetString(Resource.String.SupportUsTitle);

            _lessonsLayout.Click       += OnAppVersionClicked;
            _contactUsLayout.Click     += OnContactUsClicked;
            _contactUsLayout.LongClick += OnContactUsLongClicked;
            _supportUsLayout.Click     += OnSupportUsClicked;
        }