コード例 #1
0
		void ConnectGoogleApiClient()
		{
			googleApiClient = new GoogleApiClient.Builder(this)
				.AddApi(WearableClass.API)
				.AddConnectionCallbacks(
					async connectionHint =>
					{
						if (Log.IsLoggable(Tag, LogPriority.Info))
						{
							Log.Info(Tag, "Connected to the Google API client");
						}

						var stepCountOn = await XFitWatchfaceConfigHelper.ReadStepCountStatus(googleApiClient);
						var stepCountState = stepCountOn ? "ON" : "OFF";
						var stepCountSetting = new Setting($"Step count\n{stepCountState}", "stepcount", stepCountOn);
						settings = new Setting[] { stepCountSetting };
						listView.SetAdapter(new ListAdapter(this, settings));

					},
					cause =>
					{
						if (Log.IsLoggable(Tag, LogPriority.Info))
						{
							Log.Info(Tag, "Connection suspended");
						}
					}
				)
				.Build();

			googleApiClient.Connect();
		}
コード例 #2
0
		public ListAdapter(Context context, Setting[] items)
		{
			this.context = context;
			this.items = items;
			inflater = LayoutInflater.From(context);
		}