protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activityRestore);

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

            SetSupportActionBar(toolbar);

            SupportActionBar.SetTitle(Resource.String.restore);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Icons.GetIcon("arrow_back", IsDark));

            var loadStorageBtn = FindViewById <LinearLayout>(Resource.Id.activityRestore_loadStorage);

            loadStorageBtn.Click += LoadStorageClick;

            var loadCloudBtn = FindViewById <LinearLayout>(Resource.Id.activityRestore_loadCloud);

            loadCloudBtn.Click += LoadCloudClick;

            _connection = await Database.Connect(this);

            _authSource     = new AuthSource(_connection);
            _categorySource = new CategorySource(_connection);
        }
Beispiel #2
0
		public CategorySetInfo( string path, string name, CategorySource source ) {

			this._path = path;
			this._name = name;
			this._source = source;

		}
        public AssignCategoriesBottomSheet(CategorySource categorySource, int itemPosition, List <string> checkedCategories)
        {
            RetainInstance = true;

            _categorySource    = categorySource;
            _checkedCategories = checkedCategories;
            _itemPosition      = itemPosition;
        }
Beispiel #4
0
        private void InitCategories()
        {
            _categoriesMenu =
                _navigationView.Menu.AddSubMenu(Menu.None, Menu.None, Menu.None, Resource.String.categories);
            _categoriesMenu.SetGroupCheckable(0, true, true);

            _categorySource = new CategorySource(_connection);
        }
Beispiel #5
0
 public ChooseCategoriesDialog(CategorySource categorySource, EventHandler onClose, Action <bool, int> itemClick,
                               int authPosition, List <string> checkedCategories)
 {
     _categorySource    = categorySource;
     _itemClick         = itemClick;
     _onClose           = onClose;
     _checkedCategories = checkedCategories;
     AuthPosition       = authPosition;
 }
Beispiel #6
0
        private void SetupCategorySource()
        {
            CategorySource               = new CategorySource();
            CategorySource.FontSize      = 11f;
            CategorySource.ImageViewSize = new SizeF(100f, 100f);

            collectionViewUser.RegisterClassForCell(typeof(CategoryCell), CategoryCell.CellID);
            collectionViewUser.ShowsHorizontalScrollIndicator = false;
            collectionViewUser.Source = CategorySource;
        }
Beispiel #7
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activityManageCategories);

            _preferences = new PreferenceWrapper(this);

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

            SetSupportActionBar(toolbar);

            SupportActionBar.SetTitle(Resource.String.categories);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_action_arrow_back);

            _rootLayout = FindViewById <RelativeLayout>(Resource.Id.layoutRoot);

            _addButton        = FindViewById <FloatingActionButton>(Resource.Id.buttonAdd);
            _addButton.Click += OnAddClick;

            var connection = await Database.GetSharedConnection();

            _categorySource                   = new CategorySource(connection);
            _categoryListAdapter              = new ManageCategoriesListAdapter(_categorySource);
            _categoryListAdapter.MenuClick   += OnMenuClick;
            _categoryListAdapter.HasStableIds = true;
            _categoryListAdapter.DefaultId    = _preferences.DefaultCategory;

            _categoryList     = FindViewById <RecyclerView>(Resource.Id.list);
            _emptyStateLayout = FindViewById <LinearLayout>(Resource.Id.layoutEmptyState);

            _categoryList.SetAdapter(_categoryListAdapter);
            _categoryList.HasFixedSize = true;

            var layout = new FixedGridLayoutManager(this, 1);

            _categoryList.SetLayoutManager(layout);

            var callback    = new ReorderableListTouchHelperCallback(this, _categoryListAdapter, layout);
            var touchHelper = new ItemTouchHelper(callback);

            touchHelper.AttachToRecyclerView(_categoryList);

            var decoration = new DividerItemDecoration(this, layout.Orientation);

            _categoryList.AddItemDecoration(decoration);

            var layoutAnimation = AnimationUtils.LoadLayoutAnimation(this, Resource.Animation.layout_animation_fade_in);

            _categoryList.LayoutAnimation = layoutAnimation;

            await Refresh();
        }
Beispiel #8
0
 public WearQueryService()
 {
     _initTask = new Lazy <Task>(async delegate
     {
         var password      = await SecureStorageWrapper.GetDatabasePassword();
         _connection       = await Database.GetPrivateConnection(password);
         _customIconSource = new CustomIconSource(_connection);
         _categorySource   = new CategorySource(_connection);
         _authSource       = new AuthenticatorSource(_connection);
     });
 }
 public WearQueryService()
 {
     _initTask = new Lazy <Task>(async() =>
     {
         _connection       = await Database.Connect(ApplicationContext);
         _customIconSource = new CustomIconSource(_connection);
         _categorySource   = new CategorySource(_connection);
         _authSource       = new AuthenticatorSource(_connection);
         _authSource.SetGenerationMethod(GenerationMethod.Time);
     });
 }
Beispiel #10
0
        /// <summary>
        /// ViewModel 資料初始化
        /// </summary>
        /// <returns></returns>
        private async Task ViewModelInit()
        {
            Title = "你有一則新留言";

            NaviPageSource.Clear();
            NaviPageSource.Add("首頁");
            NaviPageSource.Add("明細頁面");
            NaviPageSelectedItem = NaviPageSource[1];

            StyleSource.Clear();
            StyleSource.Add(LocalNotificationStyleEnum.BigText.ToString());
            StyleSource.Add(LocalNotificationStyleEnum.Image.ToString());
            StyleSource.Add(LocalNotificationStyleEnum.Inbox.ToString());
            StyleSource.Add(LocalNotificationStyleEnum.Normal.ToString());
            StyleSelectedItem = StyleSource[0];

            VisibilitySource.Clear();
            VisibilitySource.Add(LocalNotificationVisibilityEnum.Private.ToString());
            VisibilitySource.Add(LocalNotificationVisibilityEnum.Public.ToString());
            VisibilitySource.Add(LocalNotificationVisibilityEnum.Secret.ToString());
            VisibilitySelectedItem = VisibilitySource[0];

            PrioritySource.Clear();
            PrioritySource.Add(LocalNotificationPriorityEnum.Default.ToString());
            PrioritySource.Add(LocalNotificationPriorityEnum.High.ToString());
            PrioritySource.Add(LocalNotificationPriorityEnum.Low.ToString());
            PrioritySource.Add(LocalNotificationPriorityEnum.Maximum.ToString());
            PrioritySource.Add(LocalNotificationPriorityEnum.Minimum.ToString());
            PrioritySelectedItem = PrioritySource[0];

            CategorySource.Clear();
            CategorySource.Add(LocalNotificationCategoryEnum.Alarm.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Call.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Email.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Error.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Event.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Message.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Progress.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Promo.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Recommendation.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Service.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Social.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Status.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.System.ToString());
            CategorySource.Add(LocalNotificationCategoryEnum.Transport.ToString());
            CategorySelectedItem = CategorySource[0];

            ResetContentText();
            await Task.Delay(100);
        }
        public async Task Handle(CreateCategory message)
        {
            try
            {
                var item = await repository.Get(message.Id.ToString());

                if (item != null)
                {
                    throw new Exception($"Category with id: {message.Id} already exist");
                }
            }
            catch (AggregateNotFoundException)
            {
                // That is fine that id not used
            }
            var category = CategorySource.Create(message.Id, message.ParentId, message.Name, message.Color, message.Visible);
            await repository.Save(category);
        }
Beispiel #12
0
        public AutoBackupWorker(Context context, WorkerParameters workerParams) : base(context, workerParams)
        {
            _context     = context;
            _preferences = new PreferenceWrapper(context);

            _initTask = new Lazy <Task>(async delegate
            {
                var password      = await SecureStorageWrapper.GetDatabasePassword();
                _connection       = await Database.GetPrivateConnection(password);
                _customIconSource = new CustomIconSource(_connection);
                _categorySource   = new CategorySource(_connection);
                _authSource       = new AuthenticatorSource(_connection);

                await _categorySource.Update();
                await _customIconSource.Update();
                await _authSource.Update();
            });
        }
Beispiel #13
0
        private async Task Init()
        {
            _categorySource = new CategorySource(_connection);
            await _categorySource.Update();

            _customIconSource = new CustomIconSource(_connection);
            await _customIconSource.Update();

            _authSource = new AuthenticatorSource(_connection);
            RunOnUiThread(InitAuthenticatorList);
            await RefreshAuthenticators();

            _timer = new Timer {
                Interval  = 1000,
                AutoReset = true
            };

            _timer.Elapsed += Tick;
        }
        private async Task Init()
        {
            _authenticatorSource = new AuthenticatorSource(_connection);
            await _authenticatorSource.Update();

            _categorySource = new CategorySource(_connection);
            await _categorySource.Update();

            InitAuthenticatorList();
            await RefreshAuthenticators();

            _timer = new Timer {
                Interval  = 1000,
                AutoReset = true,
                Enabled   = true
            };

            _timer.Elapsed += Tick;
            _timer.Start();
        }
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activityEditCategories);

            var toolbar     = FindViewById <Toolbar>(Resource.Id.activityEditCategories_toolbar);
            var progressBar = FindViewById <ProgressBar>(Resource.Id.activityEditCategories_progressBar);

            SetSupportActionBar(toolbar);

            SupportActionBar.SetTitle(Resource.String.editCategories);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetDisplayShowHomeEnabled(true);
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_action_arrow_back);

            _addButton        = FindViewById <FloatingActionButton>(Resource.Id.activityEditCategories_buttonAdd);
            _addButton.Click += OnAddClick;

            _connection = await Database.Connect(this);

            _categorySource               = new CategorySource(_connection);
            _categoryAdapter              = new CategoryAdapter(_categorySource);
            _categoryAdapter.RenameClick += OnRenameClick;
            _categoryAdapter.DeleteClick += OnDeleteClick;

            _categoryList = FindViewById <RecyclerView>(Resource.Id.activityEditCategories_list);
            _emptyState   = FindViewById <LinearLayout>(Resource.Id.activityEditCategories_emptyState);

            _categoryList.SetAdapter(_categoryAdapter);
            _categoryList.HasFixedSize = true;
            _categoryList.SetItemViewCacheSize(20);

            var callback    = new AuthListTouchHelperCallback(_categoryAdapter);
            var touchHelper = new ItemTouchHelper(callback);

            touchHelper.AttachToRecyclerView(_categoryList);

            var layout     = new LinearLayoutManager(this);
            var decoration = new DividerItemDecoration(this, layout.Orientation);

            _categoryList.AddItemDecoration(decoration);
            _categoryList.SetLayoutManager(layout);

            var layoutAnimation =
                AnimationUtils.LoadLayoutAnimation(this, Resource.Animation.layout_animation_fade_in);

            _categoryList.LayoutAnimation = layoutAnimation;

            await _categorySource.UpdateTask;

            CheckEmptyState();
            _categoryAdapter.NotifyDataSetChanged();
            _categoryList.ScheduleLayoutAnimation();

            var alphaAnimation = new AlphaAnimation(1.0f, 0.0f)
            {
                Duration = 200
            };

            alphaAnimation.AnimationEnd += (sender, e) => { progressBar.Visibility = ViewStates.Gone; };
            progressBar.StartAnimation(alphaAnimation);
        }
 public ManageCategoriesListAdapter(CategorySource source)
 {
     _source = source;
 }
Beispiel #17
0
 public CategoriesListAdapter(Context context, CategorySource source)
 {
     _context         = context;
     _source          = source;
     SelectedPosition = 0;
 }
 public MainMenuBottomSheet(CategorySource source, string currCategoryId)
 {
     RetainInstance  = true;
     _source         = source;
     _currCategoryId = currCategoryId;
 }
Beispiel #19
0
		public CategorySetInfo( CategorySet set, CategorySource source ) : this( set.SavePath, set.Name, source ) {

			this._set = set;
		}