本文整理匯總了Java中android.support.wearable.view.WearableListView.setClickListener方法的典型用法代碼示例。如果您正苦於以下問題:Java WearableListView.setClickListener方法的具體用法?Java WearableListView.setClickListener怎麽用?Java WearableListView.setClickListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.wearable.view.WearableListView
的用法示例。
在下文中一共展示了WearableListView.setClickListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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 = (WearableListView) findViewById(R.id.devices_list);
listView.setAdapter(mDeviceAdapter = new DevicesAdapter(listView));
listView.setClickListener(mOnRowClickListener);
listView.addOnScrollListener(mOnScrollListener);
// The header will be moved as the list is scrolled
mHeader = findViewById(R.id.header);
// Register a broadcast receiver that will listen for events from the service.
LocalBroadcastManager.getInstance(this).registerReceiver(mServiceBroadcastReceiver, BleProfileService.makeIntentFilter());
}
示例2: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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);
}
示例3: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_config_wear_default);
final Configuration parent = (Configuration) getIntent().getSerializableExtra(EXTRA_PARENT);
final int selectedIndex = getIntent().getIntExtra(EXTRA_SELECTED_INDEX, 0);
final WearableListView listView = (WearableListView) findViewById(R.id.list_config);
listView.setAdapter(new SelectionAdapter(getItems(parent)));
listView.scrollToPosition(selectedIndex);
listView.setClickListener(new WearableListView.ClickListener() {
@Override
public void onClick(final WearableListView.ViewHolder viewHolder) {
final Serializable selection = (Serializable) viewHolder.itemView.getTag();
final Intent data = new Intent();
data.putExtra(EXTRA_PARENT, parent);
data.putExtra(EXTRA_RESULT, selection);
setResult(RESULT_OK, data);
finish();
}
@Override
public void onTopEmptyRegionClick() { }
});
}
示例4: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_config_wear_default);
apiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Wearable.API)
.build();
onBeforeListViewSetup(apiClient);
final WearableListView listView = (WearableListView) findViewById(R.id.list_config);
listView.setAdapter(getListAdapter());
listView.setClickListener(getListClickListener());
}
示例5: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_watch_face_config);
val = new Values(getApplicationContext());
// 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 ListAdapter(this, elements));
// Set a click listener
listView.setClickListener(this);
}
示例6: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apps_settings);
mContext = getApplicationContext();
// Get the list component from the layout of the activity
mListView =
(WearableListView) findViewById(R.id.wearable_list);
mListAppInfo = Utils.getAllApps(this);
// Assign an adapter to the list
mListView.setAdapter(new Adapter(this, mListAppInfo, getPackageManager()));
// Set a click listener
mListView.setClickListener(this);
mThread = new Thread(new Task());
mThread.start();
}
示例7: handleIntent
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
private void handleIntent(Intent intent) {
VehicleMode flightMode = intent.getParcelableExtra(WearReceiverService.EXTRA_EVENT_DATA);
if(flightMode == null)
flightMode = VehicleMode.UNKNOWN;
List<VehicleMode> vehicleModes = VehicleMode.getVehicleModePerDroneType(flightMode.getDroneType());
WearableListView listView = (WearableListView) findViewById(R.id.wear_list);
listView.setAdapter(new VehicleModeAdapter(vehicleModes));
listView.setClickListener(this);
RecyclerView.LayoutManager layoutMgr = listView.getLayoutManager();
if (layoutMgr != null) {
int currentPos = vehicleModes.indexOf(flightMode);
if (currentPos != -1)
layoutMgr.scrollToPosition(currentPos);
}
}
示例8: setMenuElements
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
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();
}
});
}
示例9: onCreateView
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
/**
* Creates the view by inflating the layout and assigning a custom adapter to the view to track the
* list and setting a click listener to it.
* @param inflater Inflater of the layout.
* @param container Parent view of the fragment if available.
* @param savedInstanceState Contains fragment's save state if available.
* @return View of the fragment's ui.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
if (elements == null) {
elements = getSensors();
}
View view=inflater.inflate(R.layout.fragment_one_layout, container,false);
WearableListView listView =
(WearableListView) view.findViewById(R.id.wearable_list);
mAdapter = new WearableListAdapter(this, elements);
listView.setAdapter(mAdapter);
if (listView.getAdapter() == null) {
Log.d("Nullcheck is null", "");
}
listView.setClickListener(this);
return view;
}
示例10: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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(mDeviceAdapter = new DevicesAdapter(listView));
listView.setClickListener(mOnRowClickListener);
listView.addOnScrollListener(mOnScrollListener);
// The header will be moved as the list is scrolled
mHeader = findViewById(R.id.header);
// Register a broadcast receiver that will listen for events from the service.
LocalBroadcastManager.getInstance(this).registerReceiver(mServiceBroadcastReceiver, BleProfileService.makeIntentFilter());
}
示例11: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apps_settings);
mContext = getApplicationContext();
mNoAppsView = (TextView) findViewById(R.id.noapps);
// Get the list component from the layout of the activity
mListView =
(WearableListView) findViewById(R.id.wearable_list);
mListAppInfo = Utils.getInstalledApps(this);
// Assign an adapter to the list
mListView.setAdapter(new Adapter(this, mListAppInfo, getPackageManager()));
if (mListAppInfo.size() == 0) {
mNoAppsView.setVisibility(View.VISIBLE);
}
// Set a click listener
mListView.setClickListener(this);
mThread = new Thread(new Task());
mThread.start();
}
示例12: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_apps_settings);
mContext = getApplicationContext();
// Get the list component from the layout of the activity
mListView =
(WearableListView) findViewById(R.id.wearable_list);
mListAppInfo = Utils.getRunningServices(this);
// Assign an adapter to the list
mListView.setAdapter(new Adapter(this, mListAppInfo, getPackageManager()));
// Set a click listener
mListView.setClickListener(this);
mThread = new Thread(new Task());
mThread.start();
}
示例13: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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, mServiceConnection, 0);
final WearableListView listView = (WearableListView) findViewById(R.id.list);
listView.setClickListener(this);
listView.setAdapter(mAdapter = new UARTConfigurationsAdapter(this));
mGoogleApiClient = 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(mServiceBroadcastReceiver, filter);
}
示例14: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@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);
}
示例15: onCreate
import android.support.wearable.view.WearableListView; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.w(TAG, "onCreate");
setContentView(R.layout.activity_main);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
ArrayList<Integer> mIcons = new ArrayList<>();
mIcons.add(R.drawable.ic_red_door);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_station);
mIcons.add(R.drawable.ic_action_select_all);
mIcons.add(R.drawable.ic_action_delete);
// This is our list header
mHeader = (TextView) findViewById(R.id.header);
mMeasureClass = new MeasureClass(this) {
@Override
public void updateMeasurementsCount() {}
};
WearableListView wearableListView =
(WearableListView) findViewById(R.id.wearable_List);
WearableAdapter wa = new WearableAdapter(this, mIcons);
wearableListView.setAdapter(wa);
wearableListView.setClickListener(mClickListener);
wearableListView.addOnScrollListener(mOnScrollListener);
}