當前位置: 首頁>>代碼示例>>Java>>正文


Java WearableListView.ViewHolder方法代碼示例

本文整理匯總了Java中android.support.wearable.view.WearableListView.ViewHolder方法的典型用法代碼示例。如果您正苦於以下問題:Java WearableListView.ViewHolder方法的具體用法?Java WearableListView.ViewHolder怎麽用?Java WearableListView.ViewHolder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.wearable.view.WearableListView的用法示例。


在下文中一共展示了WearableListView.ViewHolder方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onBindViewHolder

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(final WearableListView.ViewHolder holder, final int position) {
	final ItemViewHolder viewHolder = (ItemViewHolder) holder;

	if (position < mDevices.size()) {
		final BluetoothDevice device = mDevices.get(position);

		viewHolder.mDevice = device;
		viewHolder.mName.setText(TextUtils.isEmpty(device.getName()) ? mNotAvailable : device.getName());
		viewHolder.mAddress.setText(getState(device, position));
		viewHolder.mIcon.showIndeterminateProgress(position == mConnectingPosition);
	} else {
		viewHolder.mDevice = null;
		viewHolder.mName.setText(mScanning ? R.string.devices_list_scanning : R.string.devices_list_start_scan);
		viewHolder.mAddress.setText(null);
		viewHolder.mIcon.showIndeterminateProgress(mScanning);
	}
}
 
開發者ID:runtimeco,項目名稱:Android-DFU-App,代碼行數:19,代碼來源:DevicesAdapter.java

示例2: onClick

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onClick(final WearableListView.ViewHolder holder) {
	final DevicesAdapter.ItemViewHolder viewHolder = (DevicesAdapter.ItemViewHolder) holder;
	final BluetoothDevice device = viewHolder.getDevice();

	if (device != null) {
		mDeviceAdapter.stopLeScan();
		mDeviceAdapter.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 {
		mDeviceAdapter.startLeScan();
	}
}
 
開發者ID:runtimeco,項目名稱:Android-DFU-App,代碼行數:18,代碼來源:ScannerActivity.java

示例3: onBindViewHolder

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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);
}
 
開發者ID:marcouberti,項目名稱:adrenaline_watch_face,代碼行數:22,代碼來源:WatchFaceWearableConfigActivity.java

示例4: onBindViewHolder

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(WearableListView.ViewHolder holder,
                             int position) {
    // retrieve the text view
    ItemViewHolder itemHolder = (ItemViewHolder) holder;
    ImageView ivAppIcon = itemHolder.ivAppIcon;
    TextView tvAppName = itemHolder.tvAppName;
    TextView tvPkgSize = itemHolder.tvPkgSize;
    // replace text contents
    ApplicationInfo entry = (ApplicationInfo) mListAppInfo.get(position);
    ivAppIcon.setImageDrawable(entry.loadIcon(mPm));
    tvAppName.setText(entry.loadLabel(mPm));
    tvPkgSize.setText("");
    // replace list item's metadata
    holder.itemView.setTag(position);
}
 
開發者ID:sssemil,項目名稱:Advanced-Settings-for-Android-Wear,代碼行數:17,代碼來源:SystemAppsSettingsActivity.java

示例5: onClick

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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);
}
 
開發者ID:sztyler,項目名稱:sensordatacollector,代碼行數:18,代碼來源:Chooser.java

示例6: onClick

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onClick(WearableListView.ViewHolder v) {
    Integer tag = (Integer) v.itemView.getTag();
    if (elements[tag].equals("EnableTicks")) {
        val.setBoolean("EnableTicks", !val.getBoolean("EnableTicks"));
        finish();
    } else if (elements[tag].equals("EnableShadows")) {
        val.setBoolean("EnableShadows", !val.getBoolean("EnableShadows"));
        finish();
    } else if (elements[tag].equals("ResetSettings")) {
        val.resetValues();
        finish();
    } else {
        Intent intent = new ColorPickActivity.IntentBuilder().oldColor(val.getColor(elements[tag])).build(this);
        startActivityForResult(intent, tag);
    }
}
 
開發者ID:FruitieX,項目名稱:materialwatch,代碼行數:18,代碼來源:WatchFaceConfig.java

示例7: onClick

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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);
	}
}
 
開發者ID:runtimeco,項目名稱:Android-DFU-App,代碼行數:12,代碼來源:UARTConfigurationsActivity.java

示例8: onBindViewHolder

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(WearableListView.ViewHolder holder,
                             int position) {
    // retrieve the text view
    ItemViewHolder itemHolder = (ItemViewHolder) holder;
    TextView view = itemHolder.descriptionText;
    // replace text contents
    view.setText(mDataset.get(position).getString("description"));
    // replace list item's metadata
    holder.itemView.setTag(position);

    ImageView mCircle = itemHolder.priorityCircleImage;
    int result;
    int prior = Integer.valueOf(mDataset.get(position).getString("priority"));
    switch (prior) {
        case Constants.STATE_NOT_CLASSIFIED:
            result = R.color.not_classified_color;
            break;
        case Constants.STATE_INFORMATION:
            result = R.color.information_color;
            break;
        case Constants.STATE_WARNING:
            result = R.color.warning_color;
            break;
        case Constants.STATE_AVERAGE:
            result = R.color.average_color;
            break;
        case Constants.STATE_HIGH:
            result = R.color.high_color;
            break;
        case Constants.STATE_DISASTER:
            result = R.color.disaster_color;
            break;
        default:
            result = R.color.not_classified_color;
            break;
    }
    ((GradientDrawable) mCircle.getDrawable()).setColor(mContext.getResources().getColor(result));

}
 
開發者ID:CactusSoft,項目名稱:zabbkit-android,代碼行數:41,代碼來源:EventsAdapter.java

示例9: onClick

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onClick(WearableListView.ViewHolder viewHolder) {
    int pos = viewHolder.getAdapterPosition();
    getSharedPreferences("config", 0).edit()
            .putInt(mComplicationId + "_selected_position", pos)
            .putString(mComplicationId + "_selected_currency_name", mElements[pos])
            .putString(mComplicationId + "_selected_currency_symbol", mSymbols[pos])
            .putString(mComplicationId + "_selected_currency_ticker", mTickers[pos])
            .putInt(mComplicationId + "_selected_currency_invert", mInvert[pos])
            .apply();

    setResult(RESULT_OK);
    ComplicationService.requestUpdateComplication(this, mComplicationId);
    finish();
}
 
開發者ID:dps,項目名稱:wear-exchangerates,代碼行數:16,代碼來源:ConfigActivity.java

示例10: onBindViewHolder

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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[position]);
    // replace list item's metadata
    holder.itemView.setTag(mDataset[position]);
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:12,代碼來源:MenuListActivity.java

示例11: onClick

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onClick(WearableListView.ViewHolder viewHolder) {
    int clickedMenu = viewHolder.getLayoutPosition();
    switch (clickedMenu) {
        case WearableAdapter.ITEM_LOCALIZATION:
            startActivity(new Intent(MainWatchActivity.this, WatchLocalizationActivity.class));
            break;
        case PositionsHelper.ITEM_SCAN11:
        case PositionsHelper.ITEM_SCAN12:
        case PositionsHelper.ITEM_SCAN21:
        case PositionsHelper.ITEM_SCAN22:
        case PositionsHelper.ITEM_SCAN31:
        case PositionsHelper.ITEM_SCAN32:
        case PositionsHelper.ITEM_SCAN41:
        case PositionsHelper.ITEM_SCAN42:
            Intent intent = new Intent(MainWatchActivity.this, ProcessingActivity.class);
            intent.putExtra("mode", "measure");
            intent.putExtra("placeId", PositionsHelper.getMenuLabelForPosition(clickedMenu));
            startActivity(intent);
            break;

        case WearableAdapter.ITEM_CALCULATE:
            intent = new Intent(MainWatchActivity.this, ProcessingActivity.class);
            intent.putExtra("mode", "average");
            startActivity(intent);
            break;
        case WearableAdapter.ITEM_DELETE:
            mMeasureClass.deleteAllMeasurements();
            break;
        default:
            Toast.makeText(MainWatchActivity.this,
                    String.format("You selected item #%s",
                            viewHolder.getLayoutPosition() + 1),
                    Toast.LENGTH_SHORT).show();
            break;
    }

}
 
開發者ID:chenkel,項目名稱:Lokalisierung-mit-Wearables,代碼行數:39,代碼來源:MainWatchActivity.java

示例12: onBindViewHolder

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onBindViewHolder(WearableListView.ViewHolder viewHolder,
                             int position) {
    ItemViewHolder itemViewHolder = (ItemViewHolder) viewHolder;
    CircledImageView circledView = itemViewHolder.mCircledImageView;
    circledView.setImageResource(mItems.get(position));
    TextView textView = itemViewHolder.mItemTextView;
    switch (position) {
        case ITEM_LOCALIZATION:
            textView.setText(R.string.menu_start_localization);
            break;
        case PositionsHelper.ITEM_SCAN11:
        case PositionsHelper.ITEM_SCAN12:
        case PositionsHelper.ITEM_SCAN21:
        case PositionsHelper.ITEM_SCAN22:
        case PositionsHelper.ITEM_SCAN31:
        case PositionsHelper.ITEM_SCAN32:
        case PositionsHelper.ITEM_SCAN41:
        case PositionsHelper.ITEM_SCAN42:
            String menuText = String.format(Locale.getDefault(), mRes.getString(R.string.menu_measure_place), PositionsHelper.getMenuLabelForPosition(position));
            textView.setText(menuText);
            break;
        case ITEM_CALCULATE:
            textView.setText(R.string.menu_calculate_average);
            break;
        case ITEM_DELETE:
            textView.setText(R.string.menu_delete_all_measurements);
            break;
    }
}
 
開發者ID:chenkel,項目名稱:Lokalisierung-mit-Wearables,代碼行數:31,代碼來源:WearableAdapter.java

示例13: onClick

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onClick(WearableListView.ViewHolder v) {
    String tag = (String) v.itemView.getTag();
    doAction(tag);
    //ActionsDefinitions.doAction(v.getAdapterPosition(), this);
    finish();
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:8,代碼來源:MenuListActivity.java

示例14: onCreateViewHolder

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
/**
 * Create a ViewHolder that will hold a reference to the views that
 * we will need to update for each new item in the list.
 */
@SuppressLint("InflateParams")
@Override
public WearableListView.ViewHolder onCreateViewHolder(
    ViewGroup viewGroup, int i) {

    // Return a new ViewHolder (see below for class ViewHolder).
    // Each view in our list will use the item_task.xml layout.
    return new ViewHolder(
        inflater.inflate(R.layout.item_task, null));
}
 
開發者ID:emmby,項目名稱:easy-a,代碼行數:15,代碼來源:WearableTaskListAdapter.java

示例15: onCreateViewHolder

import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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);
}
 
開發者ID:florent37,項目名稱:WearMenu,代碼行數:8,代碼來源:WearMenuListListViewAdapter.java


注:本文中的android.support.wearable.view.WearableListView.ViewHolder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。