Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            //  Thread.CurrentThread.CurrentCulture = new CultureInfo("bg-BG");

            CultureInfo.DefaultThreadCurrentCulture = new CultureInfo("bg-BG");


            mHour = FindViewById <TextView>(Resource.Id.Hour);
            mDate = FindViewById <TextView>(Resource.Id.Date);

            mAbonati     = FindViewById <TextView>(Resource.Id.Customers);
            mObnoveniKum = FindViewById <TextView>(Resource.Id.Updated);

            mListView = FindViewById <ListView>(Resource.Id.myListView);
            mToolBar  = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);
            SetSupportActionBar(mToolBar);
            SupportActionBar.Title = "Начало ";

            mJobScheduler = (JobScheduler)GetSystemService(Context.JobSchedulerService);
            //  mJobScheduler = (JobScheduler)(android.app.JobSchedulerImpl@8652ee9);
            // JobInfo job = new JobInfo();
            // mJobScheduler.Schedule(job);

            //  mJobScheduler.CancelAll();

            // !=
            if (mJobScheduler == null || mJobScheduler.AllPendingJobs.Count == 0)
            {
                StartService();
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MyActionBarDrawerToggle"/> class.
 /// </summary>
 /// <param name="activity">The activity.</param>
 /// <param name="layout">The layout.</param>
 /// <param name="toolbar">The toolbar.</param>
 /// <param name="openRes">The open resource.</param>
 /// <param name="closeRes">The close resource.</param>
 public MyActionBarDrawerToggle(HomeActivity activity,
                                DrawerLayout layout,
                                Android.Support.V7.Widget.Toolbar toolbar,
                                int openRes,
                                int closeRes)
     : base(activity, layout, toolbar, openRes, closeRes)
 {
     owner = activity;
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

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


            mToolBar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.basicToolbar);
            SetSupportActionBar(mToolBar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            sent             = FindViewById <Button>(Resource.Id.Sent);
            addPicFromCamera = FindViewById <Button>(Resource.Id.Camera);
            addPicFromGalary = FindViewById <Button>(Resource.Id.Gallery);
            mCity            = FindViewById <EditText>(Resource.Id.City);
            mAddress         = FindViewById <EditText>(Resource.Id.Address);
            mDescription     = FindViewById <EditText>(Resource.Id.Description);
            mFullName        = FindViewById <EditText>(Resource.Id.FullName);
            mPhoneNumber     = FindViewById <EditText>(Resource.Id.phoneNumber);
            mError           = FindViewById <TextView>(Resource.Id.error);

            mFinalCryptPassword = string.Empty;

            pic = FindViewById <ImageView>(Resource.Id.imageView1);

            mIsFromGalleryPressed = false;
            mError.Visibility     = ViewStates.Invisible;


            if (IsThereAnAppToTakePictures())
            {
                CreateDirectoryForPictures();

                addPicFromCamera = FindViewById <Button>(Resource.Id.Camera);
                pic = FindViewById <ImageView>(Resource.Id.imageView1);

                addPicFromCamera.Click += TakeAPicture;
            }

            addPicFromGalary.Click += (object sender, EventArgs e) =>
            {
                mIsFromGalleryPressed = true;

                var intent = new Intent();
                intent.SetType("image/*");
                intent.SetAction(Intent.ActionGetContent);
                this.StartActivityForResult(Intent.CreateChooser(intent, "Select a photo"), 0);
            };

            sent.Visibility = ViewStates.Visible;
            sent.Click     += Sent_Click;
        }
Пример #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.AddCustomerView);

            mCustomers = new List <Customer>();

            mError       = FindViewById <TextView>(Resource.Id.error);
            mAddCustomer = FindViewById <Button>(Resource.Id.AddCustomer);
            mBillNumber  = FindViewById <EditText>(Resource.Id.BillNumber);
            mEgn         = FindViewById <EditText>(Resource.Id.EGN);
            mToolBar     = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.basicToolbar1);
            // mProgressBar = FindViewById<ProgressBar>(Resource.Id.progressBar1);

            mError.Visibility = ViewStates.Invisible;
            //mProgressBar.Visibility = ViewStates.Invisible;

            SetSupportActionBar(mToolBar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            mAddCustomer.Click += MAddCustomer_Click;
        }
Пример #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            receiver = new NetworkBroadcastReceiver(this);
            receiver.SetListener(this);
            intentFilter = new IntentFilter("android.net.conn.CONNECTIVITY_CHANGE");
            RegisterReceiver(receiver, intentFilter);

            tvNetworkNotification = (TextView)FindViewById(Resource.Id.network_notification);
            ConnectivityManager cm = (ConnectivityManager)this.GetSystemService(Context.ConnectivityService);

            if (cm.ActiveNetworkInfo == null)
            {
                var ad = new Android.Support.V7.App.AlertDialog.Builder(this);
                ad.SetTitle("No Connection");
                ad.SetMessage("Looks like there's a problem with your network connection. Try again later.");
                ad.SetCancelable(false);
                ad.SetPositiveButton("OK", this);
                Android.Support.V7.App.AlertDialog dialog = ad.Create();
                dialog.Show();
            }
            else
            {
                MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.googlemap);
                mapFragment.GetMapAsync(this);

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

                // Deserialize the member object
                ISharedPreferences pref = GetSharedPreferences(GetString(Resource.String.PreferenceFileName), FileCreationMode.Private);
                var member = pref.GetString(GetString(Resource.String.PreferenceSavedMember), "");
                user = JsonConvert.DeserializeObject <Member>(member);

                var profile = new ProfileDrawerItem();
                profile.WithName(user.username);
                profile.WithIdentifier(100);

                headerResult = new AccountHeaderBuilder()
                               .WithActivity(this)
                               .WithHeaderBackground(Resource.Drawable.profilebackground)
                               .WithSelectionListEnabledForSingleProfile(false)
                               .AddProfiles(profile)
                               .WithOnAccountHeaderListener(this)
                               .WithSavedInstance(bundle)
                               .Build();

                var header = new PrimaryDrawerItem();
                header.WithName(Resource.String.Drawer_Item_Trips);
                header.WithIcon(GoogleMaterial.Icon.GmdDirectionsCar);
                header.WithIdentifier(1);

                var logoutDrawer = new SecondaryDrawerItem();
                logoutDrawer.WithName(Resource.String.Drawer_Item_Logout);
                logoutDrawer.WithIcon(GoogleMaterial.Icon.GmdSettingsPower);
                logoutDrawer.WithIdentifier(4);

                //create the drawer and remember the `Drawer` result object
                Drawer result = new DrawerBuilder()
                                .WithActivity(this)
                                .WithToolbar(toolbar)
                                .WithAccountHeader(headerResult)
                                .AddDrawerItems(
                    header,
                    new DividerDrawerItem(),
                    logoutDrawer
                    )
                                .WithOnDrawerItemClickListener(this)
                                .Build();

                originAutocompleteFragment = (PlaceAutocompleteFragment)
                                             FragmentManager.FindFragmentById(Resource.Id.place_autocomplete_origin_fragment);
                originAutocompleteFragment.SetHint("Enter the origin");
                originAutocompleteFragment.PlaceSelected += OnOriginSelected;

                destAutocompleteFragment = (PlaceAutocompleteFragment)
                                           FragmentManager.FindFragmentById(Resource.Id.place_autocomplete_destination_fragment);
                destAutocompleteFragment.SetHint("Enter the destination");
                destAutocompleteFragment.PlaceSelected += OnDestinationSelected;

                progress = new ProgressDialog(this);
                progress.Indeterminate = true;
                progress.SetProgressStyle(ProgressDialogStyle.Spinner);
                progress.SetMessage("Getting location...");
                progress.SetCancelable(false);
                RunOnUiThread(() =>
                {
                    progress.Show();
                });

                // Request Update request
                locationManager = (LocationManager)GetSystemService(Context.LocationService);
                IList <string> providers    = locationManager.AllProviders;
                Criteria       criteria     = new Criteria();
                string         bestProvider = locationManager.GetBestProvider(criteria, true);
                locationManager.RequestLocationUpdates(bestProvider, MIN_TIME, MIN_DISTANCE, this);
            }
        }