use of org.telegram.ui.Components.EditTextBoldCursor in project Telegram-FOSS by Telegram-FOSS-Team.
the class PassportActivity method createEmailVerificationInterface.
private void createEmailVerificationInterface(Context context) {
actionBar.setTitle(LocaleController.getString("PassportEmail", R.string.PassportEmail));
inputFields = new EditTextBoldCursor[1];
for (int a = 0; a < 1; a++) {
ViewGroup container = new FrameLayout(context);
linearLayout2.addView(container, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50));
container.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
inputFields[a] = new EditTextBoldCursor(context);
inputFields[a].setTag(a);
inputFields[a].setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
inputFields[a].setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
inputFields[a].setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
inputFields[a].setBackgroundDrawable(null);
inputFields[a].setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
inputFields[a].setCursorSize(AndroidUtilities.dp(20));
inputFields[a].setCursorWidth(1.5f);
inputFields[a].setInputType(InputType.TYPE_CLASS_PHONE);
inputFields[a].setImeOptions(EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI);
inputFields[a].setHint(LocaleController.getString("PassportEmailCode", R.string.PassportEmailCode));
inputFields[a].setSelection(inputFields[a].length());
inputFields[a].setPadding(0, 0, 0, AndroidUtilities.dp(6));
inputFields[a].setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
container.addView(inputFields[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 21, 12, 21, 6));
inputFields[a].setOnEditorActionListener((textView, i, keyEvent) -> {
if (i == EditorInfo.IME_ACTION_DONE || i == EditorInfo.IME_ACTION_NEXT) {
doneItem.callOnClick();
return true;
}
return false;
});
inputFields[a].addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (ignoreOnTextChange) {
return;
}
if (emailCodeLength != 0 && inputFields[FIELD_EMAIL].length() == emailCodeLength) {
doneItem.callOnClick();
}
}
});
}
bottomCell = new TextInfoPrivacyCell(context);
bottomCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
bottomCell.setText(LocaleController.formatString("PassportEmailVerifyInfo", R.string.PassportEmailVerifyInfo, currentValues.get("email")));
linearLayout2.addView(bottomCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
use of org.telegram.ui.Components.EditTextBoldCursor in project Telegram-FOSS by Telegram-FOSS-Team.
the class PhotoPickerActivity method createView.
@SuppressWarnings("unchecked")
@Override
public View createView(Context context) {
listSort = false;
actionBar.setBackgroundColor(Theme.getColor(dialogBackgroundKey));
actionBar.setTitleColor(Theme.getColor(textKey));
actionBar.setItemsColor(Theme.getColor(textKey), false);
actionBar.setItemsBackgroundColor(Theme.getColor(selectorKey), false);
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
if (selectedAlbum != null) {
actionBar.setTitle(selectedAlbum.bucketName);
} else if (type == 0) {
actionBar.setTitle(LocaleController.getString("SearchImagesTitle", R.string.SearchImagesTitle));
} else if (type == 1) {
actionBar.setTitle(LocaleController.getString("SearchGifsTitle", R.string.SearchGifsTitle));
}
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
} else if (id == change_sort) {
listSort = !listSort;
if (listSort) {
listView.setPadding(0, 0, 0, AndroidUtilities.dp(48));
} else {
listView.setPadding(AndroidUtilities.dp(6), AndroidUtilities.dp(8), AndroidUtilities.dp(6), AndroidUtilities.dp(50));
}
listView.stopScroll();
layoutManager.scrollToPositionWithOffset(0, 0);
listAdapter.notifyDataSetChanged();
} else if (id == open_in) {
if (delegate != null) {
delegate.onOpenInPressed();
}
finishFragment();
}
}
});
if (isDocumentsPicker) {
ActionBarMenu menu = actionBar.createMenu();
ActionBarMenuItem menuItem = menu.addItem(0, R.drawable.ic_ab_other);
menuItem.setSubMenuDelegate(new ActionBarMenuItem.ActionBarSubMenuItemDelegate() {
@Override
public void onShowSubMenu() {
showAsListItem.setText(listSort ? LocaleController.getString("ShowAsGrid", R.string.ShowAsGrid) : LocaleController.getString("ShowAsList", R.string.ShowAsList));
showAsListItem.setIcon(listSort ? R.drawable.msg_media : R.drawable.msg_list);
}
@Override
public void onHideSubMenu() {
}
});
showAsListItem = menuItem.addSubItem(change_sort, R.drawable.msg_list, LocaleController.getString("ShowAsList", R.string.ShowAsList));
menuItem.addSubItem(open_in, R.drawable.msg_openin, LocaleController.getString("OpenInExternalApp", R.string.OpenInExternalApp));
}
if (selectedAlbum == null) {
ActionBarMenu menu = actionBar.createMenu();
searchItem = menu.addItem(0, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
@Override
public void onSearchExpand() {
}
@Override
public boolean canCollapseSearch() {
finishFragment();
return false;
}
@Override
public void onTextChanged(EditText editText) {
if (editText.getText().length() == 0) {
searchResult.clear();
searchResultKeys.clear();
lastSearchString = null;
imageSearchEndReached = true;
searching = false;
if (imageReqId != 0) {
ConnectionsManager.getInstance(currentAccount).cancelRequest(imageReqId, true);
imageReqId = 0;
}
emptyView.setText(LocaleController.getString("NoRecentSearches", R.string.NoRecentSearches));
updateSearchInterface();
}
}
@Override
public void onSearchPressed(EditText editText) {
processSearch(editText);
}
});
EditTextBoldCursor editText = searchItem.getSearchField();
editText.setTextColor(Theme.getColor(textKey));
editText.setCursorColor(Theme.getColor(textKey));
editText.setHintTextColor(Theme.getColor(Theme.key_chat_messagePanelHint));
}
if (selectedAlbum == null) {
if (type == 0) {
searchItem.setSearchFieldHint(LocaleController.getString("SearchImagesTitle", R.string.SearchImagesTitle));
} else if (type == 1) {
searchItem.setSearchFieldHint(LocaleController.getString("SearchGifsTitle", R.string.SearchGifsTitle));
}
}
sizeNotifierFrameLayout = new SizeNotifierFrameLayout(context) {
private int lastNotifyWidth;
private boolean ignoreLayout;
private int lastItemSize;
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int totalHeight = MeasureSpec.getSize(heightMeasureSpec);
int availableWidth = MeasureSpec.getSize(widthMeasureSpec);
if (AndroidUtilities.isTablet()) {
itemsPerRow = 4;
} else if (AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y) {
itemsPerRow = 4;
} else {
itemsPerRow = 3;
}
ignoreLayout = true;
itemSize = (availableWidth - AndroidUtilities.dp(6 * 2) - AndroidUtilities.dp(5 * 2)) / itemsPerRow;
if (lastItemSize != itemSize) {
lastItemSize = itemSize;
AndroidUtilities.runOnUIThread(() -> listAdapter.notifyDataSetChanged());
}
if (listSort) {
layoutManager.setSpanCount(1);
} else {
layoutManager.setSpanCount(itemSize * itemsPerRow + AndroidUtilities.dp(5) * (itemsPerRow - 1));
}
ignoreLayout = false;
onMeasureInternal(widthMeasureSpec, MeasureSpec.makeMeasureSpec(totalHeight, MeasureSpec.EXACTLY));
}
private void onMeasureInternal(int widthMeasureSpec, int heightMeasureSpec) {
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(widthSize, heightSize);
int kbHeight = measureKeyboardHeight();
int keyboardSize = SharedConfig.smoothKeyboard ? 0 : kbHeight;
if (keyboardSize <= AndroidUtilities.dp(20)) {
if (!AndroidUtilities.isInMultiwindow && commentTextView != null && frameLayout2.getParent() == this) {
heightSize -= commentTextView.getEmojiPadding();
heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, MeasureSpec.EXACTLY);
}
}
if (kbHeight > AndroidUtilities.dp(20) && commentTextView != null) {
ignoreLayout = true;
commentTextView.hideEmojiView();
ignoreLayout = false;
}
if (SharedConfig.smoothKeyboard && commentTextView != null && commentTextView.isPopupShowing()) {
fragmentView.setTranslationY(0);
listView.setTranslationY(0);
emptyView.setTranslationY(0);
}
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child == null || child.getVisibility() == GONE) {
continue;
}
if (commentTextView != null && commentTextView.isPopupView(child)) {
if (AndroidUtilities.isInMultiwindow || AndroidUtilities.isTablet()) {
if (AndroidUtilities.isTablet()) {
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(AndroidUtilities.isTablet() ? 200 : 320), heightSize - AndroidUtilities.statusBarHeight + getPaddingTop()), MeasureSpec.EXACTLY));
} else {
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightSize - AndroidUtilities.statusBarHeight + getPaddingTop(), MeasureSpec.EXACTLY));
}
} else {
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(child.getLayoutParams().height, MeasureSpec.EXACTLY));
}
} else {
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
}
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
if (lastNotifyWidth != r - l) {
lastNotifyWidth = r - l;
if (listAdapter != null) {
listAdapter.notifyDataSetChanged();
}
if (sendPopupWindow != null && sendPopupWindow.isShowing()) {
sendPopupWindow.dismiss();
}
}
final int count = getChildCount();
int keyboardSize = SharedConfig.smoothKeyboard ? 0 : measureKeyboardHeight();
int paddingBottom = commentTextView != null && frameLayout2.getParent() == this && keyboardSize <= AndroidUtilities.dp(20) && !AndroidUtilities.isInMultiwindow && !AndroidUtilities.isTablet() ? commentTextView.getEmojiPadding() : 0;
setBottomClip(paddingBottom);
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.getVisibility() == GONE) {
continue;
}
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int width = child.getMeasuredWidth();
final int height = child.getMeasuredHeight();
int childLeft;
int childTop;
int gravity = lp.gravity;
if (gravity == -1) {
gravity = Gravity.TOP | Gravity.LEFT;
}
final int absoluteGravity = gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
switch(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.CENTER_HORIZONTAL:
childLeft = (r - l - width) / 2 + lp.leftMargin - lp.rightMargin;
break;
case Gravity.RIGHT:
childLeft = (r - l) - width - lp.rightMargin - getPaddingRight();
break;
case Gravity.LEFT:
default:
childLeft = lp.leftMargin + getPaddingLeft();
}
switch(verticalGravity) {
case Gravity.TOP:
childTop = lp.topMargin + getPaddingTop();
break;
case Gravity.CENTER_VERTICAL:
childTop = ((b - paddingBottom) - t - height) / 2 + lp.topMargin - lp.bottomMargin;
break;
case Gravity.BOTTOM:
childTop = ((b - paddingBottom) - t) - height - lp.bottomMargin;
break;
default:
childTop = lp.topMargin;
}
if (commentTextView != null && commentTextView.isPopupView(child)) {
if (AndroidUtilities.isTablet()) {
childTop = getMeasuredHeight() - child.getMeasuredHeight();
} else {
childTop = getMeasuredHeight() + keyboardSize - child.getMeasuredHeight();
}
}
child.layout(childLeft, childTop, childLeft + width, childTop + height);
}
notifyHeightChanged();
}
@Override
public void requestLayout() {
if (ignoreLayout) {
return;
}
super.requestLayout();
}
};
sizeNotifierFrameLayout.setBackgroundColor(Theme.getColor(dialogBackgroundKey));
fragmentView = sizeNotifierFrameLayout;
listView = new RecyclerListView(context);
listView.setPadding(AndroidUtilities.dp(6), AndroidUtilities.dp(8), AndroidUtilities.dp(6), AndroidUtilities.dp(50));
listView.setClipToPadding(false);
listView.setHorizontalScrollBarEnabled(false);
listView.setVerticalScrollBarEnabled(false);
listView.setItemAnimator(null);
listView.setLayoutAnimation(null);
listView.setLayoutManager(layoutManager = new GridLayoutManager(context, 4) {
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
});
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (listAdapter.getItemViewType(position) == 1 || listSort || selectedAlbum == null && TextUtils.isEmpty(lastSearchString)) {
return layoutManager.getSpanCount();
} else {
return itemSize + (position % itemsPerRow != itemsPerRow - 1 ? AndroidUtilities.dp(5) : 0);
}
}
});
sizeNotifierFrameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP));
listView.setAdapter(listAdapter = new ListAdapter(context));
listView.setGlowColor(Theme.getColor(dialogBackgroundKey));
listView.setOnItemClickListener((view, position) -> {
if (selectedAlbum == null && searchResult.isEmpty()) {
if (position < recentSearches.size()) {
String text = recentSearches.get(position);
if (searchDelegate != null) {
searchDelegate.shouldSearchText(text);
} else {
searchItem.getSearchField().setText(text);
searchItem.getSearchField().setSelection(text.length());
processSearch(searchItem.getSearchField());
}
} else if (position == recentSearches.size() + 1) {
AlertDialog.Builder builder = new AlertDialog.Builder(getParentActivity());
builder.setTitle(LocaleController.getString("ClearSearchAlertTitle", R.string.ClearSearchAlertTitle));
builder.setMessage(LocaleController.getString("ClearSearchAlert", R.string.ClearSearchAlert));
builder.setPositiveButton(LocaleController.getString("ClearButton", R.string.ClearButton).toUpperCase(), (dialogInterface, i) -> {
if (searchDelegate != null) {
searchDelegate.shouldClearRecentSearch();
} else {
clearRecentSearch();
}
});
builder.setNegativeButton(LocaleController.getString("Cancel", R.string.Cancel), null);
AlertDialog dialog = builder.create();
showDialog(dialog);
TextView button = (TextView) dialog.getButton(DialogInterface.BUTTON_POSITIVE);
if (button != null) {
button.setTextColor(Theme.getColor(Theme.key_dialogTextRed2));
}
return;
}
return;
}
ArrayList<Object> arrayList;
if (selectedAlbum != null) {
arrayList = (ArrayList) selectedAlbum.photos;
} else {
arrayList = (ArrayList) searchResult;
}
if (position < 0 || position >= arrayList.size()) {
return;
}
if (searchItem != null) {
AndroidUtilities.hideKeyboard(searchItem.getSearchField());
}
if (listSort) {
onListItemClick(view, arrayList.get(position));
} else {
int type;
if (selectPhotoType == PhotoAlbumPickerActivity.SELECT_TYPE_AVATAR || selectPhotoType == PhotoAlbumPickerActivity.SELECT_TYPE_AVATAR_VIDEO) {
type = PhotoViewer.SELECT_TYPE_AVATAR;
} else if (selectPhotoType == PhotoAlbumPickerActivity.SELECT_TYPE_WALLPAPER) {
type = PhotoViewer.SELECT_TYPE_WALLPAPER;
} else if (selectPhotoType == PhotoAlbumPickerActivity.SELECT_TYPE_QR) {
type = PhotoViewer.SELECT_TYPE_QR;
} else if (chatActivity == null) {
type = 4;
} else {
type = 0;
}
PhotoViewer.getInstance().setParentActivity(getParentActivity());
PhotoViewer.getInstance().setMaxSelectedPhotos(maxSelectedPhotos, allowOrder);
PhotoViewer.getInstance().openPhotoForSelect(arrayList, position, type, isDocumentsPicker, provider, chatActivity);
}
});
if (maxSelectedPhotos != 1) {
listView.setOnItemLongClickListener((view, position) -> {
if (listSort) {
onListItemClick(view, selectedAlbum.photos.get(position));
return true;
} else {
if (view instanceof PhotoAttachPhotoCell) {
PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view;
itemRangeSelector.setIsActive(view, true, position, shouldSelect = !cell.isChecked());
}
}
return false;
});
}
itemRangeSelector = new RecyclerViewItemRangeSelector(new RecyclerViewItemRangeSelector.RecyclerViewItemRangeSelectorDelegate() {
@Override
public int getItemCount() {
return listAdapter.getItemCount();
}
@Override
public void setSelected(View view, int index, boolean selected) {
if (selected != shouldSelect || !(view instanceof PhotoAttachPhotoCell)) {
return;
}
PhotoAttachPhotoCell cell = (PhotoAttachPhotoCell) view;
cell.callDelegate();
}
@Override
public boolean isSelected(int index) {
Object key;
if (selectedAlbum != null) {
MediaController.PhotoEntry photoEntry = selectedAlbum.photos.get(index);
key = photoEntry.imageId;
} else {
MediaController.SearchImage photoEntry = searchResult.get(index);
key = photoEntry.id;
}
return selectedPhotos.containsKey(key);
}
@Override
public boolean isIndexSelectable(int index) {
return listAdapter.getItemViewType(index) == 0;
}
@Override
public void onStartStopSelection(boolean start) {
alertOnlyOnce = start ? 1 : 0;
if (start) {
parentLayout.requestDisallowInterceptTouchEvent(true);
}
listView.hideSelector(true);
}
});
if (maxSelectedPhotos != 1) {
listView.addOnItemTouchListener(itemRangeSelector);
}
emptyView = new EmptyTextProgressView(context);
emptyView.setTextColor(0xff93999d);
emptyView.setProgressBarColor(0xff527da3);
if (selectedAlbum != null) {
emptyView.setShowAtCenter(false);
emptyView.setText(LocaleController.getString("NoPhotos", R.string.NoPhotos));
} else {
emptyView.setShowAtTop(true);
emptyView.setPadding(0, AndroidUtilities.dp(200), 0, 0);
emptyView.setText(LocaleController.getString("NoRecentSearches", R.string.NoRecentSearches));
}
sizeNotifierFrameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.LEFT | Gravity.TOP, 0, 0, 0, selectPhotoType != PhotoAlbumPickerActivity.SELECT_TYPE_ALL ? 0 : 48));
listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_DRAGGING) {
AndroidUtilities.hideKeyboard(getParentActivity().getCurrentFocus());
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (selectedAlbum == null) {
int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
int visibleItemCount = firstVisibleItem == RecyclerView.NO_POSITION ? 0 : Math.abs(layoutManager.findLastVisibleItemPosition() - firstVisibleItem) + 1;
if (visibleItemCount > 0) {
int totalItemCount = layoutManager.getItemCount();
if (firstVisibleItem + visibleItemCount > totalItemCount - 2 && !searching) {
if (!imageSearchEndReached) {
searchImages(type == 1, lastSearchString, nextImagesSearchOffset, true);
}
}
}
}
}
});
if (selectedAlbum == null) {
updateSearchInterface();
}
if (needsBottomLayout) {
shadow = new View(context);
shadow.setBackgroundResource(R.drawable.header_shadow_reverse);
shadow.setTranslationY(AndroidUtilities.dp(48));
sizeNotifierFrameLayout.addView(shadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 3, Gravity.BOTTOM | Gravity.LEFT, 0, 0, 0, 48));
frameLayout2 = new FrameLayout(context);
frameLayout2.setBackgroundColor(Theme.getColor(dialogBackgroundKey));
frameLayout2.setVisibility(View.INVISIBLE);
frameLayout2.setTranslationY(AndroidUtilities.dp(48));
sizeNotifierFrameLayout.addView(frameLayout2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM));
frameLayout2.setOnTouchListener((v, event) -> true);
if (commentTextView != null) {
commentTextView.onDestroy();
}
commentTextView = new EditTextEmoji(context, sizeNotifierFrameLayout, null, EditTextEmoji.STYLE_DIALOG);
InputFilter[] inputFilters = new InputFilter[1];
inputFilters[0] = new InputFilter.LengthFilter(MessagesController.getInstance(UserConfig.selectedAccount).maxCaptionLength);
commentTextView.setFilters(inputFilters);
commentTextView.setHint(LocaleController.getString("AddCaption", R.string.AddCaption));
commentTextView.onResume();
EditTextBoldCursor editText = commentTextView.getEditText();
editText.setMaxLines(1);
editText.setSingleLine(true);
frameLayout2.addView(commentTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT, 0, 0, 84, 0));
if (caption != null) {
commentTextView.setText(caption);
}
commentTextView.getEditText().addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
if (delegate != null) {
delegate.onCaptionChanged(s);
}
}
});
writeButtonContainer = new FrameLayout(context) {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
info.setText(LocaleController.formatPluralString("AccDescrSendPhotos", selectedPhotos.size()));
info.setClassName(Button.class.getName());
info.setLongClickable(true);
info.setClickable(true);
}
};
writeButtonContainer.setFocusable(true);
writeButtonContainer.setFocusableInTouchMode(true);
writeButtonContainer.setVisibility(View.INVISIBLE);
writeButtonContainer.setScaleX(0.2f);
writeButtonContainer.setScaleY(0.2f);
writeButtonContainer.setAlpha(0.0f);
sizeNotifierFrameLayout.addView(writeButtonContainer, LayoutHelper.createFrame(60, 60, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, 12, 10));
writeButton = new ImageView(context);
writeButtonDrawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_dialogFloatingButton), Theme.getColor(Build.VERSION.SDK_INT >= 21 ? Theme.key_dialogFloatingButtonPressed : Theme.key_dialogFloatingButton));
if (Build.VERSION.SDK_INT < 21) {
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow_profile).mutate();
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, writeButtonDrawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
writeButtonDrawable = combinedDrawable;
}
writeButton.setBackgroundDrawable(writeButtonDrawable);
writeButton.setImageResource(R.drawable.attach_send);
writeButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
writeButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_dialogFloatingIcon), PorterDuff.Mode.MULTIPLY));
writeButton.setScaleType(ImageView.ScaleType.CENTER);
if (Build.VERSION.SDK_INT >= 21) {
writeButton.setOutlineProvider(new ViewOutlineProvider() {
@SuppressLint("NewApi")
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
}
});
}
writeButtonContainer.addView(writeButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, Gravity.LEFT | Gravity.TOP, Build.VERSION.SDK_INT >= 21 ? 2 : 0, 0, 0, 0));
writeButton.setOnClickListener(v -> {
if (chatActivity != null && chatActivity.isInScheduleMode()) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), chatActivity.getDialogId(), this::sendSelectedPhotos);
} else {
sendSelectedPhotos(true, 0);
}
});
writeButton.setOnLongClickListener(view -> {
if (chatActivity == null || maxSelectedPhotos == 1) {
return false;
}
TLRPC.Chat chat = chatActivity.getCurrentChat();
TLRPC.User user = chatActivity.getCurrentUser();
if (sendPopupLayout == null) {
sendPopupLayout = new ActionBarPopupWindow.ActionBarPopupWindowLayout(getParentActivity());
sendPopupLayout.setAnimationEnabled(false);
sendPopupLayout.setOnTouchListener(new View.OnTouchListener() {
private android.graphics.Rect popupRect = new android.graphics.Rect();
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
if (sendPopupWindow != null && sendPopupWindow.isShowing()) {
v.getHitRect(popupRect);
if (!popupRect.contains((int) event.getX(), (int) event.getY())) {
sendPopupWindow.dismiss();
}
}
}
return false;
}
});
sendPopupLayout.setDispatchKeyEventListener(keyEvent -> {
if (keyEvent.getKeyCode() == KeyEvent.KEYCODE_BACK && keyEvent.getRepeatCount() == 0 && sendPopupWindow != null && sendPopupWindow.isShowing()) {
sendPopupWindow.dismiss();
}
});
sendPopupLayout.setShownFromBotton(false);
itemCells = new ActionBarMenuSubItem[2];
for (int a = 0; a < 2; a++) {
if (a == 0 && !chatActivity.canScheduleMessage() || a == 1 && UserObject.isUserSelf(user)) {
continue;
}
int num = a;
itemCells[a] = new ActionBarMenuSubItem(getParentActivity(), a == 0, a == 1);
if (num == 0) {
if (UserObject.isUserSelf(user)) {
itemCells[a].setTextAndIcon(LocaleController.getString("SetReminder", R.string.SetReminder), R.drawable.msg_schedule);
} else {
itemCells[a].setTextAndIcon(LocaleController.getString("ScheduleMessage", R.string.ScheduleMessage), R.drawable.msg_schedule);
}
} else {
itemCells[a].setTextAndIcon(LocaleController.getString("SendWithoutSound", R.string.SendWithoutSound), R.drawable.input_notify_off);
}
itemCells[a].setMinimumWidth(AndroidUtilities.dp(196));
sendPopupLayout.addView(itemCells[a], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 48));
itemCells[a].setOnClickListener(v -> {
if (sendPopupWindow != null && sendPopupWindow.isShowing()) {
sendPopupWindow.dismiss();
}
if (num == 0) {
AlertsCreator.createScheduleDatePickerDialog(getParentActivity(), chatActivity.getDialogId(), this::sendSelectedPhotos);
} else {
sendSelectedPhotos(true, 0);
}
});
}
sendPopupLayout.setupRadialSelectors(Theme.getColor(selectorKey));
sendPopupWindow = new ActionBarPopupWindow(sendPopupLayout, LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT);
sendPopupWindow.setAnimationEnabled(false);
sendPopupWindow.setAnimationStyle(R.style.PopupContextAnimation2);
sendPopupWindow.setOutsideTouchable(true);
sendPopupWindow.setClippingEnabled(true);
sendPopupWindow.setInputMethodMode(ActionBarPopupWindow.INPUT_METHOD_NOT_NEEDED);
sendPopupWindow.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
sendPopupWindow.getContentView().setFocusableInTouchMode(true);
}
sendPopupLayout.measure(View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(1000), View.MeasureSpec.AT_MOST));
sendPopupWindow.setFocusable(true);
int[] location = new int[2];
view.getLocationInWindow(location);
sendPopupWindow.showAtLocation(view, Gravity.LEFT | Gravity.TOP, location[0] + view.getMeasuredWidth() - sendPopupLayout.getMeasuredWidth() + AndroidUtilities.dp(8), location[1] - sendPopupLayout.getMeasuredHeight() - AndroidUtilities.dp(2));
sendPopupWindow.dimBehind();
view.performHapticFeedback(HapticFeedbackConstants.KEYBOARD_TAP, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
return false;
});
textPaint.setTextSize(AndroidUtilities.dp(12));
textPaint.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
selectedCountView = new View(context) {
@Override
protected void onDraw(Canvas canvas) {
String text = String.format("%d", Math.max(1, selectedPhotosOrder.size()));
int textSize = (int) Math.ceil(textPaint.measureText(text));
int size = Math.max(AndroidUtilities.dp(16) + textSize, AndroidUtilities.dp(24));
int cx = getMeasuredWidth() / 2;
int cy = getMeasuredHeight() / 2;
textPaint.setColor(Theme.getColor(Theme.key_dialogRoundCheckBoxCheck));
paint.setColor(Theme.getColor(dialogBackgroundKey));
rect.set(cx - size / 2, 0, cx + size / 2, getMeasuredHeight());
canvas.drawRoundRect(rect, AndroidUtilities.dp(12), AndroidUtilities.dp(12), paint);
paint.setColor(Theme.getColor(Theme.key_dialogRoundCheckBox));
rect.set(cx - size / 2 + AndroidUtilities.dp(2), AndroidUtilities.dp(2), cx + size / 2 - AndroidUtilities.dp(2), getMeasuredHeight() - AndroidUtilities.dp(2));
canvas.drawRoundRect(rect, AndroidUtilities.dp(10), AndroidUtilities.dp(10), paint);
canvas.drawText(text, cx - textSize / 2, AndroidUtilities.dp(16.2f), textPaint);
}
};
selectedCountView.setAlpha(0.0f);
selectedCountView.setScaleX(0.2f);
selectedCountView.setScaleY(0.2f);
sizeNotifierFrameLayout.addView(selectedCountView, LayoutHelper.createFrame(42, 24, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, -2, 9));
if (selectPhotoType != PhotoAlbumPickerActivity.SELECT_TYPE_ALL) {
commentTextView.setVisibility(View.GONE);
}
}
allowIndices = (selectedAlbum != null || type == 0 || type == 1) && allowOrder;
listView.setEmptyView(emptyView);
updatePhotosButton(0);
return fragmentView;
}
use of org.telegram.ui.Components.EditTextBoldCursor in project Telegram-FOSS by Telegram-FOSS-Team.
the class PassportActivity method checkFieldsForError.
private boolean checkFieldsForError() {
if (currentDocumentsType != null) {
if (errorsValues.containsKey("error_all") || errorsValues.containsKey("error_document_all")) {
onFieldError(topErrorCell);
return true;
}
if (uploadDocumentCell != null) {
if (documents.isEmpty()) {
onFieldError(uploadDocumentCell);
return true;
} else {
for (int a = 0, size = documents.size(); a < size; a++) {
SecureDocument document = documents.get(a);
String key = "files" + getDocumentHash(document);
if (key != null && errorsValues.containsKey(key)) {
onFieldError(documentsCells.get(document));
return true;
}
}
}
}
if (errorsValues.containsKey("files_all") || errorsValues.containsKey("translation_all")) {
onFieldError(bottomCell);
return true;
}
if (uploadFrontCell != null) {
if (frontDocument == null) {
onFieldError(uploadFrontCell);
return true;
} else {
String key = "front" + getDocumentHash(frontDocument);
if (errorsValues.containsKey(key)) {
onFieldError(documentsCells.get(frontDocument));
return true;
}
}
}
if (currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeIdentityCard || currentDocumentsType.type instanceof TLRPC.TL_secureValueTypeDriverLicense) {
if (uploadReverseCell != null) {
if (reverseDocument == null) {
onFieldError(uploadReverseCell);
return true;
} else {
String key = "reverse" + getDocumentHash(reverseDocument);
if (errorsValues.containsKey(key)) {
onFieldError(documentsCells.get(reverseDocument));
return true;
}
}
}
}
if (uploadSelfieCell != null && currentBotId != 0) {
if (selfieDocument == null) {
onFieldError(uploadSelfieCell);
return true;
} else {
String key = "selfie" + getDocumentHash(selfieDocument);
if (errorsValues.containsKey(key)) {
onFieldError(documentsCells.get(selfieDocument));
return true;
}
}
}
if (uploadTranslationCell != null && currentBotId != 0) {
if (translationDocuments.isEmpty()) {
onFieldError(uploadTranslationCell);
return true;
} else {
for (int a = 0, size = translationDocuments.size(); a < size; a++) {
SecureDocument document = translationDocuments.get(a);
String key = "translation" + getDocumentHash(document);
if (errorsValues.containsKey(key)) {
onFieldError(documentsCells.get(document));
return true;
}
}
}
}
}
for (int i = 0; i < 2; i++) {
EditTextBoldCursor[] fields;
if (i == 0) {
fields = inputFields;
} else {
fields = nativeInfoCell != null && nativeInfoCell.getVisibility() == View.VISIBLE ? inputExtraFields : null;
}
if (fields == null) {
continue;
}
for (int a = 0; a < fields.length; a++) {
boolean error = false;
if (fields[a].hasErrorText()) {
error = true;
}
if (!errorsValues.isEmpty()) {
String key;
if (currentType.type instanceof TLRPC.TL_secureValueTypePersonalDetails) {
if (i == 0) {
switch(a) {
case FIELD_NAME:
key = "first_name";
break;
case FIELD_MIDNAME:
key = "middle_name";
break;
case FIELD_SURNAME:
key = "last_name";
break;
case FIELD_BIRTHDAY:
key = "birth_date";
break;
case FIELD_GENDER:
key = "gender";
break;
case FIELD_CITIZENSHIP:
key = "country_code";
break;
case FIELD_RESIDENCE:
key = "residence_country_code";
break;
case FIELD_CARDNUMBER:
key = "document_no";
break;
case FIELD_EXPIRE:
key = "expiry_date";
break;
default:
key = null;
break;
}
} else {
switch(a) {
case FIELD_NATIVE_NAME:
key = "first_name_native";
break;
case FIELD_NATIVE_MIDNAME:
key = "middle_name_native";
break;
case FIELD_NATIVE_SURNAME:
key = "last_name_native";
break;
default:
key = null;
break;
}
}
} else if (currentType.type instanceof TLRPC.TL_secureValueTypeAddress) {
switch(a) {
case FIELD_STREET1:
key = "street_line1";
break;
case FIELD_STREET2:
key = "street_line2";
break;
case FIELD_CITY:
key = "city";
break;
case FIELD_STATE:
key = "state";
break;
case FIELD_COUNTRY:
key = "country_code";
break;
case FIELD_POSTCODE:
key = "post_code";
break;
default:
key = null;
break;
}
} else {
key = null;
}
if (key != null) {
String value = errorsValues.get(key);
if (!TextUtils.isEmpty(value)) {
if (value.equals(fields[a].getText().toString())) {
error = true;
}
}
}
}
if (documentOnly) {
if (currentDocumentsType != null && a < FIELD_CARDNUMBER) {
continue;
}
}
if (!error) {
int len = fields[a].length();
boolean allowZeroLength = false;
if (currentActivityType == TYPE_IDENTITY) {
if (a == FIELD_EXPIRE) {
continue;
} else if (i == 0 && (a == FIELD_NAME || a == FIELD_SURNAME || a == FIELD_MIDNAME) || i == 1 && (a == FIELD_NATIVE_NAME || a == FIELD_NATIVE_MIDNAME || a == FIELD_NATIVE_SURNAME)) {
if (len > 255) {
error = true;
}
if (i == 0 && a == FIELD_MIDNAME || i == 1 && a == FIELD_NATIVE_MIDNAME) {
allowZeroLength = true;
}
} else if (a == FIELD_CARDNUMBER) {
if (len > 24) {
error = true;
}
}
} else if (currentActivityType == TYPE_ADDRESS) {
if (a == FIELD_STREET2) {
continue;
} else if (a == FIELD_CITY) {
if (len < 2) {
error = true;
}
} else if (a == FIELD_STATE) {
if ("US".equals(currentCitizeship)) {
if (len < 2) {
error = true;
}
} else {
continue;
}
} else if (a == FIELD_POSTCODE) {
if (len < 2 || len > 10) {
error = true;
}
}
}
if (!error && !allowZeroLength && len == 0) {
error = true;
}
}
if (error) {
onFieldError(fields[a]);
return true;
}
}
}
return false;
}
use of org.telegram.ui.Components.EditTextBoldCursor in project Telegram-FOSS by Telegram-FOSS-Team.
the class PhotoPickerSearchActivity method createView.
@Override
public View createView(Context context) {
actionBar.setBackgroundColor(Theme.getColor(Theme.key_dialogBackground));
actionBar.setTitleColor(Theme.getColor(Theme.key_dialogTextBlack));
actionBar.setItemsColor(Theme.getColor(Theme.key_dialogTextBlack), false);
actionBar.setItemsBackgroundColor(Theme.getColor(Theme.key_dialogButtonSelector), false);
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
if (AndroidUtilities.isTablet()) {
actionBar.setOccupyStatusBar(false);
}
actionBar.setExtraHeight(AndroidUtilities.dp(44));
actionBar.setAllowOverlayTitle(false);
actionBar.setAddToContainer(false);
actionBar.setClipContent(true);
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
hasOwnBackground = true;
ActionBarMenu menu = actionBar.createMenu();
searchItem = menu.addItem(search_button, R.drawable.ic_ab_search).setIsSearchField(true).setActionBarMenuItemSearchListener(new ActionBarMenuItem.ActionBarMenuItemSearchListener() {
@Override
public void onSearchExpand() {
imagesSearch.getActionBar().openSearchField("", false);
gifsSearch.getActionBar().openSearchField("", false);
searchItem.getSearchField().requestFocus();
}
@Override
public boolean canCollapseSearch() {
finishFragment();
return false;
}
@Override
public void onTextChanged(EditText editText) {
imagesSearch.getActionBar().setSearchFieldText(editText.getText().toString());
gifsSearch.getActionBar().setSearchFieldText(editText.getText().toString());
}
@Override
public void onSearchPressed(EditText editText) {
imagesSearch.getActionBar().onSearchPressed();
gifsSearch.getActionBar().onSearchPressed();
}
});
searchItem.setSearchFieldHint(LocaleController.getString("SearchImagesTitle", R.string.SearchImagesTitle));
EditTextBoldCursor editText = searchItem.getSearchField();
editText.setTextColor(Theme.getColor(Theme.key_dialogTextBlack));
editText.setCursorColor(Theme.getColor(Theme.key_dialogTextBlack));
editText.setHintTextColor(Theme.getColor(Theme.key_chat_messagePanelHint));
scrollSlidingTextTabStrip = new ScrollSlidingTextTabStrip(context);
scrollSlidingTextTabStrip.setUseSameWidth(true);
scrollSlidingTextTabStrip.setColors(Theme.key_chat_attachActiveTab, Theme.key_chat_attachActiveTab, Theme.key_chat_attachUnactiveTab, Theme.key_dialogButtonSelector);
actionBar.addView(scrollSlidingTextTabStrip, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 44, Gravity.LEFT | Gravity.BOTTOM));
scrollSlidingTextTabStrip.setDelegate(new ScrollSlidingTextTabStrip.ScrollSlidingTabStripDelegate() {
@Override
public void onPageSelected(int id, boolean forward) {
if (viewPages[0].selectedType == id) {
return;
}
swipeBackEnabled = id == scrollSlidingTextTabStrip.getFirstTabId();
viewPages[1].selectedType = id;
viewPages[1].setVisibility(View.VISIBLE);
switchToCurrentSelectedMode(true);
animatingForward = forward;
if (id == 0) {
searchItem.setSearchFieldHint(LocaleController.getString("SearchImagesTitle", R.string.SearchImagesTitle));
} else {
searchItem.setSearchFieldHint(LocaleController.getString("SearchGifsTitle", R.string.SearchGifsTitle));
}
}
@Override
public void onPageScrolled(float progress) {
if (progress == 1 && viewPages[1].getVisibility() != View.VISIBLE) {
return;
}
if (animatingForward) {
viewPages[0].setTranslationX(-progress * viewPages[0].getMeasuredWidth());
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth() - progress * viewPages[0].getMeasuredWidth());
} else {
viewPages[0].setTranslationX(progress * viewPages[0].getMeasuredWidth());
viewPages[1].setTranslationX(progress * viewPages[0].getMeasuredWidth() - viewPages[0].getMeasuredWidth());
}
if (progress == 1) {
ViewPage tempPage = viewPages[0];
viewPages[0] = viewPages[1];
viewPages[1] = tempPage;
viewPages[1].setVisibility(View.GONE);
}
}
});
ViewConfiguration configuration = ViewConfiguration.get(context);
maximumVelocity = configuration.getScaledMaximumFlingVelocity();
SizeNotifierFrameLayout sizeNotifierFrameLayout;
fragmentView = sizeNotifierFrameLayout = new SizeNotifierFrameLayout(context) {
private int startedTrackingPointerId;
private boolean startedTracking;
private boolean maybeStartTracking;
private int startedTrackingX;
private int startedTrackingY;
private VelocityTracker velocityTracker;
private boolean globalIgnoreLayout;
private boolean prepareForMoving(MotionEvent ev, boolean forward) {
int id = scrollSlidingTextTabStrip.getNextPageId(forward);
if (id < 0) {
return false;
}
getParent().requestDisallowInterceptTouchEvent(true);
maybeStartTracking = false;
startedTracking = true;
startedTrackingX = (int) ev.getX();
actionBar.setEnabled(false);
scrollSlidingTextTabStrip.setEnabled(false);
viewPages[1].selectedType = id;
viewPages[1].setVisibility(View.VISIBLE);
animatingForward = forward;
switchToCurrentSelectedMode(true);
if (forward) {
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth());
} else {
viewPages[1].setTranslationX(-viewPages[0].getMeasuredWidth());
}
return true;
}
@Override
public void forceHasOverlappingRendering(boolean hasOverlappingRendering) {
super.forceHasOverlappingRendering(hasOverlappingRendering);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(widthSize, heightSize);
measureChildWithMargins(actionBar, widthMeasureSpec, 0, heightMeasureSpec, 0);
int keyboardSize = SharedConfig.smoothKeyboard ? 0 : measureKeyboardHeight();
if (keyboardSize <= AndroidUtilities.dp(20)) {
if (!AndroidUtilities.isInMultiwindow) {
heightSize -= commentTextView.getEmojiPadding();
heightMeasureSpec = MeasureSpec.makeMeasureSpec(heightSize, MeasureSpec.EXACTLY);
}
} else {
globalIgnoreLayout = true;
commentTextView.hideEmojiView();
globalIgnoreLayout = false;
}
int actionBarHeight = actionBar.getMeasuredHeight();
globalIgnoreLayout = true;
for (int a = 0; a < viewPages.length; a++) {
if (viewPages[a] == null) {
continue;
}
if (viewPages[a].listView != null) {
viewPages[a].listView.setPadding(AndroidUtilities.dp(4), actionBarHeight + AndroidUtilities.dp(4), AndroidUtilities.dp(4), AndroidUtilities.dp(4));
}
}
globalIgnoreLayout = false;
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child == null || child.getVisibility() == GONE || child == actionBar) {
continue;
}
if (commentTextView != null && commentTextView.isPopupView(child)) {
if (AndroidUtilities.isInMultiwindow || AndroidUtilities.isTablet()) {
if (AndroidUtilities.isTablet()) {
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(AndroidUtilities.isTablet() ? 200 : 320), heightSize - AndroidUtilities.statusBarHeight + getPaddingTop()), MeasureSpec.EXACTLY));
} else {
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightSize - AndroidUtilities.statusBarHeight + getPaddingTop(), MeasureSpec.EXACTLY));
}
} else {
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(child.getLayoutParams().height, MeasureSpec.EXACTLY));
}
} else {
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
}
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
final int count = getChildCount();
int keyboardSize = SharedConfig.smoothKeyboard ? 0 : measureKeyboardHeight();
int paddingBottom = keyboardSize <= AndroidUtilities.dp(20) && !AndroidUtilities.isInMultiwindow && !AndroidUtilities.isTablet() ? commentTextView.getEmojiPadding() : 0;
setBottomClip(paddingBottom);
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.getVisibility() == GONE) {
continue;
}
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int width = child.getMeasuredWidth();
final int height = child.getMeasuredHeight();
int childLeft;
int childTop;
int gravity = lp.gravity;
if (gravity == -1) {
gravity = Gravity.TOP | Gravity.LEFT;
}
final int absoluteGravity = gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
switch(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.CENTER_HORIZONTAL:
childLeft = (r - l - width) / 2 + lp.leftMargin - lp.rightMargin;
break;
case Gravity.RIGHT:
childLeft = (r - l) - width - lp.rightMargin - getPaddingRight();
break;
case Gravity.LEFT:
default:
childLeft = lp.leftMargin + getPaddingLeft();
}
switch(verticalGravity) {
case Gravity.TOP:
childTop = lp.topMargin + getPaddingTop();
break;
case Gravity.CENTER_VERTICAL:
childTop = ((b - paddingBottom) - t - height) / 2 + lp.topMargin - lp.bottomMargin;
break;
case Gravity.BOTTOM:
childTop = ((b - paddingBottom) - t) - height - lp.bottomMargin;
break;
default:
childTop = lp.topMargin;
}
if (commentTextView != null && commentTextView.isPopupView(child)) {
if (AndroidUtilities.isTablet()) {
childTop = getMeasuredHeight() - child.getMeasuredHeight();
} else {
childTop = getMeasuredHeight() + keyboardSize - child.getMeasuredHeight();
}
}
child.layout(childLeft, childTop, childLeft + width, childTop + height);
}
notifyHeightChanged();
}
@Override
protected void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
if (parentLayout != null) {
parentLayout.drawHeaderShadow(canvas, actionBar.getMeasuredHeight() + (int) actionBar.getTranslationY());
}
}
@Override
public void requestLayout() {
if (globalIgnoreLayout) {
return;
}
super.requestLayout();
}
public boolean checkTabsAnimationInProgress() {
if (tabsAnimationInProgress) {
boolean cancel = false;
if (backAnimation) {
if (Math.abs(viewPages[0].getTranslationX()) < 1) {
viewPages[0].setTranslationX(0);
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth() * (animatingForward ? 1 : -1));
cancel = true;
}
} else if (Math.abs(viewPages[1].getTranslationX()) < 1) {
viewPages[0].setTranslationX(viewPages[0].getMeasuredWidth() * (animatingForward ? -1 : 1));
viewPages[1].setTranslationX(0);
cancel = true;
}
if (cancel) {
if (tabsAnimation != null) {
tabsAnimation.cancel();
tabsAnimation = null;
}
tabsAnimationInProgress = false;
}
return tabsAnimationInProgress;
}
return false;
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return checkTabsAnimationInProgress() || scrollSlidingTextTabStrip.isAnimatingIndicator() || onTouchEvent(ev);
}
@Override
protected void onDraw(Canvas canvas) {
backgroundPaint.setColor(Theme.getColor(Theme.key_windowBackgroundGray));
canvas.drawRect(0, actionBar.getMeasuredHeight() + actionBar.getTranslationY(), getMeasuredWidth(), getMeasuredHeight(), backgroundPaint);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
if (!parentLayout.checkTransitionAnimation() && !checkTabsAnimationInProgress()) {
if (ev != null) {
if (velocityTracker == null) {
velocityTracker = VelocityTracker.obtain();
}
velocityTracker.addMovement(ev);
}
if (ev != null && ev.getAction() == MotionEvent.ACTION_DOWN && !startedTracking && !maybeStartTracking) {
startedTrackingPointerId = ev.getPointerId(0);
maybeStartTracking = true;
startedTrackingX = (int) ev.getX();
startedTrackingY = (int) ev.getY();
velocityTracker.clear();
} else if (ev != null && ev.getAction() == MotionEvent.ACTION_MOVE && ev.getPointerId(0) == startedTrackingPointerId) {
int dx = (int) (ev.getX() - startedTrackingX);
int dy = Math.abs((int) ev.getY() - startedTrackingY);
if (startedTracking && (animatingForward && dx > 0 || !animatingForward && dx < 0)) {
if (!prepareForMoving(ev, dx < 0)) {
maybeStartTracking = true;
startedTracking = false;
viewPages[0].setTranslationX(0);
viewPages[1].setTranslationX(animatingForward ? viewPages[0].getMeasuredWidth() : -viewPages[0].getMeasuredWidth());
scrollSlidingTextTabStrip.selectTabWithId(viewPages[1].selectedType, 0);
}
}
if (maybeStartTracking && !startedTracking) {
float touchSlop = AndroidUtilities.getPixelsInCM(0.3f, true);
if (Math.abs(dx) >= touchSlop && Math.abs(dx) > dy) {
prepareForMoving(ev, dx < 0);
}
} else if (startedTracking) {
viewPages[0].setTranslationX(dx);
if (animatingForward) {
viewPages[1].setTranslationX(viewPages[0].getMeasuredWidth() + dx);
} else {
viewPages[1].setTranslationX(dx - viewPages[0].getMeasuredWidth());
}
float scrollProgress = Math.abs(dx) / (float) viewPages[0].getMeasuredWidth();
scrollSlidingTextTabStrip.selectTabWithId(viewPages[1].selectedType, scrollProgress);
}
} else if (ev == null || ev.getPointerId(0) == startedTrackingPointerId && (ev.getAction() == MotionEvent.ACTION_CANCEL || ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_POINTER_UP)) {
velocityTracker.computeCurrentVelocity(1000, maximumVelocity);
float velX;
float velY;
if (ev != null && ev.getAction() != MotionEvent.ACTION_CANCEL) {
velX = velocityTracker.getXVelocity();
velY = velocityTracker.getYVelocity();
if (!startedTracking) {
if (Math.abs(velX) >= 3000 && Math.abs(velX) > Math.abs(velY)) {
prepareForMoving(ev, velX < 0);
}
}
} else {
velX = 0;
velY = 0;
}
if (startedTracking) {
float x = viewPages[0].getX();
tabsAnimation = new AnimatorSet();
backAnimation = Math.abs(x) < viewPages[0].getMeasuredWidth() / 3.0f && (Math.abs(velX) < 3500 || Math.abs(velX) < Math.abs(velY));
float distToMove;
float dx;
if (backAnimation) {
dx = Math.abs(x);
if (animatingForward) {
tabsAnimation.playTogether(ObjectAnimator.ofFloat(viewPages[0], View.TRANSLATION_X, 0), ObjectAnimator.ofFloat(viewPages[1], View.TRANSLATION_X, viewPages[1].getMeasuredWidth()));
} else {
tabsAnimation.playTogether(ObjectAnimator.ofFloat(viewPages[0], View.TRANSLATION_X, 0), ObjectAnimator.ofFloat(viewPages[1], View.TRANSLATION_X, -viewPages[1].getMeasuredWidth()));
}
} else {
dx = viewPages[0].getMeasuredWidth() - Math.abs(x);
if (animatingForward) {
tabsAnimation.playTogether(ObjectAnimator.ofFloat(viewPages[0], View.TRANSLATION_X, -viewPages[0].getMeasuredWidth()), ObjectAnimator.ofFloat(viewPages[1], View.TRANSLATION_X, 0));
} else {
tabsAnimation.playTogether(ObjectAnimator.ofFloat(viewPages[0], View.TRANSLATION_X, viewPages[0].getMeasuredWidth()), ObjectAnimator.ofFloat(viewPages[1], View.TRANSLATION_X, 0));
}
}
tabsAnimation.setInterpolator(interpolator);
int width = getMeasuredWidth();
int halfWidth = width / 2;
float distanceRatio = Math.min(1.0f, 1.0f * dx / (float) width);
float distance = (float) halfWidth + (float) halfWidth * AndroidUtilities.distanceInfluenceForSnapDuration(distanceRatio);
velX = Math.abs(velX);
int duration;
if (velX > 0) {
duration = 4 * Math.round(1000.0f * Math.abs(distance / velX));
} else {
float pageDelta = dx / getMeasuredWidth();
duration = (int) ((pageDelta + 1.0f) * 100.0f);
}
duration = Math.max(150, Math.min(duration, 600));
tabsAnimation.setDuration(duration);
tabsAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animator) {
tabsAnimation = null;
if (backAnimation) {
viewPages[1].setVisibility(View.GONE);
} else {
ViewPage tempPage = viewPages[0];
viewPages[0] = viewPages[1];
viewPages[1] = tempPage;
viewPages[1].setVisibility(View.GONE);
swipeBackEnabled = viewPages[0].selectedType == scrollSlidingTextTabStrip.getFirstTabId();
scrollSlidingTextTabStrip.selectTabWithId(viewPages[0].selectedType, 1.0f);
}
tabsAnimationInProgress = false;
maybeStartTracking = false;
startedTracking = false;
actionBar.setEnabled(true);
scrollSlidingTextTabStrip.setEnabled(true);
}
});
tabsAnimation.start();
tabsAnimationInProgress = true;
startedTracking = false;
} else {
maybeStartTracking = false;
actionBar.setEnabled(true);
scrollSlidingTextTabStrip.setEnabled(true);
}
if (velocityTracker != null) {
velocityTracker.recycle();
velocityTracker = null;
}
}
return startedTracking;
}
return false;
}
};
sizeNotifierFrameLayout.setWillNotDraw(false);
imagesSearch.setParentFragment(this);
commentTextView = imagesSearch.commentTextView;
commentTextView.setSizeNotifierLayout(sizeNotifierFrameLayout);
for (int a = 0; a < 4; a++) {
View view;
switch(a) {
case 0:
view = imagesSearch.frameLayout2;
break;
case 1:
view = imagesSearch.writeButtonContainer;
break;
case 2:
view = imagesSearch.selectedCountView;
break;
case 3:
default:
view = imagesSearch.shadow;
break;
}
ViewGroup parent = (ViewGroup) view.getParent();
parent.removeView(view);
}
gifsSearch.setLayoutViews(imagesSearch.frameLayout2, imagesSearch.writeButtonContainer, imagesSearch.selectedCountView, imagesSearch.shadow, imagesSearch.commentTextView);
gifsSearch.setParentFragment(this);
for (int a = 0; a < viewPages.length; a++) {
viewPages[a] = new ViewPage(context) {
@Override
public void setTranslationX(float translationX) {
super.setTranslationX(translationX);
if (tabsAnimationInProgress) {
if (viewPages[0] == this) {
float scrollProgress = Math.abs(viewPages[0].getTranslationX()) / (float) viewPages[0].getMeasuredWidth();
scrollSlidingTextTabStrip.selectTabWithId(viewPages[1].selectedType, scrollProgress);
}
}
}
};
sizeNotifierFrameLayout.addView(viewPages[a], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
if (a == 0) {
viewPages[a].parentFragment = imagesSearch;
viewPages[a].listView = imagesSearch.getListView();
} else if (a == 1) {
viewPages[a].parentFragment = gifsSearch;
viewPages[a].listView = gifsSearch.getListView();
viewPages[a].setVisibility(View.GONE);
}
viewPages[a].listView.setScrollingTouchSlop(RecyclerView.TOUCH_SLOP_PAGING);
viewPages[a].fragmentView = (FrameLayout) viewPages[a].parentFragment.getFragmentView();
viewPages[a].listView.setClipToPadding(false);
viewPages[a].actionBar = viewPages[a].parentFragment.getActionBar();
viewPages[a].addView(viewPages[a].fragmentView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
viewPages[a].addView(viewPages[a].actionBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
viewPages[a].actionBar.setVisibility(View.GONE);
RecyclerView.OnScrollListener onScrollListener = viewPages[a].listView.getOnScrollListener();
viewPages[a].listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
onScrollListener.onScrollStateChanged(recyclerView, newState);
if (newState != RecyclerView.SCROLL_STATE_DRAGGING) {
int scrollY = (int) -actionBar.getTranslationY();
int actionBarHeight = ActionBar.getCurrentActionBarHeight();
if (scrollY != 0 && scrollY != actionBarHeight) {
if (scrollY < actionBarHeight / 2) {
viewPages[0].listView.smoothScrollBy(0, -scrollY);
} else {
viewPages[0].listView.smoothScrollBy(0, actionBarHeight - scrollY);
}
}
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
onScrollListener.onScrolled(recyclerView, dx, dy);
if (recyclerView == viewPages[0].listView) {
float currentTranslation = actionBar.getTranslationY();
float newTranslation = currentTranslation - dy;
if (newTranslation < -ActionBar.getCurrentActionBarHeight()) {
newTranslation = -ActionBar.getCurrentActionBarHeight();
} else if (newTranslation > 0) {
newTranslation = 0;
}
if (newTranslation != currentTranslation) {
setScrollY(newTranslation);
}
}
}
});
}
sizeNotifierFrameLayout.addView(actionBar, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
sizeNotifierFrameLayout.addView(imagesSearch.shadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 3, Gravity.BOTTOM | Gravity.LEFT, 0, 0, 0, 48));
sizeNotifierFrameLayout.addView(imagesSearch.frameLayout2, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 48, Gravity.LEFT | Gravity.BOTTOM));
sizeNotifierFrameLayout.addView(imagesSearch.writeButtonContainer, LayoutHelper.createFrame(60, 60, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, 12, 10));
sizeNotifierFrameLayout.addView(imagesSearch.selectedCountView, LayoutHelper.createFrame(42, 24, Gravity.RIGHT | Gravity.BOTTOM, 0, 0, -2, 9));
updateTabs();
switchToCurrentSelectedMode(false);
swipeBackEnabled = scrollSlidingTextTabStrip.getCurrentTabId() == scrollSlidingTextTabStrip.getFirstTabId();
return fragmentView;
}
use of org.telegram.ui.Components.EditTextBoldCursor in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatEditActivity method createView.
@Override
public View createView(Context context) {
if (nameTextView != null) {
nameTextView.onDestroy();
}
actionBar.setBackButtonImage(R.drawable.ic_ab_back);
actionBar.setAllowOverlayTitle(true);
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
if (checkDiscard()) {
finishFragment();
}
} else if (id == done_button) {
processDone();
}
}
});
SizeNotifierFrameLayout sizeNotifierFrameLayout = new SizeNotifierFrameLayout(context) {
private boolean ignoreLayout;
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
int heightSize = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(widthSize, heightSize);
heightSize -= getPaddingTop();
measureChildWithMargins(actionBar, widthMeasureSpec, 0, heightMeasureSpec, 0);
int keyboardSize = measureKeyboardHeight();
if (keyboardSize > AndroidUtilities.dp(20)) {
ignoreLayout = true;
nameTextView.hideEmojiView();
ignoreLayout = false;
}
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
View child = getChildAt(i);
if (child == null || child.getVisibility() == GONE || child == actionBar) {
continue;
}
if (nameTextView != null && nameTextView.isPopupView(child)) {
if (AndroidUtilities.isInMultiwindow || AndroidUtilities.isTablet()) {
if (AndroidUtilities.isTablet()) {
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(Math.min(AndroidUtilities.dp(AndroidUtilities.isTablet() ? 200 : 320), heightSize - AndroidUtilities.statusBarHeight + getPaddingTop()), MeasureSpec.EXACTLY));
} else {
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(heightSize - AndroidUtilities.statusBarHeight + getPaddingTop(), MeasureSpec.EXACTLY));
}
} else {
child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(child.getLayoutParams().height, MeasureSpec.EXACTLY));
}
} else {
measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
}
}
}
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
final int count = getChildCount();
int keyboardSize = measureKeyboardHeight();
int paddingBottom = keyboardSize <= AndroidUtilities.dp(20) && !AndroidUtilities.isInMultiwindow && !AndroidUtilities.isTablet() ? nameTextView.getEmojiPadding() : 0;
setBottomClip(paddingBottom);
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
if (child.getVisibility() == GONE) {
continue;
}
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
final int width = child.getMeasuredWidth();
final int height = child.getMeasuredHeight();
int childLeft;
int childTop;
int gravity = lp.gravity;
if (gravity == -1) {
gravity = Gravity.TOP | Gravity.LEFT;
}
final int absoluteGravity = gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
switch(absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
case Gravity.CENTER_HORIZONTAL:
childLeft = (r - l - width) / 2 + lp.leftMargin - lp.rightMargin;
break;
case Gravity.RIGHT:
childLeft = r - width - lp.rightMargin;
break;
case Gravity.LEFT:
default:
childLeft = lp.leftMargin;
}
switch(verticalGravity) {
case Gravity.TOP:
childTop = lp.topMargin + getPaddingTop();
break;
case Gravity.CENTER_VERTICAL:
childTop = ((b - paddingBottom) - t - height) / 2 + lp.topMargin - lp.bottomMargin;
break;
case Gravity.BOTTOM:
childTop = ((b - paddingBottom) - t) - height - lp.bottomMargin;
break;
default:
childTop = lp.topMargin;
}
if (nameTextView != null && nameTextView.isPopupView(child)) {
if (AndroidUtilities.isTablet()) {
childTop = getMeasuredHeight() - child.getMeasuredHeight();
} else {
childTop = getMeasuredHeight() + keyboardSize - child.getMeasuredHeight();
}
}
child.layout(childLeft, childTop, childLeft + width, childTop + height);
}
notifyHeightChanged();
}
@Override
public void requestLayout() {
if (ignoreLayout) {
return;
}
super.requestLayout();
}
};
sizeNotifierFrameLayout.setOnTouchListener((v, event) -> true);
fragmentView = sizeNotifierFrameLayout;
fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
ScrollView scrollView = new ScrollView(context);
scrollView.setFillViewport(true);
sizeNotifierFrameLayout.addView(scrollView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
LinearLayout linearLayout1 = new LinearLayout(context);
scrollView.addView(linearLayout1, new ScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
linearLayout1.setOrientation(LinearLayout.VERTICAL);
actionBar.setTitle(LocaleController.getString("ChannelEdit", R.string.ChannelEdit));
avatarContainer = new LinearLayout(context);
avatarContainer.setOrientation(LinearLayout.VERTICAL);
avatarContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
linearLayout1.addView(avatarContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
FrameLayout frameLayout = new FrameLayout(context);
avatarContainer.addView(frameLayout, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
avatarImage = new BackupImageView(context) {
@Override
public void invalidate() {
if (avatarOverlay != null) {
avatarOverlay.invalidate();
}
super.invalidate();
}
@Override
public void invalidate(int l, int t, int r, int b) {
if (avatarOverlay != null) {
avatarOverlay.invalidate();
}
super.invalidate(l, t, r, b);
}
};
avatarImage.setRoundRadius(AndroidUtilities.dp(32));
if (ChatObject.canChangeChatInfo(currentChat)) {
frameLayout.addView(avatarImage, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 8));
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setColor(0x55000000);
avatarOverlay = new View(context) {
@Override
protected void onDraw(Canvas canvas) {
if (avatarImage != null && avatarImage.getImageReceiver().hasNotThumb()) {
paint.setAlpha((int) (0x55 * avatarImage.getImageReceiver().getCurrentAlpha()));
canvas.drawCircle(getMeasuredWidth() / 2.0f, getMeasuredHeight() / 2.0f, getMeasuredWidth() / 2.0f, paint);
}
}
};
frameLayout.addView(avatarOverlay, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 8));
avatarProgressView = new RadialProgressView(context);
avatarProgressView.setSize(AndroidUtilities.dp(30));
avatarProgressView.setProgressColor(0xffffffff);
avatarProgressView.setNoProgress(false);
frameLayout.addView(avatarProgressView, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 8));
showAvatarProgress(false, false);
avatarContainer.setOnClickListener(v -> {
if (imageUpdater.isUploadingImage()) {
return;
}
TLRPC.Chat chat = getMessagesController().getChat(chatId);
if (chat.photo != null && chat.photo.photo_big != null) {
PhotoViewer.getInstance().setParentActivity(getParentActivity());
if (chat.photo.dc_id != 0) {
chat.photo.photo_big.dc_id = chat.photo.dc_id;
}
ImageLocation videoLocation;
if (info != null && (info.chat_photo instanceof TLRPC.TL_photo) && !info.chat_photo.video_sizes.isEmpty()) {
videoLocation = ImageLocation.getForPhoto(info.chat_photo.video_sizes.get(0), info.chat_photo);
} else {
videoLocation = null;
}
PhotoViewer.getInstance().openPhotoWithVideo(chat.photo.photo_big, videoLocation, provider);
}
});
} else {
frameLayout.addView(avatarImage, LayoutHelper.createFrame(64, 64, Gravity.TOP | (LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT), LocaleController.isRTL ? 0 : 16, 12, LocaleController.isRTL ? 16 : 0, 12));
}
nameTextView = new EditTextEmoji(context, sizeNotifierFrameLayout, this, EditTextEmoji.STYLE_FRAGMENT);
if (isChannel) {
nameTextView.setHint(LocaleController.getString("EnterChannelName", R.string.EnterChannelName));
} else {
nameTextView.setHint(LocaleController.getString("GroupName", R.string.GroupName));
}
nameTextView.setEnabled(ChatObject.canChangeChatInfo(currentChat));
nameTextView.setFocusable(nameTextView.isEnabled());
nameTextView.getEditText().addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
avatarDrawable.setInfo(5, nameTextView.getText().toString(), null);
if (avatarImage != null) {
avatarImage.invalidate();
}
}
});
InputFilter[] inputFilters = new InputFilter[1];
inputFilters[0] = new InputFilter.LengthFilter(128);
nameTextView.setFilters(inputFilters);
frameLayout.addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER_VERTICAL, LocaleController.isRTL ? 5 : 96, 0, LocaleController.isRTL ? 96 : 5, 0));
settingsContainer = new LinearLayout(context);
settingsContainer.setOrientation(LinearLayout.VERTICAL);
settingsContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
linearLayout1.addView(settingsContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
if (ChatObject.canChangeChatInfo(currentChat)) {
setAvatarCell = new TextCell(context) {
@Override
protected void onDraw(Canvas canvas) {
canvas.drawLine(LocaleController.isRTL ? 0 : AndroidUtilities.dp(20), getMeasuredHeight() - 1, getMeasuredWidth() - (LocaleController.isRTL ? AndroidUtilities.dp(20) : 0), getMeasuredHeight() - 1, Theme.dividerPaint);
}
};
setAvatarCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
setAvatarCell.setColors(Theme.key_windowBackgroundWhiteBlueIcon, Theme.key_windowBackgroundWhiteBlueButton);
setAvatarCell.setOnClickListener(v -> {
imageUpdater.openMenu(avatar != null, () -> {
avatar = null;
MessagesController.getInstance(currentAccount).changeChatAvatar(chatId, null, null, null, 0, null, null, null, null);
showAvatarProgress(false, true);
avatarImage.setImage(null, null, avatarDrawable, currentChat);
cameraDrawable.setCurrentFrame(0);
setAvatarCell.imageView.playAnimation();
}, dialogInterface -> {
if (!imageUpdater.isUploadingImage()) {
cameraDrawable.setCustomEndFrame(86);
setAvatarCell.imageView.playAnimation();
} else {
cameraDrawable.setCurrentFrame(0, false);
}
});
cameraDrawable.setCurrentFrame(0);
cameraDrawable.setCustomEndFrame(43);
setAvatarCell.imageView.playAnimation();
});
settingsContainer.addView(setAvatarCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
descriptionTextView = new EditTextBoldCursor(context);
descriptionTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 16);
descriptionTextView.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
descriptionTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
descriptionTextView.setPadding(0, 0, 0, AndroidUtilities.dp(6));
descriptionTextView.setBackgroundDrawable(null);
descriptionTextView.setGravity(LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT);
descriptionTextView.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_CAP_SENTENCES | InputType.TYPE_TEXT_FLAG_MULTI_LINE | InputType.TYPE_TEXT_FLAG_AUTO_CORRECT);
descriptionTextView.setImeOptions(EditorInfo.IME_ACTION_DONE);
descriptionTextView.setEnabled(ChatObject.canChangeChatInfo(currentChat));
descriptionTextView.setFocusable(descriptionTextView.isEnabled());
inputFilters = new InputFilter[1];
inputFilters[0] = new InputFilter.LengthFilter(255);
descriptionTextView.setFilters(inputFilters);
descriptionTextView.setHint(LocaleController.getString("DescriptionOptionalPlaceholder", R.string.DescriptionOptionalPlaceholder));
descriptionTextView.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
descriptionTextView.setCursorSize(AndroidUtilities.dp(20));
descriptionTextView.setCursorWidth(1.5f);
if (descriptionTextView.isEnabled()) {
settingsContainer.addView(descriptionTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 23, 15, 23, 9));
} else {
settingsContainer.addView(descriptionTextView, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, 23, 12, 23, 6));
}
descriptionTextView.setOnEditorActionListener((textView, i, keyEvent) -> {
if (i == EditorInfo.IME_ACTION_DONE && doneButton != null) {
doneButton.performClick();
return true;
}
return false;
});
descriptionTextView.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
}
@Override
public void afterTextChanged(Editable editable) {
}
});
settingsTopSectionCell = new ShadowSectionCell(context);
linearLayout1.addView(settingsTopSectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
typeEditContainer = new LinearLayout(context);
typeEditContainer.setOrientation(LinearLayout.VERTICAL);
typeEditContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
linearLayout1.addView(typeEditContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
if (currentChat.megagroup && (info == null || info.can_set_location)) {
locationCell = new TextDetailCell(context);
locationCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
typeEditContainer.addView(locationCell, LayoutHelper.createLinear(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
locationCell.setOnClickListener(v -> {
if (!AndroidUtilities.isGoogleMapsInstalled(ChatEditActivity.this)) {
return;
}
LocationActivity fragment = new LocationActivity(LocationActivity.LOCATION_TYPE_GROUP);
fragment.setDialogId(-chatId);
if (info != null && info.location instanceof TLRPC.TL_channelLocation) {
fragment.setInitialLocation((TLRPC.TL_channelLocation) info.location);
}
fragment.setDelegate((location, live, notify, scheduleDate) -> {
TLRPC.TL_channelLocation channelLocation = new TLRPC.TL_channelLocation();
channelLocation.address = location.address;
channelLocation.geo_point = location.geo;
info.location = channelLocation;
info.flags |= 32768;
updateFields(false);
getMessagesController().loadFullChat(chatId, 0, true);
});
presentFragment(fragment);
});
}
if (currentChat.creator && (info == null || info.can_set_username)) {
typeCell = new TextDetailCell(context);
typeCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
typeEditContainer.addView(typeCell, LayoutHelper.createLinear(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
typeCell.setOnClickListener(v -> {
ChatEditTypeActivity fragment = new ChatEditTypeActivity(chatId, locationCell != null && locationCell.getVisibility() == View.VISIBLE);
fragment.setInfo(info);
presentFragment(fragment);
});
}
if (ChatObject.isChannel(currentChat) && (isChannel && ChatObject.canUserDoAdminAction(currentChat, ChatObject.ACTION_CHANGE_INFO) || !isChannel && ChatObject.canUserDoAdminAction(currentChat, ChatObject.ACTION_PIN))) {
linkedCell = new TextDetailCell(context);
linkedCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
typeEditContainer.addView(linkedCell, LayoutHelper.createLinear(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
linkedCell.setOnClickListener(v -> {
ChatLinkActivity fragment = new ChatLinkActivity(chatId);
fragment.setInfo(info);
presentFragment(fragment);
});
}
if (!isChannel && ChatObject.canBlockUsers(currentChat) && (ChatObject.isChannel(currentChat) || currentChat.creator)) {
historyCell = new TextDetailCell(context);
historyCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
typeEditContainer.addView(historyCell, LayoutHelper.createLinear(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
historyCell.setOnClickListener(v -> {
BottomSheet.Builder builder = new BottomSheet.Builder(context);
builder.setApplyTopPadding(false);
LinearLayout linearLayout = new LinearLayout(context);
linearLayout.setOrientation(LinearLayout.VERTICAL);
HeaderCell headerCell = new HeaderCell(context, Theme.key_dialogTextBlue2, 23, 15, false);
headerCell.setHeight(47);
headerCell.setText(LocaleController.getString("ChatHistory", R.string.ChatHistory));
linearLayout.addView(headerCell);
LinearLayout linearLayoutInviteContainer = new LinearLayout(context);
linearLayoutInviteContainer.setOrientation(LinearLayout.VERTICAL);
linearLayout.addView(linearLayoutInviteContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
RadioButtonCell[] buttons = new RadioButtonCell[2];
for (int a = 0; a < 2; a++) {
buttons[a] = new RadioButtonCell(context, true);
buttons[a].setTag(a);
buttons[a].setBackgroundDrawable(Theme.getSelectorDrawable(false));
if (a == 0) {
buttons[a].setTextAndValue(LocaleController.getString("ChatHistoryVisible", R.string.ChatHistoryVisible), LocaleController.getString("ChatHistoryVisibleInfo", R.string.ChatHistoryVisibleInfo), true, !historyHidden);
} else {
if (ChatObject.isChannel(currentChat)) {
buttons[a].setTextAndValue(LocaleController.getString("ChatHistoryHidden", R.string.ChatHistoryHidden), LocaleController.getString("ChatHistoryHiddenInfo", R.string.ChatHistoryHiddenInfo), false, historyHidden);
} else {
buttons[a].setTextAndValue(LocaleController.getString("ChatHistoryHidden", R.string.ChatHistoryHidden), LocaleController.getString("ChatHistoryHiddenInfo2", R.string.ChatHistoryHiddenInfo2), false, historyHidden);
}
}
linearLayoutInviteContainer.addView(buttons[a], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
buttons[a].setOnClickListener(v2 -> {
Integer tag = (Integer) v2.getTag();
buttons[0].setChecked(tag == 0, true);
buttons[1].setChecked(tag == 1, true);
historyHidden = tag == 1;
builder.getDismissRunnable().run();
updateFields(true);
});
}
builder.setCustomView(linearLayout);
showDialog(builder.create());
});
}
if (isChannel) {
signCell = new TextCheckCell(context);
signCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
signCell.setTextAndValueAndCheck(LocaleController.getString("ChannelSignMessages", R.string.ChannelSignMessages), LocaleController.getString("ChannelSignMessagesInfo", R.string.ChannelSignMessagesInfo), signMessages, true, false);
typeEditContainer.addView(signCell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
signCell.setOnClickListener(v -> {
signMessages = !signMessages;
((TextCheckCell) v).setChecked(signMessages);
});
}
ActionBarMenu menu = actionBar.createMenu();
if (ChatObject.canChangeChatInfo(currentChat) || signCell != null || historyCell != null) {
doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
doneButton.setContentDescription(LocaleController.getString("Done", R.string.Done));
}
if (locationCell != null || signCell != null || historyCell != null || typeCell != null || linkedCell != null) {
settingsSectionCell = new ShadowSectionCell(context);
linearLayout1.addView(settingsSectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
infoContainer = new LinearLayout(context);
infoContainer.setOrientation(LinearLayout.VERTICAL);
infoContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
linearLayout1.addView(infoContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
blockCell = new TextCell(context);
blockCell.setBackground(Theme.getSelectorDrawable(false));
blockCell.setVisibility(ChatObject.isChannel(currentChat) || currentChat.creator || ChatObject.hasAdminRights(currentChat) && ChatObject.canChangeChatInfo(currentChat) ? View.VISIBLE : View.GONE);
blockCell.setOnClickListener(v -> {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
args.putInt("type", !isChannel && !currentChat.gigagroup ? ChatUsersActivity.TYPE_KICKED : ChatUsersActivity.TYPE_BANNED);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(info);
presentFragment(fragment);
});
inviteLinksCell = new TextCell(context);
inviteLinksCell.setBackground(Theme.getSelectorDrawable(false));
inviteLinksCell.setOnClickListener(v -> {
ManageLinksActivity fragment = new ManageLinksActivity(chatId, 0, 0);
fragment.setInfo(info, info.exported_invite);
presentFragment(fragment);
});
reactionsCell = new TextCell(context);
reactionsCell.setBackground(Theme.getSelectorDrawable(false));
reactionsCell.setOnClickListener(v -> {
Bundle args = new Bundle();
args.putLong(ChatReactionsEditActivity.KEY_CHAT_ID, chatId);
ChatReactionsEditActivity reactionsEditActivity = new ChatReactionsEditActivity(args);
reactionsEditActivity.setInfo(info);
presentFragment(reactionsEditActivity);
});
adminCell = new TextCell(context);
adminCell.setBackground(Theme.getSelectorDrawable(false));
adminCell.setOnClickListener(v -> {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
args.putInt("type", ChatUsersActivity.TYPE_ADMIN);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(info);
presentFragment(fragment);
});
membersCell = new TextCell(context);
membersCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
membersCell.setOnClickListener(v -> {
Bundle args = new Bundle();
args.putLong("chat_id", chatId);
args.putInt("type", ChatUsersActivity.TYPE_USERS);
ChatUsersActivity fragment = new ChatUsersActivity(args);
fragment.setInfo(info);
presentFragment(fragment);
});
if (!ChatObject.isChannelAndNotMegaGroup(currentChat)) {
memberRequestsCell = new TextCell(context);
memberRequestsCell.setBackground(Theme.getSelectorDrawable(false));
memberRequestsCell.setOnClickListener(v -> {
MemberRequestsActivity activity = new MemberRequestsActivity(chatId);
presentFragment(activity);
});
}
if (ChatObject.isChannel(currentChat) || currentChat.gigagroup) {
logCell = new TextCell(context);
logCell.setTextAndIcon(LocaleController.getString("EventLog", R.string.EventLog), R.drawable.group_log, false);
logCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
logCell.setOnClickListener(v -> presentFragment(new ChannelAdminLogActivity(currentChat)));
}
infoContainer.addView(reactionsCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
if (!isChannel && !currentChat.gigagroup) {
infoContainer.addView(blockCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
if (!isChannel) {
infoContainer.addView(inviteLinksCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
infoContainer.addView(adminCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
infoContainer.addView(membersCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
if (memberRequestsCell != null && info != null && info.requests_pending > 0) {
infoContainer.addView(memberRequestsCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
if (isChannel) {
infoContainer.addView(inviteLinksCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
if (isChannel || currentChat.gigagroup) {
infoContainer.addView(blockCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
if (logCell != null) {
infoContainer.addView(logCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
infoSectionCell = new ShadowSectionCell(context);
linearLayout1.addView(infoSectionCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
if (!ChatObject.hasAdminRights(currentChat)) {
infoContainer.setVisibility(View.GONE);
settingsTopSectionCell.setVisibility(View.GONE);
}
if (!isChannel && info != null && info.can_set_stickers) {
stickersContainer = new FrameLayout(context);
stickersContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
linearLayout1.addView(stickersContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
stickersCell = new TextSettingsCell(context);
stickersCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
stickersCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
stickersContainer.addView(stickersCell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
stickersCell.setOnClickListener(v -> {
GroupStickersActivity groupStickersActivity = new GroupStickersActivity(currentChat.id);
groupStickersActivity.setInfo(info);
presentFragment(groupStickersActivity);
});
stickersInfoCell3 = new TextInfoPrivacyCell(context);
stickersInfoCell3.setText(LocaleController.getString("GroupStickersInfo", R.string.GroupStickersInfo));
linearLayout1.addView(stickersInfoCell3, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
}
if (currentChat.creator) {
deleteContainer = new FrameLayout(context);
deleteContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
linearLayout1.addView(deleteContainer, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
deleteCell = new TextSettingsCell(context);
deleteCell.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteRedText5));
deleteCell.setBackgroundDrawable(Theme.getSelectorDrawable(false));
if (isChannel) {
deleteCell.setText(LocaleController.getString("ChannelDelete", R.string.ChannelDelete), false);
} else {
deleteCell.setText(LocaleController.getString("DeleteAndExitButton", R.string.DeleteAndExitButton), false);
}
deleteContainer.addView(deleteCell, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
deleteCell.setOnClickListener(v -> AlertsCreator.createClearOrDeleteDialogAlert(ChatEditActivity.this, false, true, false, currentChat, null, false, true, (param) -> {
if (AndroidUtilities.isTablet()) {
getNotificationCenter().postNotificationName(NotificationCenter.closeChats, -chatId);
} else {
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
}
finishFragment();
getNotificationCenter().postNotificationName(NotificationCenter.needDeleteDialog, -currentChat.id, null, currentChat, param);
}, null));
deleteInfoCell = new ShadowSectionCell(context);
deleteInfoCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
linearLayout1.addView(deleteInfoCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT));
} else {
if (!isChannel) {
if (stickersInfoCell3 == null) {
infoSectionCell.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
}
}
}
if (stickersInfoCell3 != null) {
if (deleteInfoCell == null) {
stickersInfoCell3.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider_bottom, Theme.key_windowBackgroundGrayShadow));
} else {
stickersInfoCell3.setBackgroundDrawable(Theme.getThemedDrawable(context, R.drawable.greydivider, Theme.key_windowBackgroundGrayShadow));
}
}
undoView = new UndoView(context);
sizeNotifierFrameLayout.addView(undoView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.BOTTOM | Gravity.LEFT, 8, 0, 8, 8));
nameTextView.setText(currentChat.title);
nameTextView.setSelection(nameTextView.length());
if (info != null) {
descriptionTextView.setText(info.about);
}
setAvatar();
updateFields(true);
return fragmentView;
}
Aggregations