android.support.wearable.view.WearableListView Java Examples
The following examples show how to use
android.support.wearable.view.WearableListView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SunsetsGeneralWearableConfigActivity.java From american-sunsets-watch-face with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(WearableListView.ViewHolder holder, int position) { ColorItemViewHolder colorItemViewHolder = (ColorItemViewHolder) holder; String colorName = mColors[position]; colorItemViewHolder.mColorItem.setColor(colorName); colorItemViewHolder.mColorItem.setBitmapResource(previewResource); RecyclerView.LayoutParams layoutParams = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); int colorPickerItemMargin = (int) getResources() .getDimension(R.dimen.digital_config_color_picker_item_margin); // Add margins to first and last item to make it possible for user to tap on them. if (position == 0) { layoutParams.setMargins(0, colorPickerItemMargin, 0, 0); } else if (position == mColors.length - 1) { layoutParams.setMargins(0, 0, 0, colorPickerItemMargin); } else { layoutParams.setMargins(0, 0, 0, 0); } colorItemViewHolder.itemView.setLayoutParams(layoutParams); }
Example #2
Source File: WatchFaceConfigActivity.java From AndroidDemoProjects with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(WearableListView.ViewHolder viewHolder, int position ) { BackgroundItemViewHolder holder = (BackgroundItemViewHolder) viewHolder; String backgroundName = mBackgrounds[ position ]; holder.mBackgroundItem.setBackground( backgroundName, position ); RecyclerView.LayoutParams layoutParams = new RecyclerView.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT ); int backgroundPickerItemMargin = (int) getResources().getDimension( R.dimen.background_picker_item_margin ); if( position == 0 ) { layoutParams.setMargins( 0, backgroundPickerItemMargin, 0, 0 ); } else if( position == mBackgrounds.length - 1 ) { layoutParams.setMargins( 0, 0, 0, backgroundPickerItemMargin ); } else { layoutParams.setMargins( 0, 0, 0, 0 ); } holder.itemView.setLayoutParams( layoutParams ); }
Example #3
Source File: SelectionListActivity.java From android-wear-gopro-remote with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_selection_list); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); Intent i = getIntent(); if(i != null) { String[] items = i.getStringArrayExtra(EXTRA_ITEMS); String selected = i.getStringExtra(EXTRA_SELECTED_ITEM); WearableListView listView = (WearableListView) findViewById(R.id.list); Adapter adapter = new Adapter(this, items); listView.setAdapter(adapter); listView.setClickListener(this); listView.scrollToPosition(adapter.getPositionByValue(selected)); } }
Example #4
Source File: Chooser.java From sensordatacollector with GNU General Public License v2.0 | 6 votes |
@Override public void onClick(WearableListView.ViewHolder viewHolder) { // parse data String position = Chooser.this.adapterPosition.get(viewHolder.getPosition()); // update mobile device BroadcastService.getInstance().sendMessage("/position/update", position); // update local device MainActivity mc = (MainActivity) ActivityController.getInstance().get("MainActivity"); mc.updatePositionView(position); // finish Chooser.this.finish(); Chooser.this.overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right); }
Example #5
Source File: WearMenu.java From WearMenu with Apache License 2.0 | 6 votes |
public void setMenuElements(List<String> titles, List<Drawable> drawables){ setContentView(R.layout.wearmenu_list); if(mListBackgroundId > 0) findViewById(R.id.wearmenu_listview_container).setBackgroundResource(mListBackgroundId); WearableListView listView = (WearableListView) findViewById(R.id.wearmenu_listview); listView.setAdapter(new WearMenuListListViewAdapter(getContext(), titles, drawables, mListTextColor, mListSelectedColor)); listView.setClickListener(new WearableListView.ClickListener() { @Override public void onClick(WearableListView.ViewHolder viewHolder) { if(mWearMenuListener != null) mWearMenuListener.onWearMenuListClicked(viewHolder.getPosition()); toggle(); } @Override public void onTopEmptyRegionClick() { toggle(); } }); }
Example #6
Source File: SunsetsBackgroundWearableConfigActivity.java From american-sunsets-watch-face with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(WearableListView.ViewHolder holder, int position) { ColorItemViewHolder colorItemViewHolder = (ColorItemViewHolder) holder; String colorName = mColors[position]; colorItemViewHolder.mColorItem.setColor(colorName); RecyclerView.LayoutParams layoutParams = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); int colorPickerItemMargin = (int) getResources() .getDimension(R.dimen.digital_config_color_picker_item_margin); // Add margins to first and last item to make it possible for user to tap on them. if (position == 0) { layoutParams.setMargins(0, colorPickerItemMargin, 0, 0); } else if (position == mColors.length - 1) { layoutParams.setMargins(0, 0, 0, colorPickerItemMargin); } else { layoutParams.setMargins(0, 0, 0, 0); } colorItemViewHolder.itemView.setLayoutParams(layoutParams); }
Example #7
Source File: ItemListViewAdapter.java From sensordatacollector with GNU General Public License v2.0 | 6 votes |
@Override public void onBindViewHolder(WearableListView.ViewHolder viewHolder, int i) { String currentValue = this.elements.get(i); ItemListView itemView = (ItemListView) viewHolder.itemView; TextView txtView = (TextView) itemView.findViewById(R.id.text); txtView.setText(this.elements.get(i)); CircledImageView imgView = (CircledImageView) itemView.findViewById(R.id.image); if(this.selectedElements == null) { imgView.setImageResource(android.R.color.transparent); return; } for(String activ : selectedElements) { // mark activity and subactivity if subactivity is activ if(activ.equals(currentValue) || activ.startsWith(currentValue + Settings.ACTIVITY_DELIMITER) || (this.parent != null && activ.equals(this.parent + Settings.ACTIVITY_DELIMITER + currentValue))) { imgView.setImageResource(R.drawable.yes); return; } } imgView.setImageResource(android.R.color.transparent); }
Example #8
Source File: SunsetsGeneralWearableConfigActivity.java From american-sunsets-watch-face with Apache License 2.0 | 6 votes |
@Override // WearableListView.ClickListener public void onClick(WearableListView.ViewHolder viewHolder) { ColorItemViewHolder colorItemViewHolder = (ColorItemViewHolder) viewHolder; int position = colorItemViewHolder.getAdapterPosition(); if(position == 0) {//images Intent intent = new Intent(this, SunsetsBackgroundWearableConfigActivity.class); startActivity(intent); }else if(position == 1){//fluid motion int fluid_mode = 0; if(colorItemViewHolder.mColorItem.getColorName().equalsIgnoreCase(getResources().getString(R.string.fluid_motion))){ colors[1] = getResources().getString(R.string.battery_saving); listView.getAdapter().notifyItemRangeChanged(1,1); fluid_mode = 1; }else { colors[1] = getResources().getString(R.string.fluid_motion); listView.getAdapter().notifyItemRangeChanged(1,1); fluid_mode = 0; } updateConfigDataItem(SunsetsWatchFaceUtil.KEY_FLUID_MODE,fluid_mode); } }
Example #9
Source File: DevicesAdapter.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void onBindViewHolder(@NonNull final WearableListView.ViewHolder holder, final int position) { final ItemViewHolder viewHolder = (ItemViewHolder) holder; if (position < devices.size()) { final BluetoothDevice device = devices.get(position); viewHolder.device = device; viewHolder.name.setText(TextUtils.isEmpty(device.getName()) ? notAvailable : device.getName()); viewHolder.address.setText(getState(device, position)); viewHolder.icon.showIndeterminateProgress(position == connectingPosition); } else { viewHolder.device = null; viewHolder.name.setText(scanning ? R.string.devices_list_scanning : R.string.devices_list_start_scan); viewHolder.address.setText(null); viewHolder.icon.showIndeterminateProgress(scanning); } }
Example #10
Source File: ScannerActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_with_header); // Get the list component from the layout of the activity final WearableListView listView = findViewById(R.id.devices_list); listView.setAdapter(deviceAdapter = new DevicesAdapter(listView)); listView.setClickListener(onRowClickListener); listView.addOnScrollListener(onScrollListener); // The header will be moved as the list is scrolled header = findViewById(R.id.header); // Register a broadcast receiver that will listen for events from the service. LocalBroadcastManager.getInstance(this).registerReceiver(serviceBroadcastReceiver, BleProfileService.makeIntentFilter()); }
Example #11
Source File: MenuListActivity.java From AndroidAPS with GNU Affero General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); elements = getElements(); setContentView(R.layout.actions_list_activity); // Get the list component from the layout of the activity WearableListView listView = (WearableListView) findViewById(R.id.wearable_list); // Assign an adapter to the list listView.setAdapter(new Adapter(this, elements)); // Set a click listener listView.setClickListener(this); }
Example #12
Source File: ScannerActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void onClick(final WearableListView.ViewHolder holder) { final DevicesAdapter.ItemViewHolder viewHolder = (DevicesAdapter.ItemViewHolder) holder; final BluetoothDevice device = viewHolder.getDevice(); if (device != null) { deviceAdapter.stopLeScan(); deviceAdapter.setConnectingPosition(holder.getAdapterPosition()); // Start the service that will connect to selected device final Intent service = new Intent(ScannerActivity.this, BleProfileService.class); service.putExtra(BleProfileService.EXTRA_DEVICE_ADDRESS, device.getAddress()); startService(service); } else { deviceAdapter.startLeScan(); } }
Example #13
Source File: DigitalWatchFaceWearableConfigActivity.java From wear-os-samples with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(WearableListView.ViewHolder holder, int position) { ColorItemViewHolder colorItemViewHolder = (ColorItemViewHolder) holder; String colorName = mColors[position]; colorItemViewHolder.mColorItem.setColor(colorName); RecyclerView.LayoutParams layoutParams = new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); int colorPickerItemMargin = (int) getResources() .getDimension(R.dimen.digital_config_color_picker_item_margin); // Add margins to first and last item to make it possible for user to tap on them. if (position == 0) { layoutParams.setMargins(0, colorPickerItemMargin, 0, 0); } else if (position == mColors.length - 1) { layoutParams.setMargins(0, 0, 0, colorPickerItemMargin); } else { layoutParams.setMargins(0, 0, 0, 0); } colorItemViewHolder.itemView.setLayoutParams(layoutParams); }
Example #14
Source File: Chooser.java From sensordatacollector with GNU General Public License v2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { // init super.onCreate(savedInstanceState); setContentView(R.layout.round_chooser); detector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() { public void onLongPress(MotionEvent e) { DismissOverlayView dismissOverlay = (DismissOverlayView) (Chooser.this).findViewById(R.id.dismiss_overlay); dismissOverlay.setIntroText(R.string.welcome_long_press_exit); dismissOverlay.showIntroIfNecessary(); dismissOverlay.show(); } }); // register activity ActivityController.getInstance().add("Chooser", this); // adapter this.adapterPosture = new ItemListViewAdapter(Chooser.this, true); this.adapterPosition = new ItemListViewAdapter(Chooser.this, true); // view TextView tv = (TextView) findViewById(R.id.posture_posture_headline); tv.setText(R.string.posture_headline); WearableListView view = (WearableListView) findViewById(R.id.posture_posture_list); view.setAdapter(this.adapterPosture); view.setClickListener(new PostureClickListener()); // send database request String query = "SELECT name FROM " + SQLTableName.POSTURES; BroadcastService.getInstance().sendMessage("/database/request/posture", query); }
Example #15
Source File: CollectionActivity.java From arcgis-runtime-demos-android with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(WearableListView.ViewHolder holder, int position) { // retrieve the text view ItemViewHolder itemHolder = (ItemViewHolder) holder; TextView view = itemHolder.textView; // replace text contents view.setText(mDataset.get(position)); // replace list item's metadata holder.itemView.setTag(position); }
Example #16
Source File: Chooser.java From sensordatacollector with GNU General Public License v2.0 | 5 votes |
public void createPostureList(final String s) { // process data final NavigableSet<String> data = new TreeSet<>(); data.addAll(Arrays.asList(s.split("\n"))); // refresh UI runOnUiThread(new Runnable() { @Override public void run() { // data List<String> postures = new ArrayList<>(data); MainActivity main = (MainActivity) ActivityController.getInstance().get("MainActivity"); String selectedElement = ((TextView) main.findViewById(R.id.posture_posture)).getText().toString(); int pos = Utils.getPosition(selectedElement, postures); // set current element Chooser.this.adapterPosture.setSelectedElements(Arrays.asList(selectedElement)); // progressbar ProgressBar pb = (ProgressBar) findViewById(R.id.progressBar1); pb.setVisibility(View.INVISIBLE); // update adapter Chooser.this.adapterPosture.update(null, postures); Chooser.this.adapterPosture.notifyDataSetChanged(); // view WearableListView view = (WearableListView) findViewById(R.id.posture_posture_list); view.scrollToPosition(pos); } }); }
Example #17
Source File: SelectionListActivity.java From android-wear-gopro-remote with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(WearableListView.ViewHolder holder, int position) { TextView view = (TextView) holder.itemView.findViewById(R.id.name); view.setText(labels[position]); holder.itemView.setTag(values[position]); if(imageResources[position] > 0) { ImageView imageView = (ImageView) holder.itemView.findViewById(R.id.circle); imageView.setImageResource(imageResources[position]); } }
Example #18
Source File: WatchSettingsActivity.java From android-wear-gopro-remote with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_watch_settings); mListView = (WearableListView) findViewById(R.id.list); mLoadingPanel = (RelativeLayout)findViewById(R.id.loadingPanel); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mListView.setAdapter(new SettingsAdapter(this)); mListView.setClickListener(this); }
Example #19
Source File: ListChooserActivity.java From WearPreferenceActivity with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.preference_list); loadIntentExtras(); checkRequiredExtras(); final WearableListView list = (WearableListView) findViewById(android.R.id.list); list.setAdapter(new PreferenceEntriesAdapter()); list.scrollToPosition(getIntent().getIntExtra(EXTRA_CURRENT_VALUE, 0)); list.setClickListener(this); }
Example #20
Source File: CollectionActivity.java From arcgis-runtime-demos-android with Apache License 2.0 | 5 votes |
@Override public void onClick(WearableListView.ViewHolder v) { Integer tag = (Integer) v.itemView.getTag(); setContentView(R.layout.activity_collection); TextView text = (TextView) findViewById(R.id.text); // When the user clicks an item, send a request to the phone depending on our // current response type switch (mNextResponseType) { case LAYER: // If we are sending a layer response, send a message including the // name of the layer selected Log.d("Test", "Selected: " + layerNames.get(tag)); sendMessage(FEATURE_TYPE_REQUEST, layerNames.get(tag).getBytes()); // While waiting for the response, show text that indicates we are fetching // the feature types text.setText(R.string.fetching_types); break; case FEATURE_TYPE: // If we are sending a feature type response, send a message including // the type of the feature to be collected by the mobile device Log.d("Test", "Selected: " + featureTypeNames.get(tag)); sendMessage(FEATURE_TYPE_RESPONSE, featureTypeNames.get(tag).getBytes()); // While waiting for the response, show text that indicates we are collecting // the feature text.setText(R.string.collecting_feature); break; } }
Example #21
Source File: CollectionActivity.java From arcgis-runtime-demos-android with Apache License 2.0 | 5 votes |
/** * Handle a FeatureType response. The FeatureType response includes a list * FeatureTypes for the selected layer that can be shown to the user. * * @param item the DataItem received from the mobile device */ private void handleFeatureTypeResponse(DataItem item) { DataMap dm = DataMapItem.fromDataItem(item).getDataMap(); // Get the list of feature types from the data map featureTypeNames = dm.getStringArrayList("featureTypes"); // Set the content view to the selection scroll list setContentView(R.layout.selection_list); // Get the WearableListView and set its adapter and click listener WearableListView listView = (WearableListView) findViewById(R.id.wearable_list); listView.setAdapter(new Adapter(this, featureTypeNames)); listView.setClickListener(this); // Note that our next response type should be a layer response (when the user selects // an item) mNextResponseType = RESPONSE_TYPE.FEATURE_TYPE; }
Example #22
Source File: WatchFaceConfigActivity.java From AndroidDemoProjects with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_background_selector); mImageResourceList = getResources().obtainTypedArray( R.array.background_resource_ids ); mHeader = (TextView) findViewById( R.id.header ); WearableListView listView = (WearableListView) findViewById( R.id.background_picker ); BoxInsetLayout content = (BoxInsetLayout) findViewById( R.id.content ); content.setOnApplyWindowInsetsListener( new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { if( !insets.isRound() ) { v.setPaddingRelative( (getResources().getDimensionPixelSize( R.dimen.content_padding_start ) ), v.getPaddingTop(), v.getPaddingEnd(), v.getPaddingBottom() ); } return v.onApplyWindowInsets( insets ); } }); listView.setHasFixedSize( true ); listView.setClickListener( this ); listView.addOnScrollListener( this ); String[] backgrounds = getResources().getStringArray( R.array.background_array ); listView.setAdapter( new BackgroundListAdapter( backgrounds ) ); }
Example #23
Source File: CollectionActivity.java From arcgis-runtime-demos-android with Apache License 2.0 | 5 votes |
/** * Handles a layer response. The layer response includes a list of layers * that have recently been used on the mobile device that can be shown to * the user for selection. * * @param item the DataItem received from the mobile device */ private void handleLayerResponse(DataItem item) { DataMap dm = DataMapItem.fromDataItem(item).getDataMap(); // Get the list of layer names from the data map layerNames = dm.getStringArrayList("layers"); // Set the content view to the selection scroll list setContentView(R.layout.selection_list); // Get the WearableListView and set its adapter and click listener WearableListView listView = (WearableListView) findViewById(R.id.wearable_list); listView.setAdapter(new Adapter(this, layerNames)); listView.setClickListener(this); // Note that our next response type should be a layer response (when the user selects // an item) mNextResponseType = RESPONSE_TYPE.LAYER; }
Example #24
Source File: WearMenuListListViewAdapter.java From WearMenu with Apache License 2.0 | 5 votes |
@Override public WearableListView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { WearMenuListItemLayout layout = (WearMenuListItemLayout) mInflater.inflate(R.layout.wearmenu_list_element, null); layout.setListSelectedColor(mListSelectedColor); layout.setListTextColor(mListTextColor); return new WearMenuListViewAdapterViewHolder(layout); }
Example #25
Source File: WearMenuListListViewAdapter.java From WearMenu with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(WearableListView.ViewHolder holder, int position) { WearMenuListViewAdapterViewHolder itemHolder = (WearMenuListViewAdapterViewHolder) holder; itemHolder.textView.setText(mTitles.get(position)); holder.itemView.setTag(position); if(mDrawables != null){ itemHolder.imageButton.setImageDrawable(mDrawables.get(position)); } }
Example #26
Source File: DevicesAdapter.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 5 votes |
public DevicesAdapter(final WearableListView listView) { final Context context = listView.getContext(); inflater = LayoutInflater.from(context); notAvailable = context.getString(R.string.not_available); connectingText = context.getString(R.string.state_connecting); availableText = context.getString(R.string.devices_list_available); bondedText = context.getString(R.string.devices_list_bonded); bondingText = context.getString(R.string.devices_list_bonding); this.listView = listView; handler = new Handler(); final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); if (bluetoothAdapter != null) devices.addAll(bluetoothAdapter.getBondedDevices()); }
Example #27
Source File: MainActivity.java From AndroidWearable-Samples with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); WearableListView listView = (WearableListView) findViewById(R.id.list); listView.setAdapter(new Adapter(this)); listView.setClickListener(this); }
Example #28
Source File: UARTConfigurationsActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list); // Check if the WEAR device is connected to the UART device itself, or by the phone. // Binding will fail if we are using phone as proxy as the service has not been started before. final Intent service = new Intent(this, BleProfileService.class); bindService(service, serviceConnection, 0); final WearableListView listView = findViewById(R.id.list); listView.setClickListener(this); listView.setAdapter(adapter = new UARTConfigurationsAdapter(this)); googleApiClient = new GoogleApiClient.Builder(this) .addApi(Wearable.API) .addConnectionCallbacks(this) .addOnConnectionFailedListener(this) .build(); // Register the broadcast receiver that will listen for events from the device final IntentFilter filter = new IntentFilter(); filter.addAction(BleProfileService.BROADCAST_CONNECTION_STATE); filter.addAction(BleProfileService.BROADCAST_ERROR); LocalBroadcastManager.getInstance(this).registerReceiver(serviceBroadcastReceiver, filter); }
Example #29
Source File: UARTConfigurationsActivity.java From Android-nRF-Toolbox with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public void onClick(final WearableListView.ViewHolder viewHolder) { if (viewHolder instanceof UARTConfigurationsAdapter.ConfigurationViewHolder) { final UARTConfigurationsAdapter.ConfigurationViewHolder holder = (UARTConfigurationsAdapter.ConfigurationViewHolder) viewHolder; final UartConfiguration configuration = holder.getConfiguration(); final Intent intent = new Intent(this, UARTCommandsActivity.class); intent.putExtra(UARTCommandsActivity.CONFIGURATION, configuration); startActivity(intent); } }
Example #30
Source File: SetTimerActivity.java From android-Timer with Apache License 2.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); int paramLength = getIntent().getIntExtra(AlarmClock.EXTRA_LENGTH, 0); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "SetTimerActivity:onCreate=" + paramLength); } if (paramLength > 0 && paramLength <= 86400) { long durationMillis = paramLength * 1000; setupTimer(durationMillis); finish(); return; } Resources res = getResources(); for (int i = 0; i < NUMBER_OF_TIMES; i++) { mTimeOptions[i] = new ListViewItem( res.getQuantityString(R.plurals.timer_minutes, i + 1, i + 1), (i + 1) * 60 * 1000); } setContentView(R.layout.timer_set_timer); // Initialize a simple list of countdown time options. mWearableListView = (WearableListView) findViewById(R.id.times_list_view); mWearableListView.setAdapter(new TimerWearableListViewAdapter(this)); mWearableListView.setClickListener(this); }