예제 #1
0
        private void InitViews()
        {
            _loadingLayout = FindViewById <RelativeLayout>(Resource.Id.layoutLoading);
            _emptyLayout   = FindViewById <RelativeLayout>(Resource.Id.layoutEmpty);
            _offlineLayout = FindViewById <LinearLayout>(Resource.Id.layoutOffline);

            _authList = FindViewById <WearableRecyclerView>(Resource.Id.list);
            _authList.EdgeItemsCenteringEnabled = true;
            _authList.HasFixedSize = true;
            _authList.SetItemViewCacheSize(12);
            _authList.SetItemAnimator(null);

            var layoutCallback = new AuthenticatorListLayoutCallback(this);

            _authList.SetLayoutManager(new WearableLinearLayoutManager(this, layoutCallback));

            _authListAdapter              = new AuthenticatorListAdapter(_authSource, _customIconCache);
            _authListAdapter.ItemClick   += OnItemClick;
            _authListAdapter.HasStableIds = true;
            _authList.SetAdapter(_authListAdapter);

            var categoriesDrawer = FindViewById <WearableNavigationDrawerView>(Resource.Id.drawerCategories);

            _categoryListAdapter = new CategoryListAdapter(this, _categoryCache);
            categoriesDrawer.SetAdapter(_categoryListAdapter);
            categoriesDrawer.ItemSelected += OnCategorySelected;
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.edit_product_main);
            operation  = new DataOperation();
            categories = operation.GetAllCategory();

            etID    = FindViewById <EditText>(Resource.Id.etID);
            etName  = FindViewById <EditText>(Resource.Id.etName);
            etPrice = FindViewById <EditText>(Resource.Id.etPrice);

            spinnerCategory = FindViewById <Spinner>(Resource.Id.spinnerCategory);

            btn1 = FindViewById <Button>(Resource.Id.btn1);
            btn2 = FindViewById <Button>(Resource.Id.btn2);
            btn3 = FindViewById <Button>(Resource.Id.btn3);


            btn1.Click += Btn1_Click;
            btn2.Click += Btn2_Click;
            btn3.Click += Btn3_Click;

            adapter = new CategoryListAdapter(this, categories);
            spinnerCategory.Adapter = adapter;
        }
예제 #3
0
        protected override async void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activityMain);

            try
            {
                await WearableClass.GetMessageClient(this).AddListenerAsync(this);
                await FindServerNode();
            }
            catch (ApiException) { }

            _loadingLayout = FindViewById <RelativeLayout>(Resource.Id.layoutLoading);
            _emptyLayout   = FindViewById <RelativeLayout>(Resource.Id.layoutEmpty);
            _offlineLayout = FindViewById <LinearLayout>(Resource.Id.layoutOffline);

            _authList = FindViewById <WearableRecyclerView>(Resource.Id.list);
            _authList.EdgeItemsCenteringEnabled = true;
            _authList.HasFixedSize = true;
            _authList.SetItemViewCacheSize(12);
            _authList.SetItemAnimator(null);

            var layoutCallback = new ScrollingListLayoutCallback(Resources.Configuration.IsScreenRound);

            _authList.SetLayoutManager(new WearableLinearLayoutManager(this, layoutCallback));

            _authCache       = new ListCache <WearAuthenticator>("authenticators", this);
            _categoryCache   = new ListCache <WearCategory>("categories", this);
            _customIconCache = new CustomIconCache(this);

            await _authCache.Init();

            _authSource = new AuthenticatorSource(_authCache);

            _authListAdapter              = new AuthenticatorListAdapter(_authSource, _customIconCache);
            _authListAdapter.ItemClick   += OnItemClick;
            _authListAdapter.HasStableIds = true;
            _authList.SetAdapter(_authListAdapter);

            if (_authCache.GetItems().Count > 0 || _serverNode == null)
            {
                UpdateViewState();
            }

            await _categoryCache.Init();

            var categoriesDrawer = FindViewById <WearableNavigationDrawerView>(Resource.Id.drawerCategories);

            _categoryListAdapter = new CategoryListAdapter(this, _categoryCache);
            categoriesDrawer.SetAdapter(_categoryListAdapter);
            categoriesDrawer.ItemSelected += OnCategorySelected;

            await Refresh();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.view_category_main);
            operation = new DataOperation();

            listCategory = FindViewById <ListView>(Resource.Id.listCategory);
            btn1         = FindViewById <Button>(Resource.Id.btn1);

            btn1.Click += Btn1_Click;

            adapter = new CategoryListAdapter(this, operation.GetAllCategory());
            listCategory.Adapter = adapter;
        }
예제 #5
0
        private void InitViews()
        {
            _loadingLayout = FindViewById <RelativeLayout>(Resource.Id.layoutLoading);
            _emptyLayout   = FindViewById <RelativeLayout>(Resource.Id.layoutEmpty);
            _offlineLayout = FindViewById <LinearLayout>(Resource.Id.layoutOffline);

            _authList = FindViewById <WearableRecyclerView>(Resource.Id.list);
            _authList.EdgeItemsCenteringEnabled = true;
            _authList.HasFixedSize = true;
            _authList.SetItemViewCacheSize(12);
            _authList.SetItemAnimator(null);

            var layoutCallback = new AuthenticatorListLayoutCallback(this);

            _authList.SetLayoutManager(new WearableLinearLayoutManager(this, layoutCallback));

            _authListAdapter                = new AuthenticatorListAdapter(_authSource, _customIconCache);
            _authListAdapter.ItemClick     += OnItemClick;
            _authListAdapter.ItemLongClick += OnItemLongClick;
            _authListAdapter.HasStableIds   = true;
            _authListAdapter.DefaultAuth    = _preferences.DefaultAuth;
            _authList.SetAdapter(_authListAdapter);

            _categoryList        = FindViewById <WearableNavigationDrawerView>(Resource.Id.drawerCategories);
            _categoryListAdapter = new CategoryListAdapter(this, _categoryCache);
            _categoryList.SetAdapter(_categoryListAdapter);
            _categoryList.ItemSelected += OnCategorySelected;

            if (_authSource.CategoryId == null)
            {
                return;
            }

            var categoryPosition = _categoryCache.FindIndex(c => c.Id == _authSource.CategoryId) + 1;

            if (categoryPosition <= -1)
            {
                return;
            }

            _preventCategorySelectEvent = true;
            _categoryList.SetCurrentItem(categoryPosition, false);
        }
예제 #6
0
        /// <summary>
        /// Called when [create].
        /// </summary>
        /// <param name="bundle">The bundle.</param>
        protected override void OnCreate(Bundle bundle)
        {
            // Check if _handler has Categories and Businesses initialized
            ErrorCheckActivity.checkXMLHandlerInitialization(this.ApplicationContext, _handler.isInitialized);

            base.OnCreate(bundle);

            // Set our view from the layout resource
            SetContentView(Resource.Layout.ListCategory);

            // Set the toolbar
            var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.Title = this.ApplicationContext.GetString(Resource.String.CategoryListActivityLabel);

            _ListView = FindViewById <ListView>(Resource.Id.lvListArea);

            // Get a sorted Unique List<sring> of Categories
            _categoryListStrings = new List <string>();

            foreach (var c in _handler.CategoryList)
            {
                _categoryListStrings.Add(c.Name);
            }

            _categoryListStrings = _categoryListStrings.Distinct().ToList();
            _categoryListStrings.Sort();

            // Remove the Repair subcategory from _categoryListStrings
            _categoryListStrings.Remove(this.ApplicationContext.GetString(Resource.String.RepairCategoryName));

            // Set the custom adapter
            CategoryListAdapter adapter = new CategoryListAdapter(this, _categoryListStrings);

            _ListView.Adapter = adapter;

            // Set the ListView on-click function
            _ListView.ItemClick += _ListView_ItemClick;
        }
예제 #7
0
 public HomeController(CategoryListAdapter adapter)
 {
     _adapter = adapter;
 }