Ejemplo n.º 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var mainView = inflater.Inflate(Resource.Layout.fragment_joblist, container, false);

            _progressDialog = mainView.FindViewById <ProgressBar>(Resource.Id.loadingIndicator);

            //ShowLoadingIndicator();

            var recycler  = mainView.FindViewById <RecyclerView>(Resource.Id.jobs_list);
            var llManager = new LinearLayoutManager(this.Context);

            llManager.Orientation = LinearLayoutManager.Vertical;

            recycler.SetLayoutManager(llManager);

            _jobListAdapter = new JobListAdapter(_jobs);
            recycler.SetAdapter(_jobListAdapter);

            this.HasOptionsMenu = true;

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

            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            //SupportActionBar.SetDisplayShowCustomEnabled(true);
            SupportActionBar.Title = string.Format(GetString(Resource.String.xml_tool_ecu_title), Intent.GetStringExtra(ExtraEcuName) ?? string.Empty);
            SetContentView(Resource.Layout.xml_tool_ecu);

            _imm         = (InputMethodManager)GetSystemService(InputMethodService);
            _contentView = FindViewById <View>(Android.Resource.Id.Content);

            SetResult(Android.App.Result.Canceled);

            _activityCommon = new ActivityCommon(this);
            _ecuInfo        = IntentEcuInfo;
            _ediabas        = IntentEdiabas;

            _editTextPageName      = FindViewById <EditText>(Resource.Id.editTextPageName);
            _editTextPageName.Text = _ecuInfo.PageName;

            _editTextEcuName      = FindViewById <EditText>(Resource.Id.editTextEcuName);
            _editTextEcuName.Text = _ecuInfo.EcuName;

            _spinnerJobs         = FindViewById <Spinner>(Resource.Id.spinnerJobs);
            _spinnerJobsAdapter  = new JobListAdapter(this);
            _spinnerJobs.Adapter = _spinnerJobsAdapter;
            _spinnerJobs.SetOnTouchListener(this);
            _spinnerJobs.ItemSelected += (sender, args) =>
            {
                int pos = args.Position;
                JobSelected(pos >= 0 ? _spinnerJobsAdapter.Items[pos] : null);
            };

            _layoutJobConfig = FindViewById <LinearLayout>(Resource.Id.layoutJobConfig);
            _layoutJobConfig.SetOnTouchListener(this);

            _textViewJobCommentsTitle = FindViewById <TextView>(Resource.Id.textViewJobCommentsTitle);
            _textViewJobComments      = FindViewById <TextView>(Resource.Id.textViewJobComments);

            _spinnerJobResults               = FindViewById <Spinner>(Resource.Id.spinnerJobResults);
            _spinnerJobResultsAdapter        = new ResultListAdapter(this);
            _spinnerJobResults.Adapter       = _spinnerJobResultsAdapter;
            _spinnerJobResults.ItemSelected += (sender, args) =>
            {
                ResultSelected(args.Position);
            };

            _textViewResultCommentsTitle = FindViewById <TextView>(Resource.Id.textViewResultCommentsTitle);
            _textViewResultComments      = FindViewById <TextView>(Resource.Id.textViewResultComments);
            _editTextDisplayText         = FindViewById <EditText>(Resource.Id.editTextDisplayText);
            _editTextLogTag = FindViewById <EditText>(Resource.Id.editTextLogTag);

            _textViewFormatDot = FindViewById <TextView>(Resource.Id.textViewFormatDot);
            _editTextFormat    = FindViewById <EditText>(Resource.Id.editTextFormat);

            _spinnerFormatPos         = FindViewById <Spinner>(Resource.Id.spinnerFormatPos);
            _spinnerFormatPosAdapter  = new StringAdapter(this);
            _spinnerFormatPos.Adapter = _spinnerFormatPosAdapter;
            _spinnerFormatPosAdapter.Items.Add(GetString(Resource.String.xml_tool_ecu_format_right));
            _spinnerFormatPosAdapter.Items.Add(GetString(Resource.String.xml_tool_ecu_format_left));
            _spinnerFormatPosAdapter.NotifyDataSetChanged();
            _spinnerFormatPos.ItemSelected += FormatItemSelected;

            _spinnerFormatLength1         = FindViewById <Spinner>(Resource.Id.spinnerFormatLength1);
            _spinnerFormatLength1Adapter  = new StringObjAdapter(this);
            _spinnerFormatLength1.Adapter = _spinnerFormatLength1Adapter;
            _spinnerFormatLength1Adapter.Items.Add(new StringObjType("--", -1));
            foreach (int value in LengthValues)
            {
                _spinnerFormatLength1Adapter.Items.Add(new StringObjType(value.ToString(), value));
            }
            _spinnerFormatLength1Adapter.NotifyDataSetChanged();
            _spinnerFormatLength1.ItemSelected += FormatItemSelected;

            _spinnerFormatLength2         = FindViewById <Spinner>(Resource.Id.spinnerFormatLength2);
            _spinnerFormatLength2Adapter  = new StringObjAdapter(this);
            _spinnerFormatLength2.Adapter = _spinnerFormatLength2Adapter;
            _spinnerFormatLength2Adapter.Items.Add(new StringObjType("--", -1));
            foreach (int value in LengthValues)
            {
                _spinnerFormatLength2Adapter.Items.Add(new StringObjType(value.ToString(), value));
            }
            _spinnerFormatLength2Adapter.NotifyDataSetChanged();
            _spinnerFormatLength2.ItemSelected += FormatItemSelected;

            _spinnerFormatType         = FindViewById <Spinner>(Resource.Id.spinnerFormatType);
            _spinnerFormatTypeAdapter  = new StringObjAdapter(this);
            _spinnerFormatType.Adapter = _spinnerFormatTypeAdapter;
            _spinnerFormatTypeAdapter.Items.Add(new StringObjType("--", FormatType.None));
            _spinnerFormatTypeAdapter.NotifyDataSetChanged();
            _spinnerFormatType.ItemSelected += FormatItemSelected;

            _buttonTestFormat         = FindViewById <Button>(Resource.Id.buttonTestFormat);
            _buttonTestFormat.Enabled = _ediabas != null;
            _buttonTestFormat.Click  += (sender, args) =>
            {
                ExecuteTestFormat();
            };
            _textViewTestFormatOutput = FindViewById <TextView>(Resource.Id.textViewTestFormatOutput);

            _layoutJobConfig.Visibility = ViewStates.Gone;
            UpdateDisplay();
            ResetTestResult();
        }