use of org.telegram.ui.ActionBar.BackDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class MediaActivity method createView.
@Override
public View createView(Context context) {
actionBar.setBackButtonDrawable(new BackDrawable(false));
actionBar.setCastShadows(false);
actionBar.setAddToContainer(false);
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
finishFragment();
}
}
});
FrameLayout avatarContainer = new FrameLayout(context);
FrameLayout fragmentView = new FrameLayout(context) {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
FrameLayout.LayoutParams lp = (LayoutParams) sharedMediaLayout.getLayoutParams();
lp.topMargin = ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0);
lp = (LayoutParams) avatarContainer.getLayoutParams();
lp.topMargin = actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0;
lp.height = ActionBar.getCurrentActionBarHeight();
int textTop = (ActionBar.getCurrentActionBarHeight() / 2 - AndroidUtilities.dp(22)) / 2 + AndroidUtilities.dp(!AndroidUtilities.isTablet() && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE ? 4 : 5);
lp = (LayoutParams) nameTextView.getLayoutParams();
lp.topMargin = textTop;
textTop = ActionBar.getCurrentActionBarHeight() / 2 + (ActionBar.getCurrentActionBarHeight() / 2 - AndroidUtilities.dp(19)) / 2 - AndroidUtilities.dp(3);
lp = (LayoutParams) mediaCounterTextView.getLayoutParams();
lp.topMargin = textTop;
lp = (LayoutParams) avatarImageView.getLayoutParams();
lp.topMargin = (ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(42)) / 2;
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
if (sharedMediaLayout != null && sharedMediaLayout.isInFastScroll()) {
return sharedMediaLayout.dispatchFastScrollEvent(ev);
}
if (sharedMediaLayout != null && sharedMediaLayout.checkPinchToZoom(ev)) {
return true;
}
return super.dispatchTouchEvent(ev);
}
};
this.fragmentView = fragmentView;
nameTextView = new SimpleTextView(context);
nameTextView.setTextSize(18);
nameTextView.setGravity(Gravity.LEFT);
nameTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
nameTextView.setLeftDrawableTopPadding(-AndroidUtilities.dp(1.3f));
nameTextView.setScrollNonFitText(true);
nameTextView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
avatarContainer.addView(nameTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 56, 0));
avatarImageView = new ProfileActivity.AvatarImageView(context) {
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
super.onInitializeAccessibilityNodeInfo(info);
if (getImageReceiver().hasNotThumb()) {
info.setText(LocaleController.getString("AccDescrProfilePicture", R.string.AccDescrProfilePicture));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_CLICK, LocaleController.getString("Open", R.string.Open)));
info.addAction(new AccessibilityNodeInfo.AccessibilityAction(AccessibilityNodeInfo.ACTION_LONG_CLICK, LocaleController.getString("AccDescrOpenInPhotoViewer", R.string.AccDescrOpenInPhotoViewer)));
}
} else {
info.setVisibleToUser(false);
}
}
};
avatarImageView.getImageReceiver().setAllowDecodeSingleFrame(true);
avatarImageView.setRoundRadius(AndroidUtilities.dp(21));
avatarImageView.setPivotX(0);
avatarImageView.setPivotY(0);
AvatarDrawable avatarDrawable = new AvatarDrawable();
avatarDrawable.setProfile(true);
avatarImageView.setImageDrawable(avatarDrawable);
avatarContainer.addView(avatarImageView, LayoutHelper.createFrame(42, 42, Gravity.TOP | Gravity.LEFT, 64, 0, 0, 0));
mediaCounterTextView = new AudioPlayerAlert.ClippingTextViewSwitcher(context) {
@Override
protected TextView createTextView() {
TextView textView = new TextView(context);
textView.setTextColor(Theme.getColor(Theme.key_player_actionBarSubtitle));
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
textView.setSingleLine(true);
textView.setEllipsize(TextUtils.TruncateAt.END);
textView.setGravity(Gravity.LEFT);
return textView;
}
};
avatarContainer.addView(mediaCounterTextView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 118, 0, 56, 0));
sharedMediaLayout = new SharedMediaLayout(context, dialogId, sharedMediaPreloader, 0, null, currentChatInfo, false, this, new SharedMediaLayout.Delegate() {
@Override
public void scrollToSharedMedia() {
}
@Override
public boolean onMemberClick(TLRPC.ChatParticipant participant, boolean b, boolean resultOnly) {
return false;
}
@Override
public TLRPC.Chat getCurrentChat() {
return null;
}
@Override
public boolean isFragmentOpened() {
return true;
}
@Override
public RecyclerListView getListView() {
return null;
}
@Override
public boolean canSearchMembers() {
return false;
}
@Override
public void updateSelectedMediaTabText() {
updateMediaCount();
}
}, SharedMediaLayout.VIEW_TYPE_MEDIA_ACTIVITY) {
@Override
protected void onSelectedTabChanged() {
updateMediaCount();
}
@Override
protected void onSearchStateChanged(boolean expanded) {
if (SharedConfig.smoothKeyboard) {
AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid);
}
AndroidUtilities.updateViewVisibilityAnimated(avatarContainer, !expanded, 0.95f, true);
}
};
sharedMediaLayout.setPinnedToTop(true);
sharedMediaLayout.getSearchItem().setTranslationY(0);
sharedMediaLayout.photoVideoOptionsItem.setTranslationY(0);
fragmentView.addView(sharedMediaLayout);
fragmentView.addView(actionBar);
fragmentView.addView(avatarContainer);
TLObject avatarObject = null;
if (DialogObject.isEncryptedDialog(dialogId)) {
TLRPC.EncryptedChat encryptedChat = getMessagesController().getEncryptedChat(DialogObject.getEncryptedChatId(dialogId));
if (encryptedChat != null) {
TLRPC.User user = getMessagesController().getUser(encryptedChat.user_id);
if (user != null) {
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
avatarDrawable.setInfo(user);
avatarObject = user;
}
}
} else if (DialogObject.isUserDialog(dialogId)) {
TLRPC.User user = MessagesController.getInstance(currentAccount).getUser(dialogId);
if (user != null) {
if (user.self) {
nameTextView.setText(LocaleController.getString("SavedMessages", R.string.SavedMessages));
avatarDrawable.setAvatarType(AvatarDrawable.AVATAR_TYPE_SAVED);
avatarDrawable.setSmallSize(true);
} else {
nameTextView.setText(ContactsController.formatName(user.first_name, user.last_name));
avatarDrawable.setInfo(user);
avatarObject = user;
}
}
} else {
TLRPC.Chat chat = MessagesController.getInstance(currentAccount).getChat(-dialogId);
if (chat != null) {
nameTextView.setText(chat.title);
avatarDrawable.setInfo(chat);
avatarObject = chat;
}
}
final ImageLocation thumbLocation = ImageLocation.getForUserOrChat(avatarObject, ImageLocation.TYPE_SMALL);
avatarImageView.setImage(thumbLocation, "50_50", avatarDrawable, avatarObject);
if (TextUtils.isEmpty(nameTextView.getText())) {
nameTextView.setText(LocaleController.getString("SharedContentTitle", R.string.SharedContentTitle));
}
if (sharedMediaLayout.isSearchItemVisible()) {
sharedMediaLayout.getSearchItem().setVisibility(View.VISIBLE);
}
if (sharedMediaLayout.isCalendarItemVisible()) {
sharedMediaLayout.photoVideoOptionsItem.setVisibility(View.VISIBLE);
} else {
sharedMediaLayout.photoVideoOptionsItem.setVisibility(View.INVISIBLE);
}
AndroidUtilities.updateViewVisibilityAnimated(avatarContainer, true, 1, false);
updateMediaCount();
updateColors();
return fragmentView;
}
use of org.telegram.ui.ActionBar.BackDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class ArticleViewer method setParentActivity.
public void setParentActivity(Activity activity, BaseFragment fragment) {
parentFragment = fragment;
currentAccount = UserConfig.selectedAccount;
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingDidReset);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingPlayStateChanged);
NotificationCenter.getInstance(currentAccount).addObserver(this, NotificationCenter.messagePlayingDidStart);
if (parentActivity == activity) {
updatePaintColors();
refreshThemeColors();
return;
}
parentActivity = activity;
SharedPreferences sharedPreferences = ApplicationLoader.applicationContext.getSharedPreferences("articles", Activity.MODE_PRIVATE);
selectedFont = sharedPreferences.getInt("font_type", 0);
createPaint(false);
backgroundPaint = new Paint();
layerShadowDrawable = activity.getResources().getDrawable(R.drawable.layer_shadow);
slideDotDrawable = activity.getResources().getDrawable(R.drawable.slide_dot_small);
slideDotBigDrawable = activity.getResources().getDrawable(R.drawable.slide_dot_big);
scrimPaint = new Paint();
windowView = new WindowView(activity);
windowView.setWillNotDraw(false);
windowView.setClipChildren(true);
windowView.setFocusable(false);
containerView = new FrameLayout(activity) {
@Override
protected boolean drawChild(Canvas canvas, View child, long drawingTime) {
if (windowView.movingPage) {
int width = getMeasuredWidth();
int translationX = (int) listView[0].getTranslationX();
int clipLeft = 0;
int clipRight = width;
if (child == listView[1]) {
clipRight = translationX;
} else if (child == listView[0]) {
clipLeft = translationX;
}
final int restoreCount = canvas.save();
canvas.clipRect(clipLeft, 0, clipRight, getHeight());
final boolean result = super.drawChild(canvas, child, drawingTime);
canvas.restoreToCount(restoreCount);
if (translationX != 0) {
if (child == listView[0]) {
final float alpha = Math.max(0, Math.min((width - translationX) / (float) AndroidUtilities.dp(20), 1.0f));
layerShadowDrawable.setBounds(translationX - layerShadowDrawable.getIntrinsicWidth(), child.getTop(), translationX, child.getBottom());
layerShadowDrawable.setAlpha((int) (0xff * alpha));
layerShadowDrawable.draw(canvas);
} else if (child == listView[1]) {
float opacity = Math.min(0.8f, (width - translationX) / (float) width);
if (opacity < 0) {
opacity = 0;
}
scrimPaint.setColor((int) (((0x99000000 & 0xff000000) >>> 24) * opacity) << 24);
canvas.drawRect(clipLeft, 0, clipRight, getHeight(), scrimPaint);
}
}
return result;
} else {
return super.drawChild(canvas, child, drawingTime);
}
}
};
windowView.addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
// containerView.setFitsSystemWindows(true);
if (Build.VERSION.SDK_INT >= 21) {
windowView.setFitsSystemWindows(true);
containerView.setOnApplyWindowInsetsListener((v, insets) -> {
if (Build.VERSION.SDK_INT >= 30) {
return WindowInsets.CONSUMED;
} else {
return insets.consumeSystemWindowInsets();
}
});
}
fullscreenVideoContainer = new FrameLayout(activity);
fullscreenVideoContainer.setBackgroundColor(0xff000000);
fullscreenVideoContainer.setVisibility(View.INVISIBLE);
windowView.addView(fullscreenVideoContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
fullscreenAspectRatioView = new AspectRatioFrameLayout(activity);
fullscreenAspectRatioView.setVisibility(View.GONE);
fullscreenVideoContainer.addView(fullscreenAspectRatioView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.CENTER));
fullscreenTextureView = new TextureView(activity);
listView = new RecyclerListView[2];
adapter = new WebpageAdapter[2];
layoutManager = new LinearLayoutManager[2];
for (int i = 0; i < listView.length; i++) {
WebpageAdapter webpageAdapter = adapter[i] = new WebpageAdapter(parentActivity);
listView[i] = new RecyclerListView(activity) {
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
super.onLayout(changed, l, t, r, b);
int count = getChildCount();
for (int a = 0; a < count; a++) {
View child = getChildAt(a);
if (child.getTag() instanceof Integer) {
Integer tag = (Integer) child.getTag();
if (tag == 90) {
int bottom = child.getBottom();
if (bottom < getMeasuredHeight()) {
int height = getMeasuredHeight();
child.layout(0, height - child.getMeasuredHeight(), child.getMeasuredWidth(), height);
break;
}
}
}
}
}
@Override
public boolean onInterceptTouchEvent(MotionEvent e) {
if (pressedLinkOwnerLayout != null && pressedLink == null && (popupWindow == null || !popupWindow.isShowing()) && (e.getAction() == MotionEvent.ACTION_UP || e.getAction() == MotionEvent.ACTION_CANCEL)) {
pressedLink = null;
pressedLinkOwnerLayout = null;
pressedLinkOwnerView = null;
} else if (pressedLinkOwnerLayout != null && pressedLink != null && e.getAction() == MotionEvent.ACTION_UP) {
checkLayoutForLinks(webpageAdapter, e, pressedLinkOwnerView, pressedLinkOwnerLayout, 0, 0);
}
return super.onInterceptTouchEvent(e);
}
@Override
public boolean onTouchEvent(MotionEvent e) {
if (pressedLinkOwnerLayout != null && pressedLink == null && (popupWindow == null || !popupWindow.isShowing()) && (e.getAction() == MotionEvent.ACTION_UP || e.getAction() == MotionEvent.ACTION_CANCEL)) {
pressedLink = null;
pressedLinkOwnerLayout = null;
pressedLinkOwnerView = null;
}
return super.onTouchEvent(e);
}
@Override
public void setTranslationX(float translationX) {
super.setTranslationX(translationX);
if (windowView.movingPage) {
containerView.invalidate();
float progress = translationX / getMeasuredWidth();
setCurrentHeaderHeight((int) (windowView.startMovingHeaderHeight + (AndroidUtilities.dp(56) - windowView.startMovingHeaderHeight) * progress));
}
}
};
((DefaultItemAnimator) listView[i].getItemAnimator()).setDelayAnimations(false);
listView[i].setLayoutManager(layoutManager[i] = new LinearLayoutManager(parentActivity, LinearLayoutManager.VERTICAL, false));
listView[i].setAdapter(webpageAdapter);
listView[i].setClipToPadding(false);
listView[i].setVisibility(i == 0 ? View.VISIBLE : View.GONE);
listView[i].setPadding(0, AndroidUtilities.dp(56), 0, 0);
listView[i].setTopGlowOffset(AndroidUtilities.dp(56));
containerView.addView(listView[i], LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView[i].setOnItemLongClickListener((view, position) -> {
if (view instanceof BlockRelatedArticlesCell) {
BlockRelatedArticlesCell cell = (BlockRelatedArticlesCell) view;
showCopyPopup(cell.currentBlock.parent.articles.get(cell.currentBlock.num).url);
return true;
}
return false;
});
listView[i].setOnItemClickListener((view, position, x, y) -> {
if (textSelectionHelper != null) {
if (textSelectionHelper.isSelectionMode()) {
textSelectionHelper.clear();
return;
}
textSelectionHelper.clear();
}
if (view instanceof ReportCell && webpageAdapter.currentPage != null) {
ReportCell cell = (ReportCell) view;
if (previewsReqId != 0 || cell.hasViews && x < view.getMeasuredWidth() / 2) {
return;
}
TLObject object = MessagesController.getInstance(currentAccount).getUserOrChat("previews");
if (object instanceof TLRPC.TL_user) {
openPreviewsChat((TLRPC.User) object, webpageAdapter.currentPage.id);
} else {
final int currentAccount = UserConfig.selectedAccount;
final long pageId = webpageAdapter.currentPage.id;
showProgressView(true, true);
TLRPC.TL_contacts_resolveUsername req = new TLRPC.TL_contacts_resolveUsername();
req.username = "previews";
previewsReqId = ConnectionsManager.getInstance(currentAccount).sendRequest(req, (response, error) -> AndroidUtilities.runOnUIThread(() -> {
if (previewsReqId == 0) {
return;
}
previewsReqId = 0;
showProgressView(true, false);
if (response != null) {
TLRPC.TL_contacts_resolvedPeer res = (TLRPC.TL_contacts_resolvedPeer) response;
MessagesController.getInstance(currentAccount).putUsers(res.users, false);
MessagesStorage.getInstance(currentAccount).putUsersAndChats(res.users, res.chats, false, true);
if (!res.users.isEmpty()) {
openPreviewsChat(res.users.get(0), pageId);
}
}
}));
}
} else if (position >= 0 && position < webpageAdapter.localBlocks.size()) {
TLRPC.PageBlock pageBlock = webpageAdapter.localBlocks.get(position);
TLRPC.PageBlock originalBlock = pageBlock;
pageBlock = getLastNonListPageBlock(pageBlock);
if (pageBlock instanceof TL_pageBlockDetailsChild) {
TL_pageBlockDetailsChild detailsChild = (TL_pageBlockDetailsChild) pageBlock;
pageBlock = detailsChild.block;
}
if (pageBlock instanceof TLRPC.TL_pageBlockChannel) {
TLRPC.TL_pageBlockChannel pageBlockChannel = (TLRPC.TL_pageBlockChannel) pageBlock;
MessagesController.getInstance(currentAccount).openByUserName(pageBlockChannel.channel.username, parentFragment, 2);
close(false, true);
} else if (pageBlock instanceof TL_pageBlockRelatedArticlesChild) {
TL_pageBlockRelatedArticlesChild pageBlockRelatedArticlesChild = (TL_pageBlockRelatedArticlesChild) pageBlock;
openWebpageUrl(pageBlockRelatedArticlesChild.parent.articles.get(pageBlockRelatedArticlesChild.num).url, null);
} else if (pageBlock instanceof TLRPC.TL_pageBlockDetails) {
view = getLastNonListCell(view);
if (!(view instanceof BlockDetailsCell)) {
return;
}
pressedLinkOwnerLayout = null;
pressedLinkOwnerView = null;
int index = webpageAdapter.blocks.indexOf(originalBlock);
if (index < 0) {
return;
}
TLRPC.TL_pageBlockDetails pageBlockDetails = (TLRPC.TL_pageBlockDetails) pageBlock;
pageBlockDetails.open = !pageBlockDetails.open;
int oldCount = webpageAdapter.getItemCount();
webpageAdapter.updateRows();
int newCount = webpageAdapter.getItemCount();
int changeCount = Math.abs(newCount - oldCount);
BlockDetailsCell cell = (BlockDetailsCell) view;
cell.arrow.setAnimationProgressAnimated(pageBlockDetails.open ? 0.0f : 1.0f);
cell.invalidate();
if (changeCount != 0) {
if (pageBlockDetails.open) {
webpageAdapter.notifyItemRangeInserted(position + 1, changeCount);
} else {
webpageAdapter.notifyItemRangeRemoved(position + 1, changeCount);
}
}
}
}
});
listView[i].setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
textSelectionHelper.stopScrolling();
}
}
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
if (recyclerView.getChildCount() == 0) {
return;
}
textSelectionHelper.onParentScrolled();
headerView.invalidate();
checkScroll(dy);
}
});
}
headerPaint.setColor(0xff000000);
statusBarPaint.setColor(0xff000000);
headerProgressPaint.setColor(0xff242426);
headerView = new FrameLayout(activity) {
@Override
protected void onDraw(Canvas canvas) {
int width = getMeasuredWidth();
int height = getMeasuredHeight();
canvas.drawRect(0, 0, width, height, headerPaint);
if (layoutManager == null) {
return;
}
int first = layoutManager[0].findFirstVisibleItemPosition();
int last = layoutManager[0].findLastVisibleItemPosition();
int count = layoutManager[0].getItemCount();
View view;
if (last >= count - 2) {
view = layoutManager[0].findViewByPosition(count - 2);
} else {
view = layoutManager[0].findViewByPosition(first);
}
if (view == null) {
return;
}
float itemProgress = width / (float) (count - 1);
int childCount = layoutManager[0].getChildCount();
float viewHeight = view.getMeasuredHeight();
float viewProgress;
if (last >= count - 2) {
viewProgress = (count - 2 - first) * itemProgress * (listView[0].getMeasuredHeight() - view.getTop()) / viewHeight;
} else {
viewProgress = itemProgress * (1.0f - (Math.min(0, view.getTop() - listView[0].getPaddingTop()) + viewHeight) / viewHeight);
}
float progress = first * itemProgress + viewProgress;
canvas.drawRect(0, 0, progress, height, headerProgressPaint);
}
};
headerView.setWillNotDraw(false);
containerView.addView(headerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 56));
headerView.setOnClickListener(v -> listView[0].smoothScrollToPosition(0));
titleTextView = new SimpleTextView(activity);
titleTextView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
titleTextView.setTextSize(20);
titleTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
titleTextView.setTextColor(0xffb3b3b3);
titleTextView.setPivotX(0.0f);
titleTextView.setPivotY(AndroidUtilities.dp(28));
headerView.addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 56, Gravity.LEFT | Gravity.TOP, 72, 0, 48 * 2, 0));
lineProgressView = new LineProgressView(activity);
lineProgressView.setProgressColor(0xffffffff);
lineProgressView.setPivotX(0.0f);
lineProgressView.setPivotY(AndroidUtilities.dp(2));
headerView.addView(lineProgressView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 2, Gravity.LEFT | Gravity.BOTTOM, 0, 0, 0, 1));
lineProgressTickRunnable = () -> {
float progressLeft = 0.7f - lineProgressView.getCurrentProgress();
if (progressLeft > 0.0f) {
float tick;
if (progressLeft < 0.25f) {
tick = 0.01f;
} else {
tick = 0.02f;
}
lineProgressView.setProgress(lineProgressView.getCurrentProgress() + tick, true);
AndroidUtilities.runOnUIThread(lineProgressTickRunnable, 100);
}
};
menuContainer = new FrameLayout(activity);
headerView.addView(menuContainer, LayoutHelper.createFrame(48, 56, Gravity.TOP | Gravity.RIGHT));
searchShadow = new View(activity);
searchShadow.setBackgroundResource(R.drawable.header_shadow);
searchShadow.setAlpha(0.0f);
containerView.addView(searchShadow, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 3, Gravity.LEFT | Gravity.TOP, 0, 56, 0, 0));
searchContainer = new FrameLayout(parentActivity);
searchContainer.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
searchContainer.setVisibility(View.INVISIBLE);
if (Build.VERSION.SDK_INT < 21) {
searchContainer.setAlpha(0.0f);
}
headerView.addView(searchContainer, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 56));
searchField = new EditTextBoldCursor(parentActivity) {
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
if (!AndroidUtilities.showKeyboard(this)) {
clearFocus();
requestFocus();
}
}
return super.onTouchEvent(event);
}
};
searchField.setCursorWidth(1.5f);
searchField.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
searchField.setCursorColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
searchField.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
searchField.setHintTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteHintText));
searchField.setSingleLine(true);
searchField.setHint(LocaleController.getString("Search", R.string.Search));
searchField.setBackgroundResource(0);
searchField.setPadding(0, 0, 0, 0);
int inputType = searchField.getInputType() | EditorInfo.TYPE_TEXT_FLAG_NO_SUGGESTIONS;
searchField.setInputType(inputType);
if (Build.VERSION.SDK_INT < 23) {
searchField.setCustomSelectionActionModeCallback(new ActionMode.Callback() {
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
public void onDestroyActionMode(ActionMode mode) {
}
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
return false;
}
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
return false;
}
});
}
searchField.setOnEditorActionListener((v, actionId, event) -> {
if (event != null && (event.getAction() == KeyEvent.ACTION_UP && event.getKeyCode() == KeyEvent.KEYCODE_SEARCH || event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) {
AndroidUtilities.hideKeyboard(searchField);
}
return false;
});
searchField.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) {
if (ignoreOnTextChange) {
ignoreOnTextChange = false;
return;
}
processSearch(s.toString().toLowerCase());
if (clearButton != null) {
if (TextUtils.isEmpty(s)) {
if (clearButton.getTag() != null) {
clearButton.setTag(null);
clearButton.clearAnimation();
if (animateClear) {
clearButton.animate().setInterpolator(new DecelerateInterpolator()).alpha(0.0f).setDuration(180).scaleY(0.0f).scaleX(0.0f).rotation(45).withEndAction(() -> clearButton.setVisibility(View.INVISIBLE)).start();
} else {
clearButton.setAlpha(0.0f);
clearButton.setRotation(45);
clearButton.setScaleX(0.0f);
clearButton.setScaleY(0.0f);
clearButton.setVisibility(View.INVISIBLE);
animateClear = true;
}
}
} else {
if (clearButton.getTag() == null) {
clearButton.setTag(1);
clearButton.clearAnimation();
clearButton.setVisibility(View.VISIBLE);
if (animateClear) {
clearButton.animate().setInterpolator(new DecelerateInterpolator()).alpha(1.0f).setDuration(180).scaleY(1.0f).scaleX(1.0f).rotation(0).start();
} else {
clearButton.setAlpha(1.0f);
clearButton.setRotation(0);
clearButton.setScaleX(1.0f);
clearButton.setScaleY(1.0f);
animateClear = true;
}
}
}
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
searchField.setImeOptions(EditorInfo.IME_FLAG_NO_FULLSCREEN | EditorInfo.IME_ACTION_SEARCH);
searchField.setTextIsSelectable(false);
searchContainer.addView(searchField, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 36, Gravity.CENTER_VERTICAL, 72, 0, 48, 0));
clearButton = new ImageView(parentActivity) {
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
clearAnimation();
if (getTag() == null) {
clearButton.setVisibility(INVISIBLE);
clearButton.setAlpha(0.0f);
clearButton.setRotation(45);
clearButton.setScaleX(0.0f);
clearButton.setScaleY(0.0f);
} else {
clearButton.setAlpha(1.0f);
clearButton.setRotation(0);
clearButton.setScaleX(1.0f);
clearButton.setScaleY(1.0f);
}
}
};
clearButton.setImageDrawable(new CloseProgressDrawable2());
clearButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.MULTIPLY));
clearButton.setScaleType(ImageView.ScaleType.CENTER);
clearButton.setAlpha(0.0f);
clearButton.setRotation(45);
clearButton.setScaleX(0.0f);
clearButton.setScaleY(0.0f);
clearButton.setOnClickListener(v -> {
if (searchField.length() != 0) {
searchField.setText("");
}
searchField.requestFocus();
AndroidUtilities.showKeyboard(searchField);
});
clearButton.setContentDescription(LocaleController.getString("ClearButton", R.string.ClearButton));
searchContainer.addView(clearButton, LayoutHelper.createFrame(48, LayoutHelper.MATCH_PARENT, Gravity.CENTER_VERTICAL | Gravity.RIGHT));
backButton = new ImageView(activity);
backButton.setScaleType(ImageView.ScaleType.CENTER);
backDrawable = new BackDrawable(false);
backDrawable.setAnimationTime(200.0f);
backDrawable.setColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
backDrawable.setRotatedColor(0xffb3b3b3);
backDrawable.setRotation(1.0f, false);
backButton.setImageDrawable(backDrawable);
backButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR));
headerView.addView(backButton, LayoutHelper.createFrame(54, 56));
backButton.setOnClickListener(v -> {
/*if (collapsed) {
uncollapse();
} else {
collapse();
}*/
if (searchContainer.getTag() != null) {
showSearch(false);
} else {
close(true, true);
}
});
backButton.setContentDescription(LocaleController.getString("AccDescrGoBack", R.string.AccDescrGoBack));
menuButton = new ActionBarMenuItem(parentActivity, null, Theme.ACTION_BAR_WHITE_SELECTOR_COLOR, 0xffb3b3b3) {
@Override
public void toggleSubMenu() {
super.toggleSubMenu();
listView[0].stopScroll();
checkScrollAnimated();
}
};
menuButton.setLayoutInScreen(true);
menuButton.setDuplicateParentStateEnabled(false);
menuButton.setClickable(true);
menuButton.setIcon(R.drawable.ic_ab_other);
menuButton.addSubItem(search_item, R.drawable.msg_search, LocaleController.getString("Search", R.string.Search));
menuButton.addSubItem(share_item, R.drawable.msg_share, LocaleController.getString("ShareFile", R.string.ShareFile));
menuButton.addSubItem(open_item, R.drawable.msg_openin, LocaleController.getString("OpenInExternalApp", R.string.OpenInExternalApp));
menuButton.addSubItem(settings_item, R.drawable.menu_settings, LocaleController.getString("Settings", R.string.Settings));
menuButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.ACTION_BAR_WHITE_SELECTOR_COLOR));
menuButton.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
menuContainer.addView(menuButton, LayoutHelper.createFrame(48, 56));
progressView = new ContextProgressView(activity, 2);
progressView.setVisibility(View.GONE);
menuContainer.addView(progressView, LayoutHelper.createFrame(48, 56));
menuButton.setOnClickListener(v -> menuButton.toggleSubMenu());
menuButton.setDelegate(id -> {
if (adapter[0].currentPage == null || parentActivity == null) {
return;
}
if (id == search_item) {
showSearch(true);
} else if (id == share_item) {
showDialog(new ShareAlert(parentActivity, null, adapter[0].currentPage.url, false, adapter[0].currentPage.url, false));
} else if (id == open_item) {
String webPageUrl;
if (!TextUtils.isEmpty(adapter[0].currentPage.cached_page.url)) {
webPageUrl = adapter[0].currentPage.cached_page.url;
} else {
webPageUrl = adapter[0].currentPage.url;
}
Browser.openUrl(parentActivity, webPageUrl, true, false);
} else if (id == settings_item) {
BottomSheet.Builder builder = new BottomSheet.Builder(parentActivity);
builder.setApplyTopPadding(false);
LinearLayout settingsContainer = new LinearLayout(parentActivity);
settingsContainer.setPadding(0, 0, 0, AndroidUtilities.dp(4));
settingsContainer.setOrientation(LinearLayout.VERTICAL);
HeaderCell headerCell = new HeaderCell(parentActivity);
headerCell.setText(LocaleController.getString("FontSize", R.string.FontSize));
settingsContainer.addView(headerCell, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 3, 1, 3, 0));
TextSizeCell sizeCell = new TextSizeCell(parentActivity);
settingsContainer.addView(sizeCell, LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 3, 0, 3, 0));
headerCell = new HeaderCell(parentActivity);
headerCell.setText(LocaleController.getString("FontType", R.string.FontType));
settingsContainer.addView(headerCell, LayoutHelper.createLinear(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.TOP, 3, 4, 3, 2));
for (int a = 0; a < 2; a++) {
fontCells[a] = new FontCell(parentActivity);
switch(a) {
case 0:
fontCells[a].setTextAndTypeface(LocaleController.getString("Default", R.string.Default), Typeface.DEFAULT);
break;
case 1:
fontCells[a].setTextAndTypeface("Serif", Typeface.SERIF);
break;
}
fontCells[a].select(a == selectedFont, false);
fontCells[a].setTag(a);
fontCells[a].setOnClickListener(v -> {
int num = (Integer) v.getTag();
selectedFont = num;
for (int a1 = 0; a1 < 2; a1++) {
fontCells[a1].select(a1 == num, true);
}
updatePaintFonts();
for (int i = 0; i < listView.length; i++) {
adapter[i].notifyDataSetChanged();
}
});
settingsContainer.addView(fontCells[a], LayoutHelper.createLinear(LayoutHelper.MATCH_PARENT, 50));
}
builder.setCustomView(settingsContainer);
showDialog(linkSheet = builder.create());
}
});
searchPanel = new FrameLayout(parentActivity) {
@Override
public void onDraw(Canvas canvas) {
int bottom = Theme.chat_composeShadowDrawable.getIntrinsicHeight();
Theme.chat_composeShadowDrawable.setBounds(0, 0, getMeasuredWidth(), bottom);
Theme.chat_composeShadowDrawable.draw(canvas);
canvas.drawRect(0, bottom, getMeasuredWidth(), getMeasuredHeight(), Theme.chat_composeBackgroundPaint);
}
};
searchPanel.setOnTouchListener((v, event) -> true);
searchPanel.setWillNotDraw(false);
searchPanel.setVisibility(View.INVISIBLE);
searchPanel.setFocusable(true);
searchPanel.setFocusableInTouchMode(true);
searchPanel.setClickable(true);
searchPanel.setPadding(0, AndroidUtilities.dp(3), 0, 0);
containerView.addView(searchPanel, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 51, Gravity.BOTTOM));
searchUpButton = new ImageView(parentActivity);
searchUpButton.setScaleType(ImageView.ScaleType.CENTER);
searchUpButton.setImageResource(R.drawable.msg_go_up);
searchUpButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.MULTIPLY));
searchUpButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
searchPanel.addView(searchUpButton, LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.TOP, 0, 0, 48, 0));
searchUpButton.setOnClickListener(view -> scrollToSearchIndex(currentSearchIndex - 1));
searchUpButton.setContentDescription(LocaleController.getString("AccDescrSearchNext", R.string.AccDescrSearchNext));
searchDownButton = new ImageView(parentActivity);
searchDownButton.setScaleType(ImageView.ScaleType.CENTER);
searchDownButton.setImageResource(R.drawable.msg_go_down);
searchDownButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText), PorterDuff.Mode.MULTIPLY));
searchDownButton.setBackgroundDrawable(Theme.createSelectorDrawable(Theme.getColor(Theme.key_actionBarActionModeDefaultSelector), 1));
searchPanel.addView(searchDownButton, LayoutHelper.createFrame(48, 48, Gravity.RIGHT | Gravity.TOP, 0, 0, 0, 0));
searchDownButton.setOnClickListener(view -> scrollToSearchIndex(currentSearchIndex + 1));
searchDownButton.setContentDescription(LocaleController.getString("AccDescrSearchPrev", R.string.AccDescrSearchPrev));
searchCountText = new SimpleTextView(parentActivity);
searchCountText.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText));
searchCountText.setTextSize(15);
searchCountText.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
searchCountText.setGravity(Gravity.LEFT);
searchPanel.addView(searchCountText, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.LEFT | Gravity.CENTER_VERTICAL, 18, 0, 108, 0));
windowLayoutParams = new WindowManager.LayoutParams();
windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
windowLayoutParams.format = PixelFormat.TRANSLUCENT;
windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
windowLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW - 1;
windowLayoutParams.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING;
windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM;
if (Build.VERSION.SDK_INT >= 21) {
windowLayoutParams.flags |= WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
if (Build.VERSION.SDK_INT >= 28) {
windowLayoutParams.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
}
}
textSelectionHelper = new TextSelectionHelper.ArticleTextSelectionHelper();
textSelectionHelper.setParentView(listView[0]);
if (MessagesController.getGlobalMainSettings().getBoolean("translate_button", false)) {
textSelectionHelper.setOnTranslate((text, fromLang, toLang, onAlertDismiss) -> {
TranslateAlert.showAlert(parentActivity, parentFragment, fromLang, toLang, text, false, null, onAlertDismiss);
});
}
textSelectionHelper.layoutManager = layoutManager[0];
textSelectionHelper.setCallback(new TextSelectionHelper.Callback() {
@Override
public void onStateChanged(boolean isSelected) {
if (isSelected) {
showSearch(false);
}
}
@Override
public void onTextCopied() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) {
BulletinFactory.of(containerView, null).createCopyBulletin(LocaleController.getString("TextCopied", R.string.TextCopied)).show();
}
}
});
containerView.addView(textSelectionHelper.getOverlayView(activity));
pinchToZoomHelper = new PinchToZoomHelper(containerView, windowView);
pinchToZoomHelper.setClipBoundsListener(new PinchToZoomHelper.ClipBoundsListener() {
@Override
public void getClipTopBottom(float[] topBottom) {
topBottom[0] = currentHeaderHeight;
topBottom[1] = listView[0].getMeasuredHeight();
}
});
pinchToZoomHelper.setCallback(new PinchToZoomHelper.Callback() {
@Override
public void onZoomStarted(MessageObject messageObject) {
if (listView[0] != null) {
listView[0].cancelClickRunnables(true);
}
}
});
updatePaintColors();
}
use of org.telegram.ui.ActionBar.BackDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class CallLogActivity method createView.
@Override
public View createView(Context context) {
greenDrawable = getParentActivity().getResources().getDrawable(R.drawable.ic_call_made_green_18dp).mutate();
greenDrawable.setBounds(0, 0, greenDrawable.getIntrinsicWidth(), greenDrawable.getIntrinsicHeight());
greenDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_calls_callReceivedGreenIcon), PorterDuff.Mode.MULTIPLY));
iconOut = new ImageSpan(greenDrawable, ImageSpan.ALIGN_BOTTOM);
greenDrawable2 = getParentActivity().getResources().getDrawable(R.drawable.ic_call_received_green_18dp).mutate();
greenDrawable2.setBounds(0, 0, greenDrawable2.getIntrinsicWidth(), greenDrawable2.getIntrinsicHeight());
greenDrawable2.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_calls_callReceivedGreenIcon), PorterDuff.Mode.MULTIPLY));
iconIn = new ImageSpan(greenDrawable2, ImageSpan.ALIGN_BOTTOM);
redDrawable = getParentActivity().getResources().getDrawable(R.drawable.ic_call_received_green_18dp).mutate();
redDrawable.setBounds(0, 0, redDrawable.getIntrinsicWidth(), redDrawable.getIntrinsicHeight());
redDrawable.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_calls_callReceivedRedIcon), PorterDuff.Mode.MULTIPLY));
iconMissed = new ImageSpan(redDrawable, ImageSpan.ALIGN_BOTTOM);
actionBar.setBackButtonDrawable(new BackDrawable(false));
actionBar.setAllowOverlayTitle(true);
actionBar.setTitle(LocaleController.getString("Calls", R.string.Calls));
actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
@Override
public void onItemClick(int id) {
if (id == -1) {
if (actionBar.isActionModeShowed()) {
hideActionMode(true);
} else {
finishFragment();
}
} else if (id == delete_all_calls) {
showDeleteAlert(true);
} else if (id == delete) {
showDeleteAlert(false);
}
}
});
ActionBarMenu menu = actionBar.createMenu();
otherItem = menu.addItem(10, R.drawable.ic_ab_other);
otherItem.setContentDescription(LocaleController.getString("AccDescrMoreOptions", R.string.AccDescrMoreOptions));
otherItem.addSubItem(delete_all_calls, R.drawable.msg_delete, LocaleController.getString("DeleteAllCalls", R.string.DeleteAllCalls));
fragmentView = new FrameLayout(context);
fragmentView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundGray));
FrameLayout frameLayout = (FrameLayout) fragmentView;
flickerLoadingView = new FlickerLoadingView(context);
flickerLoadingView.setViewType(FlickerLoadingView.CALL_LOG_TYPE);
flickerLoadingView.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
flickerLoadingView.showDate(false);
emptyView = new EmptyTextProgressView(context, flickerLoadingView);
frameLayout.addView(emptyView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView = new RecyclerListView(context);
listView.setEmptyView(emptyView);
listView.setLayoutManager(layoutManager = new LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false));
listView.setAdapter(listViewAdapter = new ListAdapter(context));
listView.setVerticalScrollbarPosition(LocaleController.isRTL ? RecyclerListView.SCROLLBAR_POSITION_LEFT : RecyclerListView.SCROLLBAR_POSITION_RIGHT);
frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
listView.setOnItemClickListener((view, position) -> {
if (view instanceof CallCell) {
CallLogRow row = calls.get(position - listViewAdapter.callsStartRow);
if (actionBar.isActionModeShowed()) {
addOrRemoveSelectedDialog(row.calls, (CallCell) view);
} else {
Bundle args = new Bundle();
args.putLong("user_id", row.user.id);
args.putInt("message_id", row.calls.get(0).id);
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
presentFragment(new ChatActivity(args), true);
}
} else if (view instanceof GroupCallCell) {
GroupCallCell cell = (GroupCallCell) view;
Bundle args = new Bundle();
args.putLong("chat_id", cell.currentChat.id);
getNotificationCenter().postNotificationName(NotificationCenter.closeChats);
presentFragment(new ChatActivity(args), true);
}
});
listView.setOnItemLongClickListener((view, position) -> {
if (view instanceof CallCell) {
addOrRemoveSelectedDialog(calls.get(position - listViewAdapter.callsStartRow).calls, (CallCell) view);
return true;
}
return false;
});
listView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
int firstVisibleItem = layoutManager.findFirstVisibleItemPosition();
int visibleItemCount = firstVisibleItem == RecyclerView.NO_POSITION ? 0 : Math.abs(layoutManager.findLastVisibleItemPosition() - firstVisibleItem) + 1;
if (visibleItemCount > 0) {
int totalItemCount = listViewAdapter.getItemCount();
if (!endReached && !loading && !calls.isEmpty() && firstVisibleItem + visibleItemCount >= totalItemCount - 5) {
final CallLogRow row = calls.get(calls.size() - 1);
AndroidUtilities.runOnUIThread(() -> getCalls(row.calls.get(row.calls.size() - 1).id, 100));
}
}
if (floatingButton.getVisibility() != View.GONE) {
final View topChild = recyclerView.getChildAt(0);
int firstViewTop = 0;
if (topChild != null) {
firstViewTop = topChild.getTop();
}
boolean goingDown;
boolean changed = true;
if (prevPosition == firstVisibleItem) {
final int topDelta = prevTop - firstViewTop;
goingDown = firstViewTop < prevTop;
changed = Math.abs(topDelta) > 1;
} else {
goingDown = firstVisibleItem > prevPosition;
}
if (changed && scrollUpdated) {
hideFloatingButton(goingDown);
}
prevPosition = firstVisibleItem;
prevTop = firstViewTop;
scrollUpdated = true;
}
}
});
if (loading) {
emptyView.showProgress();
} else {
emptyView.showTextView();
}
floatingButton = new ImageView(context);
floatingButton.setVisibility(View.VISIBLE);
floatingButton.setScaleType(ImageView.ScaleType.CENTER);
Drawable drawable = Theme.createSimpleSelectorCircleDrawable(AndroidUtilities.dp(56), Theme.getColor(Theme.key_chats_actionBackground), Theme.getColor(Theme.key_chats_actionPressedBackground));
if (Build.VERSION.SDK_INT < 21) {
Drawable shadowDrawable = context.getResources().getDrawable(R.drawable.floating_shadow).mutate();
shadowDrawable.setColorFilter(new PorterDuffColorFilter(0xff000000, PorterDuff.Mode.MULTIPLY));
CombinedDrawable combinedDrawable = new CombinedDrawable(shadowDrawable, drawable, 0, 0);
combinedDrawable.setIconSize(AndroidUtilities.dp(56), AndroidUtilities.dp(56));
drawable = combinedDrawable;
}
floatingButton.setBackgroundDrawable(drawable);
floatingButton.setColorFilter(new PorterDuffColorFilter(Theme.getColor(Theme.key_chats_actionIcon), PorterDuff.Mode.MULTIPLY));
floatingButton.setImageResource(R.drawable.ic_call);
floatingButton.setContentDescription(LocaleController.getString("Call", R.string.Call));
if (Build.VERSION.SDK_INT >= 21) {
StateListAnimator animator = new StateListAnimator();
animator.addState(new int[] { android.R.attr.state_pressed }, ObjectAnimator.ofFloat(floatingButton, "translationZ", AndroidUtilities.dp(2), AndroidUtilities.dp(4)).setDuration(200));
animator.addState(new int[] {}, ObjectAnimator.ofFloat(floatingButton, "translationZ", AndroidUtilities.dp(4), AndroidUtilities.dp(2)).setDuration(200));
floatingButton.setStateListAnimator(animator);
floatingButton.setOutlineProvider(new ViewOutlineProvider() {
@SuppressLint("NewApi")
@Override
public void getOutline(View view, Outline outline) {
outline.setOval(0, 0, AndroidUtilities.dp(56), AndroidUtilities.dp(56));
}
});
}
frameLayout.addView(floatingButton, LayoutHelper.createFrame(Build.VERSION.SDK_INT >= 21 ? 56 : 60, Build.VERSION.SDK_INT >= 21 ? 56 : 60, (LocaleController.isRTL ? Gravity.LEFT : Gravity.RIGHT) | Gravity.BOTTOM, LocaleController.isRTL ? 14 : 0, 0, LocaleController.isRTL ? 0 : 14, 14));
floatingButton.setOnClickListener(v -> {
Bundle args = new Bundle();
args.putBoolean("destroyAfterSelect", true);
args.putBoolean("returnAsResult", true);
args.putBoolean("onlyUsers", true);
args.putBoolean("allowSelf", false);
ContactsActivity contactsFragment = new ContactsActivity(args);
contactsFragment.setDelegate((user, param, activity) -> {
TLRPC.UserFull userFull = getMessagesController().getUserFull(user.id);
VoIPHelper.startCall(lastCallUser = user, false, userFull != null && userFull.video_calls_available, getParentActivity(), null, getAccountInstance());
});
presentFragment(contactsFragment);
});
return fragmentView;
}
use of org.telegram.ui.ActionBar.BackDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class SharedMediaLayout method getThemeDescriptions.
public ArrayList<ThemeDescription> getThemeDescriptions() {
ArrayList<ThemeDescription> arrayList = new ArrayList<>();
arrayList.add(new ThemeDescription(selectedMessagesCountTextView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription(shadowLine, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_divider));
arrayList.add(new ThemeDescription(deleteItem.getIconView(), ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription(deleteItem, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_actionBarActionModeDefaultSelector));
if (gotoItem != null) {
arrayList.add(new ThemeDescription(gotoItem.getIconView(), ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription(gotoItem, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_actionBarActionModeDefaultSelector));
}
if (forwardItem != null) {
arrayList.add(new ThemeDescription(forwardItem.getIconView(), ThemeDescription.FLAG_IMAGECOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription(forwardItem, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_actionBarActionModeDefaultSelector));
}
arrayList.add(new ThemeDescription(closeButton, ThemeDescription.FLAG_IMAGECOLOR, null, null, new Drawable[] { backDrawable }, null, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription(closeButton, ThemeDescription.FLAG_BACKGROUNDFILTER, null, null, null, null, Theme.key_actionBarActionModeDefaultSelector));
arrayList.add(new ThemeDescription(actionModeLayout, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(scrollSlidingTextTabStrip, ThemeDescription.FLAG_BACKGROUND, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(floatingDateView, 0, null, null, null, null, Theme.key_chat_mediaTimeBackground));
arrayList.add(new ThemeDescription(floatingDateView, 0, null, null, null, null, Theme.key_chat_mediaTimeText));
arrayList.add(new ThemeDescription(scrollSlidingTextTabStrip, 0, new Class[] { ScrollSlidingTextTabStrip.class }, new String[] { "selectorDrawable" }, null, null, null, Theme.key_profile_tabSelectedLine));
arrayList.add(new ThemeDescription(scrollSlidingTextTabStrip.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { TextView.class }, null, null, null, Theme.key_profile_tabSelectedText));
arrayList.add(new ThemeDescription(scrollSlidingTextTabStrip.getTabsContainer(), ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { TextView.class }, null, null, null, Theme.key_profile_tabText));
arrayList.add(new ThemeDescription(scrollSlidingTextTabStrip.getTabsContainer(), ThemeDescription.FLAG_BACKGROUNDFILTER | ThemeDescription.FLAG_DRAWABLESELECTEDSTATE, new Class[] { TextView.class }, null, null, null, Theme.key_profile_tabSelector));
arrayList.add(new ThemeDescription(fragmentContextView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "frameLayout" }, null, null, null, Theme.key_inappPlayerBackground));
arrayList.add(new ThemeDescription(fragmentContextView, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { FragmentContextView.class }, new String[] { "playButton" }, null, null, null, Theme.key_inappPlayerPlayPause));
arrayList.add(new ThemeDescription(fragmentContextView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "titleTextView" }, null, null, null, Theme.key_inappPlayerTitle));
arrayList.add(new ThemeDescription(fragmentContextView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_FASTSCROLL, new Class[] { FragmentContextView.class }, new String[] { "titleTextView" }, null, null, null, Theme.key_inappPlayerPerformer));
arrayList.add(new ThemeDescription(fragmentContextView, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { FragmentContextView.class }, new String[] { "closeButton" }, null, null, null, Theme.key_inappPlayerClose));
arrayList.add(new ThemeDescription(fragmentContextView, ThemeDescription.FLAG_BACKGROUND | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "frameLayout" }, null, null, null, Theme.key_returnToCallBackground));
arrayList.add(new ThemeDescription(fragmentContextView, ThemeDescription.FLAG_TEXTCOLOR | ThemeDescription.FLAG_CHECKTAG, new Class[] { FragmentContextView.class }, new String[] { "titleTextView" }, null, null, null, Theme.key_returnToCallText));
for (int a = 0; a < mediaPages.length; a++) {
final int num = a;
ThemeDescription.ThemeDescriptionDelegate cellDelegate = () -> {
if (mediaPages[num].listView != null) {
int count = mediaPages[num].listView.getChildCount();
for (int a1 = 0; a1 < count; a1++) {
View child = mediaPages[num].listView.getChildAt(a1);
if (child instanceof SharedPhotoVideoCell) {
((SharedPhotoVideoCell) child).updateCheckboxColor();
} else if (child instanceof ProfileSearchCell) {
((ProfileSearchCell) child).update(0);
} else if (child instanceof UserCell) {
((UserCell) child).update(0);
}
}
}
};
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { View.class }, Theme.dividerPaint, null, null, Theme.key_divider));
arrayList.add(new ThemeDescription(mediaPages[a].progressView, 0, null, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_LISTGLOWCOLOR, null, null, null, null, Theme.key_actionBarDefault));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_SELECTOR, null, null, null, null, Theme.key_listSelector));
arrayList.add(new ThemeDescription(mediaPages[a].emptyView, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_emptyListPlaceholder));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_SECTIONS, new Class[] { GraySectionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_graySectionText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR | ThemeDescription.FLAG_SECTIONS, new Class[] { GraySectionCell.class }, null, null, null, Theme.key_graySection));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { LoadingCell.class }, new String[] { "progressBar" }, null, null, null, Theme.key_progressCircle));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { UserCell.class }, new String[] { "adminTextView" }, null, null, null, Theme.key_profile_creatorIcon));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "imageView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayIcon));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "nameTextView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "statusColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteGrayText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { UserCell.class }, new String[] { "statusOnlineColor" }, null, null, cellDelegate, Theme.key_windowBackgroundWhiteBlueText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { UserCell.class }, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
arrayList.add(new ThemeDescription(mediaPages[a].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));
arrayList.add(new ThemeDescription(mediaPages[a].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));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { ProfileSearchCell.class }, null, Theme.avatarDrawables, null, Theme.key_avatar_text));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundRed));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundOrange));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundViolet));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundGreen));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundCyan));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundBlue));
arrayList.add(new ThemeDescription(null, 0, null, null, null, cellDelegate, Theme.key_avatar_backgroundPink));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { EmptyStubView.class }, new String[] { "emptyTextView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { SharedDocumentCell.class }, new String[] { "nameTextView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { SharedDocumentCell.class }, new String[] { "dateTextView" }, null, null, null, Theme.key_windowBackgroundWhiteGrayText3));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_PROGRESSBAR, new Class[] { SharedDocumentCell.class }, new String[] { "progressView" }, null, null, null, Theme.key_sharedMedia_startStopLoadIcon));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { SharedDocumentCell.class }, new String[] { "statusImageView" }, null, null, null, Theme.key_sharedMedia_startStopLoadIcon));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOX, new Class[] { SharedDocumentCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_checkbox));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[] { SharedDocumentCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_checkboxCheck));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_IMAGECOLOR, new Class[] { SharedDocumentCell.class }, new String[] { "thumbImageView" }, null, null, null, Theme.key_files_folderIcon));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { SharedDocumentCell.class }, new String[] { "extTextView" }, null, null, null, Theme.key_files_iconText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { LoadingCell.class }, new String[] { "progressBar" }, null, null, null, Theme.key_progressCircle));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOX, new Class[] { SharedAudioCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_checkbox));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[] { SharedAudioCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_checkboxCheck));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { SharedAudioCell.class }, Theme.chat_contextResult_titleTextPaint, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_TEXTCOLOR, new Class[] { SharedAudioCell.class }, Theme.chat_contextResult_descriptionTextPaint, null, null, Theme.key_windowBackgroundWhiteGrayText2));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOX, new Class[] { SharedLinkCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_checkbox));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[] { SharedLinkCell.class }, new String[] { "checkBox" }, null, null, null, Theme.key_checkboxCheck));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { SharedLinkCell.class }, new String[] { "titleTextPaint" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { SharedLinkCell.class }, null, null, null, Theme.key_windowBackgroundWhiteLinkText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { SharedLinkCell.class }, Theme.linkSelectionPaint, null, null, Theme.key_windowBackgroundWhiteLinkSelection));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { SharedLinkCell.class }, new String[] { "letterDrawable" }, null, null, null, Theme.key_sharedMedia_linkPlaceholderText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_BACKGROUNDFILTER, new Class[] { SharedLinkCell.class }, new String[] { "letterDrawable" }, null, null, null, Theme.key_sharedMedia_linkPlaceholder));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CELLBACKGROUNDCOLOR | ThemeDescription.FLAG_SECTIONS, new Class[] { SharedMediaSectionCell.class }, null, null, null, Theme.key_windowBackgroundWhite));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_SECTIONS, new Class[] { SharedMediaSectionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { SharedMediaSectionCell.class }, new String[] { "textView" }, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { SharedPhotoVideoCell.class }, new String[] { "backgroundPaint" }, null, null, null, Theme.key_sharedMedia_photoPlaceholder));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOX, new Class[] { SharedPhotoVideoCell.class }, null, null, cellDelegate, Theme.key_checkbox));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[] { SharedPhotoVideoCell.class }, null, null, cellDelegate, Theme.key_checkboxCheck));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, new Class[] { ContextLinkCell.class }, new String[] { "backgroundPaint" }, null, null, null, Theme.key_sharedMedia_photoPlaceholder));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOX, new Class[] { ContextLinkCell.class }, null, null, cellDelegate, Theme.key_checkbox));
arrayList.add(new ThemeDescription(mediaPages[a].listView, ThemeDescription.FLAG_CHECKBOXCHECK, new Class[] { ContextLinkCell.class }, null, null, cellDelegate, Theme.key_checkboxCheck));
arrayList.add(new ThemeDescription(mediaPages[a].listView, 0, null, null, new Drawable[] { pinnedHeaderShadowDrawable }, null, Theme.key_windowBackgroundGrayShadow));
arrayList.add(new ThemeDescription(mediaPages[a].emptyView.title, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteBlackText));
arrayList.add(new ThemeDescription(mediaPages[a].emptyView.subtitle, ThemeDescription.FLAG_TEXTCOLOR, null, null, null, null, Theme.key_windowBackgroundWhiteGrayText));
}
return arrayList;
}
use of org.telegram.ui.ActionBar.BackDrawable in project Telegram-FOSS by Telegram-FOSS-Team.
the class SearchViewPager method showActionMode.
private void showActionMode(boolean show) {
if (isActionModeShowed == show) {
return;
}
if (show && parent.getActionBar().isActionModeShowed()) {
return;
}
if (show && !parent.getActionBar().actionModeIsExist(actionModeTag)) {
ActionBarMenu actionMode = parent.getActionBar().createActionMode(true, actionModeTag);
selectedMessagesCountTextView = new NumberTextView(actionMode.getContext());
selectedMessagesCountTextView.setTextSize(18);
selectedMessagesCountTextView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
selectedMessagesCountTextView.setTextColor(Theme.getColor(Theme.key_actionBarActionModeDefaultIcon));
actionMode.addView(selectedMessagesCountTextView, LayoutHelper.createLinear(0, LayoutHelper.MATCH_PARENT, 1.0f, 72, 0, 0, 0));
selectedMessagesCountTextView.setOnTouchListener((v, event) -> true);
gotoItem = actionMode.addItemWithWidth(gotoItemId, R.drawable.msg_message, AndroidUtilities.dp(54), LocaleController.getString("AccDescrGoToMessage", R.string.AccDescrGoToMessage));
forwardItem = actionMode.addItemWithWidth(forwardItemId, R.drawable.msg_forward, AndroidUtilities.dp(54), LocaleController.getString("Forward", R.string.Forward));
}
if (parent.getActionBar().getBackButton().getDrawable() instanceof MenuDrawable) {
parent.getActionBar().setBackButtonDrawable(new BackDrawable(false));
}
isActionModeShowed = show;
if (show) {
AndroidUtilities.hideKeyboard(parent.getParentActivity().getCurrentFocus());
parent.getActionBar().showActionMode();
selectedMessagesCountTextView.setNumber(selectedFiles.size(), false);
gotoItem.setVisibility(View.VISIBLE);
forwardItem.setVisibility(View.VISIBLE);
} else {
parent.getActionBar().hideActionMode();
selectedFiles.clear();
for (int i = 0; i < getChildCount(); i++) {
if (getChildAt(i) instanceof FilteredSearchView) {
((FilteredSearchView) getChildAt(i)).update();
}
}
if (noMediaFiltersSearchView != null) {
noMediaFiltersSearchView.update();
}
int n = viewsByType.size();
for (int i = 0; i < n; i++) {
View v = viewsByType.valueAt(i);
if (v instanceof FilteredSearchView) {
((FilteredSearchView) v).update();
}
}
}
}
Aggregations