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);
        }
Exemplo n.º 2
0
        private void InitAuthenticators()
        {
            _authSource = new AuthSource(_connection);

            var isCompact = _sharedPrefs.GetBoolean("pref_compactMode", false);

            _authAdapter = new AuthAdapter(_authSource, IsDark, isCompact);

            _authAdapter.ItemClick        += ItemClick;
            _authAdapter.ItemOptionsClick += ItemOptionsClick;
            _authAdapter.SetHasStableIds(true);

            _authList.SetAdapter(_authAdapter);
            _authList.HasFixedSize = true;
            _authList.SetItemViewCacheSize(20);

            var animation =
                AnimationUtils.LoadLayoutAnimation(this, Resource.Animation.layout_animation_fall_down);

            _authList.LayoutAnimation = animation;

            var useGrid = IsTablet();
            var layout  = new AuthListGridLayoutManager(this, useGrid ? 2 : 1);

            _authList.SetLayoutManager(layout);

            var callback    = new AuthListTouchHelperCallback(_authAdapter, useGrid);
            var touchHelper = new ItemTouchHelper(callback);

            touchHelper.AttachToRecyclerView(_authList);
        }