Example #1
0
        protected override void OnCreate(Bundle bundle)
        {
            StartSetup();
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.BarcodeEntry);

            prefs              = PreferenceManager.GetDefaultSharedPreferences(this);
            locationname       = prefs.GetString("LocationName", "");
            EditInventoryID    = prefs.GetString("EditFromItemListForBarcode", "");
            AccessBarCodeScan  = prefs.GetString("AccessBarCodeScan", "");
            AccessFindITExport = prefs.GetString("AccessFindITExport", "");
            AccessExport       = prefs.GetString("AccessExport", "");
            editor             = prefs.Edit();

            _fab             = FindViewById <Fab>(Resource.Id.btnSaveBarCode);
            _fab.FabColor    = Color.Blue;
            _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.icon_save2x);
            _fab.Show();
            _fabbacktolist = FindViewById <ImageView>(Resource.Id.btnBarBacktolist);



            empid        = prefs.GetLong("EmpID", 0);
            projectid    = prefs.GetLong("ProjectID", 0);
            projectname  = prefs.GetString("ProjectName", "");
            clientname   = prefs.GetString("ClientName", "");
            AlertVibrate = prefs.GetInt("AlertVibrate", 0);
            AlertTone    = prefs.GetInt("AlertTone", 0);
            editor       = prefs.Edit();

            SetTypeFace();
        }
Example #2
0
        private void Init()
        {
            if (Device.RuntimePlatform == Device.iOS)
            {
                ToolbarItems.Add(new DismissModalToolBarItem(this));
            }

            InitProps();

            var fabLayout = new FabLayout(Table);

            if (Device.RuntimePlatform == Device.Android)
            {
                Fab = new Fab(fabLayout, "pencil.png", async(sender, args) =>
                {
                    await Navigation.PushForDeviceAsync(new VaultEditCipherPage(_cipherId));
                });
            }
            else
            {
                EditItem = new EditCipherToolBarItem(this, _cipherId);
                ToolbarItems.Add(EditItem);
            }

            Content        = fabLayout;
            Title          = AppResources.ViewItem;
            BindingContext = Model;
        }
Example #3
0
        private static SimTypeAsset CreateModifiedSimType(Fab fab, string maleName, string femaleName, string baseSimName)
        {
            var bytes = FabData[(int)fab].ToArray();
            var ix    = bytes.AsSpan().IndexOf(new byte[8] {
                0x06, 0, 0, 0, 0x07, 0, 0, 0
            });
            var modified = false;

            if (FabDictByName.TryGetValue($"{maleName}{fab}", out uint maleId))
            {
                modified = true;
                bytes.Write(ix + 28, maleId);
            }
            if (FabDictByName.TryGetValue($"{femaleName}{fab}", out uint femaleId))
            {
                modified = true;
                bytes.Write(ix + 32, femaleId);
            }
            if (!modified)
            {
                return(null);
            }
            maleId   = bytes.Read <uint>(ix + 28);
            femaleId = bytes.Read <uint>(ix + 32);
            var name        = $"{baseSimName}{fab}";
            var bundleBytes = new byte[30];

            bundleBytes.Write(8, 2);
            bundleBytes.Write(16, maleId);
            bundleBytes.Write(20, femaleId);
            bundleBytes.Write(24, 0x00_00_10_10);
            return(new SimTypeAsset(name, bytes, bundleBytes));
        }
Example #4
0
 /// <summary>
 ///   This method will update the TextView and the ImageView that are
 ///   are
 /// </summary>
 /// <param name="fileName"> </param>
 /// <param name="fileImageResourceId"> </param>
 public void Update(string fileTime, string fileName, int fileImageResourceId)
 {
     if (fileTime == null)
     {
         TimeTextView.Text       = "";
         TimeTextView.Visibility = Android.Views.ViewStates.Gone;
     }
     else
     {
         TimeTextView.Text       = fileTime;
         TimeTextView.Visibility = Android.Views.ViewStates.Visible;
     }
     TextView.Text = fileName;
     ImageView.SetImageResource(fileImageResourceId);
     Fab.SetImageResource(fileImageResourceId);
     if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
     {
         Fab.Visibility       = Android.Views.ViewStates.Visible;
         ImageView.Visibility = Android.Views.ViewStates.Gone;
     }
     else
     {
         Fab.Visibility       = Android.Views.ViewStates.Gone;
         ImageView.Visibility = Android.Views.ViewStates.Visible;
     }
 }
Example #5
0
        private void CalculateHeaderTranslation(ScrolledEventArgs e)
        {
            this.Content.FindByName("Scale");
            double translation = 0;

            if (_image == null)
            {
                _herosection = (Grid)Flex.Children[0];
                _image       = (Image)_herosection.Children[0];
            }

            var _threshold = 180;


            if (e.ScrollY > _threshold && !_headerVisible)
            {
                Header.FadeTo(1).SafeFireAndForget();

                Fab.ScaleTo(0);
                _headerVisible = true;
            }
            else if (e.ScrollY < _threshold && _headerVisible)
            {
                Header.FadeTo(0).SafeFireAndForget();
                Fab.ScaleTo(1).SafeFireAndForget();
                _headerVisible = false;
            }
            System.Console.WriteLine(e.ScrollY);
            var scaleFactor = (2175 - e.ScrollY) / 1500;

            _image.Scale     = scaleFactor;
            Fab.TranslationY = -e.ScrollY;
            _lastScroll      = e.ScrollY;
        }
        private void Init()
        {
            ListView = new ExtendedListView
            {
                ItemsSource  = Folders,
                ItemTemplate = new DataTemplate(() => new SettingsFolderListViewCell(this))
            };

            if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.UWP)
            {
                ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Close));
            }

            var fabLayout = new FabLayout(ListView);

            if (Device.RuntimePlatform == Device.Android)
            {
                Fab = new Fab(fabLayout, "plus.png", async(sender, args) =>
                {
                    await Navigation.PushForDeviceAsync(new SettingsAddFolderPage());
                });
                ListView.BottomPadding = 50;
            }
            else
            {
                AddItem = new AddFolderToolBarItem(this);
                ToolbarItems.Add(AddItem);
            }

            Title   = AppResources.Folders;
            Content = fabLayout;
        }
 void Fab_Clicked(object arg1, EventArgs arg2)
 {
     if (Fab.Rotation == 0)
     {
         Fab.RotateTo(315, 500, Easing.SpringOut);
     }
     else
     {
         Fab.RotateTo(0, 500, Easing.SpringOut);
     }
 }
Example #8
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            _fab = FindViewById<Fab>(Resource.Id.button_floating_action);
            _fab.FabColor = Color.Purple;
            _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_profil_plus);
        }
Example #9
0
        private void Init()
        {
            ListView = new ExtendedListView(ListViewCachingStrategy.RecycleElement)
            {
                IsGroupingEnabled   = true,
                ItemsSource         = PresentationSections,
                HasUnevenRows       = true,
                GroupHeaderTemplate = new DataTemplate(() => new SectionHeaderViewCell(
                                                           nameof(Section <Grouping> .Name), nameof(Section <Grouping> .Count))),
                GroupShortNameBinding = new Binding(nameof(Section <Grouping> .NameShort)),
                ItemTemplate          = new GroupingOrCipherDataTemplateSelector(this)
            };

            if (Device.RuntimePlatform == Device.iOS)
            {
                ListView.RowHeight = -1;
            }

            Search = new SearchBar
            {
                Placeholder       = AppResources.Search,
                FontSize          = Device.GetNamedSize(NamedSize.Small, typeof(Button)),
                CancelButtonColor = Color.FromHex("3c8dbc")
            };
            // Bug with search bar on android 7, ref https://bugzilla.xamarin.com/show_bug.cgi?id=43975
            if (Device.RuntimePlatform == Device.Android && _deviceInfoService.Version >= 24)
            {
                Search.HeightRequest = 50;
            }

            var noDataLabel = new Label
            {
                Text = _favorites ? AppResources.NoFavorites : AppResources.NoItems,
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                Style    = (Style)Application.Current.Resources["text-muted"]
            };

            if (_folder || !string.IsNullOrWhiteSpace(_folderId))
            {
                noDataLabel.Text = AppResources.NoItemsFolder;
            }
            else if (!string.IsNullOrWhiteSpace(_collectionId))
            {
                noDataLabel.Text = AppResources.NoItemsCollection;
            }

            NoDataStackLayout = new StackLayout
            {
                Children        = { noDataLabel },
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Padding         = new Thickness(20, 0),
                Spacing         = 20
            };

            if (string.IsNullOrWhiteSpace(_collectionId) && !_favorites)
            {
                NoDataStackLayout.Children.Add(new ExtendedButton
                {
                    Text    = AppResources.AddAnItem,
                    Command = new Command(() => Helpers.AddCipher(this, _folderId)),
                    Style   = (Style)Application.Current.Resources["btn-primaryAccent"]
                });
            }

            ResultsStackLayout = new StackLayout
            {
                Children = { Search, ListView },
                Spacing  = 0
            };

            if (!string.IsNullOrWhiteSpace(_groupingName))
            {
                Title = _groupingName;
            }
            else if (_favorites)
            {
                Title = AppResources.Favorites;
            }
            else
            {
                Title = AppResources.SearchVault;

                if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.UWP)
                {
                    ToolbarItems.Add(new DismissModalToolBarItem(this));
                }
            }

            LoadingIndicator = new ActivityIndicator
            {
                IsRunning = true
            };

            if (Device.RuntimePlatform != Device.UWP)
            {
                LoadingIndicator.VerticalOptions   = LayoutOptions.CenterAndExpand;
                LoadingIndicator.HorizontalOptions = LayoutOptions.Center;
            }

            ContentView = new ContentView
            {
                Content = LoadingIndicator
            };

            var fabLayout = new FabLayout(ContentView);

            if (!string.IsNullOrWhiteSpace(_uri) || _folder || !string.IsNullOrWhiteSpace(_folderId))
            {
                if (Device.RuntimePlatform == Device.Android)
                {
                    ListView.BottomPadding = 170;
                    Fab = new Fab(fabLayout, "plus.png", (sender, args) => Helpers.AddCipher(this, _folderId));
                }
                else
                {
                    AddCipherItem = new AddCipherToolBarItem(this, _folderId);
                    ToolbarItems.Add(AddCipherItem);
                }
            }
            else if (Device.RuntimePlatform == Device.Android)
            {
                ListView.BottomPadding = 50;
            }

            Content = fabLayout;
        }
Example #10
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            this.RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.ManualEntry);

            // ========================= Get Global Shared Data
            prefs     = PreferenceManager.GetDefaultSharedPreferences(this);
            empid     = prefs.GetLong("EmpID", 0);
            projectid = prefs.GetLong("ProjectID", 0);
            if (projectid == 0)
            {
                projectid = IMApplication.projectid;
            }
            projectname = prefs.GetString("ProjectName", "");
            if (projectname == "")
            {
                projectname = IMApplication.projectname;
            }
            clientname = prefs.GetString("ClientName", "");
            if (clientname == "")
            {
                clientname = IMApplication.clientname;
            }
            ISharedPreferencesEditor editor = prefs.Edit();

            editor.PutLong("ProjectID", projectid);
            editor.PutString("ProjectName", projectname);
            editor.PutString("ClientName", clientname);
            editor.Commit();
            // applies changes synchronously on older APIs
            editor.Apply();
            locationname    = prefs.GetString("LocationName", "");
            EditInventoryID = prefs.GetString("EditFromItemList", "");


            if (IMApplication.player != null)
            {
                IMApplication.player.Stop();
                IMApplication.player = null;
            }

            // ========================= Get Global Shared Data

            // ========================= Rounded Button
            _fab             = FindViewById <Fab>(Resource.Id.btnSave);
            _fab.FabColor    = Color.Blue;
            _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.icon_save2x);
            _fab.Show();
            _fab.Click += delegate
            {
                SaveDataToLocalDataBase();
            };
            // ========================= Rounded Button

            // ========================= Button Event
            ImageView _backtolist = FindViewById <ImageView>(Resource.Id.btnManualBacktolist);

            _backtolist.Click += delegate
            {
                ClearAll();
                try
                {
                    StartActivity(typeof(LocationList));
                }
                catch
                {
                    Toast.MakeText(this, "Oops…something happened, Please try again", ToastLength.Short).Show();
                }
            };
            // ========================= Button Event

            // ========================= Set Font
            Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF");

            EditText txtprojectname = FindViewById <EditText>(Resource.Id.txtProjectName);

            txtprojectname.Typeface = tf;
            txtprojectname.Invalidate();

            EditText txtclientname = FindViewById <EditText>(Resource.Id.txtClientName);

            txtclientname.Typeface = tf;
            txtclientname.Invalidate();

            EditText txtlocation = FindViewById <EditText>(Resource.Id.txtLocation);

            txtlocation.Typeface = tf;
            txtlocation.Invalidate();

            EditText txtItemDescription = FindViewById <EditText>(Resource.Id.txtItemDescription);

            txtItemDescription.Typeface = tf;
            txtItemDescription.Invalidate();

            EditText txtbrand = FindViewById <EditText>(Resource.Id.txtBrand);

            txtbrand.Typeface = tf;
            txtbrand.Invalidate();


            EditText txtquantity = FindViewById <EditText>(Resource.Id.txtQuantity);

            txtquantity.Typeface = tf;
            txtquantity.Invalidate();

            EditText txtModelNumber = FindViewById <EditText>(Resource.Id.txtModelNumber);

            txtModelNumber.Typeface = tf;
            txtModelNumber.Invalidate();

            EditText txtUnitCost = FindViewById <EditText>(Resource.Id.txtUnitCost);

            txtUnitCost.Typeface = tf;
            txtUnitCost.Invalidate();

            EditText txtNotes = FindViewById <EditText>(Resource.Id.txtNotes);

            txtNotes.Typeface = tf;
            txtNotes.Invalidate();
            // ========================= Set Font

            txtlocation.SetText(locationname, TextView.BufferType.Editable);
            editor = prefs.Edit();
            txtlocation.TextChanged += delegate
            {
                editor.PutString("LocationName", txtlocation.Text);
                editor.Commit();
            };
            txtprojectname.SetText(projectname, TextView.BufferType.Editable);
            txtclientname.SetText(clientname, TextView.BufferType.Editable);

            Cam1 = FindViewById <ImageView>(Resource.Id.cam1);
            TextView Cam1Path = FindViewById <TextView>(Resource.Id.cam1path);

            Cam1.Click += delegate
            {
                if (IMApplication.camera != null)
                {
                    IMApplication.camera.Release();
                    IMApplication.camera = null;
                }

                if (Cam1Path.Text.Trim() == "")
                {
                    rnd    = new Random();
                    number = rnd.Next(10000, 99999);
                    Intent       intent  = new Intent(Android.Provider.MediaStore.ActionImageCapture);
                    string       path    = CreateDirectoryForPictures();
                    string       picname = String.Format("img_{0}.jpg", number);
                    Java.IO.File objFile = new Java.IO.File(path, picname);
                    intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile));
                    intent.PutExtra("height", 100);

                    capturedimagename = picname;
                    StartActivityForResult(intent, 1);
                }
                else
                {
                    string picname = CreateDirectoryForPictures() + "/" + Cam1Path.Text.Trim();
                    OnPreviewImage(picname);
                    currentPreviewcount = 1;
                }
            };
            Cam2 = FindViewById <ImageView>(Resource.Id.cam2);
            TextView Cam2path = FindViewById <TextView>(Resource.Id.cam2path);

            Cam2.Click += delegate
            {
                if (IMApplication.camera != null)
                {
                    IMApplication.camera.Release();
                    IMApplication.camera = null;
                }

                if (Cam2path.Text.Trim() == "")
                {
                    rnd    = new Random();
                    number = rnd.Next(10000, 99999);
                    Intent       intent  = new Intent(Android.Provider.MediaStore.ActionImageCapture);
                    string       path    = CreateDirectoryForPictures();
                    string       picname = String.Format("img_{0}.jpg", number);
                    Java.IO.File objFile = new Java.IO.File(path, picname);
                    intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile));
                    capturedimagename = picname;
                    StartActivityForResult(intent, 2);
                }
                else
                {
                    string picname = CreateDirectoryForPictures() + "/" + Cam2path.Text.Trim();
                    OnPreviewImage(picname);
                    currentPreviewcount = 2;
                }
            };

            Cam3 = FindViewById <ImageView>(Resource.Id.cam3);
            TextView Cam3path = FindViewById <TextView>(Resource.Id.cam3path);

            Cam3.Click += delegate
            {
                if (IMApplication.camera != null)
                {
                    IMApplication.camera.Release();
                    IMApplication.camera = null;
                }

                if (Cam3path.Text.Trim() == "")
                {
                    rnd    = new Random();
                    number = rnd.Next(10000, 99999);
                    Intent intent = new Intent(Android.Provider.MediaStore.ActionImageCapture);

                    string       path    = CreateDirectoryForPictures();
                    string       picname = String.Format("img_{0}.jpg", number);
                    Java.IO.File objFile = new Java.IO.File(path, picname);
                    intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile));
                    intent.PutExtra(Android.Provider.MediaStore.ExtraSizeLimit, 300);
                    capturedimagename = picname;
                    StartActivityForResult(intent, 3);
                }
                else
                {
                    string picname = CreateDirectoryForPictures() + "/" + Cam3path.Text.Trim();
                    OnPreviewImage(picname);
                    currentPreviewcount = 3;
                }
            };

            Cam4 = FindViewById <ImageView>(Resource.Id.cam4);
            TextView Cam4path = FindViewById <TextView>(Resource.Id.cam4path);

            Cam4.Click += delegate
            {
                if (IMApplication.camera != null)
                {
                    IMApplication.camera.Release();
                    IMApplication.camera = null;
                }

                if (Cam4path.Text.Trim() == "")
                {
                    rnd    = new Random();
                    number = rnd.Next(10000, 99999);
                    Intent       intent  = new Intent(Android.Provider.MediaStore.ActionImageCapture);
                    string       path    = CreateDirectoryForPictures();
                    string       picname = String.Format("img_{0}.jpg", number);
                    Java.IO.File objFile = new Java.IO.File(path, picname);
                    intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile));
                    capturedimagename = picname;
                    StartActivityForResult(intent, 4);
                }
                else
                {
                    string picname = CreateDirectoryForPictures() + "/" + Cam4path.Text.Trim();
                    OnPreviewImage(picname);
                    currentPreviewcount = 4;
                }
            };

            Button btnSavePreview = FindViewById <Button>(Resource.Id.btnSavePreview);

            btnSavePreview.Click += delegate {
                LinearLayout LayoutManualEntry   = FindViewById <LinearLayout>(Resource.Id.LayoutManualEntry);
                LinearLayout LayoutManualPreview = FindViewById <LinearLayout>(Resource.Id.LayoutManualPreview);
                LayoutManualEntry.Visibility   = ViewStates.Visible;
                LayoutManualPreview.Visibility = ViewStates.Gone;
            };

            Button btnDiscardPreview = FindViewById <Button>(Resource.Id.btnDiscardPreview);

            btnDiscardPreview.Click += delegate
            {
                if (currentPreviewcount != 0)
                {
                    rnd    = new Random();
                    number = rnd.Next(10000, 99999);
                    Intent       intent  = new Intent(Android.Provider.MediaStore.ActionImageCapture);
                    string       path    = CreateDirectoryForPictures();
                    string       picname = String.Format("img_{0}.jpg", number);
                    Java.IO.File objFile = new Java.IO.File(path, picname);
                    intent.PutExtra(Android.Provider.MediaStore.ExtraOutput, Android.Net.Uri.FromFile(objFile));
                    capturedimagename = picname;
                    StartActivityForResult(intent, currentPreviewcount);
                    currentPreviewcount = 0;
                }
            };
            if (EditInventoryID.Trim() != "")
            {
                PopulateDataFromDatabase(EditInventoryID);
            }
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            Title = Resources.GetString(Resource.String.title_home);

            MyDrawerLayout    = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            Search            = FindViewById <SearchView>(Resource.Id.search);
            SwipeRefresh      = FindViewById <SwipeRefreshLayout>(Resource.Id.refresh);
            SwipeRefreshEmpty = FindViewById <SwipeRefreshLayout>(Resource.Id.refreshEmpty);
            Fab = FindViewById <FloatingActionButton>(Resource.Id.fab);
            ListViewRepositories = FindViewById <MvxListView>(Resource.Id.listRep);

            MyToggle = new ActionBarDrawerToggle(this, MyDrawerLayout, Resource.String.open_drawer, Resource.String.close_drawer);
            MyDrawerLayout.AddDrawerListener(MyToggle);
            MyToggle.SyncState();



            ListViewRepositories.ViewTreeObserver.ScrollChanged += (sender, e) =>
            {
                if (ViewModel.Repositories != null && ViewModel.Repositories.Count > 0 && ListViewRepositories.LastVisiblePosition >= ViewModel.Repositories.Count() - 10)
                {
                    ViewModel.LoadMore(null);
                }
            };

            SwipeRefresh.Refresh      += Refresh;
            SwipeRefreshEmpty.Refresh += Refresh;

            Fab.Click += (sender, e) =>
            {
                if (ViewModel.SearchVisible)
                {
                    DoSearch();
                }
                else
                {
                    ViewModel.SearchVisible = true;
                    ShowKeyboard(Search);
                }
            };

            ListViewRepositories.ScrollStateChanged += (sender, e) =>
            {
                if (e.ScrollState == Android.Widget.ScrollState.Idle)
                {
                    Fab.Show();
                }
                else
                {
                    Fab.Hide();
                    ViewModel.SearchVisible = false;
                }
            };



            Search.SetIconifiedByDefault(false);

            Search.QueryTextChange += (object sender, SearchView.QueryTextChangeEventArgs e) =>
            {
                if (string.IsNullOrEmpty(Search.Query))
                {
                    DoSearch(false);
                }
            };
            Search.QueryTextSubmit += (object sender, SearchView.QueryTextSubmitEventArgs e) =>
            {
                DoSearch();
            };
        }
Example #12
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            Typeface tf = Typeface.CreateFromAsset(Assets, "Fonts/ROBOTO-LIGHT.TTF");

            this.RequestWindowFeature(WindowFeatures.NoTitle);
            SetContentView(Resource.Layout.Main_Search_A);
            StartSetup();
            _fab             = FindViewById <Fab> (Resource.Id.btnOpenCreateProjectPopUp);
            _fab.FabColor    = Color.ParseColor("#3597d4");
            _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.CreateProject);
            _fab.Show();
            prefs     = PreferenceManager.GetDefaultSharedPreferences(this);
            editor    = prefs.Edit();
            projectid = prefs.GetLong("ProjectID", 0);
            long empid = prefs.GetLong("EmpID", 5);

            EmpID      = prefs.GetLong("EmpID", 0);
            UserType   = prefs.GetLong("UserType", 1);
            UserPlan   = prefs.GetString("UserPlan", "");
            IsInternal = prefs.GetLong("IsInternal", 0);
            if (IsInternal == 1)
            {
                _fab.Visibility = ViewStates.Gone;
            }
            else
            {
                _fab.Visibility = ViewStates.Visible;
            }
            _fab.Click += delegate {
                if (UserType == 1)
                {
                    OpenInAppPurchasePopUp();
                }
                else
                {
                    showcreateprojectdialog();
                }
            };
            WebService objime = new WebService();

            projectloadingdialog = ProgressDialog.Show(this, "Loading", "Please wait.....");
            objime.ProjectListAsync("", empid.ToString());
            objime.ProjectListCompleted += getempxml;
            //	listView=listView = FindViewById<ListView>(Resource.Id.List);
            if (IMApplication.player != null)
            {
                IMApplication.player.Stop();
                IMApplication.player = null;
            }
            ImageView Cam1 = FindViewById <ImageView> (Resource.Id.imgSearchBack);
            ImageView imgDeleteVoiceSearch = FindViewById <ImageView> (Resource.Id.imgDeleteVoiceSearch);
            ImageView imgVoiceSearch       = FindViewById <ImageView> (Resource.Id.imgVoiceSearch);
            EditText  txtsearchproject     = FindViewById <EditText> (Resource.Id.txtsearchproject);

            listView                = FindViewById <ListView> (Resource.Id.List);
            listView.ItemClick     += OnListItemClick;
            listView.ItemLongClick += DeleteProject;
            db = this.OpenOrCreateDatabase("ImInventory", FileCreationMode.Private, null);
            txtsearchproject.TextChanged += delegate {
                int projectidcolumn;
                int ProjectID;

                string           text = txtsearchproject.Text;
                ICursor          c1   = db.RawQuery("SELECT * FROM " + "tbl_Inventory WHERE EmpID = " + empid + " AND (ItemDescription like '%" + text + "%' OR BarCodeNumber like '%" + text + "%') GROUP BY ProjectName ORDER BY  ID  ", null);
                var              projectitemsitems         = filterdtableItems;
                List <TableItem> serceitemsbyprojectidlist = new List <TableItem>();
                if (c1.Count > 0)
                {
                    projectidcolumn = c1.GetColumnIndex("ProjectID");
                    c1.MoveToFirst();
                    if (c1 != null)
                    {
                        // Loop through all Results
                        do
                        {
                            ProjectID = c1.GetInt(projectidcolumn);
                            List <TableItem> serceitemsbyprojectid = projectitemsitems.Where(x => x.ProjectID == Convert.ToString(ProjectID)).ToList();
                            serceitemsbyprojectidlist = serceitemsbyprojectidlist.Concat(serceitemsbyprojectid).ToList();
                        }while (c1.MoveToNext());
                    }
                }

                if (text.Trim() != "")
                {
                    imgVoiceSearch.Visibility       = ViewStates.Gone;
                    imgDeleteVoiceSearch.Visibility = ViewStates.Visible;
                    List <TableItem> serceitemsbyprojectname = projectitemsitems.Where(x => x.Projectname.ToLower().Contains(text.Trim().ToLower())).ToList();
                    List <TableItem> serceitemsbyclientname  = projectitemsitems.Where(x => x.ClientName.ToLower().Contains(text.Trim().ToLower())).ToList();
                    projectitemsitems = serceitemsbyprojectname.Concat(serceitemsbyclientname).ToList();
                    projectitemsitems = projectitemsitems.Concat(serceitemsbyprojectidlist).ToList();
                    projectitemsitems = projectitemsitems.OrderBy(x => x.ProjectID).ToList();
                    var projectitemsitem = projectitemsitems.GroupBy(x => new { x.ProjectID }).OrderBy(g => g.Key.ProjectID).ThenBy(g => g.Key.ProjectID).ToList();
                    projectitemsitems = new List <TableItem>();
                    foreach (var group in projectitemsitem)
                    {
                        List <TableItem> cps = group.ToList();
                        projectitemsitems = projectitemsitems.Concat(group).ToList();
                    }
                    tableItems = projectitemsitems;
                }
                else
                {
                    imgVoiceSearch.Visibility       = ViewStates.Visible;
                    imgDeleteVoiceSearch.Visibility = ViewStates.Gone;
                    projectitemsitems = filterdtableItems;
                }

                listView.Adapter = new ProjectScreenAdapter(this, projectitemsitems);
            };

            imgDeleteVoiceSearch.Click += delegate {
                listView = FindViewById <ListView> (Resource.Id.List);
                imgVoiceSearch.Visibility       = ViewStates.Visible;
                imgDeleteVoiceSearch.Visibility = ViewStates.Gone;
                txtsearchproject.SetText("", TextView.BufferType.Editable);
                //listView = FindViewById<ListView>(Resource.Id.List);
                listView.Adapter = new ProjectScreenAdapter(this, filterdtableItems);
                tableItems       = filterdtableItems;
                //listView.ItemClick += OnListItemClick;
            };
            Cam1.Click += delegate {
                this.Finish();
                //StartActivity (typeof(Main));
            };
        }
Example #13
0
 private void ShowElements()
 {
     NavigationPage.SetHasNavigationBar(App.MainBottomBarPage, true);
     Fab.TranslateTo(0, -40);
 }
Example #14
0
 private void HideElements()
 {
     NavigationPage.SetHasNavigationBar(App.MainBottomBarPage, false);
     Fab.TranslateTo(0, 40);
 }
Example #15
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            LinearLayout MainLinear = FindViewById <LinearLayout> (Resource.Id.MainLinear);

            _fab      = FindViewById <Fab> (Resource.Id.fabbutton);
            fab_pop_1 = FindViewById <Fab> (Resource.Id.fab_pop_1);
            fab_pop_2 = FindViewById <Fab> (Resource.Id.fab_pop_2);
            fab_pop_3 = FindViewById <Fab> (Resource.Id.fab_pop_3);


            fab_pop_1.Visibility = ViewStates.Invisible;
            fab_pop_2.Visibility = ViewStates.Invisible;
            fab_pop_3.Visibility = ViewStates.Invisible;

            Animation fade_in  = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_in);
            Animation fade_out = AnimationUtils.LoadAnimation(this, Resource.Animation.fade_out);

            var holodarkOrange = Resources.GetColor(Android.Resource.Color.HoloOrangeDark);
            var holoPurple     = Resources.GetColor(Android.Resource.Color.HoloPurple);
            var holoGreen      = Resources.GetColor(Android.Resource.Color.HoloGreenLight);

            _fab.FabColor      = Color.Rgb(4, 136, 209);
            fab_pop_1.FabColor = holodarkOrange;
            fab_pop_2.FabColor = holoPurple;
            fab_pop_3.FabColor = holoGreen;

            _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);

            _fab.Click += (s, e) => {
                if (i == 0)
                {
                    fab_pop_3.StartAnimation(fade_in);
                    fab_pop_3.Visibility = ViewStates.Visible;
                    fab_pop_2.StartAnimation(fade_in);
                    fab_pop_2.Visibility = ViewStates.Visible;
                    fab_pop_1.StartAnimation(fade_in);
                    fab_pop_1.Visibility = ViewStates.Visible;
                    i = 1;
                }
                else
                {
                    fab_pop_1.StartAnimation(fade_out);
                    fab_pop_1.Visibility = ViewStates.Invisible;
                    fab_pop_2.StartAnimation(fade_out);
                    fab_pop_2.Visibility = ViewStates.Invisible;
                    fab_pop_3.StartAnimation(fade_out);
                    fab_pop_3.Visibility = ViewStates.Invisible;
                    i = 0;
                }

                fab_pop_1.Click += delegate {
                    MainLinear.SetBackgroundColor(holodarkOrange);
                    MainLinear.StartAnimation(fade_in);
                    MainLinear.StartAnimation(fade_in);
                    fab_pop_1.StartAnimation(fade_out);
                    fab_pop_1.Visibility = ViewStates.Invisible;
                    fab_pop_2.StartAnimation(fade_out);
                    fab_pop_2.Visibility = ViewStates.Invisible;
                    fab_pop_3.StartAnimation(fade_out);
                    fab_pop_3.Visibility = ViewStates.Invisible;
                    i = 0;
                };
                fab_pop_2.Click += delegate {
                    MainLinear.SetBackgroundColor(holoPurple);
                    MainLinear.StartAnimation(fade_in);
                    fab_pop_1.StartAnimation(fade_out);
                    fab_pop_1.Visibility = ViewStates.Invisible;
                    fab_pop_2.StartAnimation(fade_out);
                    fab_pop_2.Visibility = ViewStates.Invisible;
                    fab_pop_3.StartAnimation(fade_out);
                    fab_pop_3.Visibility = ViewStates.Invisible;
                    i = 0;
                };
                fab_pop_3.Click += delegate {
                    MainLinear.SetBackgroundColor(holoGreen);
                    MainLinear.StartAnimation(fade_in);
                    fab_pop_1.StartAnimation(fade_out);
                    fab_pop_1.Visibility = ViewStates.Invisible;
                    fab_pop_2.StartAnimation(fade_out);
                    fab_pop_2.Visibility = ViewStates.Invisible;
                    fab_pop_3.StartAnimation(fade_out);
                    fab_pop_3.Visibility = ViewStates.Invisible;
                    i = 0;
                };
            };
        }
        private void Init()
        {
            SearchItem = new SearchToolBarItem(this);
            ToolbarItems.Add(SearchItem);

            ListView = new ExtendedListView(ListViewCachingStrategy.RecycleElement)
            {
                IsGroupingEnabled   = true,
                ItemsSource         = PresentationSections,
                HasUnevenRows       = true,
                GroupHeaderTemplate = new DataTemplate(() => new SectionHeaderViewCell(
                                                           nameof(Section <Grouping> .Name), nameof(Section <Grouping> .Count), new Thickness(16, 12))),
                ItemTemplate = new GroupingOrCipherDataTemplateSelector(this)
            };

            if (Device.RuntimePlatform == Device.iOS)
            {
                ListView.RowHeight = -1;
            }

            var noDataLabel = new Label
            {
                Text = AppResources.NoItems,
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                Style    = (Style)Application.Current.Resources["text-muted"]
            };

            var addCipherButton = new ExtendedButton
            {
                Text    = AppResources.AddAnItem,
                Command = new Command(() => Helpers.AddCipher(this, null)),
                Style   = (Style)Application.Current.Resources["btn-primaryAccent"]
            };

            NoDataStackLayout = new StackLayout
            {
                Children        = { noDataLabel, addCipherButton },
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Padding         = new Thickness(20, 0),
                Spacing         = 20
            };

            LoadingIndicator = new ActivityIndicator
            {
                IsRunning = true
            };

            if (Device.RuntimePlatform != Device.UWP)
            {
                LoadingIndicator.VerticalOptions   = LayoutOptions.CenterAndExpand;
                LoadingIndicator.HorizontalOptions = LayoutOptions.Center;
            }

            ContentView = new ContentView
            {
                Content = LoadingIndicator
            };

            var fabLayout = new FabLayout(ContentView);

            if (Device.RuntimePlatform == Device.Android)
            {
                Fab = new Fab(fabLayout, "plus.png", (sender, args) => Helpers.AddCipher(this, null));
                ListView.BottomPadding = 170;
            }
            else
            {
                AddCipherItem = new AddCipherToolBarItem(this, null);
                ToolbarItems.Add(AddCipherItem);
            }

            Content = fabLayout;
            Title   = AppResources.MyVault;
        }
Example #17
0
        private void Init()
        {
            var noDataLabel = new Label
            {
                Text = string.Format(AppResources.NoItemsForUri, _name ?? "--"),
                HorizontalTextAlignment = TextAlignment.Center,
                FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                Style    = (Style)Application.Current.Resources["text-muted"]
            };

            var addCipherButton = new ExtendedButton
            {
                Text    = AppResources.AddAnItem,
                Command = new Command(() => AddCipherAsync()),
                Style   = (Style)Application.Current.Resources["btn-primaryAccent"]
            };

            NoDataStackLayout = new StackLayout
            {
                Children        = { noDataLabel, addCipherButton },
                VerticalOptions = LayoutOptions.CenterAndExpand,
                Padding         = new Thickness(20, 0),
                Spacing         = 20
            };

            SearchItem = new SearchToolBarItem(this);
            ToolbarItems.Add(SearchItem);

            ListView = new ExtendedListView(ListViewCachingStrategy.RecycleElement)
            {
                IsGroupingEnabled   = true,
                ItemsSource         = PresentationCiphersGroup,
                HasUnevenRows       = true,
                GroupHeaderTemplate = new DataTemplate(() => new SectionHeaderViewCell(
                                                           nameof(Section <AutofillCipher> .Name))),
                ItemTemplate = new DataTemplate(() => new VaultListViewCell(
                                                    (VaultListPageModel.Cipher c) => Helpers.CipherMoreClickedAsync(this, c, true)))
            };

            if (Device.RuntimePlatform == Device.iOS)
            {
                ListView.RowHeight = -1;
            }

            Title = string.Format(AppResources.ItemsForUri, _name ?? "--");

            LoadingIndicator = new ActivityIndicator
            {
                IsRunning         = true,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                HorizontalOptions = LayoutOptions.Center
            };

            ContentView = new ContentView
            {
                Content = LoadingIndicator
            };

            var fabLayout = new FabLayout(ContentView);

            Fab = new Fab(fabLayout, "plus.png", async(sender, args) => await AddCipherAsync());
            ListView.BottomPadding = 170;

            Content = fabLayout;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

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

            _fab = FindViewById<Fab>(Resource.Id.fabbutton);
            _fab.FabColor = Color.White;
            _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            _fab.Click += (s, e) => Toast.MakeText(this, "Clicked Fab", ToastLength.Short).Show();
            ActionBar.SetBackgroundDrawable(new ColorDrawable(Color.Black));

            var blue = FindViewById<View>(Resource.Id.blueButton);
            blue.Click += (s, e) =>
            {
                var holoBlue = Resources.GetColor(Android.Resource.Color.HoloBlueLight);
                _fab.FabColor = holoBlue;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoBlue));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };

            var purple = FindViewById<View>(Resource.Id.purpleButton);
            purple.Click += (s, e) =>
            {
                var holoPurple = Resources.GetColor(Android.Resource.Color.HoloPurple);
                _fab.FabColor = holoPurple;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoPurple));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };

            var green = FindViewById<View>(Resource.Id.greenButton);
            green.Click += (s, e) =>
            {
                var holoGreen = Resources.GetColor(Android.Resource.Color.HoloGreenLight);
                _fab.FabColor = holoGreen;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoGreen));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };

            var orange = FindViewById<View>(Resource.Id.orangeButton);
            orange.Click += (s, e) =>
            {
                var holoOrange = Resources.GetColor(Android.Resource.Color.HoloOrangeLight);
                _fab.FabColor = holoOrange;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoOrange));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };

            var red = FindViewById<View>(Resource.Id.redButton);
            red.Click += (s, e) =>
            {
                var holoRed = Resources.GetColor(Android.Resource.Color.HoloRedLight);
                _fab.FabColor = holoRed;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holoRed));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };

            var darkred = FindViewById<View>(Resource.Id.darkredButton);
            darkred.Click += (s, e) =>
            {
                var holodarkRed = Resources.GetColor(Android.Resource.Color.HoloRedDark);
                _fab.FabColor = holodarkRed;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holodarkRed));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };

            var darkblue = FindViewById<View>(Resource.Id.darkblueButton);
            darkblue.Click += (s, e) =>
            {
                var holodarkBlue = Resources.GetColor(Android.Resource.Color.HoloBlueDark);
                _fab.FabColor = holodarkBlue;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holodarkBlue));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };

            var darkgreen = FindViewById<View>(Resource.Id.darkgreenButton);
            darkgreen.Click += (s, e) =>
            {
                var holodarkGreen = Resources.GetColor(Android.Resource.Color.HoloGreenDark);
                _fab.FabColor = holodarkGreen;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holodarkGreen));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };

            var darkorange = FindViewById<View>(Resource.Id.darkorangeButton);
            darkorange.Click += (s, e) =>
            {
                var holodarkOrange = Resources.GetColor(Android.Resource.Color.HoloOrangeDark);
                _fab.FabColor = holodarkOrange;
                ActionBar.SetBackgroundDrawable(new ColorDrawable(holodarkOrange));
                _fab.FabDrawable = Resources.GetDrawable(Resource.Drawable.ic_content_new);
            };
        }