예제 #1
0
        private void initView()
        {
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            SwitchCompat sw = FindViewById <SwitchCompat>(Resource.Id.switchServer);

            sw.CheckedChange += (sender, e) =>
            {
                if (!isPassPermissionAndSetting())
                {
                    sw.Checked = false;
                    return;
                }
                if (e.IsChecked)
                {
                    server.start("BLE");
                }
                else
                {
                    server.stop();
                }
            };

            ledView = FindViewById <View>(Resource.Id.ledView);
            ledView.SetBackgroundColor(Color.Gray);
        }
예제 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.activity_main);

            recyclerView = FindViewById <RecyclerView>(Resource.Id.recyclerView);
            switchState  = FindViewById <SwitchCompat>(Resource.Id.stateButton);


            switchState.CheckedChange += SwitchState_CheckedChange;


            layoutManager = new LinearLayoutManager(this);
            var onScrollListener = new RecyclerViewOnScrollListener((LinearLayoutManager)layoutManager);

            onScrollListener.LoadMoreEvent += (object sender, EventArgs e) => {
                AddIssues();;
            };
            recyclerView.AddOnScrollListener(onScrollListener);
            recyclerView.SetLayoutManager(layoutManager);
            issueAdapter            = new IssueAdapter(this, recyclerView, Issues);
            issueAdapter.ItemClick += OnItemClick;
            recyclerView.SetAdapter(issueAdapter);


            AddIssues();
        }
예제 #3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Log.Debug(TAG, "OnCreate");
            base.OnCreate(savedInstanceState);

            CardTitle    = FindViewById <AppCompatTextView>(Resource.Id.script_card_title);
            CardSubtitle = FindViewById <AppCompatTextView>(Resource.Id.script_card_subtitle);

            ScriptName = FindViewById <AppCompatEditText>(Resource.Id.editTextScriptName);

            AutorunTrigger = FindViewById <SwitchCompat>(Resource.Id.switchAutorunTriggerScript);
            //
            HardwareTrigger = FindViewById <AppCompatSpinner>(Resource.Id.spinnerScriptTriggerHardware);
            PortTrigger     = FindViewById <AppCompatSpinner>(Resource.Id.spinnerScriptTriggerPort);
            StateTrigger    = FindViewById <AppCompatSpinner>(Resource.Id.spinnerScriptTriggerState);

            AutorunTrigger.Checked = false;
            //
            HardwareTrigger.Enabled = false;
            PortTrigger.Enabled     = false;
            StateTrigger.Enabled    = false;

            ButtonOk = FindViewById <AppCompatButton>(Resource.Id.script_button_ok);

            HardwaresListSpinnerLoad(ref HardwareTrigger);
            //
            ArrayAdapter adapterPortStatuses = ArrayAdapter <string> .CreateFromResource(this, Resource.Array.script_trigger_port_states_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapterPortStatuses.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            StateTrigger.Adapter = adapterPortStatuses;
        }
예제 #4
0
        protected override void OnDetached()
        {
            //restore the old color
            SwitchCompat switchCompat = (SwitchCompat)Control;

            switchCompat.SetHighlightColor(oldColor);
        }
예제 #5
0
        /// <summary>
        /// Initialises the activity.
        /// </summary>
        /// <param name="savedInstanceState">The incoming bundle</param>
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Bundle currentBundle = savedInstanceState ?? this.Intent.Extras;

            if (currentBundle != null)
            {
                if (currentBundle.ContainsKey(TaskIdBundleKey))
                {
                    this._taskId = currentBundle.GetInt(TaskIdBundleKey, 0);
                }
            }

            // set our layout to be the home screen
            this.SetContentView(Resource.Layout.TaskActivityView);

            Toolbar toolBar = this.FindViewById <Toolbar>(Resource.Id.applicationToolbar);

            this.SetSupportActionBar(toolBar);
            this.SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            // find all our controls
            this._notesEditText      = this.FindViewById <EditText>(Resource.Id.notesEditText);
            this._nameEditText       = this.FindViewById <EditText>(Resource.Id.nameEditText);
            this._saveButton         = this.FindViewById <Button>(Resource.Id.saveButton);
            this._doneSwitch         = this.FindViewById <SwitchCompat>(Resource.Id.doneSwitch);
            this._cancelDeleteButton = this.FindViewById <Button>(Resource.Id.cancelDeleteButton);

            // button clicks
            this._cancelDeleteButton.Click += (sender, e) => { this.CancelDelete(); };
            this._saveButton.Click         += (sender, e) => { this.Save(); };
        }
예제 #6
0
        private void SetSwitch(int id, bool state = false)
        {
            SwitchCompat switchView = optionsView.FindViewById <SwitchCompat>(id);

            switchView.SetOnCheckedChangeListener(this);
            switchView.Checked = state;
        }
예제 #7
0
        private void SetupChatStateView(BaseActivity activity)
        {
            this.chatStateSwitch        = activity.FindViewById <SwitchCompat>(Resource.Id.switchChatState);
            this.chatStateSwitch.Click += ChatStateSwitch_Click;
            var chatStateLayout = activity.FindViewById <RelativeLayout>(Resource.Id.relLayoutChat);

            chatStateLayout.Click += ChatStateLayout_Click;
        }
예제 #8
0
        private void InflateLayout()
        {
            var view = LayoutInflater.From(Context).Inflate(Resource.Layout.custom_switch, this);

            switchCompat = view.FindViewById <SwitchCompat>(Resource.Id.switch_compat);
            textView     = view.FindViewById <TextView>(Resource.Id.switch_compat_text);
            switchCompat.CheckedChange += delegate { SetChecked(switchCompat.Checked); };
        }
예제 #9
0
        protected override void OnAttached()
        {
            //Store the old color and set the new one
            SwitchCompat      switchCompat = (SwitchCompat)Control;
            SwitchColorEffect effect       = (SwitchColorEffect)Element.Effects.FirstOrDefault(e => e is SwitchColorEffect);

            oldColor = switchCompat.HighlightColor;
            switchCompat.SetHighlightColor(effect.Color.ToAndroid());
        }
예제 #10
0
        private SwitchCompat CreateSwitch(bool value)
        {
            var toggle = new SwitchCompat(context);

            toggle.LayoutParameters = CreateLinearLayoutParams(DroidUtils.DpToPixels(64), ViewGroup.LayoutParams.WrapContent, GravityFlags.Right | GravityFlags.CenterVertical);
            toggle.Checked          = value;
            toggle.CheckedChange   += Toggle_CheckedChange;

            return(toggle);
        }
예제 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:XFGloss.Droid.Renderers.SwitchCompatCellView"/> class.
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="cell">Cell.</param>
        public SwitchCompatCellView(Context context, Cell cell) : base(context, cell)
        {
            var sw = new SwitchCompat(context);

            sw.SetOnCheckedChangeListener(this);

            SetAccessoryView(sw);

            SetImageVisible(false);
        }
예제 #12
0
 protected void BindViews()
 {
     toolbar       = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.my_toolbar);
     swEnableAwake = FindViewById <SwitchCompat>(Resource.Id.swEnableAwake);
     if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
     {
         Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
     }
     SetSupportActionBar(toolbar);
 }
예제 #13
0
        private async void OnCheckedChange(object obj, EventArgs args)
        {
            SwitchCompat switchButton = (SwitchCompat)obj;

            if (!switchButton.Checked && !await DialogUtils.DisplayDialogAsync(this, AreYouSureDialogViewModel))
            {
                switchButton.Checked = true;
            }

            _viewModel.OnCheckedChange(switchButton.Checked);
        }
예제 #14
0
        protected override void OnAttached()
        {
            control = (SwitchCompat)Control;

            control.CheckedChange += Control_CheckedChange;

            var color = Utility.Effects.SwitchColorEffect.GetColor(Element).ToAndroid();

            control.ThumbDrawable.SetColorFilter(color, Android.Graphics.PorterDuff.Mode.Multiply);
            control.TrackDrawable.SetColorFilter(color, Android.Graphics.PorterDuff.Mode.Multiply);
        }
예제 #15
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            OverridePendingTransition(0, 0);

            SetTheme(StyleHelper.Style.CommonActivityStyle);

            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_chat_details);

            _navigationBarView = FindViewById <NavigationBarView>(Resource.Id.activity_chat_details_navigation_bar);
            _navigationBarView.SetLeftButton(StyleHelper.Style.NavigationBarBackButtonIcon, ViewModel.BackCommand);
            _navigationBarView.SetTitle(ViewModel.LocalizedStrings.DetailsTitle);
            _navigationBarView.SetRightButton(ViewModel.LocalizedStrings.Save, new RelayCommand(OnSaveClick));
            _navigationBarView.RightTextButton.Visibility = ViewStates.Gone;

            _chatPhotoImageView = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo);

            _chatEditedPhotoImageView = FindViewById <MvxCachedImageView>(Resource.Id.iv_chat_photo_edited);

            _chatNameText     = FindViewById <TextView>(Resource.Id.activity_chat_details_chat_name);
            _chatNameEditText = FindViewById <EditText>(Resource.Id.activity_chat_details_chat_name_edit);

            _chatMembersCountTextView = FindViewById <TextView>(Resource.Id.tv_members_count);

            _addMemberContainer = FindViewById <LinearLayout>(Resource.Id.activity_chat_details_add_member_container);
            _addmemberImageView = FindViewById <ImageView>(Resource.Id.activity_chat_details_add_member_image);
            _addmemberImageView.SetImageResource(StyleHelper.Style.AddMemberIcon);
            _addMemberTextView      = FindViewById <TextView>(Resource.Id.activity_chat_details_add_member_text);
            _addMemberTextView.Text = ViewModel.LocalizedStrings.AddMembers;

            _membersRecyclerView = FindViewById <RecyclerView>(Resource.Id.rv_contacts_list);

            _changeChatPhotoButton = FindViewById <Button>(Resource.Id.b_chat_change_photo);
            _changeChatPhotoButton.SetCommand(new RelayCommand(OpenImagePicker));
            _changeChatPhotoButton.Text = ViewModel.LocalizedStrings.ChangePhoto;

            _muteNotificationsLabel      = FindViewById <TextView>(Resource.Id.activity_chat_details_mute_label);
            _muteNotificationsLabel.Text = ViewModel.LocalizedStrings.Notifications;
            _muteNotificationsSwitch     = FindViewById <SwitchCompat>(Resource.Id.activity_chat_details_mute_switch);
            _muteNotificationsSwitch.SetCommand(ViewModel.HeaderViewModel.ChangeMuteNotificationsCommand);

            InitializeMembersRecyclerView();

            // TODO YP: remove ServiceLocator
            _imagePicker = new ImagePicker(
                Dependencies.Container.Resolve <IPermissionsManager>(),
                Dependencies.Container.Resolve <IImagePickerService>())
            {
                MaxImageWidth = 300
            };

            _busyOverlayView = FindViewById <BusyOverlayView>(Resource.Id.activity_chat_details_busy_view);
        }
예제 #16
0
 public static void SetTheme(this SwitchCompat view, string thumbColorOff, string trackColorOff, string thumbColorOn, string trackColorOn)
 {
     if (view.Checked)
     {
         view.TrackDrawable.SetColorFilter(_theme.Colors[trackColorOn], PorterDuff.Mode.SrcAtop);
         view.ThumbDrawable.SetColorFilter(_theme.Colors[thumbColorOn], PorterDuff.Mode.SrcAtop);
     }
     else
     {
         view.TrackDrawable.SetColorFilter(_theme.Colors[trackColorOff], PorterDuff.Mode.SrcAtop);
         view.ThumbDrawable.SetColorFilter(_theme.Colors[thumbColorOff], PorterDuff.Mode.SrcAtop);
     }
 }
 /// <summary>
 /// Dispose the specified disposing.
 /// </summary>
 /// <returns>The dispose.</returns>
 /// <param name="disposing">If set to <c>true</c> disposing.</param>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         _switch.SetOnCheckedChangeListener(null);
         _switch.Background?.Dispose();
         _switch.Background = null;
         _switch.ThumbDrawable?.Dispose();
         _switch.ThumbDrawable = null;
         _switch.Dispose();
         _switch = null;
     }
     base.Dispose(disposing);
 }
예제 #18
0
 public void OnDetached()
 {
     _track.Dispose();
     _thumb.Dispose();
     _background.Dispose();
     _background    = null;
     _orgBackground = null;
     _orgThumb      = null;
     _orgTrack      = null;
     _track         = null;
     _thumb         = null;
     _aSwitch       = null;
     _element       = null;
 }
예제 #19
0
        private void SetupNotificationsStateView(BaseActivity activity)
        {
            this.notificationsStateSwitch        = activity.FindViewById <SwitchCompat>(Resource.Id.switchNotificationsState);
            this.notificationsStateSwitch.Click += NotificationsStateSwitch_Click;
            var newsNotificationsLayout = activity.FindViewById <RelativeLayout>(Resource.Id.relLayoutNewsNotifications);

            newsNotificationsLayout.Click += NewsNotificationsLayout_Click;

            this.imgBtnRadius   = activity.FindViewById <ImageButton>(Resource.Id.imgBtnRadius);
            imgBtnRadius.Click += ImgBtnRadius_Click;
            var newsRadiusLayout = activity.FindViewById <RelativeLayout>(Resource.Id.relLayoutNewsRadius);

            newsRadiusLayout.Click += ImgBtnRadius_Click;
        }
예제 #20
0
        public override View GetView(Context context)
        {
            var cell  = LayoutInflater.From(context).Inflate(Resource.Layout.forms_cell_checkbox, null);
            var label = cell.FindViewById <TextView>(Resource.Id.label);

            _checkBox = cell.FindViewById <SwitchCompat>(Resource.Id.checkbox);
            _checkBox.SetTextColor(AppearanceTextColor);
            _checkBox.SetHighlightColor(AppearanceAccentColor);
            label.Text               = _hint;
            _checkBox.Checked        = _value;
            _checkBox.Enabled        = Form.EditingEnabled;
            _checkBox.CheckedChange += OnCheckBoxClicked;

            return(cell);
        }
        private void OnActivityCheckedChange(object sender, EventArgs args)
        {
            SwitchCompat switchCompat = (SwitchCompat)sender;

            if (!BatteryOptimisationUtils.CheckIsEnableBatteryOptimizations())
            {
                BatteryOptimisationUtils.StopBatteryOptimizationSetting(this);
                switchCompat.Checked = true;
            }
            else
            {
                BatteryOptimisationUtils.StartBatterySetting(this);
                switchCompat.Checked = false;
            }
        }
예제 #22
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            Log.Debug(TAG, "OnCreate");
            base.OnCreate(savedInstanceState);

            ScriptId = Intent.Extras.GetInt(nameof(ScriptModel.Id), 0);

            CardTitle    = FindViewById <AppCompatTextView>(Resource.Id.command_card_title);
            CardSubtitle = FindViewById <AppCompatTextView>(Resource.Id.command_card_subtitle);

            HiddenCommandCheckBox      = FindViewById <AppCompatCheckBox>(Resource.Id.checkBoxHiddenCommand);
            PauseSecondsBeforeStarting = FindViewById <AppCompatEditText>(Resource.Id.editTextPauseSecBeforeExecuting);
            FooterLayout = FindViewById <LinearLayoutCompat>(Resource.Id.command_footer_layout);

            RequiredCondition = FindViewById <SwitchCompat>(Resource.Id.switchCondition);

            HardwareCondition = FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandHardwareCondition);
            PortCondition     = FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandPortCondition);
            StateCondition    = FindViewById <AppCompatSpinner>(Resource.Id.spinnerCommandStateCondition);

            RequiredCondition.Checked = false;
            //
            HardwareCondition.Enabled = false;
            PortCondition.Enabled     = false;
            StateCondition.Enabled    = false;

            TypesCommand = FindViewById <AppCompatSpinner>(Resource.Id.spinnerTypeCommand);

            about_selected_command = FindViewById <AppCompatTextView>(Resource.Id.about_selected_command);

            CommandConfigForm = FindViewById <LinearLayoutCompat>(Resource.Id.command_config_form);

            ButtonOk = FindViewById <AppCompatButton>(Resource.Id.command_button_ok);

            HardwaresListSpinnerLoad(ref HardwareCondition);

            ArrayAdapter adapterPortStatusesCondition = ArrayAdapter <string> .CreateFromResource(this, Resource.Array.required_condition_port_states_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapterPortStatusesCondition.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            StateCondition.Adapter = adapterPortStatusesCondition;

            ArrayAdapter adapterTypesCommands = ArrayAdapter <string> .CreateFromResource(this, Resource.Array.commands_types_array, Android.Resource.Layout.SimpleSpinnerItem);

            adapterTypesCommands.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem);
            TypesCommand.Adapter = adapterTypesCommands;
        }
예제 #23
0
        private void ApplyStyle()
        {
            // FindViewById
            _backgroundLayout = thisView.FindViewById <LinearLayout>(Resource.Id.settings_backgroundLayout);
            _mainTitle        = thisView.FindViewById <TextView>(Resource.Id.settings_mainTitle);
            _textTheme        = thisView.FindViewById <TextView>(Resource.Id.settings_textTheme);
            _themeSwitch      = thisView.FindViewById <SwitchCompat>(Resource.Id.settings_themeSwitch);
            _themeSwitchText  = thisView.FindViewById <TextView>(Resource.Id.settings_themeSwitchText);

            // Styling
            _backgroundLayout.SetBackgroundColor(new ApplyTheme().GetColor(DesiredColor.MainBackground));
            _textTheme.SetTextColor(new ApplyTheme().GetColor(DesiredColor.MainText));
            _themeSwitchText.SetTextColor(new ApplyTheme().GetColor(DesiredColor.MainText));

            // Strings
            _mainTitle.Text = Resources.GetString(Resource.String.settings_settingsTitle);
            _textTheme.Text = Resources.GetString(Resource.String.settings_textTheme);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);
            var view = inflater.Inflate(Resource.Layout.brakecooling_conditional_fragment, container, false);

            view.FindViewById <TextView>(Resource.Id.aircraftMassTextView).Text          = $"Aircraft Mass in {_massUnit}:";
            view.FindViewById <TextView>(Resource.Id.outsideAirTemperatureTextView).Text = $"Outside Air Temperature in {_temperatureUnit}:";
            _aircraftMassEditText          = view.FindViewById <EditText>(Resource.Id.aircraftMassEditText);
            _brakesOnSpeedEditText         = view.FindViewById <EditText>(Resource.Id.brakesOnSpeedEditText);
            _pressureAltitudeEditText      = view.FindViewById <EditText>(Resource.Id.pressureAltitudeEditText);
            _outsideAirTemperatureEditText = view.FindViewById <EditText>(Resource.Id.outsideAirTemperatureEditText);
            _brakeTypeSwitch          = view.FindViewById <SwitchCompat>(Resource.Id.brakeTypeSwitch);
            _inFlightSwitch           = view.FindViewById <SwitchCompat>(Resource.Id.inFlightSwitch);
            _reverseSwitch            = view.FindViewById <SwitchCompat>(Resource.Id.reverseSwitch);
            _brakeCoolingTimeTextView = view.FindViewById <TextView>(Resource.Id.brakeCoolingTimeTextView);

            int brakeLevel = 1;

            view.FindViewById <RadioGroup>(Resource.Id.brakeLevelRadioGroup).CheckedChange += (s, e) =>
            {
                var javaLangString = (Java.Lang.String)view.FindViewById <RadioButton>(e.CheckedId).Tag;
                brakeLevel = int.Parse(javaLangString.ToString());
                _brakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_brakeTypeSwitch.Checked, _reverseSwitch.Checked, _inFlightSwitch.Checked, _settingsService.GetSetting <bool>("UseImperialMass"), _settingsService.GetSetting <bool>("UseFahrenheit"), brakeLevel, _aircraftMassEditText.Text, _brakesOnSpeedEditText.Text, _pressureAltitudeEditText.Text, _outsideAirTemperatureEditText.Text);
            };

            _aircraftMassEditText.TextChanged          += (s, e) => { _brakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_brakeTypeSwitch.Checked, _reverseSwitch.Checked, _inFlightSwitch.Checked, _settingsService.GetSetting <bool>("UseImperialMass"), _settingsService.GetSetting <bool>("UseFahrenheit"), brakeLevel, _aircraftMassEditText.Text, _brakesOnSpeedEditText.Text, _pressureAltitudeEditText.Text, _outsideAirTemperatureEditText.Text); };
            _brakesOnSpeedEditText.TextChanged         += (s, e) => { _brakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_brakeTypeSwitch.Checked, _reverseSwitch.Checked, _inFlightSwitch.Checked, _settingsService.GetSetting <bool>("UseImperialMass"), _settingsService.GetSetting <bool>("UseFahrenheit"), brakeLevel, _aircraftMassEditText.Text, _brakesOnSpeedEditText.Text, _pressureAltitudeEditText.Text, _outsideAirTemperatureEditText.Text); };
            _pressureAltitudeEditText.TextChanged      += (s, e) => { _brakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_brakeTypeSwitch.Checked, _reverseSwitch.Checked, _inFlightSwitch.Checked, _settingsService.GetSetting <bool>("UseImperialMass"), _settingsService.GetSetting <bool>("UseFahrenheit"), brakeLevel, _aircraftMassEditText.Text, _brakesOnSpeedEditText.Text, _pressureAltitudeEditText.Text, _outsideAirTemperatureEditText.Text); };
            _outsideAirTemperatureEditText.TextChanged += (s, e) => { _brakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_brakeTypeSwitch.Checked, _reverseSwitch.Checked, _inFlightSwitch.Checked, _settingsService.GetSetting <bool>("UseImperialMass"), _settingsService.GetSetting <bool>("UseFahrenheit"), brakeLevel, _aircraftMassEditText.Text, _brakesOnSpeedEditText.Text, _pressureAltitudeEditText.Text, _outsideAirTemperatureEditText.Text); };
            _brakeTypeSwitch.CheckedChange             += (s, e) => { _brakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_brakeTypeSwitch.Checked, _reverseSwitch.Checked, _inFlightSwitch.Checked, _settingsService.GetSetting <bool>("UseImperialMass"), _settingsService.GetSetting <bool>("UseFahrenheit"), brakeLevel, _aircraftMassEditText.Text, _brakesOnSpeedEditText.Text, _pressureAltitudeEditText.Text, _outsideAirTemperatureEditText.Text); };
            _inFlightSwitch.CheckedChange += (s, e) => { _brakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_brakeTypeSwitch.Checked, _reverseSwitch.Checked, _inFlightSwitch.Checked, _settingsService.GetSetting <bool>("UseImperialMass"), _settingsService.GetSetting <bool>("UseFahrenheit"), brakeLevel, _aircraftMassEditText.Text, _brakesOnSpeedEditText.Text, _pressureAltitudeEditText.Text, _outsideAirTemperatureEditText.Text); };
            _reverseSwitch.CheckedChange  += (s, e) => { _brakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_brakeTypeSwitch.Checked, _reverseSwitch.Checked, _inFlightSwitch.Checked, _settingsService.GetSetting <bool>("UseImperialMass"), _settingsService.GetSetting <bool>("UseFahrenheit"), brakeLevel, _aircraftMassEditText.Text, _brakesOnSpeedEditText.Text, _pressureAltitudeEditText.Text, _outsideAirTemperatureEditText.Text); };

            view.FindViewById <Button>(Resource.Id.clearBrakeCoolingButton).Click += (s, e) =>
            {
                view.PerformHapticFeedback(FeedbackConstants.VirtualKey, FeedbackFlags.IgnoreGlobalSetting);
                _aircraftMassEditText.Text          = "";
                _brakesOnSpeedEditText.Text         = "";
                _pressureAltitudeEditText.Text      = "";
                _outsideAirTemperatureEditText.Text = "";
            };
            return(view);
        }
예제 #25
0
        public override void bindViews()
        {
            mTvSort         = FindViewById <TextView>(Resource.Id.mTvSort);
            mTvFlipStyle    = FindViewById <TextView>(Resource.Id.tvFlipStyle);
            mTvCacheSize    = FindViewById <TextView>(Resource.Id.tvCacheSize);
            noneCoverCompat = FindViewById <SwitchCompat>(Resource.Id.noneCoverCompat);

            var bookshelfSort = FindViewById(Resource.Id.bookshelfSort);

            bookshelfSort.Click += (sender, e) => onClickBookShelfSort();
            var rlFlipStyle = FindViewById(Resource.Id.rlFlipStyle);

            rlFlipStyle.Click += (sender, e) => onClickFlipStyle();
            var feedBack = FindViewById(Resource.Id.feedBack);

            feedBack.Click += (sender, e) => onClickFeedBack();
            var cleanCache = FindViewById(Resource.Id.cleanCache);

            cleanCache.Click += (sender, e) => onClickCleanCache();
        }
예제 #26
0
        public override void OnViewModelLoadedOverride()
        {
            if (ViewModel.Account == null)
            {
                return;
            }

            _switchTasks                = FindViewById <SwitchCompat>(Resource.Id.SettingsWidgetAgendaShowTasksSwitch);
            _switchTasks.Checked        = ViewModel.Account.MainTileSettings.ShowHomework;
            _switchTasks.CheckedChange += new WeakEventHandler <CompoundButton.CheckedChangeEventArgs>(Switch_CheckedChange).Handler;

            _switchEvents               = FindViewById <SwitchCompat>(Resource.Id.SettingsWidgetAgendaShowEventsSwitch);
            _switchEvents.Checked       = ViewModel.Account.MainTileSettings.ShowExams;
            _switchTasks.CheckedChange += new WeakEventHandler <CompoundButton.CheckedChangeEventArgs>(Switch_CheckedChange).Handler;

            _editShowDays              = FindViewById <EditText>(Resource.Id.SettingsWidgetAgendaSkipDaysEditText);
            _editShowDays.TextChanged += new WeakEventHandler <Android.Text.TextChangedEventArgs>(_editShowDays_TextChanged).Handler;

            base.OnViewModelLoadedOverride();
        }
예제 #27
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);
            var view = inflater.Inflate(Resource.Layout.brakecooling_indicational_fragment, container, false);

            _indicationalBrakeCoolingTimeTextView = view.FindViewById <TextView>(Resource.Id.indicationalBrakeCoolingTimeTextView);
            _brakeTemperatureValueEditText        = view.FindViewById <EditText>(Resource.Id.brakeTemperatureValueEditText);
            _indicationalBrakeTypeSwitch          = view.FindViewById <SwitchCompat>(Resource.Id.indicationalBrakeTypeSwitch);
            _indicationalInFlightSwitch           = view.FindViewById <SwitchCompat>(Resource.Id.indicationalInFlightSwitch);

            _brakeTemperatureValueEditText.TextChanged += (s, e) => _indicationalBrakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_indicationalBrakeTypeSwitch.Checked, _indicationalInFlightSwitch.Checked, e.Text.ToString());
            _indicationalBrakeTypeSwitch.CheckedChange += (s, e) => _indicationalBrakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!e.IsChecked, _indicationalInFlightSwitch.Checked, _brakeTemperatureValueEditText.Text);
            _indicationalInFlightSwitch.CheckedChange  += (s, e) => _indicationalBrakeCoolingTimeTextView.Text = _brakeCoolingService.BrakeCoolingMessage(!_indicationalBrakeTypeSwitch.Checked, e.IsChecked, _brakeTemperatureValueEditText.Text);
            view.FindViewById <Button>(Resource.Id.indicationalClearBrakeCoolingButton).Click += (s, e) =>
            {
                view.PerformHapticFeedback(FeedbackConstants.VirtualKey, FeedbackFlags.IgnoreGlobalSetting);
                _brakeTemperatureValueEditText.Text = "";
            };
            return(view);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="T:AiForms.Renderers.Droid.SwitchCellView"/> class.
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="cell">Cell.</param>
        public SwitchCellView(Context context, Cell cell) : base(context, cell)
        {
            _switch = new SwitchCompat(context);

            _switch.SetOnCheckedChangeListener(this);
            _switch.Gravity = Android.Views.GravityFlags.Right;

            var switchParam = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent)
            {
            };

            using (switchParam) {
                AccessoryStack.AddView(_switch, switchParam);
            }

            _switch.Focusable      = false;
            Focusable              = false;
            DescendantFocusability = Android.Views.DescendantFocusability.AfterDescendants;
        }
예제 #29
0
        public AlterColorSwitch(SwitchCompat aswitch, Element element)
        {
            _aSwitch = aswitch;
            _element = element;

            _orgBackground = _aSwitch.Background as RippleDrawable;

            _orgTrack = _aSwitch.TrackDrawable;
            _orgThumb = _aSwitch.ThumbDrawable;

            _background = _orgBackground.GetConstantState().NewDrawable() as RippleDrawable;
            _track      = _aSwitch.TrackDrawable.GetConstantState().NewDrawable();
            _thumb      = _aSwitch.ThumbDrawable.GetConstantState().NewDrawable();

            _track.SetState(_orgTrack.GetState());
            _thumb.SetState(_orgThumb.GetState());

            _aSwitch.Background    = _background;
            _aSwitch.TrackDrawable = _track;
            _aSwitch.ThumbDrawable = _thumb;
        }
예제 #30
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.profile_edit_activity);
            mToolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);       
            SetSupportActionBar(mToolbar);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            svProfile = FindViewById<ScrollView>(Resource.Id.svProfile);
            txtName = FindViewById<EditText>(Resource.Id.edit_profile_name);
            txtAddress = FindViewById<EditText>(Resource.Id.edit_profile_address);
            txtUsername = FindViewById<EditText>(Resource.Id.edit_profile_username);
            txtPassword = FindViewById<EditText>(Resource.Id.edit_profile_password);
            txtPort = FindViewById<EditText>(Resource.Id.edit_profile_port);
            radioEnigma1 = FindViewById<RadioButton>(Resource.Id.rbEnigma1);
            radioEnigma2 = FindViewById<RadioButton>(Resource.Id.rbEnigma2);
            switchStreaming = FindViewById<SwitchCompat>(Resource.Id.switch_streaming);
            txtStreamingPort = FindViewById<EditText>(Resource.Id.edit_streaming_port);
            switchTranscoding = FindViewById<SwitchCompat>(Resource.Id.switch_transcoding);
            txtTranscodingPort = FindViewById<EditText>(Resource.Id.edit_transcoding_port);
            cbUseSsl = FindViewById<CheckBox>(Resource.Id.cbUseSsl);
            layoutStreaming = FindViewById<LinearLayout>(Resource.Id.layout_Streaming);
            layoutTranscoding = FindViewById<LinearLayout>(Resource.Id.layout_Transcoding);

            //update controls content
            if (bundle != null && bundle.ContainsKey(profileNameKey))
            {
                //restore state
                editProfileName = bundle.GetString(profileOriginalNameKey);
                txtName.Text = bundle.GetString(profileNameKey);
                txtAddress.Text = bundle.GetString(profileAddressKey);
                txtUsername.Text = bundle.GetString(profileUsernameKey);
                txtPassword.Text = bundle.GetString(profilePasswordKey);
                txtPort.Text = bundle.GetString(profilePortKey);
                radioEnigma1.Checked = bundle.GetBoolean(profileEnigma1Key);
                radioEnigma2.Checked = bundle.GetBoolean(profileEnigma2Key);
                switchStreaming.Checked = bundle.GetBoolean(profileStreamingKey);
                txtStreamingPort.Text = bundle.GetString(profileStreamingPortKey);
                switchTranscoding.Checked = bundle.GetBoolean(profileTranscodingKey);
                txtTranscodingPort.Text = bundle.GetString(profileTranscodingPortKey);
                cbUseSsl.Checked = bundle.GetBoolean(profileUseSslKey);
                isDirty = bundle.GetBoolean(isDirtyKey);
            }
            else if (Intent != null && Intent.HasExtra(ProfilesFragment.profileNameKey))
            {
                //edit existing profile   
                SignalMeterProfile profile = null;
                editProfileName = Intent.GetStringExtra(ProfilesFragment.profileNameKey);
            
                if (ConnectionManager.Profiles != null)
                {
                    profile = ConnectionManager.Profiles.FirstOrDefault(x => x.Name == editProfileName);
                    if (profile == null)
                        profile = new SignalMeterProfile();
                }
                else
                    profile = new SignalMeterProfile();

                txtName.Text = profile.Name;
                txtAddress.Text = profile.Address;
                txtUsername.Text = profile.Username;
                txtPassword.Text = profile.Password;
                txtPort.Text = profile.HttpPort.ToString();
                radioEnigma1.Checked = profile.Enigma == global::Krkadoni.Enigma.Enums.EnigmaType.Enigma1;
                radioEnigma2.Checked = profile.Enigma == global::Krkadoni.Enigma.Enums.EnigmaType.Enigma2;
                switchStreaming.Checked = profile.Streaming;
                txtStreamingPort.Text = profile.StreamingPort == 0 ? string.Empty : profile.StreamingPort.ToString();
                switchTranscoding.Checked = profile.Transcoding;
                txtTranscodingPort.Text = profile.TranscodingPort == 0 ? string.Empty : profile.TranscodingPort.ToString();
                cbUseSsl.Checked = profile.UseSsl;

            }
            else
            {
                //create new profile

            }

            //add event handlers
            txtName.TextChanged += (sender, e) => isDirty = true;
            txtAddress.TextChanged += (sender, e) => isDirty = true;
            txtUsername.TextChanged += (sender, e) => isDirty = true;
            txtPassword.TextChanged += (sender, e) => isDirty = true;
            txtPort.TextChanged += (sender, e) => isDirty = true;
            radioEnigma1.CheckedChange += (sender, e) => isDirty = true;
            radioEnigma2.CheckedChange += (sender, e) => isDirty = true;
            txtStreamingPort.TextChanged += (sender, e) => isDirty = true;
            txtTranscodingPort.TextChanged += (sender, e) => isDirty = true;
            cbUseSsl.CheckedChange += (sender, e) => isDirty = true;
            switchStreaming.CheckedChange += (sender, e) =>
            {
                isDirty = true;
                layoutStreaming.Visibility = switchStreaming.Checked ? ViewStates.Visible : ViewStates.Gone;
                if (switchStreaming.Checked)
                    svProfile.Post(() => svProfile.ScrollTo(0, svProfile.Bottom));
            };
            switchTranscoding.CheckedChange += (sender, e) =>
            {
                isDirty = true;
                layoutTranscoding.Visibility = switchTranscoding.Checked ? ViewStates.Visible : ViewStates.Gone;
                if (switchTranscoding.Checked)
                    svProfile.Post(() => svProfile.ScrollTo(0, svProfile.Bottom));
            };

            SupportActionBar.Title = string.IsNullOrEmpty(editProfileName) ? 
                GetString(Resource.String.action_add_profile) : 
                editProfileName;
            layoutStreaming.Visibility = switchStreaming.Checked ? ViewStates.Visible : ViewStates.Gone;
            layoutTranscoding.Visibility = switchTranscoding.Checked ? ViewStates.Visible : ViewStates.Gone;

        }
예제 #31
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.welcome_page_five);

            LinearLayout headerLayout = FindViewById <LinearLayout>(Resource.Id.consent_header);
            TextView     header       = headerLayout.FindViewById <TextView>(Resource.Id.welcome_page_five_title);

            header.Text = ConsentViewModel.WELCOME_PAGE_CONSENT_TITLE;

            Button previousButton = FindViewById <Button>(Resource.Id.welcome_page_five_prev_button);

            previousButton.Click += new SingleClick(PreviousButtonPressed, 500).Run;
            previousButton.Text   = WelcomeViewModel.PREVIOUS_PAGE_BUTTON_TEXT;

            Button nextButton = FindViewById <Button>(Resource.Id.welcome_page_five_button_next);

            nextButton.Click += new SingleClick(NextButtonPressed, 500).Run;
            nextButton.Text   = WelcomeViewModel.NEXT_PAGE_BUTTON_TEXT;

            _switchCustom = FindViewById <SwitchCompat>(Resource.Id.welcome_page_five_switch);
            _switchCustom.CheckedChange     += OnCheckedChange;
            _switchCustom.ContentDescription = ConsentViewModel.SWITCH_ACCESSIBILITY_CONSENT_SWITCH_DESCRIPTOR;

            _consentWarning = FindViewById <LinearLayout>(Resource.Id.welcome_page_five_consent_warning);
            SetConsentWarningShown(false);
            _consentWarningTextView      = FindViewById <TextView>(Resource.Id.welcome_page_five_consent_warning_text);
            _consentWarningTextView.Text = ConsentViewModel.CONSENT_REQUIRED;

            TextView consentTextView = FindViewById <TextView>(Resource.Id.welcome_page_five_switch_text);

            consentTextView.Text     = ConsentViewModel.GIVE_CONSENT_TEXT;
            consentTextView.LabelFor = _switchCustom.Id;

            RelativeLayout RelativeLayout1 = FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_frivillig_brug);
            RelativeLayout RelativeLayout2 = FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_sadan_fungerer_appen);
            RelativeLayout RelativeLayout3 = FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_hvad_registreres);
            RelativeLayout RelativeLayout4 = FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_hvordan_accepterer);
            RelativeLayout RelativeLayout5 = FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_ret);
            RelativeLayout RelativeLayout6 = FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_kontaktregistringer);
            RelativeLayout RelativeLayout7 = FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_mere);
            RelativeLayout RelativeLayout8 = FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_behandlingen);
            RelativeLayout RelativeLayout9 = FindViewById <RelativeLayout>(Resource.Id.consent_paragraph_aendringer);

            TextView consentOneTitle   = RelativeLayout1.FindViewById <TextView>(Resource.Id.consent_page_title);
            TextView consentTwoTitle   = RelativeLayout2.FindViewById <TextView>(Resource.Id.consent_page_title);
            TextView consentThreeTitle = RelativeLayout3.FindViewById <TextView>(Resource.Id.consent_page_title);
            TextView consentFourTitle  = RelativeLayout4.FindViewById <TextView>(Resource.Id.consent_page_title);
            TextView consentFiveTitle  = RelativeLayout5.FindViewById <TextView>(Resource.Id.consent_page_title);
            TextView consentSixTitle   = RelativeLayout6.FindViewById <TextView>(Resource.Id.consent_page_title);
            TextView consentSevenTitle = RelativeLayout7.FindViewById <TextView>(Resource.Id.consent_page_title);
            TextView consentEightTitle = RelativeLayout8.FindViewById <TextView>(Resource.Id.consent_page_title);
            TextView consentNineTitle  = RelativeLayout9.FindViewById <TextView>(Resource.Id.consent_page_title);

            consentOneTitle.Text   = ConsentViewModel.CONSENT_ONE_TITLE;
            consentTwoTitle.Text   = ConsentViewModel.CONSENT_TWO_TITLE;
            consentThreeTitle.Text = ConsentViewModel.CONSENT_THREE_TITLE;
            consentFourTitle.Text  = ConsentViewModel.CONSENT_FOUR_TITLE;
            consentFiveTitle.Text  = ConsentViewModel.CONSENT_FIVE_TITLE;
            consentSixTitle.Text   = ConsentViewModel.CONSENT_SIX_TITLE;
            consentSevenTitle.Text = ConsentViewModel.CONSENT_SEVEN_TITLE;
            consentEightTitle.Text = ConsentViewModel.CONSENT_EIGHT_TITLE;
            consentNineTitle.Text  = ConsentViewModel.CONSENT_NINE_TITLE;

            consentOneTitle.ContentDescription   = ConsentViewModel.CONSENT_ONE_TITLE.ToLower();
            consentTwoTitle.ContentDescription   = ConsentViewModel.CONSENT_TWO_TITLE.ToLower();
            consentThreeTitle.ContentDescription = ConsentViewModel.CONSENT_THREE_TITLE.ToLower();
            consentFourTitle.ContentDescription  = ConsentViewModel.CONSENT_FOUR_TITLE.ToLower();
            consentFiveTitle.ContentDescription  = ConsentViewModel.CONSENT_FIVE_TITLE.ToLower();
            consentSixTitle.ContentDescription   = ConsentViewModel.CONSENT_SIX_TITLE.ToLower();
            consentSevenTitle.ContentDescription = ConsentViewModel.CONSENT_SEVEN_TITLE.ToLower();
            consentEightTitle.ContentDescription = ConsentViewModel.CONSENT_EIGHT_TITLE.ToLower();
            consentNineTitle.ContentDescription  = ConsentViewModel.CONSENT_NINE_TITLE.ToLower();

            RelativeLayout1.FindViewById <TextView>(Resource.Id.consent_page_text).TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_ONE_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy);
            RelativeLayout2.FindViewById <TextView>(Resource.Id.consent_page_text).TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_TWO_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy);
            RelativeLayout3.FindViewById <TextView>(Resource.Id.consent_page_text).TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_THREE_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy);
            RelativeLayout4.FindViewById <TextView>(Resource.Id.consent_page_text).TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_FOUR_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy);
            RelativeLayout5.FindViewById <TextView>(Resource.Id.consent_page_text).TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_FIVE_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy);
            RelativeLayout6.FindViewById <TextView>(Resource.Id.consent_page_text).TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_SIX_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy);
            RelativeLayout7.FindViewById <TextView>(Resource.Id.consent_page_text).TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_SEVEN_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy);
            RelativeLayout8.FindViewById <TextView>(Resource.Id.consent_page_text).TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_EIGHT_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy);
            RelativeLayout9.FindViewById <TextView>(Resource.Id.consent_page_text).TextFormatted = HtmlCompat.FromHtml(ConsentViewModel.CONSENT_NINE_PARAGRAPH, HtmlCompat.FromHtmlModeLegacy);

            Button policyLinkBtn = FindViewById <Button>(Resource.Id.consent_paragraph_policy_btn);

            policyLinkBtn.Text   = ConsentViewModel.CONSENT_SEVEN_BUTTON_TEXT;
            policyLinkBtn.Click += PolicyLinkBtn_Click;
        }
예제 #32
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);

            //base.OnCreateView(inflater, container, savedInstanceState);

            // Get the view from fragment xml
            signalView = inflater.Inflate(Resource.Layout.signal_fragment, container, false);
            signalLevelsView = signalView.FindViewById<LinearLayout>(Resource.Id.signalLevels);

            IsLandscape = (Activity.FindViewById(Resource.Id.tablet_layout) != null);
            if (IsLandscape)
            {
                btnMonitor = signalView.FindViewById<Button>(Resource.Id.button_signal_monitor);
                btnMonitor.Click += async (sender, e) => StartStopMonitor();
            }

            lblCurrentService = signalView.FindViewById<TextView>(Resource.Id.lblCurrentService);   
            lblCurrentService.Text = string.Empty;
            lblCurrentService.Click += (sender, e) => ((MainActivity)Activity).DisplayView(MainEventHandlers.ViewsEnum.Services);
            lblCurrentSatellite = signalView.FindViewById<TextView>(Resource.Id.lblCurrentSatellite);   
            lblCurrentSatellite.Text = string.Empty;

            lblSNR = signalView.FindViewById<TextView>(Resource.Id.lblSNR); 
            pbSNR = signalView.FindViewById<ProgressBar>(Resource.Id.pbSNR);
            pbSNR.ProgressDrawable = Resources.GetDrawable(Resource.Drawable.progress);

            lbldB = signalView.FindViewById<TextView>(Resource.Id.lbldB);   
            pbdB = signalView.FindViewById<ProgressBar>(Resource.Id.pbdB);
            pbdB.ProgressDrawable = Resources.GetDrawable(Resource.Drawable.progress);

            lblAGC = signalView.FindViewById<TextView>(Resource.Id.lblAGC); 
            pbAGC = signalView.FindViewById<ProgressBar>(Resource.Id.pbAGC);
            pbAGC.ProgressDrawable = Resources.GetDrawable(Resource.Drawable.progress);

            lblBER = signalView.FindViewById<TextView>(Resource.Id.lblBER); 
            pbBER = signalView.FindViewById<ProgressBar>(Resource.Id.pbBER);
            pbBER.ProgressDrawable = Resources.GetDrawable(Resource.Drawable.progress_reverse);

            ceLOCK = signalView.FindViewById<CheckBox>(Resource.Id.ceLock);
            ceSYNC = signalView.FindViewById<CheckBox>(Resource.Id.ceSync); 

            lblrqTime = signalView.FindViewById<TextView>(Resource.Id.lblrqTime);
            switchVoice = signalView.FindViewById<SwitchCompat>(Resource.Id.switch_voice);
            switchVoice.CheckedChange += (sender, e) => SwitchTts();

            return signalView;
        }
예제 #33
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            View view = (View) inflater.Inflate(Resource.Layout.SheZhiLayout,container, false);
            mVersion = view.FindViewById<TextView> (Resource.Id.sheZhiversion);
            mSwitch = view.FindViewById<SwitchCompat> (Resource.Id.toggleButton1);
            mSwitchVib = view.FindViewById<SwitchCompat> (Resource.Id.toggleButton2);
            mUpdateLayout = view.FindViewById<LinearLayout> (Resource.Id.BanBenGengXinLayout);
            mZhuXiaoLayout = view.FindViewById<LinearLayout> (Resource.Id.zhuxiaodenglu);
            mLiuLiangTongJi = view.FindViewById<LinearLayout> (Resource.Id.liuLiangShiYong);

            mProgressbar = view.FindViewById<ProgressBar> (Resource.Id.progressBar);

            mProgressbar.Visibility = ViewStates.Invisible;

            mVersion.Text = Application.Context.PackageManager.GetPackageInfo (Application.Context.PackageName, 0).VersionName;

            try{
                var prefs = Application.Context.GetSharedPreferences("MySwitchState", FileCreationMode.Private);
                somePref = prefs.GetString("PrefName", null);

            }catch{

            }

            switch (somePref)
            {
            case "False":
                mSwitch.Checked = false;
                break;
            case "True":
                mSwitch.Checked = true;
                break;
            default:
                mSwitch.Checked = true;
                break;
            }

            mSwitch.Click += delegate {

                if (mSwitch.Checked)
                {
                    var prefs1 = Application.Context.GetSharedPreferences("MySwitchState", FileCreationMode.Private);
                    var prefEditor = prefs1.Edit();
                    prefEditor.PutString("PrefName", "True");
                    prefEditor.Commit();

                }
                else
                {
                    var prefs2 = Application.Context.GetSharedPreferences("MySwitchState", FileCreationMode.Private);
                    var prefEditor = prefs2.Edit();
                    prefEditor.PutString("PrefName", "False");
                    prefEditor.Commit();

                }

            };

            try{
                var prefs2 = Application.Context.GetSharedPreferences("MySwitchState2", FileCreationMode.Private);
                vibPref = prefs2.GetString("vibState", null);

            }catch{

            }

            switch (vibPref)
            {
            case "False":
                mSwitchVib.Checked = false;
                break;
            case "True":
                mSwitchVib.Checked = true;
                break;
            default:
                mSwitchVib.Checked = true;
                break;
            }

            mSwitchVib.Click += delegate {

                if (mSwitchVib.Checked)
                {
                    var prefs1 = Application.Context.GetSharedPreferences("MySwitchState2", FileCreationMode.Private);
                    var prefEditor = prefs1.Edit();
                    prefEditor.PutString("vibState", "True");
                    prefEditor.Commit();

                }
                else
                {
                    var prefs2 = Application.Context.GetSharedPreferences("MySwitchState2", FileCreationMode.Private);
                    var prefEditor = prefs2.Edit();
                    prefEditor.PutString("vibState", "False");
                    prefEditor.Commit();

                }

            };

            mLiuLiangTongJi.Click += delegate {

            //				long datausage= TrafficStats.GetUidTxBytes(Android.OS.Process.MyUid())/(1024*1024);
            //
            //				string msg=String.Format(datausage.ToString()+"MB");
            //
            //				Toast mToast = Toast.MakeText (Application.Context, msg, ToastLength.Long);
            //				mToast.Show ();
            //

                float dataRX= (float)TrafficStats.GetUidRxBytes(Android.OS.Process.MyUid())/(float)(1024*1024);
                float dataTX= (float)TrafficStats.GetUidTxBytes(Android.OS.Process.MyUid())/(float)(1024*1024);

                View customToastroot =inflater.Inflate(Resource.Layout.myCustomToast, null);
                Toast customtoast=new Toast(Application.Context);

                TextView mdataRX=customToastroot.FindViewById<TextView>(Resource.Id.customToastText1);
                TextView mdataTX=customToastroot.FindViewById<TextView>(Resource.Id.customToastText2);

                mdataRX.Text=String.Format(" 下载使用流量总计: "+dataRX.ToString("0.00")+"MB");
                mdataTX.Text=String.Format(" 上传使用流量总计: "+dataTX.ToString("0.00")+"MB");

                customtoast.View=customToastroot;
                customtoast.SetGravity(GravityFlags.CenterHorizontal | GravityFlags.Bottom ,0, 80);
                customtoast.Duration=ToastLength.Long;
                customtoast.Show();

            };

            mUpdateLayout.Click += delegate {

                mProgressbar.Visibility = ViewStates.Visible;

                mWorker=new BackgroundWorker();

                mWorker.DoWork +=delegate {
                    checkVersion();
                    Thread.Sleep(1500);
                };

                mWorker.RunWorkerCompleted += delegate {

                    mProgressbar.Visibility = ViewStates.Gone;
                    onWorkCompleted();
                };

                mWorker.RunWorkerAsync();

            };

            mZhuXiaoLayout.Click += delegate {

                var callDialog = new AlertDialog.Builder(Activity);
                callDialog.SetMessage(string.Format("您确定注销登录吗?"));
                callDialog.SetNeutralButton("确定", delegate {

                    Intent service = new Intent (Application.Context, typeof(UpdateServices));
                    Activity.StopService (service);

                    Intent i = new Intent(Activity, typeof(LogInPage));
                    // set the new task and clear flags
                    i.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask);
                    Activity.StartActivity(i);
                    Activity.OverridePendingTransition(Resource.Animation.slide_in_bottom, Resource.Animation.slide_out_top);

                });
                callDialog.SetNegativeButton("取消", delegate { });

                // Show the alert dialog to the user and wait for response.
                callDialog.Show();

            };

            return view;
        }