use of org.telegram.ui.Cells.UserCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class ContactsActivity method getThemeDescriptions.
@Override
public ArrayList<ThemeDescription> getThemeDescriptions() {
ArrayList<ThemeDescription> themeDescriptions = new ArrayList<>();
ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
if (listView != null) {
int count = listView.getChildCount();
for (int a = 0; a < count; a++) {
View child = listView.getChildAt(a);
if (child instanceof UserCell) {
((UserCell) child).update(0);
} else if (child instanceof ProfileSearchCell) {
((ProfileSearchCell) child).update(0);
}
}
}
};
themeDescriptions.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCH, null, null, null, null, Theme.key_actionBarDefaultSearch));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SEARCHPLACEHOLDER, null, null, null, null, Theme.key_actionBarDefaultSearchPlaceholder));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_SECTIONS, new Class[] { LetterSectionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayText4));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { View.class }, Theme.dividerPaint, null, null, Theme.key_divider));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_FASTSCROLL, null, null, null, null, Theme.key_fastScrollActive));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_FASTSCROLL, null, null, null, null, Theme.key_fastScrollInactive));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_FASTSCROLL, null, null, null, null, Theme.key_fastScrollText));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "nameTextView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "statusColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteGrayText));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "statusOnlineColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlueText));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueText2));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { TextCell.class }, new String[] { "imageView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayIcon));
themeDescriptions.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_chats_actionIcon));
themeDescriptions.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_chats_actionBackground));
themeDescriptions.add(new ThemeDescription(floatingButton, ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, null, null, null, null, Theme.key_chats_actionPressedBackground));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { GraySectionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_graySectionText));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[] { GraySectionCell.class }, null, null, null, Theme.key_graySection));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_groupDrawable, Theme.dialogs_broadcastDrawable, Theme.dialogs_botDrawable }, null, Theme.key_chats_nameIcon));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_verifiedCheckDrawable }, null, Theme.key_chats_verifiedCheck));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Drawable[] { Theme.dialogs_verifiedDrawable }, null, Theme.key_chats_verifiedBackground));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, Theme.dialogs_offlinePaint, null, null, Theme.key_windowBackgroundWhiteGrayText3));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, Theme.dialogs_onlinePaint, null, null, Theme.key_windowBackgroundWhiteBlueText3));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Paint[] { Theme.dialogs_namePaint[0], Theme.dialogs_namePaint[1], Theme.dialogs_searchNamePaint }, null, null, Theme.key_chats_name));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { ProfileSearchCell.class }, null, new Paint[] { Theme.dialogs_nameEncryptedPaint[0], Theme.dialogs_nameEncryptedPaint[1], Theme.dialogs_searchNameEncryptedPaint }, null, null, Theme.key_chats_secretName));
return themeDescriptions;
}
use of org.telegram.ui.Cells.UserCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class InviteLinkBottomSheet method updateColorForView.
private void updateColorForView(View view) {
if (view instanceof HeaderCell) {
((HeaderCell) view).getTextView().setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlueHeader));
} else if (view instanceof LinkActionView) {
((LinkActionView) view).updateColors();
} else if (view instanceof TextInfoPrivacyCell) {
CombinedDrawable combinedDrawable = new CombinedDrawable(new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray)), Theme.getThemedDrawable(view.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
combinedDrawable.setFullsize(true);
view.setBackground(combinedDrawable);
((TextInfoPrivacyCell) view).setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText4));
} else if (view instanceof UserCell) {
((UserCell) view).update(0);
}
RecyclerView.ViewHolder holder = listView.getChildViewHolder(view);
if (holder != null) {
if (holder.getItemViewType() == 7) {
Drawable shadowDrawable = Theme.getThemedDrawable(view.getContext(), R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow);
Drawable background = new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray));
CombinedDrawable combinedDrawable = new CombinedDrawable(background, shadowDrawable, 0, 0);
combinedDrawable.setFullsize(true);
view.setBackgroundDrawable(combinedDrawable);
} else if (holder.getItemViewType() == 2) {
Drawable shadowDrawable = Theme.getThemedDrawable(view.getContext(), R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow);
Drawable background = new ColorDrawable(Theme.getColor(Theme.key_windowBackgroundGray));
CombinedDrawable combinedDrawable = new CombinedDrawable(background, shadowDrawable, 0, 0);
combinedDrawable.setFullsize(true);
view.setBackgroundDrawable(combinedDrawable);
}
}
}
use of org.telegram.ui.Cells.UserCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class FilterCreateActivity method createView.
@Override
public View createView(Context context) {
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
ActionBarMenu menu = actionBar.createMenu();
if (creatingNew) {
actionBar.setTitle(LocaleController.getString("FilterNew", R.string.FilterNew));
} else {
TextPaint paint = new TextPaint(Paint.ANTI_ALIAS_FLAG);
paint.setTextSize(AndroidUtilities.dp(20));
actionBar.setTitle(Emoji.replaceEmoji(filter.name, paint.getFontMetricsInt(), AndroidUtilities.dp(20), false));
}
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
if (checkDiscard()) {
finishFragment();
}
} else if (id == done_button) {
processDone();
}
}
});
doneItem = menu.addItem(done_button, LocaleController.getString("Save", R.string.Save).toUpperCase());
fragmentView = new FrameLayout(context);
FrameLayout frameLayout = (FrameLayout) fragmentView;
frameLayout.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
listView = new RecyclerListView(context) {
@Override
public boolean requestFocus(int direction, Rect previouslyFocusedRect) {
return false;
}
};
listView.setLayoutManager(new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
listView.setVerticalScrollBarEnabled(false);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setAdapter(adapter = new ListAdapter(context));
listView.setOnItemClickListener((view, position) -> {
if (getParentActivity() == null) {
return;
}
if (position == includeShowMoreRow) {
includeExpanded = true;
updateRows();
} else if (position == excludeShowMoreRow) {
excludeExpanded = true;
updateRows();
} else if (position == includeAddRow || position == excludeAddRow) {
ArrayList<Long> arrayList = position == excludeAddRow ? newNeverShow : newAlwaysShow;
FilterUsersActivity fragment = new FilterUsersActivity(position == includeAddRow, arrayList, newFilterFlags);
fragment.setDelegate((ids, flags) -> {
newFilterFlags = flags;
if (position == excludeAddRow) {
newNeverShow = ids;
for (int a = 0; a < newNeverShow.size(); a++) {
Long id = newNeverShow.get(a);
newAlwaysShow.remove(id);
newPinned.delete(id);
}
} else {
newAlwaysShow = ids;
for (int a = 0; a < newAlwaysShow.size(); a++) {
newNeverShow.remove(newAlwaysShow.get(a));
}
ArrayList<Long> toRemove = new ArrayList<>();
for (int a = 0, N = newPinned.size(); a < N; a++) {
Long did = newPinned.keyAt(a);
if (DialogObject.isEncryptedDialog(did)) {
continue;
}
if (newAlwaysShow.contains(did)) {
continue;
}
toRemove.add(did);
}
for (int a = 0, N = toRemove.size(); a < N; a++) {
newPinned.delete(toRemove.get(a));
}
}
fillFilterName();
checkDoneButton(false);
updateRows();
});
presentFragment(fragment);
} else if (position == removeRow) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("FilterDelete", R.string.FilterDelete));
builder.setMessage(LocaleController.getString("FilterDeleteAlert", R.string.FilterDeleteAlert));
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
builder.setPositiveButton(LocaleController.getString("Delete", R.string.Delete), (dialog, which) -> {
AlertDialog progressDialog = null;
if (getParentActivity() != null) {
progressDialog = new AlertDialog(getParentActivity(), 3);
progressDialog.setCanCacnel(false);
progressDialog.show();
}
final AlertDialog progressDialogFinal = progressDialog;
TLRPC.TL_messages_updateDialogFilter req = new TLRPC.TL_messages_updateDialogFilter();
req.id = filter.id;
getConnectionsManager().sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
try {
if (progressDialogFinal != null) {
progressDialogFinal.dismiss();
}
} catch (Exception e) {
FileLog.e(e);
}
getMessagesController().removeFilter(filter);
getMessagesStorage().deleteDialogFilter(filter);
finishFragment();
}));
});
AlertDialog alertDialog = builder.create();
showDialog(alertDialog);
TextView button = (TextView) alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
} else if (position == nameRow) {
PollEditTextCell cell = (PollEditTextCell) view;
cell.getTextView().requestFocus();
AndroidUtilities.showKeyboard(cell.getTextView());
} else if (view instanceof UserCell) {
UserCell cell = (UserCell) view;
showRemoveAlert(position, cell.getName(), cell.getCurrentObject(), position < includeSectionRow);
}
});
listView.setOnItemLongClickListener((view, position) -> {
if (view instanceof UserCell) {
UserCell cell = (UserCell) view;
showRemoveAlert(position, cell.getName(), cell.getCurrentObject(), position < includeSectionRow);
return true;
}
return false;
});
checkDoneButton(false);
return fragmentView;
}
use of org.telegram.ui.Cells.UserCell in project Telegram-FOSS by Telegram-FOSS-Team.
the class FilterCreateActivity method getThemeDescriptions.
@Override
public ArrayList<ThemeDescription> getThemeDescriptions() {
ArrayList<ThemeDescription> themeDescriptions = new ArrayList<>();
ThemeDescription.ThemeDescriptionDelegate themeDelegate = () -> {
if (listView != null) {
int count = listView.getChildCount();
for (int a = 0; a < count; a++) {
View child = listView.getChildAt(a);
if (child instanceof UserCell) {
((UserCell) child).update(0);
}
}
}
};
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR, new Class[] { HeaderCell.class, TextCell.class, PollEditTextCell.class, UserCell.class }, null, null, null, Theme.key_windowBackgroundWhite));
themeDescriptions.add(new ThemeDescription(fragmentView, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundGray));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_actionBarDefault));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_ITEMSCOLOR, null, null, null, null, Theme.key_actionBarDefaultIcon));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_TITLECOLOR, null, null, null, null, Theme.key_actionBarDefaultTitle));
themeDescriptions.add(new ThemeDescription(actionBar, ThemeDescription.FLAG_AB_SELECTORCOLOR, null, null, null, null, Theme.key_actionBarDefaultSelector));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { View.class }, Theme.dividerPaint, null, null, Theme.key_divider));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { HeaderCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueHeader));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteRedText5));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[] { TextCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlueText4));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_CHECKTAG, new Class[] { TextCell.class }, new String[] { "ImageView" }, null, null, null, Theme.key_switchTrackChecked));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[] { ShadowSectionCell.class }, null, null, null, Theme.key_windowBackgroundGrayShadow));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[] { TextInfoPrivacyCell.class }, null, null, null, Theme.key_windowBackgroundGrayShadow));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { TextInfoPrivacyCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayText4));
themeDescriptions.add(new ThemeDescription(listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { UserCell.class }, new String[] { "adminTextView" }, null, null, null, Theme.key_profile_creatorIcon));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "imageView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayIcon));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "nameTextView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "statusColor" }, null, null, themeDelegate, Theme.key_windowBackgroundWhiteGrayText));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, new String[] { "statusOnlineColor" }, null, null, themeDelegate, Theme.key_windowBackgroundWhiteBlueText));
themeDescriptions.add(new ThemeDescription(listView, 0, new Class[] { UserCell.class }, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, themeDelegate, Theme.key_avatar_backgroundRed));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, themeDelegate, Theme.key_avatar_backgroundOrange));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, themeDelegate, Theme.key_avatar_backgroundViolet));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, themeDelegate, Theme.key_avatar_backgroundGreen));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, themeDelegate, Theme.key_avatar_backgroundCyan));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, themeDelegate, Theme.key_avatar_backgroundBlue));
themeDescriptions.add(new ThemeDescription(null, 0, null, null, null, themeDelegate, Theme.key_avatar_backgroundPink));
return themeDescriptions;
}
Aggregations