示例#1
0
        public override void OnBackPressed()
        {
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            ServiceFunctions.RegisterDevice(this);
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed

            base.OnBackPressed();
        }
        void SendRegistrationToServer(string token)
        {
            Context context = this;

            Task.Run(async() =>
            {
                await ServiceFunctions.RegisterDevice(context);
            });
        }
示例#3
0
        private void OnCreate_Main()
        {
            showToolbarMenu = true;

            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar(toolbar);
            SupportActionBar.Title = "Roamit";
            toolbar.Background     = new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.ParseColor("#111111"));

            FindViewById <RelativeLayout>(Resource.Id.main_actions).Visibility = ViewStates.Visible;
            FindViewById <RelativeLayout>(Resource.Id.main_share).Visibility   = ViewStates.Gone;

            //FindViewById<Button>(Resource.Id.button3).Click += Button3_Click;
            //FindViewById<Button>(Resource.Id.mainSendMessageCarrier).Click += SendMessageCarrier_Click;
            var mainLayout = FindViewById <LinearLayout>(Resource.Id.mainLayout);

            clipboardButton      = FindViewById <Button>(Resource.Id.clipboardButton);
            sendUrlButton        = FindViewById <Button>(Resource.Id.main_btn_openUrl);
            sendFileButton       = FindViewById <Button>(Resource.Id.sendFileButton);
            sendPictureButton    = FindViewById <Button>(Resource.Id.sendPictureButton);
            clipboardPreviewText = FindViewById <TextView>(Resource.Id.clipboardPreviewText);

            clipboardButton.Click   += SendClipboard_Click;
            sendUrlButton.Click     += SendUrlButton_Click;
            sendFileButton.Click    += SendFile_Click;
            sendPictureButton.Click += SendPictureButton_Click;

            mainLayout.ViewTreeObserver.GlobalLayout += (ss, ee) =>
            {
                int x = Math.Min(mainLayout.Width, mainLayout.Height);
                sendFileButton.SetWidth((int)(x * 0.5));
                sendFileButton.SetHeight((int)(x * 0.5));
                clipboardButton.SetWidth((int)(x * 0.25));
                clipboardButton.SetHeight((int)(x * 0.25));
                sendPictureButton.SetWidth((int)(x * 0.25));
                sendPictureButton.SetHeight((int)(x * 0.25));
            };

            SetClipboardPreviewText();
            clipboardUpdateTimer = new Timer(ClipboardUpdateTimer_Tick, null, 0, 1000);

            Context context = this;

            Task.Run(async() =>
            {
#if DEBUG
                FirebaseInstanceId.Instance.DeleteInstanceId();
#endif
                await ServiceFunctions.RegisterDevice(context);
                RefreshUserTrialStatus();
            });

            Analytics.TrackPage("MainPage");
        }
示例#4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.WebViewContainer);

            webView = FindViewById <WebView>(Resource.Id.webView);
            var client = new HybridWebViewClient(this);

            webView.SetWebViewClient(client);
            webView.Settings.JavaScriptEnabled = true;

            var settings = new Classes.Settings(this);

            if (IsShareDialog)
            {
                InitShareDialog();
            }
            else
            {
                if (settings.Theme == AppTheme.Dark)
                {
                    webView.LoadUrl($"{homeUrl}#dark");
                }
                else
                {
                    webView.LoadUrl($"{homeUrl}#light");
                }

                ShowWhatsNewIfNecessary();
            }


            bannerLayout         = FindViewById <RelativeLayout>(Resource.Id.webViewContainer_banner);
            startSessionListener = new CallbackStartSessionListener(this);
            showBannerAdListener = new CallbackShowBanner(this);
            RevMob.StartWithListener(this, startSessionListener, Droid.Config.Secrets.RevMobId);
            UserTrialStatusUpdated();
            TrialHelper.UserTrialStatusChanged += UserTrialStatusUpdated;
            RefreshUserTrialStatus();


            checkClipboardTextTimer = new System.Timers.Timer()
            {
                Interval = 1000,
            };
            checkClipboardTextTimer.Elapsed += CheckClipboardTextTimer_Elapsed;
            checkClipboardTextTimer.Start();

            if (IsInitialized)
            {
                Common.PackageManager.RemoteSystems.CollectionChanged += DevicesCollectionChanged;
                Common.AndroidPushNotifier.Devices.CollectionChanged  += DevicesCollectionChanged;
                return;
            }
            IsInitialized = true;

            if (Common.PackageManager == null)
            {
                Common.PackageManager = new RomePackageManager(this);
                Common.PackageManager.Initialize("com.roamit.service");
            }
            else
            {
                foreach (var item in Common.PackageManager.RemoteSystems)
                {
                    Common.ListManager.AddDevice(item);
                }
            }

            if (Common.AndroidPushNotifier == null)
            {
                InitAndroidPushNotifier();
            }
            else
            {
                foreach (var item in Common.AndroidPushNotifier.Devices)
                {
                    Common.ListManager.AddDevice(item);
                }

                Common.AndroidPushNotifier.Devices.CollectionChanged -= DevicesCollectionChanged;
                Common.AndroidPushNotifier.Devices.CollectionChanged += DevicesCollectionChanged;
            }

            if (Common.MessageCarrierPackageManager == null)
            {
                Common.MessageCarrierPackageManager = new RomePackageManager(this);
                Common.MessageCarrierPackageManager.Initialize("com.roamit.messagecarrierservice");
            }

            InitRomeDiscovery();

            Context context = this;

            Task.Run(async() =>
            {
#if DEBUG
                FirebaseInstanceId.Instance.DeleteInstanceId();
#endif
                await ServiceFunctions.RegisterDevice(context);
                RefreshUserTrialStatus();
            });

            Analytics.TrackPage("WebViewContainerActivity");

            if (settings.AllowToStayInBackground)
            {
                StartService(new Intent(this, typeof(Services.RomeReadyService)));
            }

            CheckForLegacyVersionInstallations();
        }