コード例 #1
0
        void Init()
        {
            View rootView = Window.DecorView.RootView;

            rootView.LayoutDirection = LayoutUtils.GetLayoutDirection();
            ConstraintLayout settingsIntroLayout = FindViewById <ConstraintLayout>(Resource.Id.settings_intro_frame);
            ConstraintLayout howItWorksLayout    = FindViewById <ConstraintLayout>(Resource.Id.settings_saddan_frame);
            ConstraintLayout gdprLayout          = FindViewById <ConstraintLayout>(Resource.Id.settings_behandling_frame);
            ConstraintLayout helpLayout          = FindViewById <ConstraintLayout>(Resource.Id.settings_hjaelp_frame);
            ConstraintLayout aboutLayout         = FindViewById <ConstraintLayout>(Resource.Id.om_frame);
            ConstraintLayout deploymentLayout    = FindViewById <ConstraintLayout>(Resource.Id.test_frame);
            ConstraintLayout generalLayout       = FindViewById <ConstraintLayout>(Resource.Id.general_settings);

            TextView settingsIntroButton = settingsIntroLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView howItWorksButton    = howItWorksLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView gdprButton          = gdprLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView helpButton          = helpLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView aboutButton         = aboutLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView generalButton       = generalLayout.FindViewById <TextView>(Resource.Id.settings_general_link_text);
            TextView deploymentButton    = deploymentLayout.FindViewById <TextView>(Resource.Id.settings_link_text);

            ImageView _fhiLogo;

            _fhiLogo = FindViewById <ImageView>(Resource.Id.settings_icon_imageview);
            _fhiLogo.ContentDescription = ViewModels.InfectionStatusViewModel.SMITTESPORING_FHI_LOGO_ACCESSIBILITY;

            settingsIntroButton.Text          = _settingsViewModel.SettingItemList[0].Text;
            settingsIntroButton.TextAlignment = TextAlignment.ViewStart;
            howItWorksButton.Text             = _settingsViewModel.SettingItemList[1].Text;
            howItWorksButton.TextAlignment    = TextAlignment.ViewStart;
            gdprButton.Text             = _settingsViewModel.SettingItemList[2].Text;
            gdprButton.TextAlignment    = TextAlignment.ViewStart;
            helpButton.Text             = _settingsViewModel.SettingItemList[3].Text;
            helpButton.TextAlignment    = TextAlignment.ViewStart;
            aboutButton.Text            = _settingsViewModel.SettingItemList[4].Text;
            aboutButton.TextAlignment   = TextAlignment.ViewStart;
            generalButton.Text          = _settingsViewModel.SettingItemList[5].Text;
            generalButton.TextAlignment = TextAlignment.ViewStart;

            if (_settingsViewModel.ShowDebugItem)
            {
                deploymentButton.Text       = _settingsViewModel.SettingItemList[6].Text;
                deploymentLayout.Visibility = ViewStates.Visible;
            }

            ViewGroup closeButton = FindViewById <ViewGroup>(Resource.Id.ic_close_white);

            closeButton.ContentDescription          = ViewModels.SettingsViewModel.SETTINGS_ITEM_ACCESSIBILITY_CLOSE_BUTTON;
            closeButton.AccessibilityTraversalAfter = Resource.Id.settings_general_link_text;
            closeButton.Click         += new SingleClick((sender, e) => Finish()).Run;
            settingsIntroButton.Click += new SingleClick((sender, args) => NavigationHelper.GoToOnBoarding(this, false)).Run;
            howItWorksButton.Click    += new SingleClick((sender, args) => NavigationHelper.GoToSettingsHowItWorksPage(this)).Run;
            helpButton.Click          += new SingleClick((sender, args) => NavigationHelper.GoToSettingsHelpPage(this)).Run;
            aboutButton.Click         += new SingleClick((sender, args) => NavigationHelper.GoToSettingsAboutPage(this)).Run;
            gdprButton.Click          += new SingleClick((sender, args) => NavigationHelper.GoToConsentsWithdrawPage(this)).Run;
            deploymentButton.Click    += new SingleClick((sender, args) => NavigationHelper.GoToDebugPage(this)).Run;
            generalButton.Click       += new SingleClick((sender, args) => NavigationHelper.GoToGenetalSettingsPage(this)).Run;
        }
コード例 #2
0
        private void SetGalleryThumbnail(Uri uri)
        {
            // Reference of the view that holds the gallery thumbnail
            ImageButton thumbnail = container.FindViewById <ImageButton>(Resource.Id.photo_view_button);

            // Run the operations in the view's thread
            thumbnail.Post(() =>
            {
                // Remove thumbnail padding
                int padding = (int)Resources.GetDimension(Resource.Dimension.stroke_small);
                thumbnail.SetPadding(padding, padding, padding, padding);

                // Load thumbnail into circular button using Glide
                Glide.With(thumbnail)
                .Load(uri)
                .Apply(RequestOptions.CircleCropTransform())
                .Into(thumbnail);
            });
        }
コード例 #3
0
        void Init()
        {
            ConstraintLayout settingsIntroLayout = FindViewById <ConstraintLayout>(Resource.Id.settings_intro_frame);
            ConstraintLayout howItWorksLayout    = FindViewById <ConstraintLayout>(Resource.Id.settings_saddan_frame);
            ConstraintLayout gdprLayout          = FindViewById <ConstraintLayout>(Resource.Id.settings_behandling_frame);
            ConstraintLayout helpLayout          = FindViewById <ConstraintLayout>(Resource.Id.settings_hjaelp_frame);
            ConstraintLayout aboutLayout         = FindViewById <ConstraintLayout>(Resource.Id.om_frame);
            ConstraintLayout deploymentLayout    = FindViewById <ConstraintLayout>(Resource.Id.test_frame);
            ConstraintLayout generalLayout       = FindViewById <ConstraintLayout>(Resource.Id.general_settings);

            TextView settingsIntroButton = settingsIntroLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView howItWorksButton    = howItWorksLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView gdprButton          = gdprLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView helpButton          = helpLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView aboutButton         = aboutLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView generalButton       = generalLayout.FindViewById <TextView>(Resource.Id.settings_link_text);
            TextView deploymentButton    = deploymentLayout.FindViewById <TextView>(Resource.Id.settings_link_text);

            settingsIntroButton.Text = _settingsViewModel.SettingItemList[0].Text;
            howItWorksButton.Text    = _settingsViewModel.SettingItemList[1].Text;
            gdprButton.Text          = _settingsViewModel.SettingItemList[2].Text;
            helpButton.Text          = _settingsViewModel.SettingItemList[3].Text;
            aboutButton.Text         = _settingsViewModel.SettingItemList[4].Text;
            generalButton.Text       = _settingsViewModel.SettingItemList[5].Text;

            if (_settingsViewModel.ShowDebugItem)
            {
                deploymentButton.Text       = _settingsViewModel.SettingItemList[6].Text;
                deploymentLayout.Visibility = ViewStates.Visible;
            }

            ViewGroup closeButton = FindViewById <ViewGroup>(Resource.Id.ic_close_white);

            closeButton.ContentDescription = ViewModels.SettingsViewModel.SETTINGS_ITEM_ACCESSIBILITY_CLOSE_BUTTON;
            closeButton.Click         += new SingleClick((sender, e) => Finish()).Run;
            settingsIntroButton.Click += new SingleClick((sender, args) => NavigationHelper.GoToOnBoarding(this, false)).Run;
            howItWorksButton.Click    += new SingleClick((sender, args) => NavigationHelper.GoToSettingsHowItWorksPage(this)).Run;
            helpButton.Click          += new SingleClick((sender, args) => NavigationHelper.GoToSettingsHelpPage(this)).Run;
            aboutButton.Click         += new SingleClick((sender, args) => NavigationHelper.GoToSettingsAboutPage(this)).Run;
            gdprButton.Click          += new SingleClick((sender, args) => NavigationHelper.GoToConsentsWithdrawPage(this)).Run;
            deploymentButton.Click    += new SingleClick((sender, args) => NavigationHelper.GoToDebugPage(this)).Run;
            generalButton.Click       += new SingleClick((sender, args) => NavigationHelper.GoToGenetalSettingsPage(this)).Run;
        }
コード例 #4
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            container  = view as ConstraintLayout;
            viewFinder = container.FindViewById <PreviewView>(Resource.Id.view_finder);

            // Initialize our background executor
            cameraExecutor = Java.Util.Concurrent.Executors.NewSingleThreadExecutor();

            volumeDownReceiver = new VolumeDownReceiver(this);

            broadcastManager = LocalBroadcastManager.GetInstance(view.Context);

            // Set up the intent filter that will receive events from our main activity
            var filter = new IntentFilter();

            filter.AddAction(MainActivity.KeyEventAction);
            broadcastManager.RegisterReceiver(volumeDownReceiver, filter);

            // Every time the orientation of device changes, update rotation for use cases
            displayManager.RegisterDisplayListener(this, null);

            // Determine the output directory
            outputDirectory = MainActivity.GetOutputDirectory(RequireContext());

            // Wait for the views to be properly laid out
            viewFinder.Post(() =>
            {
                // Keep track of the display in which this view is attached
                displayId = viewFinder.Display.DisplayId;

                // Build UI controls
                UpdateCameraUi();

                // Set up the camera and its use cases
                SetUpCamera();
            });
        }
コード例 #5
0
        void InitView()
        {
            // Views related to the main content in the on-state.
            _numberCounterTextView     = FindViewById <TextView>(Resource.Id.number_counter_textView);
            _numberCounterTextTextView = FindViewById <TextView>(Resource.Id.number_counter_text_textView);
            _lastUpdatedTextView       = FindViewById <TextView>(Resource.Id.last_updated_textView);
            _counterExplainedTextView  = FindViewById <TextView>(Resource.Id.counter_explained_text_textView);
            _onOffButton = FindViewById <Button>(Resource.Id.on_off_button);
            _explanationContactCounterButton =
                FindViewById <ImageButton>(Resource.Id.number_counter_text_help_imageButton);
            ConstraintLayout userDataLayout     = FindViewById <ConstraintLayout>(Resource.Id.userData);
            ConstraintLayout allUsersDataLayout = FindViewById <ConstraintLayout>(Resource.Id.allUsersData);

            _explanationDailyAverageImageButton =
                userDataLayout.FindViewById <ImageButton>(Resource.Id.daily_average_text_help_imageButton);
            _explanationDailyAverageAllUsersImageButton =
                allUsersDataLayout.FindViewById <ImageButton>(Resource.Id.daily_average_text_help_imageButton);

            _dailyAverageTextView               = userDataLayout.FindViewById <TextView>(Resource.Id.daily_average_text_textView);
            _dailyAverageNumberTextView         = userDataLayout.FindViewById <TextView>(Resource.Id.daily_average_number_textView);
            _dailyAverageAllUsersTextView       = allUsersDataLayout.FindViewById <TextView>(Resource.Id.daily_average_text_textView);
            _dailyAverageNumberAllUsersTextView =
                allUsersDataLayout.FindViewById <TextView>(Resource.Id.daily_average_number_textView);
            _settingsIcon = FindViewById <RelativeLayout>(Resource.Id.icon_settin);
            _averageContactsRelativeLayout = FindViewById <LinearLayout>(Resource.Id.average_contacts_relativeLayout);
            _horizontalDevider             = FindViewById <View>(Resource.Id.horizontal_devider);

            // Update default text
            _lastUpdatedTextView.Text       = "";
            _numberCounterTextView.Text     = "";
            _numberCounterTextTextView.Text = ProximityStatusViewModel.PROXIMITY_NUMBER_OF_CONTACTS_TEXT;
            _counterExplainedTextView.Text  = ProximityStatusViewModel.PROXIMITY_TODAY_TEXT;
            _counterExplainedTextView.ContentDescription = ProximityStatusViewModel.PROXIMITY_TODAY_TEXT_ACCESSIBILITY;
            _dailyAverageTextView.Text         = ProximityStatusViewModel.PROXIMITY_DAILY_AVERAGE_TEXT;
            _dailyAverageAllUsersTextView.Text = ProximityStatusViewModel.PROXIMITY_DAILY_AVERAGE_ALL_USERS_TEXT;

            // OnClickListeners
            _explanationDailyAverageAllUsersImageButton.Click += ExplanationDailyAverageAllUsers_Click;
            _explanationContactCounterButton.Click            += ExplanationCounter_Click;
            _explanationDailyAverageImageButton.Click         += ExplanationDailyAverage_Click;
            _onOffButton.Click  += new SingleClick(StartStopButton_Click, 500).Run;
            _settingsIcon.Click += (sender, e) => NavigationHelper.GoToSettingsPage(this);

            // Accessibility descriptions
            _explanationDailyAverageAllUsersImageButton.ContentDescription = ProximityStatusViewModel.PROXIMITY_ACCESIBILITY_DAILY_AVERAGE_ALL_USERS_DESCRIPTOR;
            _explanationContactCounterButton.ContentDescription            = ProximityStatusViewModel.PROXIMITY_ACCESIBILITY_NUMBER_OF_CONTACTS_DESCRIPTOR;
            _explanationDailyAverageImageButton.ContentDescription         = ProximityStatusViewModel.PROXIMITY_ACCESIBILITY_DAILY_AVERAGE_DESCRIPTOR;
            _settingsIcon.ContentDescription = ProximityStatusViewModel.MENU_ACCESS_TEXT;

            // Views related to errors and warnings
            _unsupportedTextView = FindViewById <TextView>(Resource.Id.unsupported_Transmit_text_textView);
            _counterOffTextView  = FindViewById <TextView>(Resource.Id.counter_off_text_textView);
            _counterOffLayout    =
                FindViewById <RelativeLayout>(Resource.Id.proximity_status_page_counter_off_relativeLayout);
            _counterOnLayout =
                FindViewById <RelativeLayout>(Resource.Id.proximity_status_page_counter_on_relativeLayout);
            _warningLocalLayout = FindViewById <LinearLayout>(Resource.Id.warningBar);       // Included layout in proximity_activity.xml
            _warningLayout      = FindViewById <RelativeLayout>(Resource.Id.warning_layout); // Part of warningbar.xml, sibling to _errorTextView
            _warningTextView    = FindViewById <TextView>(Resource.Id.warning_textView);     // Child of _warningLayout
            _errorButton        = FindViewById <Button>(Resource.Id.button_error);           // Part of warningbar.xml sibling to _warningLayout

            _errorButton.Text         = WelcomeViewModel.TRANSMISSION_ERROR_MSG_NOTIFICATION_TEXT;
            _warningTextView.Text     = ProximityStatusViewModel.PROXIMITY_COUNT_TURNED_OFF_WARNING_TEXT;
            _counterOffTextView.Text  = ProximityStatusViewModel.PROXIMITY_COUNTER_OFF_TEXT;
            _unsupportedTextView.Text = ProximityStatusViewModel.PROXIMITY_UNSUPPORTED_TRANSMIT_TEXT;

            // Default invisible layouts
            _warningLocalLayout.Visibility  = ViewStates.Gone;
            _counterOffLayout.Visibility    = ViewStates.Gone;
            _unsupportedTextView.Visibility = ViewStates.Gone;


            if (_viewModel.IsBleAvailable())
            {
                if (!_viewModel.IsRunning && _viewModel.GetAutoStartScanner())
                {
                    _onOffButton.PerformClick();
                }
                UpdateUI();
            }
            else
            {
                DisplayUnsupportedLayout();
            }
        }