本文整理了Java中butterknife.OnItemClick
类的一些代码示例,展示了OnItemClick
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。OnItemClick
类的具体详情如下:
包路径:butterknife.OnItemClick
类名称:OnItemClick
暂无
代码示例来源:origin: square/sqlbrite
@OnItemClick(android.R.id.list) void listClicked(long listId) {
listener.onListClicked(listId);
}
代码示例来源:origin: JakeWharton/butterknife
private static @Nullable Unbinder parseOnItemClick(final Object target, final Method method,
View source) {
OnItemClick onItemClick = method.getAnnotation(OnItemClick.class);
if (onItemClick == null) {
return null;
}
validateMember(method);
validateReturnType(method, void.class);
final ArgumentTransformer argumentTransformer =
createArgumentTransformer(method, ON_ITEM_CLICK_TYPES);
List<AdapterView<?>> views =
findViews(source, onItemClick.value(), isRequired(method), method.getName(),
AdapterView.class);
ViewCollections.set(views, ON_ITEM_CLICK,
(parent, view, position, id) -> tryInvoke(method, target,
argumentTransformer.transform(parent, view, position, id)));
return new ListenerUnbinder<>(views, ON_ITEM_CLICK);
}
代码示例来源:origin: henrymorgen/android-advanced-light
@OnItemClick(R.id.lv_list)
void onItemClick(int position) {
Toast.makeText(this, "onItemClick" + position, Toast.LENGTH_SHORT).show();
}
代码示例来源:origin: zfman/hputimetable
@OnItemClick(R.id.id_listView)
public void onItemClick(int pos){
Intent intent=new Intent(this,AdapterDebugHtmlActivity.class);
intent.putExtra("schoolName",list.get(pos).get("name"));
intent.putExtra("aid",list.get(pos).get("aid"));
startActivity(intent);
}
代码示例来源:origin: mengdd/HelloActivityAndFragment
@OnItemClick(R.id.samples_list)
void onSampleListClick(AdapterView<?> parent, View view, int position, long id) {
// Launch the sample associated with this list position.
startActivity(new Intent(MainActivity.this, mSamples[position].activityClass));
}
代码示例来源:origin: behindeye/WxPhoneNumberHelper
@OnItemClick(R.id.lv_group_list)
void onItemClick(int index) {
mHost.jump2PagerFragment(mGroupList, index);
}
代码示例来源:origin: mengdd/AndroidButterKnifeSample
@OnItemClick(R.id.samples_list)
void onSampleListClick(AdapterView<?> parent, View view, int position, long id) {
// Launch the sample associated with this list position.
startActivity(new Intent(MainActivity.this, mSamples[position].activityClass));
}
代码示例来源:origin: guofudong/EShop
@OnItemClick(R.id.list_category) void onItemClick(int position) {
chooseCategory(position);
}
代码示例来源:origin: zfman/hputimetable
@OnItemClick(R.id.id_multi_listview)
public void toManagerActivity(int pos) {
showListDialog(pos);
}
代码示例来源:origin: zfman/hputimetable
@OnItemClick(R.id.id_listView)
public void onItemClick(int pos){
Intent intent=new Intent(this,DebugActivity.class);
intent.putExtra("uid", ShareTools.getString(this,"debug_userkey",null));
intent.putExtra("aid",aid);
intent.putExtra("filename",list.get(pos).get("name"));
startActivity(intent);
}
代码示例来源:origin: behindeye/WxPhoneNumberHelper
@OnItemClick(R.id.lv_center_number)
void onItemClick(int position) {
Intent intent = new Intent();
intent.putExtra(Const.KEY_CHOOSE_CENTER_NUMBER, mPhoneList.get(position));
setResult(RESULT_OK, intent);
back();
}
}
代码示例来源:origin: mengdd/AndroidButterKnifeSample
@OnItemClick(R.id.my_list_view)
void onItemClick(int position) {//though there are 4 parameters, you can just write the one you want to use
Toast.makeText(this, "You clicked: " + adapter.getItem(position).getName(), Toast.LENGTH_SHORT).show();
}
代码示例来源:origin: AzimoLabs/Language-Switcher-Tile
@OnItemClick(R2.id.lvLanguages)
public void selectLanguage(int position) {
presenter.selectLanguage(lvLanguages.getItemAtPosition(position).toString());
}
代码示例来源:origin: zfman/hputimetable
@OnItemClick(R.id.id_set_major_listview)
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
String major = datas.get(i).get("major");
setLoadLayout(true);
TimetableRequest.getByMajor(getContext(), major, new GetByMajorCallback(major));
}
代码示例来源:origin: MEnthoven/Android-HC05-App
@OnItemClick(R.id.devices_list_view) void onItemClick(int position) {
setStatus("Asking to connect");
final BluetoothDevice device = bluetoothDevicesAdapter.getItem(position);
new AlertDialog.Builder(MainActivity.this)
.setCancelable(false)
.setTitle("Connect")
.setMessage("Do you want to connect to: " + device.getName() + " - " + device.getAddress())
.setPositiveButton("Connect", new DialogInterface.OnClickListener() {
@Override public void onClick(DialogInterface dialog, int which) {
Log.d(Constants.TAG, "Opening new Activity");
bluetoothAdapter.cancelDiscovery();
toolbarProgressCircle.setVisibility(View.INVISIBLE);
Intent intent = new Intent(MainActivity.this, BluetoothActivity.class);
intent.putExtra(Constants.EXTRA_DEVICE, device);
startActivity(intent);
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override public void onClick(DialogInterface dialog, int which) {
setStatus("Cancelled connection");
Log.d(Constants.TAG, "Cancelled ");
}
}).show();
}
代码示例来源:origin: xiangzhihong/gpuImage
@OnItemClick(R.id.pictures)
public void addOrUpdateImage(AdapterView<?> parent, View view, int position, long id) {
if (position == picturesAdapter.getCount() - 1 && picturesAdapter.getRealCount() < 6) {
Bundle bundle = new Bundle();
bundle.putBoolean(Constants.IS_EDIT, true);
bundle.putSerializable(Constants.EXTRA_DATA, (Serializable) diary.TagImages);
ActivityUtil.startActivity(this, PhotoAlbumActivity.class, bundle);
} else {
TagImage tagImage = picturesAdapter.getItem(position);
if (tagImage.Pic.startsWith("http://") || tagImage.Pic.startsWith("https://")) {
tagImage.localPath = tagImage.Pic;
}
Intent intent = new Intent(this, ProcessPhotoActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Constants.EXTRA_DATA, tagImage);
startActivity(intent);
}
}
代码示例来源:origin: m-cakir/radio-player
@OnItemClick(R.id.listview)
public void onItemClick(AdapterView<?> parent, View view, int position, long id){
Shoutcast shoutcast = (Shoutcast) parent.getItemAtPosition(position);
if(shoutcast == null){
return;
}
textView.setText(shoutcast.getName());
subPlayer.setVisibility(View.VISIBLE);
streamURL = shoutcast.getUrl();
radioManager.playOrPause(streamURL);
}
}
代码示例来源:origin: zfman/hputimetable
@OnItemClick(R.id.id_search_course_listview)
public void onCourseItemClick(AdapterView<?> adapterView, View view, int i, long l) {
int day=1,start=1,step=1;
if(!TextUtils.isEmpty(courseDatas.get(i).get("day"))){
day=Integer.valueOf(courseDatas.get(i).get("day"));
}
if(!TextUtils.isEmpty(courseDatas.get(i).get("start"))){
start=Integer.valueOf(courseDatas.get(i).get("start"));
}
if(!TextUtils.isEmpty(courseDatas.get(i).get("step"))){
step=Integer.valueOf(courseDatas.get(i).get("step"));
}
BundleModel model=new BundleModel()
.setFromClass(HpuRepertoryActivity.class)
.put(AddTimetableActivity.KEY_NAME,courseDatas.get(i).get("name"))
.put(AddTimetableActivity.KEY_ROOM,courseDatas.get(i).get("room"))
.put(AddTimetableActivity.KEY_TEACHER,courseDatas.get(i).get("teacher"))
.put(AddTimetableActivity.KEY_START,start)
.put(AddTimetableActivity.KEY_DAY,day)
.put(AddTimetableActivity.KEY_STEP,step)
.put(AddTimetableActivity.KEY_WEEKS,courseDatas.get(i).get("weeks"));
ActivityTools.toActivity(this,AddTimetableActivity.class,model);
}
代码示例来源:origin: Coinomi/coinomi-android
@OnItemClick(R.id.transaction_rows)
public void onItemClick(int position) {
if (position >= transactionRows.getHeaderViewsCount()) {
// Note the usage of getItemAtPosition() instead of adapter's getItem() because
// the latter does not take into account the header (which has position 0).
Object obj = transactionRows.getItemAtPosition(position);
if (obj != null && obj instanceof AbstractTransaction) {
Intent intent = new Intent(getActivity(), TransactionDetailsActivity.class);
intent.putExtra(Constants.ARG_ACCOUNT_ID, accountId);
intent.putExtra(Constants.ARG_TRANSACTION_ID, ((AbstractTransaction) obj).getHashAsString());
startActivity(intent);
} else {
Toast.makeText(getActivity(), getString(R.string.get_tx_info_error), Toast.LENGTH_LONG).show();
}
}
}
代码示例来源:origin: openwalletGH/openwallet-android
@OnItemClick(R.id.transaction_rows)
public void onItemClick(int position) {
if (position >= transactionRows.getHeaderViewsCount()) {
// Note the usage of getItemAtPosition() instead of adapter's getItem() because
// the latter does not take into account the header (which has position 0).
Object obj = transactionRows.getItemAtPosition(position);
if (obj != null && obj instanceof AbstractTransaction) {
Intent intent = new Intent(getActivity(), TransactionDetailsActivity.class);
intent.putExtra(Constants.ARG_ACCOUNT_ID, accountId);
intent.putExtra(Constants.ARG_TRANSACTION_ID, ((AbstractTransaction) obj).getHashAsString());
startActivity(intent);
} else {
Toast.makeText(getActivity(), getString(R.string.get_tx_info_error), Toast.LENGTH_LONG).show();
}
}
}
内容来源于网络,如有侵权,请联系作者删除!