コード例 #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.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);
        }
コード例 #2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            rootView        = inflater.Inflate(Resource.Layout.frag_history_list, container, false);
            workoutListView = (WearableRecyclerView)rootView.FindViewById(Resource.Id.rv_history);

            DB         = new Database();
            runRecords = DB.GetAllObjects(nameof(RunRecord)).Cast <RunRecord>().ToList();
            if (runRecords == null)
            {
                runRecords = new List <RunRecord>();
            }
            runRecords.Reverse();
            adapter = new AdapterRunHistory(Activity, workoutListView, Resource.Layout.item_history, runRecords, true);
            workoutListView.SetAdapter(adapter);
            workoutListView.CenterEdgeItems = true;
            workoutListView.SetLayoutManager(new CurvedChildLayoutManager(Activity));
            //workoutListView.SetLayoutManager(new CustomCurvedChildLayoutManager(Activity));
            adapter.NotifyDataSetChanged();
            return(rootView);
        }
コード例 #3
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activity_start);

            actionDrawer = (WearableActionDrawer)FindViewById(Resource.Id.ad_start);
            actionDrawer.SetOnMenuItemClickListener(new MenuItemClickListener(this));
            actionDrawer.PeekDrawer();

            sv_workouts = (ScrollView)FindViewById(Resource.Id.sv_workout_list);
            sv_workouts.RequestFocus();
            sv_workouts.SmoothScrollingEnabled = true;

            PopulateList();

            wrv_workouts = (WearableRecyclerView)FindViewById(Resource.Id.wrv_workout_list);
            adapter      = new AdapterRunHistory(this, wrv_workouts, Resource.Layout.item_history, runRecords, true);
            wrv_workouts.SetAdapter(adapter);
            adapter.NotifyDataSetChanged();
        }
コード例 #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.activityMain);

            _loadingLayout      = FindViewById <LinearLayout>(Resource.Id.layoutLoading);
            _emptyLayout        = FindViewById <LinearLayout>(Resource.Id.layoutEmpty);
            _disconnectedLayout = FindViewById <LinearLayout>(Resource.Id.layoutDisconnected);

            _retryButton        = FindViewById <MaterialButton>(Resource.Id.buttonRetry);
            _retryButton.Click += OnRetryClick;

            _authList = FindViewById <WearableRecyclerView>(Resource.Id.list);
            _authList.EdgeItemsCenteringEnabled = true;

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

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

            _authenticatorListAdapter            = new AuthenticatorListAdapter();
            _authenticatorListAdapter.ItemClick += ItemClick;
            _authList.SetAdapter(_authenticatorListAdapter);
        }
コード例 #5
0
 public AdapterMetricsMultiView(ActivityWearWorkout activity, WearableRecyclerView listView, List <int> list, bool itemLongClickable)
     : base(activity, listView, 0, list, itemLongClickable)
 {
     this.activity = activity;
     app           = GlobalDataDash.GetInstance();
 }
コード例 #6
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var view = base.OnCreateView(inflater, container, savedInstanceState) as SwipeDismissFrameLayout;

            // Inflate the layout for this fragment
            inflater.Inflate(Resource.Layout.fragment_location_search, view, true);

            swipeViewLayout          = view.FindViewById <SwipeDismissFrameLayout>(Resource.Id.recycler_view_layout);
            swipeCallback            = new SwipeDismissCallback();
            swipeCallback.Dismissed += (layout) =>
            {
                layout.Visibility = ViewStates.Gone;
                //layout.Reset();
            };
            swipeViewLayout.AddCallback(swipeCallback);
            keyboardButton        = view.FindViewById <FloatingActionButton>(Resource.Id.keyboard_button);
            keyboardButton.Click += (sender, e) =>
            {
                mSearchView.Visibility = ViewStates.Visible;
                mSearchView.RequestFocus();
                ShowInputMethod(mSearchView);
            };
            voiceButton        = view.FindViewById <FloatingActionButton>(Resource.Id.voice_button);
            voiceButton.Click += (sender, e) =>
            {
                mSearchView.Visibility = ViewStates.Gone;
                mSearchView.Text       = String.Empty;
                view.RequestFocus();
                Intent intent = new Intent(RecognizerIntent.ActionRecognizeSpeech)
                                .PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm)
                                .PutExtra(RecognizerIntent.ExtraPrompt, mActivity.GetString(Resource.String.location_search_hint));
                StartActivityForResult(intent, REQUEST_CODE_VOICE_INPUT);
            };

            mProgressBar             = view.FindViewById <ProgressBar>(Resource.Id.progressBar);
            mSearchView              = view.FindViewById <EditText>(Resource.Id.search_view);
            mSearchView.TextChanged += (object sender, TextChangedEventArgs e) =>
            {
                // If we're using searchfragment
                // make sure gps feature is off
                if (Settings.FollowGPS)
                {
                    Settings.FollowGPS = false;
                }
            };
            mSearchView.FocusChange += (object sender, View.FocusChangeEventArgs e) =>
            {
                View v = sender as View;

                if (e.HasFocus)
                {
                    ShowInputMethod(v.FindFocus());
                }
                else
                {
                    HideInputMethod(v);
                }
            };
            mSearchView.EditorAction += (object sender, TextView.EditorActionEventArgs e) =>
            {
                if (e.ActionId == ImeAction.Search)
                {
                    DoSearchAction();

                    // If we're using searchfragment
                    // make sure gps feature is off
                    if (Settings.FollowGPS)
                    {
                        Settings.FollowGPS = false;
                    }

                    e.Handled = true;
                }
                e.Handled = false;
            };

            mRecyclerView = view.FindViewById <WearableRecyclerView>(Resource.Id.recycler_view);

            // use this setting to improve performance if you know that changes
            // in content do not change the layout size of the RecyclerView
            mRecyclerView.HasFixedSize = true;

            // To align the edge children (first and last) with the center of the screen
            mRecyclerView.EdgeItemsCenteringEnabled = true;

            // use a linear layout manager
            mLayoutManager = new WearableLinearLayoutManager(mActivity);
            mRecyclerView.SetLayoutManager(mLayoutManager);

            // specify an adapter (see also next example)
            mAdapter            = new LocationQueryAdapter(new List <LocationQueryViewModel>());
            mAdapter.ItemClick += ClickListener;
            mRecyclerView.SetAdapter(mAdapter);

            return(view);
        }
コード例 #7
0
 public AdapterRunHistory(Context context, WearableRecyclerView listView, int layout, List <RunRecord> list, bool itemLongClickable) :
     base(context, listView, layout, list, itemLongClickable)
 {
     this.context = context;
 }