Java Code Examples for org.telegram.ui.Components.RecyclerListView#setOnItemClickListener()
The following examples show how to use
org.telegram.ui.Components.RecyclerListView#setOnItemClickListener() .
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: FiltersSetupActivity.java From Telegram with GNU General Public License v2.0 | 5 votes |
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); actionBar.setTitle(LocaleController.getString("Filters", R.string.Filters)); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } } }); fragmentView = new FrameLayout(context); FrameLayout frameLayout = (FrameLayout) fragmentView; frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray)); listView = new RecyclerListView(context); ((DefaultItemAnimator) listView.getItemAnimator()).setDelayAnimations(false); listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); listView.setVerticalScrollBarEnabled(false); itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback()); itemTouchHelper.attachToRecyclerView(listView); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); listView.setAdapter(adapter = new ListAdapter(context)); listView.setOnItemClickListener((view, position, x, y) -> { if (position >= filtersStartRow && position < filtersEndRow) { presentFragment(new FilterCreateActivity(getMessagesController().dialogFilters.get(position - filtersStartRow))); } else if (position == createFilterRow) { presentFragment(new FilterCreateActivity()); } }); return fragmentView; }
Example 2
Source File: QuickRepliesSettingsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setTitle(LocaleController.getString("VoipQuickReplies", R.string.VoipQuickReplies)); if (AndroidUtilities.isTablet()) { actionBar.setOccupyStatusBar(false); } actionBar.setAllowOverlayTitle(true); 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) { } }); frameLayout.addView(actionBar); return fragmentView; }
Example 3
Source File: FiltersSetupActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); actionBar.setTitle(LocaleController.getString("Filters", R.string.Filters)); actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() { @Override public void onItemClick(int id) { if (id == -1) { finishFragment(); } } }); fragmentView = new FrameLayout(context); FrameLayout frameLayout = (FrameLayout) fragmentView; frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray)); listView = new RecyclerListView(context); ((DefaultItemAnimator) listView.getItemAnimator()).setDelayAnimations(false); listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); listView.setVerticalScrollBarEnabled(false); itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback()); itemTouchHelper.attachToRecyclerView(listView); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); listView.setAdapter(adapter = new ListAdapter(context)); listView.setOnItemClickListener((view, position, x, y) -> { if (position >= filtersStartRow && position < filtersEndRow) { presentFragment(new FilterCreateActivity(getMessagesController().dialogFilters.get(position - filtersStartRow))); } else if (position == createFilterRow) { presentFragment(new FilterCreateActivity()); } }); return fragmentView; }
Example 4
Source File: QuickRepliesSettingsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setTitle(LocaleController.getString("VoipQuickReplies", R.string.VoipQuickReplies)); if (AndroidUtilities.isTablet()) { actionBar.setOccupyStatusBar(false); } actionBar.setAllowOverlayTitle(true); 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) { } }); frameLayout.addView(actionBar); return fragmentView; }
Example 5
Source File: DataUsageActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@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(currentAccount).resetStats(currentType); listAdapter.notifyDataSetChanged(); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } } }); frameLayout.addView(actionBar); return fragmentView; }
Example 6
Source File: ArchivedStickersActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); if (currentType == MediaDataController.TYPE_IMAGE) { actionBar.setTitle(LocaleController.getString("ArchivedStickers", R.string.ArchivedStickers)); } else { actionBar.setTitle(LocaleController.getString("ArchivedMasks", R.string.ArchivedMasks)); } 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)); emptyView = new EmptyTextProgressView(context); if (currentType == MediaDataController.TYPE_IMAGE) { emptyView.setText(LocaleController.getString("ArchivedStickersEmpty", R.string.ArchivedStickersEmpty)); } else { emptyView.setText(LocaleController.getString("ArchivedMasksEmpty", R.string.ArchivedMasksEmpty)); } frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); if (loadingStickers) { emptyView.showProgress(); } else { emptyView.showTextView(); } listView = new RecyclerListView(context); listView.setFocusable(true); listView.setEmptyView(emptyView); listView.setLayoutManager(layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); listView.setAdapter(listAdapter); listView.setOnItemClickListener((view, position) -> { if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) { final TLRPC.StickerSetCovered stickerSet = sets.get(position - stickersStartRow); 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; final StickersAlert stickersAlert = new StickersAlert(getParentActivity(), ArchivedStickersActivity.this, inputStickerSet, null, null); stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() { @Override public void onStickerSetInstalled() { ((ArchivedStickerSetCell) view).setDrawProgress(true, true); installingStickerSets.put(stickerSet.set.id, stickerSet); } @Override public void onStickerSetUninstalled() { } }); showDialog(stickersAlert); } }); listView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (!loadingStickers && !endReached && layoutManager.findLastVisibleItemPosition() > stickersLoadingRow - 2) { getStickers(); } } }); return fragmentView; }
Example 7
Source File: LogoutActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setTitle(LocaleController.getString("LogOutTitle", R.string.LogOutTitle)); if (AndroidUtilities.isTablet()) { actionBar.setOccupyStatusBar(false); } actionBar.setAllowOverlayTitle(true); 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((view, position, x, y) -> { if (position == addAccountRow) { int freeAccount = -1; for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { if (!UserConfig.getInstance(a).isClientActivated()) { freeAccount = a; break; } } if (freeAccount >= 0) { presentFragment(new LoginActivity(freeAccount)); } } else if (position == passcodeRow) { presentFragment(new PasscodeActivity(0)); } else if (position == cacheRow) { presentFragment(new CacheControlActivity()); } else if (position == phoneRow) { presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANGE_PHONE_NUMBER)); } else if (position == supportRow) { showDialog(AlertsCreator.createSupportAlert(LogoutActivity.this)); } else if (position == logoutRow) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); UserConfig userConfig = getUserConfig(); builder.setMessage(LocaleController.getString("AreYouSureLogout", R.string.AreYouSureLogout)); builder.setTitle(LocaleController.getString("LogOut", R.string.LogOut)); builder.setPositiveButton(LocaleController.getString("LogOut", R.string.LogOut), (dialogInterface, i) -> MessagesController.getInstance(currentAccount).performLogout(1)); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); AlertDialog alertDialog = builder.create(); showDialog(alertDialog); TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); if (button != null) { button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); } } }); return fragmentView; }
Example 8
Source File: ContentPreviewViewer.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
public boolean onInterceptTouchEvent(MotionEvent event, final RecyclerListView listView, final int height, ContentPreviewViewerDelegate contentPreviewViewerDelegate) { delegate = contentPreviewViewerDelegate; if (event.getAction() == MotionEvent.ACTION_DOWN) { int x = (int) event.getX(); int y = (int) event.getY(); int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View view = null; if (listView instanceof RecyclerListView) { view = listView.getChildAt(a); } if (view == null) { return false; } int top = view.getTop(); int bottom = view.getBottom(); int left = view.getLeft(); int right = view.getRight(); if (top > y || bottom < y || left > x || right < x) { continue; } int contentType = CONTENT_TYPE_NONE; if (view instanceof StickerEmojiCell) { if (((StickerEmojiCell) view).showingBitmap()) { contentType = CONTENT_TYPE_STICKER; centerImage.setRoundRadius(0); } } else if (view instanceof StickerCell) { if (((StickerCell) view).showingBitmap()) { contentType = CONTENT_TYPE_STICKER; centerImage.setRoundRadius(0); } } else if (view instanceof ContextLinkCell) { ContextLinkCell cell = (ContextLinkCell) view; if (cell.showingBitmap()) { if (cell.isSticker()) { contentType = CONTENT_TYPE_STICKER; centerImage.setRoundRadius(0); } else if (cell.isGif()) { contentType = CONTENT_TYPE_GIF; centerImage.setRoundRadius(AndroidUtilities.dp(6)); } } } if (contentType == CONTENT_TYPE_NONE) { return false; } startX = x; startY = y; currentPreviewCell = view; int contentTypeFinal = contentType; openPreviewRunnable = () -> { if (openPreviewRunnable == null) { return; } listView.setOnItemClickListener((RecyclerListView.OnItemClickListener) null); listView.requestDisallowInterceptTouchEvent(true); openPreviewRunnable = null; setParentActivity((Activity) listView.getContext()); setKeyboardHeight(height); clearsInputField = false; if (currentPreviewCell instanceof StickerEmojiCell) { StickerEmojiCell stickerEmojiCell = (StickerEmojiCell) currentPreviewCell; open(stickerEmojiCell.getSticker(), null, contentTypeFinal, stickerEmojiCell.isRecent(), stickerEmojiCell.getParentObject()); stickerEmojiCell.setScaled(true); } else if (currentPreviewCell instanceof StickerCell) { StickerCell stickerCell = (StickerCell) currentPreviewCell; open(stickerCell.getSticker(), null, contentTypeFinal, false, stickerCell.getParentObject()); stickerCell.setScaled(true); clearsInputField = stickerCell.isClearsInputField(); } else if (currentPreviewCell instanceof ContextLinkCell) { ContextLinkCell contextLinkCell = (ContextLinkCell) currentPreviewCell; open(contextLinkCell.getDocument(), contextLinkCell.getBotInlineResult(), contentTypeFinal, false, contextLinkCell.getInlineBot()); if (contentTypeFinal != CONTENT_TYPE_GIF) { contextLinkCell.setScaled(true); } } }; AndroidUtilities.runOnUIThread(openPreviewRunnable, 200); return true; } } return false; }
Example 9
Source File: FeaturedStickersActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@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((view, position) -> { if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) { final TLRPC.StickerSetCovered stickerSet = MediaDataController.getInstance(currentAccount).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, true); installingStickerSets.put(stickerSet.set.id, stickerSet); } @Override public void onStickerSetUninstalled() { } }); showDialog(stickersAlert); } }); return fragmentView; }
Example 10
Source File: ArchivedStickersActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); if (currentType == MediaDataController.TYPE_IMAGE) { actionBar.setTitle(LocaleController.getString("ArchivedStickers", R.string.ArchivedStickers)); } else { actionBar.setTitle(LocaleController.getString("ArchivedMasks", R.string.ArchivedMasks)); } 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)); emptyView = new EmptyTextProgressView(context); if (currentType == MediaDataController.TYPE_IMAGE) { emptyView.setText(LocaleController.getString("ArchivedStickersEmpty", R.string.ArchivedStickersEmpty)); } else { emptyView.setText(LocaleController.getString("ArchivedMasksEmpty", R.string.ArchivedMasksEmpty)); } frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); if (loadingStickers) { emptyView.showProgress(); } else { emptyView.showTextView(); } listView = new RecyclerListView(context); listView.setFocusable(true); listView.setEmptyView(emptyView); listView.setLayoutManager(layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)); frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT)); listView.setAdapter(listAdapter); listView.setOnItemClickListener((view, position) -> { if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) { final TLRPC.StickerSetCovered stickerSet = sets.get(position - stickersStartRow); 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; final StickersAlert stickersAlert = new StickersAlert(getParentActivity(), ArchivedStickersActivity.this, inputStickerSet, null, null); stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() { @Override public void onStickerSetInstalled() { ((ArchivedStickerSetCell) view).setDrawProgress(true, true); installingStickerSets.put(stickerSet.set.id, stickerSet); } @Override public void onStickerSetUninstalled() { } }); showDialog(stickersAlert); } }); listView.setOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { if (!loadingStickers && !endReached && layoutManager.findLastVisibleItemPosition() > stickersLoadingRow - 2) { getStickers(); } } }); return fragmentView; }
Example 11
Source File: LogoutActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setTitle(LocaleController.getString("LogOutTitle", R.string.LogOutTitle)); if (AndroidUtilities.isTablet()) { actionBar.setOccupyStatusBar(false); } actionBar.setAllowOverlayTitle(true); 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((view, position, x, y) -> { if (position == addAccountRow) { int freeAccount = -1; for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) { if (!UserConfig.getInstance(a).isClientActivated()) { freeAccount = a; break; } } if (freeAccount >= 0) { presentFragment(new LoginActivity(freeAccount)); } } else if (position == passcodeRow) { presentFragment(new PasscodeActivity(0)); } else if (position == cacheRow) { presentFragment(new CacheControlActivity()); } else if (position == phoneRow) { presentFragment(new ActionIntroActivity(ActionIntroActivity.ACTION_TYPE_CHANGE_PHONE_NUMBER)); } else if (position == supportRow) { showDialog(AlertsCreator.createSupportAlert(LogoutActivity.this)); } else if (position == logoutRow) { if (getParentActivity() == null) { return; } AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); UserConfig userConfig = getUserConfig(); builder.setMessage(LocaleController.getString("AreYouSureLogout", R.string.AreYouSureLogout)); builder.setTitle(LocaleController.getString("LogOut", R.string.LogOut)); builder.setPositiveButton(LocaleController.getString("LogOut", R.string.LogOut), (dialogInterface, i) -> MessagesController.getInstance(currentAccount).performLogout(1)); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); AlertDialog alertDialog = builder.create(); showDialog(alertDialog); TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE); if (button != null) { button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2)); } } }); return fragmentView; }
Example 12
Source File: CommonGroupsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@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((view, 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.getInstance(currentAccount).checkCanOpenChat(args, CommonGroupsActivity.this)) { return; } NotificationCenter.getInstance(currentAccount).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; }
Example 13
Source File: StickersActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public View createView(Context context) { actionBar.setBackButtonImage(R.drawable.ic_ab_back); actionBar.setAllowOverlayTitle(true); if (currentType == DataQuery.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 = DataQuery.getInstance(currentAccount).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(DataQuery.TYPE_MASK)); } else if (position == suggestRow) { AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity()); builder.setTitle(LocaleController.getString("SuggestStickers", R.string.SuggestStickers)); CharSequence[] items = new CharSequence[]{ LocaleController.getString("SuggestStickersAll", R.string.SuggestStickersAll), LocaleController.getString("SuggestStickersInstalled", R.string.SuggestStickersInstalled), LocaleController.getString("SuggestStickersNone", R.string.SuggestStickersNone), }; builder.setItems(items, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { SharedConfig.setSuggestStickers(which); listAdapter.notifyItemChanged(suggestRow); } }); showDialog(builder.create()); } } }); return fragmentView; }
Example 14
Source File: FeaturedStickersActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@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 = DataQuery.getInstance(currentAccount).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; }
Example 15
Source File: ConvertGroupActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@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(currentAccount).convertToMegaGroup(getParentActivity(), chat_id); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } } }); return fragmentView; }
Example 16
Source File: ContentPreviewViewer.java From Telegram with GNU General Public License v2.0 | 4 votes |
public boolean onInterceptTouchEvent(MotionEvent event, final RecyclerListView listView, final int height, ContentPreviewViewerDelegate contentPreviewViewerDelegate) { delegate = contentPreviewViewerDelegate; if (event.getAction() == MotionEvent.ACTION_DOWN) { int x = (int) event.getX(); int y = (int) event.getY(); int count = listView.getChildCount(); for (int a = 0; a < count; a++) { View view = null; if (listView instanceof RecyclerListView) { view = listView.getChildAt(a); } if (view == null) { return false; } int top = view.getTop(); int bottom = view.getBottom(); int left = view.getLeft(); int right = view.getRight(); if (top > y || bottom < y || left > x || right < x) { continue; } int contentType = CONTENT_TYPE_NONE; if (view instanceof StickerEmojiCell) { if (((StickerEmojiCell) view).showingBitmap()) { contentType = CONTENT_TYPE_STICKER; centerImage.setRoundRadius(0); } } else if (view instanceof StickerCell) { if (((StickerCell) view).showingBitmap()) { contentType = CONTENT_TYPE_STICKER; centerImage.setRoundRadius(0); } } else if (view instanceof ContextLinkCell) { ContextLinkCell cell = (ContextLinkCell) view; if (cell.showingBitmap()) { if (cell.isSticker()) { contentType = CONTENT_TYPE_STICKER; centerImage.setRoundRadius(0); } else if (cell.isGif()) { contentType = CONTENT_TYPE_GIF; centerImage.setRoundRadius(AndroidUtilities.dp(6)); } } } if (contentType == CONTENT_TYPE_NONE) { return false; } startX = x; startY = y; currentPreviewCell = view; int contentTypeFinal = contentType; openPreviewRunnable = () -> { if (openPreviewRunnable == null) { return; } listView.setOnItemClickListener((RecyclerListView.OnItemClickListener) null); listView.requestDisallowInterceptTouchEvent(true); openPreviewRunnable = null; setParentActivity((Activity) listView.getContext()); setKeyboardHeight(height); clearsInputField = false; if (currentPreviewCell instanceof StickerEmojiCell) { StickerEmojiCell stickerEmojiCell = (StickerEmojiCell) currentPreviewCell; open(stickerEmojiCell.getSticker(), null, contentTypeFinal, stickerEmojiCell.isRecent(), stickerEmojiCell.getParentObject()); stickerEmojiCell.setScaled(true); } else if (currentPreviewCell instanceof StickerCell) { StickerCell stickerCell = (StickerCell) currentPreviewCell; open(stickerCell.getSticker(), null, contentTypeFinal, false, stickerCell.getParentObject()); stickerCell.setScaled(true); clearsInputField = stickerCell.isClearsInputField(); } else if (currentPreviewCell instanceof ContextLinkCell) { ContextLinkCell contextLinkCell = (ContextLinkCell) currentPreviewCell; open(contextLinkCell.getDocument(), contextLinkCell.getBotInlineResult(), contentTypeFinal, false, contextLinkCell.getInlineBot()); if (contentTypeFinal != CONTENT_TYPE_GIF) { contextLinkCell.setScaled(true); } } }; AndroidUtilities.runOnUIThread(openPreviewRunnable, 200); return true; } } return false; }
Example 17
Source File: CommonGroupsActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@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((view, 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.getInstance(currentAccount).checkCanOpenChat(args, CommonGroupsActivity.this)) { return; } NotificationCenter.getInstance(currentAccount).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; }
Example 18
Source File: DataUsageActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@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(currentAccount).resetStats(currentType); listAdapter.notifyDataSetChanged(); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } } }); frameLayout.addView(actionBar); return fragmentView; }
Example 19
Source File: FeaturedStickersActivity.java From Telegram with GNU General Public License v2.0 | 4 votes |
@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((view, position) -> { if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) { final TLRPC.StickerSetCovered stickerSet = MediaDataController.getInstance(currentAccount).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, true); installingStickerSets.put(stickerSet.set.id, stickerSet); } @Override public void onStickerSetUninstalled() { } }); showDialog(stickersAlert); } }); return fragmentView; }
Example 20
Source File: ConvertGroupActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@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(currentAccount).convertToMegaGroup(getParentActivity(), chat_id); } }); builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null); showDialog(builder.create()); } } }); return fragmentView; }