本文整理汇总了Java中org.telegram.ui.Components.RecyclerListView.setOnItemClickListener方法的典型用法代码示例。如果您正苦于以下问题:Java RecyclerListView.setOnItemClickListener方法的具体用法?Java RecyclerListView.setOnItemClickListener怎么用?Java RecyclerListView.setOnItemClickListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.ui.Components.RecyclerListView
的用法示例。
在下文中一共展示了RecyclerListView.setOnItemClickListener方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createView
import org.telegram.ui.Components.RecyclerListView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
actionBar.setTitle(LocaleController.getString("Stickers", R.string.Stickers));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
listAdapter = new ListAdapter(context);
fragmentView = new FrameLayout(context);
FrameLayout frameLayout = (FrameLayout) fragmentView;
//:ramin
frameLayout.setBackgroundColor(NightModeUtil.darkIfNightMode(0xfff0f0f0));
//NightModeUtil.dark(frameLayout);
listView = new RecyclerListView(context);
listView.setFocusable(true);
listView.setTag(7);
LinearLayoutManager layoutManager = new LinearLayoutManager(context);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
listView.setLayoutManager(layoutManager);
//:ramin
if(optionsVisible()){
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback());
itemTouchHelper.attachToRecyclerView(listView);
}
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
sendReorder();
final TLRPC.TL_messages_stickerSet stickerSet = StickersQuery.getStickerSets().get(position);
ArrayList<TLRPC.Document> stickers = stickerSet.documents;
if (stickers == null || stickers.isEmpty()) {
return;
}
showDialog(new StickersAlert(getParentActivity(), null, stickerSet, null));
}
}
});
FontManager.instance().setTypefaceImmediate(fragmentView);
return fragmentView;
}
示例2: createView
import org.telegram.ui.Components.RecyclerListView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
if (currentType == StickersQuery.TYPE_IMAGE) {
actionBar.setTitle(LocaleController.getString("Stickers", R.string.Stickers));
} else {
actionBar.setTitle(LocaleController.getString("Masks", R.string.Masks));
}
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
listAdapter = new ListAdapter(context);
fragmentView = new FrameLayout(context);
FrameLayout frameLayout = (FrameLayout) fragmentView;
frameLayout.setBackgroundColor(0xfff0f0f0);
listView = new RecyclerListView(context);
listView.setFocusable(true);
listView.setTag(7);
LinearLayoutManager layoutManager = new LinearLayoutManager(context);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
listView.setLayoutManager(layoutManager);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback());
itemTouchHelper.attachToRecyclerView(listView);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
sendReorder();
final TLRPC.TL_messages_stickerSet stickerSet = StickersQuery.getStickerSets(currentType).get(position - stickersStartRow);
ArrayList<TLRPC.Document> stickers = stickerSet.documents;
if (stickers == null || stickers.isEmpty()) {
return;
}
showDialog2(new StickersAlert(getParentActivity(), StickersActivity.this, null, stickerSet, null));
} else if (position == featuredRow) {
presentFragment(new FeaturedStickersActivity());
} else if (position == archivedRow) {
presentFragment(new ArchivedStickersActivity(currentType));
} else if (position == masksRow) {
presentFragment(new StickersActivity(StickersQuery.TYPE_MASK));
}
}
});
return fragmentView;
}
示例3: createView
import org.telegram.ui.Components.RecyclerListView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
actionBar.setTitle(LocaleController.getString("FeaturedStickers", R.string.FeaturedStickers));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
listAdapter = new ListAdapter(context);
fragmentView = new FrameLayout(context);
FrameLayout frameLayout = (FrameLayout) fragmentView;
frameLayout.setBackgroundColor(0xfff0f0f0);
RecyclerListView listView = new RecyclerListView(context);
listView.setItemAnimator(null);
listView.setLayoutAnimation(null);
listView.setFocusable(true);
listView.setTag(14);
layoutManager = new LinearLayoutManager(context) {
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
};
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
listView.setLayoutManager(layoutManager);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(final View view, int position) {
if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
final TLRPC.StickerSetCovered stickerSet = StickersQuery.getFeaturedStickerSets().get(position);
TLRPC.InputStickerSet inputStickerSet;
if (stickerSet.set.id != 0) {
inputStickerSet = new TLRPC.TL_inputStickerSetID();
inputStickerSet.id = stickerSet.set.id;
} else {
inputStickerSet = new TLRPC.TL_inputStickerSetShortName();
inputStickerSet.short_name = stickerSet.set.short_name;
}
inputStickerSet.access_hash = stickerSet.set.access_hash;
StickersAlert stickersAlert = new StickersAlert(getParentActivity(), FeaturedStickersActivity.this, inputStickerSet, null, null);
stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() {
@Override
public void onStickerSetInstalled() {
FeaturedStickerSetCell cell = (FeaturedStickerSetCell) view;
cell.setDrawProgress(true);
installingStickerSets.put(stickerSet.set.id, stickerSet);
}
@Override
public void onStickerSetUninstalled() {
}
});
showDialog2(stickersAlert);
}
}
});
return fragmentView;
}
示例4: createView
import org.telegram.ui.Components.RecyclerListView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
if (currentType == StickersQuery.TYPE_IMAGE) {
actionBar.setTitle(LocaleController.getString("StickersName", R.string.StickersName));
} else {
actionBar.setTitle(LocaleController.getString("Masks", R.string.Masks));
}
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
listAdapter = new ListAdapter(context);
fragmentView = new FrameLayout(context);
FrameLayout frameLayout = (FrameLayout) fragmentView;
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
listView = new RecyclerListView(context);
listView.setFocusable(true);
listView.setTag(7);
LinearLayoutManager layoutManager = new LinearLayoutManager(context);
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
listView.setLayoutManager(layoutManager);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback());
itemTouchHelper.attachToRecyclerView(listView);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
sendReorder();
final TLRPC.TL_messages_stickerSet stickerSet = StickersQuery.getStickerSets(currentType).get(position - stickersStartRow);
ArrayList<TLRPC.Document> stickers = stickerSet.documents;
if (stickers == null || stickers.isEmpty()) {
return;
}
showDialog(new StickersAlert(getParentActivity(), StickersActivity.this, null, stickerSet, null));
} else if (position == featuredRow) {
sendReorder();
presentFragment(new FeaturedStickersActivity());
} else if (position == archivedRow) {
sendReorder();
presentFragment(new ArchivedStickersActivity(currentType));
} else if (position == masksRow) {
presentFragment(new StickersActivity(StickersQuery.TYPE_MASK));
}
}
});
return fragmentView;
}
示例5: createView
import org.telegram.ui.Components.RecyclerListView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
actionBar.setTitle(LocaleController.getString("ConvertGroup", R.string.ConvertGroup));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
listAdapter = new ListAdapter(context);
fragmentView = new FrameLayout(context);
FrameLayout frameLayout = (FrameLayout) fragmentView;
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
listView = new RecyclerListView(context);
listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
listView.setVerticalScrollBarEnabled(false);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if (position == convertRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setMessage(LocaleController.getString("ConvertGroupAlert", R.string.ConvertGroupAlert));
builder.setTitle(LocaleController.getString("ConvertGroupAlertWarning", R.string.ConvertGroupAlertWarning));
builder.setPositiveButton(LocaleController.getString("OK", R.string.OK), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
MessagesController.getInstance().convertToMegaGroup(getParentActivity(), chat_id);
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
}
});
return fragmentView;
}
示例6: createView
import org.telegram.ui.Components.RecyclerListView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
actionBar.setTitle(LocaleController.getString("FeaturedStickers", R.string.FeaturedStickers));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
listAdapter = new ListAdapter(context);
fragmentView = new FrameLayout(context);
FrameLayout frameLayout = (FrameLayout) fragmentView;
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
listView = new RecyclerListView(context);
listView.setItemAnimator(null);
listView.setLayoutAnimation(null);
listView.setFocusable(true);
listView.setTag(14);
layoutManager = new LinearLayoutManager(context) {
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
};
layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
listView.setLayoutManager(layoutManager);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(final View view, int position) {
if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
final TLRPC.StickerSetCovered stickerSet = StickersQuery.getFeaturedStickerSets().get(position);
TLRPC.InputStickerSet inputStickerSet;
if (stickerSet.set.id != 0) {
inputStickerSet = new TLRPC.TL_inputStickerSetID();
inputStickerSet.id = stickerSet.set.id;
} else {
inputStickerSet = new TLRPC.TL_inputStickerSetShortName();
inputStickerSet.short_name = stickerSet.set.short_name;
}
inputStickerSet.access_hash = stickerSet.set.access_hash;
StickersAlert stickersAlert = new StickersAlert(getParentActivity(), FeaturedStickersActivity.this, inputStickerSet, null, null);
stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() {
@Override
public void onStickerSetInstalled() {
FeaturedStickerSetCell cell = (FeaturedStickerSetCell) view;
cell.setDrawProgress(true);
installingStickerSets.put(stickerSet.set.id, stickerSet);
}
@Override
public void onStickerSetUninstalled() {
}
});
showDialog(stickersAlert);
}
}
});
return fragmentView;
}
示例7: createView
import org.telegram.ui.Components.RecyclerListView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
if (currentType == 0) {
actionBar.setTitle(LocaleController.getString("MobileUsage", R.string.MobileUsage));
} else if (currentType == 1) {
actionBar.setTitle(LocaleController.getString("WiFiUsage", R.string.WiFiUsage));
} else if (currentType == 2) {
actionBar.setTitle(LocaleController.getString("RoamingUsage", R.string.RoamingUsage));
}
if (AndroidUtilities.isTablet()) {
actionBar.setOccupyStatusBar(false);
}
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
listAdapter = new ListAdapter(context);
fragmentView = new FrameLayout(context);
fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
FrameLayout frameLayout = (FrameLayout) fragmentView;
listView = new RecyclerListView(context);
listView.setVerticalScrollBarEnabled(false);
listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
listView.setAdapter(listAdapter);
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(View view, final int position) {
if (getParentActivity() == null) {
return;
}
if (position == resetRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("AppName", R.string.AppName));
builder.setMessage(LocaleController.getString("ResetStatisticsAlert", R.string.ResetStatisticsAlert));
builder.setPositiveButton(LocaleController.getString("Reset", R.string.Reset), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
StatsController.getInstance().resetStats(currentType);
listAdapter.notifyDataSetChanged();
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
showDialog(builder.create());
}
}
});
frameLayout.addView(actionBar);
return fragmentView;
}
示例8: createView
import org.telegram.ui.Components.RecyclerListView; //导入方法依赖的package包/类
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
actionBar.setTitle(LocaleController.getString("GroupsInCommonTitle", R.string.GroupsInCommonTitle));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
fragmentView = new FrameLayout(context);
fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
FrameLayout frameLayout = (FrameLayout) fragmentView;
emptyView = new EmptyTextProgressView(context);
emptyView.setText(LocaleController.getString("NoGroupsInCommon", R.string.NoGroupsInCommon));
frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView = new RecyclerListView(context);
listView.setEmptyView(emptyView);
listView.setLayoutManager(layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
listView.setAdapter(listViewAdapter = new ListAdapter(context));
listView.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT : RecyclerListView.SCROLLBAR_POSITION_RIGHT);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
@Override
public void onItemClick(View view, int position) {
if (position < 0 || position >= chats.size()) {
return;
}
TLRPC.Chat chat = chats.get(position);
Bundle args = new Bundle();
args.putInt("chat_id", chat.id);
if (!MessagesController.checkCanOpenChat(args, CommonGroupsActivity.this)) {
return;
}
NotificationCenter.getInstance().postNotificationName(NotificationCenter.closeChats);
presentFragment(new ChatActivity(args), true);
}
});
listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
int visibleItemCount = firstVisibleItem == RecyclerView.NO_POSITION ? 0 : Math.abs(layoutManager.findLastVisibleItemPosition() - firstVisibleItem) + 1;
if (visibleItemCount > 0) {
int totalItemCount = listViewAdapter.getItemCount();
if (!endReached && !loading && !chats.isEmpty() && firstVisibleItem + visibleItemCount >= totalItemCount - 5) {
getChats(chats.get(chats.size() - 1).id, 100);
}
}
}
});
if (loading) {
emptyView.showProgress();
} else {
emptyView.showTextView();
}
return fragmentView;
}