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

            if (ETC.useLightTheme)
            {
                SetTheme(Resource.Style.GFS_Toolbar_Light);
            }

            // Create your application here
            SetContentView(Resource.Layout.DollDBGuideImageViewerLayout);
            dollNum = Intent.GetIntExtra("Info", 0);

            serverImagePath = Path.Combine(ETC.server, "Data", "Images", "Guns", "GuideImage", $"{dollNum}.png");
            localImagePath  = Path.Combine(ETC.cachePath, "Doll", "GuideImage", $"{dollNum}.png");

            SetSupportActionBar(FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.DollDBGuideImageViewerMainToolbar));
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            FindViewById <TextView>(Resource.Id.DollDBGuideImageViewerToolbarDicNumber).Text = $"No. {dollNum}";
            FindViewById <TextView>(Resource.Id.DollDBGuideImageViewerToolbarTitle).SetText(Resource.String.DollDBGuideImageViewer_Title);

            loadingLayout    = FindViewById <RelativeLayout>(Resource.Id.DollDBGuideImageViewerLoadingLayout);
            loadingIndicator = FindViewById <AVLoadingIndicatorView>(Resource.Id.DollDBGuideImageViewerLoadingIndicatorView);
            loadingText      = FindViewById <TextView>(Resource.Id.DollDBGuideImageViewerLoadingIndicatorExplainText);
            guideImageView   = FindViewById <PhotoView>(Resource.Id.DollDBGuideImageViewerImageView);

            _ = InitProcess();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            if (ETC.useLightTheme)
            {
                SetTheme(Resource.Style.GFS_Toolbar_Light);
            }

            // Create your application here
            SetContentView(Resource.Layout.ProductPercentTableLayout);

            SetSupportActionBar(FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.ProductPercentTableMainToolbar));
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            loadingIndicatorView = FindViewById <AVLoadingIndicatorView>(Resource.Id.ProductPercentTableLoadingIndicatorView);
            loadingIndicatorView.SetIndicator("BallClipRotateMultipleIndicator");
            loadingIndicatorExplain = FindViewById <TextView>(Resource.Id.ProductPercentTableLoadingIndicatorExplainText);
            nameToolbarTextView     = FindViewById <TextView>(Resource.Id.ProductPercentTableToolbarName);
            modeToolbarTextView     = FindViewById <TextView>(Resource.Id.ProductPercentTableToolbarMode);

            tableMainLayout = FindViewById <LinearLayout>(Resource.Id.ProductPercentTable_MainTableLayout);

            string[] data = Intent.GetStringArrayExtra("Info");

            id = int.Parse(data[1]);

            switch (data[0])
            {
            case "Doll":
                productCategory          = Category.Doll;
                topURL                   = "http://db.baka.pw:9999/stats/tdoll/id/";
                nameToolbarTextView.Text = $"Doll No.{id}";
                break;

            case "Equip":
                productCategory          = Category.Equip;
                topURL                   = "http://db.baka.pw:9999/stats/equip/id/";
                nameToolbarTextView.Text = $"Equip No.{id}";
                break;

            case "Fairy":
                productCategory          = Category.Fairy;
                topURL                   = "http://db.baka.pw:9999/stats/fairy/id/";
                nameToolbarTextView.Text = $"Fairy No.{id}";
                break;
            }

            typeM = Resources.GetString(Resource.String.ProductPercentTable_ProductType_Normal);
            listM = Resources.GetString(Resource.String.ProductPercentTable_List_Percentage);

            modeToolbarTextView.Text = $"{typeM} - {listM}";

            _ = ProcessData();
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                if (ETC.useLightTheme)
                {
                    SetTheme(Resource.Style.GFS_Toolbar_Light);
                }

                // Create your application here
                SetContentView(Resource.Layout.DollDBImageViewer);

                string[] temp = Intent.GetStringExtra("Data").Split(';');

                modIndex   = int.Parse(temp[1]);
                doll       = new Doll(ETC.FindDataRow(ETC.dollList, "DicNumber", int.Parse(temp[0])));
                censorType = doll.HasCensored ? doll.CensorType : null;

                toolbar                   = FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.DollDBImageViewerMainToolbar);
                loadingLayout             = FindViewById <RelativeLayout>(Resource.Id.DollDBImageViewerLoadingLayout);
                loadingIndicator          = FindViewById <AVLoadingIndicatorView>(Resource.Id.DollDBImageViewerLoadingIndicatorView);
                loadingText               = FindViewById <TextView>(Resource.Id.DollDBImageViewerLoadingIndicatorExplainText);
                dollImageView             = FindViewById <PhotoView>(Resource.Id.DollDBImageViewerImageView);
                snackbarLayout            = FindViewById <CoordinatorLayout>(Resource.Id.DollDBImageViewerSnackbarLayout);
                costumeList               = FindViewById <Spinner>(Resource.Id.DollDBImageViewerCostumeList);
                costumeList.ItemSelected += (sender, e) =>
                {
                    isDamage     = false;
                    costumeIndex = e.Position;
                    censorMenuItem.SetVisible(CheckCensorType());

                    _ = LoadImage(costumeIndex, false);
                };
                imageStatus = FindViewById <TextView>(Resource.Id.DollDBImageViewerImageStatus);

                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayShowTitleEnabled(false);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);

                await InitializeProcess();

                LoadCostumeList();
                _ = LoadImage(0, false);
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
                Toast.MakeText(this, Resource.String.Activity_OnCreateError, ToastLength.Short).Show();
            }
        }
Exemple #4
0
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            var RootView = inflater.Inflate(Resource.Layout.sound_recording_dialog, container, false);

            indicatorView      = RootView.FindViewById <AVLoadingIndicatorView>(Resource.Id.indicator);
            txtName            = RootView.FindViewById <TextView>(Resource.Id.txtindicator);
            btRecording        = RootView.FindViewById <Button>(Resource.Id.btRecord);
            btRecording.Click += BtRecording_Click;
            this.Dialog.Window.RequestFeature(WindowFeatures.NoTitle);
            this.Dialog.SetCancelable(false);
            this.Dialog.SetCanceledOnTouchOutside(false);
            this.SetStyle(DialogFragment.StyleNoTitle, 0);

            InitialScreen(false);
            recorder = new AudioRecorderService {
                StopRecordingOnSilence = false, StopRecordingAfterTimeout = true, TotalAudioTimeout = TimeSpan.FromMinutes(10)
            };
            recorder.AudioInputReceived += Recorder_AudioInputReceived;
            return(RootView);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);

                if (ETC.useLightTheme)
                {
                    SetTheme(Resource.Style.GFS_Toolbar_Light);
                }

                // Create your application here
                SetContentView(Resource.Layout.FairyDBImageViewer);

                fairy = new Fairy(ETC.FindDataRow(ETC.fairyList, "Name", Intent.GetStringExtra("Keyword")));

                toolbar = FindViewById <AndroidX.AppCompat.Widget.Toolbar>(Resource.Id.FairyDBImageViewerMainToolbar);

                SetSupportActionBar(toolbar);
                SupportActionBar.SetDisplayShowTitleEnabled(false);
                SupportActionBar.SetDisplayHomeAsUpEnabled(true);

                loadingLayout    = FindViewById <RelativeLayout>(Resource.Id.FairyDBImageViewerLoadingLayout);
                loadingIndicator = FindViewById <AVLoadingIndicatorView>(Resource.Id.FairyDBImageViewerLoadingIndicatorView);
                loadingText      = FindViewById <TextView>(Resource.Id.FairyDBImageViewerLoadingIndicatorExplainText);
                fairyImageView   = FindViewById <PhotoView>(Resource.Id.FairyDBImageViewerImageView);
                imageStatus      = FindViewById <TextView>(Resource.Id.FairyDBImageViewerImageStatus);
                fairyNumTitle    = FindViewById <TextView>(Resource.Id.FairyDBImageViewerImageNum);

                snackbarLayout = FindViewById <CoordinatorLayout>(Resource.Id.FairyDBImageViewerSnackbarLayout);

                _ = LoadImage();
            }
            catch (Exception ex)
            {
                ETC.LogError(ex, this);
                Toast.MakeText(this, Resource.String.Activity_OnCreateError, ToastLength.Short).Show();
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.activity_main);
            nfi = new CultureInfo("en-US", false).NumberFormat;



            #region Initialize Views
            //Instantiate views
            btnRefresh              = FindViewById <Button>(Resource.Id.btnRefresh);
            avi                     = FindViewById <AVLoadingIndicatorView>(Resource.Id.aviLoader);
            txtTotalNumber          = FindViewById <TextView>(Resource.Id.txtTotalNumber);
            txtTotalRecoveredNumber = FindViewById <TextView>(Resource.Id.txtTotalRecoveredNumber);
            txtTotalDeathsNumber    = FindViewById <TextView>(Resource.Id.txtTotalDeathsNumber);
            txtNewCasesNumber       = FindViewById <TextView>(Resource.Id.txtNewCasesNumber);
            searchableSpinner       = FindViewById <SearchableSpinner>(Resource.Id.spinnerRegion);
            txtGlobTotalNumber      = FindViewById <TextView>(Resource.Id.txtGlobTotalNumber);
            txtGlobRecoveredNumber  = FindViewById <TextView>(Resource.Id.txtGlobRecoveredNumber);
            txtGlobDeathsNumber     = FindViewById <TextView>(Resource.Id.txtGlobDeathsNumber);
            txtGlobNewCasesNumber   = FindViewById <TextView>(Resource.Id.txtGlobNewCasesNumber);
            txtBackground           = FindViewById <TextView>(Resource.Id.txtBackground);
            #endregion

            //assign events to views
            btnRefresh.Click += BtnRefresh_Click;
            searchableSpinner.ItemSelected += SearchableSpinner_ItemSelected;

            Log.Debug(dbtag, "Creating database, if it doesn't already exist");
            string dbPath = Path.Combine(
                System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
                "cv19db.db3");
            db = new SQLiteConnection(dbPath);
            db.CreateTable <Items>();
            DisplayData();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_mainview);

            //Получение Bitmap из пути к файлу
            string path;

            path = Intent.GetStringExtra("image");
            if (path != null && path != "")
            {
                sourceBitmap = GetBitmap(path);
            }

            //Инициализация сервисов
            latexService         = new LatexApiService(this);
            firebaseImageService = new FirebaseImageService(this);
            loadingAnimation     = FindViewById <AVLoadingIndicatorView>(Resource.Id.loadingAnimation);

            PhotoCropFragment photoCropFragment = new PhotoCropFragment(sourceBitmap, ProcessBitmaps);

            Android.Support.V4.App.FragmentManager     fragmentManager     = SupportFragmentManager;
            Android.Support.V4.App.FragmentTransaction fragmentTransaction = fragmentManager.BeginTransaction();
            fragmentTransaction.Replace(Resource.Id.content_main, photoCropFragment, "crop_view_tag").Commit();

            firebaseImageService.AddImageResultListener(delegate(string[] text, string[] ex)
            {
                if (ex == null || ex.Length == 0)
                {
                    List <string> tmpRes = new List <string>();
                    foreach (var detectionResult in text)
                    {
                        tmpRes.Add(detectionResult);
                    }
                    textParsigResults.Add(string.Join('\n', tmpRes.ToArray()));
                    textParsigResults.AddRange(tmpRes);
                }
                else if (ex.Length > 0)
                {
                    Toast.MakeText(Application.Context, $"Ошибка: {ex[0]}", ToastLength.Short).Show();
                }
                else
                {
                    Toast.MakeText(Application.Context, "null", ToastLength.Short).Show();
                }
                processedReady++;
                ProcessedReady();
            });


            latexService.AddOnLatexResultListener(delegate(string[] res, string[] ex)
            {
                if (res != null)
                {
                    List <string> tmpRes = new List <string>();
                    foreach (var detectionResult in res)
                    {
                        var jsonRes = new JSONObject(detectionResult);
                        if (jsonRes.Has("latex_styled"))
                        {
                            tmpRes.Add(jsonRes.Get("latex_styled").ToString());
                        }
                        else if (jsonRes.Has("text"))
                        {
                            tmpRes.Add(jsonRes.Get("text").ToString());
                        }
                    }
                    latexParsigResults.Add(string.Join('\n', tmpRes.ToArray()));
                    latexParsigResults.AddRange(tmpRes);
                }
                else if (ex[0] != null)
                {
                    Toast.MakeText(Application.Context, $"Ошибка: {ex[0]}", ToastLength.Short).Show();
                }
                processedReady++;
                ProcessedReady();
            });
        }
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, Android.Views.ViewGroup container, Android.OS.Bundle savedInstanceState)
        {
            var RootView = inflater.Inflate(Resource.Layout.sound_play_dialog, container, false);

            indicatorView = RootView.FindViewById <AVLoadingIndicatorView>(Resource.Id.indicator);
            btClose       = RootView.FindViewById <ImageButton>(Resource.Id.btClose);
            btReplay      = RootView.FindViewById <ImageButton>(Resource.Id.btReplay);
            btPause       = RootView.FindViewById <ImageButton>(Resource.Id.btPause);
            btPlay        = RootView.FindViewById <ImageButton>(Resource.Id.btPlay);

            btClose.Click += (sender, e) => {
                try
                {
                    if (mediaPlayer != null)
                    {
                        mediaPlayer.Stop();
                    }
                }
                catch (Exception e3)
                {
                }
                finally{
                    this.Dismiss();
                }
            };

            btReplay.Click += (sender, e) => {
                if (mediaPlayer != null)
                {
                    indicatorView.Indicator.Start();
                    mediaPlayer.Pause();
                    mediaPlayer.SeekTo(0);
                    mediaPlayer.Start();
                    SetStatusOfImageButton(btPlay, false);
                    SetStatusOfImageButton(btPause, true);
                    SetStatusOfImageButton(btReplay, true);
                }
            };

            btPause.Click += (sender, e) =>
            {
                if (mediaPlayer != null && mediaPlayer.IsPlaying)
                {
                    indicatorView.Indicator.Stop();
                    playbackPosition = mediaPlayer.CurrentPosition;
                    mediaPlayer.Pause();
                    SetStatusOfImageButton(btPlay, true);
                    SetStatusOfImageButton(btPause, false);
                    SetStatusOfImageButton(btReplay, true);
                }
            };

            btPlay.Click += OnPlay_Click;
            this.Dialog.Window.RequestFeature(WindowFeatures.NoTitle);
            this.Dialog.SetCancelable(false);
            this.Dialog.SetCanceledOnTouchOutside(false);
            this.SetStyle(DialogFragment.StyleNoTitle, 0);

            SetStatusOfImageButton(btReplay, false);
            SetStatusOfImageButton(btPause, false);
            SetStatusOfImageButton(btPlay, true);

            indicatorView.Indicator.Stop();
            return(RootView);
        }