Java Code Examples for org.telegram.ui.ActionBar.ActionBar#getCurrentActionBarHeight()
The following examples show how to use
org.telegram.ui.ActionBar.ActionBar#getCurrentActionBarHeight() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PeopleNearbyActivity.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
public HintInnerCell(Context context) { super(context); int top = (int) ((ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0)) / AndroidUtilities.density) - 44; imageView = new ImageView(context); imageView.setBackgroundDrawable(Theme.createCircleDrawable(AndroidUtilities.dp(74), Theme.getColor(Theme.key_chats_archiveBackground))); imageView.setImageDrawable(new ShareLocationDrawable(context, 2)); imageView.setScaleType(ImageView.ScaleType.CENTER); addView(imageView, LayoutHelper.createFrame(74, 74, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, top + 27, 0, 0)); titleTextView = new TextView(context); titleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 24); titleTextView.setGravity(Gravity.CENTER); titleTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PeopleNearby", R.string.PeopleNearby))); addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 52, top + 120, 52, 27)); messageTextView = new TextView(context); messageTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText)); messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); messageTextView.setGravity(Gravity.CENTER); messageTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PeopleNearbyInfo2", R.string.PeopleNearbyInfo2))); addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 40, top + 161, 40, 27)); }
Example 2
Source File: DialogsEmptyCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int totalHeight = MeasureSpec.getSize(heightMeasureSpec); if (totalHeight == 0) { totalHeight = AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight() - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); } if (currentType == 0) { ArrayList<TLRPC.RecentMeUrl> arrayList = MessagesController.getInstance(currentAccount).hintDialogs; if (!arrayList.isEmpty()) { totalHeight -= AndroidUtilities.dp(72) * arrayList.size() + arrayList.size() - 1 + AndroidUtilities.dp(12 + 38); } super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(totalHeight, MeasureSpec.EXACTLY)); } else { super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(totalHeight, MeasureSpec.AT_MOST)); } }
Example 3
Source File: PipVideoView.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
private static int getSideCoord(boolean isX, int side, float p, int sideSize) { int total; if (isX) { total = AndroidUtilities.displaySize.x - sideSize; } else { total = AndroidUtilities.displaySize.y - sideSize - ActionBar.getCurrentActionBarHeight(); } int result; if (side == 0) { result = AndroidUtilities.dp(10); } else if (side == 1) { result = total - AndroidUtilities.dp(10); } else { result = Math.round((total - AndroidUtilities.dp(20)) * p) + AndroidUtilities.dp(10); } if (!isX) { result += ActionBar.getCurrentActionBarHeight(); } return result; }
Example 4
Source File: PeopleNearbyActivity.java From Telegram with GNU General Public License v2.0 | 6 votes |
public HintInnerCell(Context context) { super(context); int top = (int) ((ActionBar.getCurrentActionBarHeight() + (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0)) / AndroidUtilities.density) - 44; imageView = new ImageView(context); imageView.setBackgroundDrawable(Theme.createCircleDrawable(AndroidUtilities.dp(74), Theme.getColor(Theme.key_chats_archiveBackground))); imageView.setImageDrawable(new ShareLocationDrawable(context, 2)); imageView.setScaleType(ImageView.ScaleType.CENTER); addView(imageView, LayoutHelper.createFrame(74, 74, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, top + 27, 0, 0)); titleTextView = new TextView(context); titleTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteBlackText)); titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 24); titleTextView.setGravity(Gravity.CENTER); titleTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PeopleNearby", R.string.PeopleNearby))); addView(titleTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 52, top + 120, 52, 27)); messageTextView = new TextView(context); messageTextView.setTextColor(Theme.getColor(Theme.key_windowBackgroundWhiteGrayText)); messageTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15); messageTextView.setGravity(Gravity.CENTER); messageTextView.setText(AndroidUtilities.replaceTags(LocaleController.formatString("PeopleNearbyInfo2", R.string.PeopleNearbyInfo2))); addView(messageTextView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.WRAP_CONTENT, Gravity.TOP | Gravity.LEFT, 40, top + 161, 40, 27)); }
Example 5
Source File: ThemeEditorView.java From Telegram with GNU General Public License v2.0 | 6 votes |
private static int getSideCoord(boolean isX, int side, float p, int sideSize) { int total; if (isX) { total = AndroidUtilities.displaySize.x - sideSize; } else { total = AndroidUtilities.displaySize.y - sideSize - ActionBar.getCurrentActionBarHeight(); } int result; if (side == 0) { result = AndroidUtilities.dp(10); } else if (side == 1) { result = total - AndroidUtilities.dp(10); } else { result = Math.round((total - AndroidUtilities.dp(20)) * p) + AndroidUtilities.dp(10); } if (!isX) { result += ActionBar.getCurrentActionBarHeight(); } return result; }
Example 6
Source File: PipRoundVideoView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private static int getSideCoord(boolean isX, int side, float p, int sideSize) { int total; if (isX) { total = AndroidUtilities.displaySize.x - sideSize; } else { total = AndroidUtilities.displaySize.y - sideSize - ActionBar.getCurrentActionBarHeight(); } int result; if (side == 0) { result = AndroidUtilities.dp(10); } else if (side == 1) { result = total - AndroidUtilities.dp(10); } else { result = Math.round((total - AndroidUtilities.dp(20)) * p) + AndroidUtilities.dp(10); } if (!isX) { result += ActionBar.getCurrentActionBarHeight(); } return result; }
Example 7
Source File: DialogsEmptyCell.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int totalHeight; if (getParent() instanceof View) { View view = (View) getParent(); totalHeight = view.getMeasuredHeight(); if (view.getPaddingTop() != 0 && Build.VERSION.SDK_INT >= 21) { totalHeight -= AndroidUtilities.statusBarHeight; } } else { totalHeight = MeasureSpec.getSize(heightMeasureSpec); } if (totalHeight == 0) { totalHeight = AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight() - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); } if (currentType == 0 || currentType == 2 || currentType == 3) { ArrayList<TLRPC.RecentMeUrl> arrayList = MessagesController.getInstance(currentAccount).hintDialogs; if (!arrayList.isEmpty()) { totalHeight -= AndroidUtilities.dp(72) * arrayList.size() + arrayList.size() - 1 + AndroidUtilities.dp(12 + 38); } super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(totalHeight, MeasureSpec.EXACTLY)); } else { super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(166), MeasureSpec.EXACTLY)); } }
Example 8
Source File: PipRoundVideoView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private static int getSideCoord(boolean isX, int side, float p, int sideSize) { int total; if (isX) { total = AndroidUtilities.displaySize.x - sideSize; } else { total = AndroidUtilities.displaySize.y - sideSize - ActionBar.getCurrentActionBarHeight(); } int result; if (side == 0) { result = AndroidUtilities.dp(10); } else if (side == 1) { result = total - AndroidUtilities.dp(10); } else { result = Math.round((total - AndroidUtilities.dp(20)) * p) + AndroidUtilities.dp(10); } if (!isX) { result += ActionBar.getCurrentActionBarHeight(); } return result; }
Example 9
Source File: PipVideoView.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
private static int getSideCoord(boolean isX, int side, float p, int sideSize) { int total; if (isX) { total = AndroidUtilities.displaySize.x - sideSize; } else { total = AndroidUtilities.displaySize.y - sideSize - ActionBar.getCurrentActionBarHeight(); } int result; if (side == 0) { result = AndroidUtilities.dp(10); } else if (side == 1) { result = total - AndroidUtilities.dp(10); } else { result = Math.round((total - AndroidUtilities.dp(20)) * p) + AndroidUtilities.dp(10); } if (!isX) { result += ActionBar.getCurrentActionBarHeight(); } return result; }
Example 10
Source File: DialogsEmptyCell.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int totalHeight = MeasureSpec.getSize(heightMeasureSpec); if (totalHeight == 0) { totalHeight = AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight() - (Build.VERSION.SDK_INT >= 21 ? AndroidUtilities.statusBarHeight : 0); } if (currentType == 0) { ArrayList<TLRPC.RecentMeUrl> arrayList = MessagesController.getInstance(currentAccount).hintDialogs; if (!arrayList.isEmpty()) { totalHeight -= AndroidUtilities.dp(72) * arrayList.size() + arrayList.size() - 1 + AndroidUtilities.dp(12 + 38); } super.onMeasure(MeasureSpec.makeMeasureSpec(MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(totalHeight, MeasureSpec.EXACTLY)); } else { super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(totalHeight, MeasureSpec.AT_MOST)); } }
Example 11
Source File: ChatAvatarContainer.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { int actionBarHeight = ActionBar.getCurrentActionBarHeight(); int viewTop = (actionBarHeight - AndroidUtilities.dp(42)) / 2 + (Build.VERSION.SDK_INT >= 21 && occupyStatusBar ? AndroidUtilities.statusBarHeight : 0); avatarImageView.layout(AndroidUtilities.dp(8), viewTop, AndroidUtilities.dp(42 + 8), viewTop + AndroidUtilities.dp(42)); if (subtitleTextView.getVisibility() == VISIBLE) { titleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(1.3f), AndroidUtilities.dp(8 + 54) + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + AndroidUtilities.dp(1.3f)); } else { titleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(11), AndroidUtilities.dp(8 + 54) + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + AndroidUtilities.dp(11)); } if (timeItem != null) { timeItem.layout(AndroidUtilities.dp(8 + 16), viewTop + AndroidUtilities.dp(15), AndroidUtilities.dp(8 + 16 + 34), viewTop + AndroidUtilities.dp(15 + 34)); } subtitleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(24), AndroidUtilities.dp(8 + 54) + subtitleTextView.getMeasuredWidth(), viewTop + subtitleTextView.getTextHeight() + AndroidUtilities.dp(24)); }
Example 12
Source File: ChatAvatarContainer.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { int actionBarHeight = ActionBar.getCurrentActionBarHeight(); int viewTop = (actionBarHeight - AndroidUtilities.dp(42)) / 2 + (Build.VERSION.SDK_INT >= 21 && occupyStatusBar ? AndroidUtilities.statusBarHeight : 0); avatarImageView.layout(AndroidUtilities.dp(8), viewTop, AndroidUtilities.dp(42 + 8), viewTop + AndroidUtilities.dp(42)); if (subtitleTextView.getVisibility() == VISIBLE) { titleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(1.3f), AndroidUtilities.dp(8 + 54) + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + AndroidUtilities.dp(1.3f)); } else { titleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(11), AndroidUtilities.dp(8 + 54) + titleTextView.getMeasuredWidth(), viewTop + titleTextView.getTextHeight() + AndroidUtilities.dp(11)); } if (timeItem != null) { timeItem.layout(AndroidUtilities.dp(8 + 16), viewTop + AndroidUtilities.dp(15), AndroidUtilities.dp(8 + 16 + 34), viewTop + AndroidUtilities.dp(15 + 34)); } subtitleTextView.layout(AndroidUtilities.dp(8 + 54), viewTop + AndroidUtilities.dp(24), AndroidUtilities.dp(8 + 54) + subtitleTextView.getMeasuredWidth(), viewTop + subtitleTextView.getTextHeight() + AndroidUtilities.dp(24)); }
Example 13
Source File: PhotoPaintView.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int width = MeasureSpec.getSize(widthMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); setMeasuredDimension(width, height); float bitmapW; float bitmapH; int fullHeight = AndroidUtilities.displaySize.y - ActionBar.getCurrentActionBarHeight(); int maxHeight = fullHeight - AndroidUtilities.dp(48); if (bitmapToEdit != null) { bitmapW = isSidewardOrientation() ? bitmapToEdit.getHeight() : bitmapToEdit.getWidth(); bitmapH = isSidewardOrientation() ? bitmapToEdit.getWidth() : bitmapToEdit.getHeight(); } else { bitmapW = width; bitmapH = height - ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(48); } float renderWidth = width; float renderHeight = (float) Math.floor(renderWidth * bitmapH / bitmapW); if (renderHeight > maxHeight) { renderHeight = maxHeight; renderWidth = (float) Math.floor(renderHeight * bitmapW / bitmapH); } renderView.measure(MeasureSpec.makeMeasureSpec((int) renderWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((int) renderHeight, MeasureSpec.EXACTLY)); entitiesView.measure(MeasureSpec.makeMeasureSpec((int) paintingSize.width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec((int) paintingSize.height, MeasureSpec.EXACTLY)); dimView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.AT_MOST)); selectionContainerView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.EXACTLY)); colorPicker.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(maxHeight, MeasureSpec.EXACTLY)); toolsView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(48), MeasureSpec.EXACTLY)); if (stickersView != null) { stickersView.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.displaySize.y, MeasureSpec.EXACTLY)); } }
Example 14
Source File: ProfileGalleryView.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public Item instantiateItem(ViewGroup container, int position) { final Item item = objects.get(position); if (item.imageView == null) { item.imageView = new BackupImageView(context) { private final int radialProgressSize = AndroidUtilities.dp(64f); private RadialProgress2 radialProgress; private ValueAnimator radialProgressHideAnimator; private float radialProgressHideAnimatorStartValue; private long firstDrawTime = -1; { final int realPosition = getRealPosition(position); if (realPosition == 0) { setImage(imagesLocations.get(realPosition), null, parentAvatarImageView.getImageReceiver().getBitmap(), imagesLocationsSizes.get(realPosition), 1, null); } else { setImage(imagesLocations.get(realPosition), null, thumbsLocations.get(realPosition), null, null, 0, 1, imagesLocationsSizes.get(realPosition)); radialProgress = new RadialProgress2(this); radialProgress.setOverrideAlpha(0.0f); radialProgress.setIcon(MediaActionDrawable.ICON_EMPTY, false, false); radialProgress.setColors(0x42000000, 0x42000000, Color.WHITE, Color.WHITE); radialProgresses.append(position, radialProgress); } getImageReceiver().setCrossfadeAlpha((byte) 2); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (radialProgress != null) { int paddingTop = (parentActionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight(); int paddingBottom = AndroidUtilities.dp2(80f); radialProgress.setProgressRect((w - radialProgressSize) / 2, paddingTop + (h - paddingTop - paddingBottom - radialProgressSize) / 2, (w + radialProgressSize) / 2, paddingTop + (h - paddingTop - paddingBottom + radialProgressSize) / 2); } } @Override protected void onDraw(Canvas canvas) { if (radialProgress != null) { if (getImageReceiver().getDrawable() != null) { if (radialProgressHideAnimator == null) { radialProgressHideAnimatorStartValue = radialProgress.getOverrideAlpha(); radialProgressHideAnimator = ValueAnimator.ofFloat(0f, 1f); radialProgressHideAnimator.setDuration((long) (radialProgressHideAnimatorStartValue * 175f)); radialProgressHideAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT); radialProgressHideAnimator.addUpdateListener(anim -> radialProgress.setOverrideAlpha(AndroidUtilities.lerp(radialProgressHideAnimatorStartValue, 0f, anim.getAnimatedFraction()))); radialProgressHideAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { radialProgress = null; radialProgresses.delete(position); } }); radialProgressHideAnimator.start(); } } else { if (firstDrawTime < 0) { firstDrawTime = System.currentTimeMillis(); } else { final long elapsedTime = System.currentTimeMillis() - firstDrawTime; if (elapsedTime <= 1000) { if (elapsedTime > 750) { radialProgress.setOverrideAlpha(CubicBezierInterpolator.DEFAULT.getInterpolation((elapsedTime - 750) / 250f)); } } } postInvalidateOnAnimation(); } canvas.drawRect(0, 0, getWidth(), getHeight(), placeholderPaint); } super.onDraw(canvas); if (radialProgress != null && radialProgress.getOverrideAlpha() > 0f) { radialProgress.draw(canvas); } } }; } if (item.imageView.getParent() == null) { container.addView(item.imageView); } return item; }
Example 15
Source File: ProfileGalleryView.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public Item instantiateItem(ViewGroup container, int position) { final Item item = objects.get(position); if (item.imageView == null) { item.imageView = new BackupImageView(context) { private final int radialProgressSize = AndroidUtilities.dp(64f); private RadialProgress2 radialProgress; private ValueAnimator radialProgressHideAnimator; private float radialProgressHideAnimatorStartValue; private long firstDrawTime = -1; { final int realPosition = getRealPosition(position); if (realPosition == 0) { setImage(imagesLocations.get(realPosition), null, parentAvatarImageView.getImageReceiver().getBitmap(), imagesLocationsSizes.get(realPosition), 1, null); } else { setImage(imagesLocations.get(realPosition), null, thumbsLocations.get(realPosition), null, null, 0, 1, imagesLocationsSizes.get(realPosition)); radialProgress = new RadialProgress2(this); radialProgress.setOverrideAlpha(0.0f); radialProgress.setIcon(MediaActionDrawable.ICON_EMPTY, false, false); radialProgress.setColors(0x42000000, 0x42000000, Color.WHITE, Color.WHITE); radialProgresses.append(position, radialProgress); } getImageReceiver().setCrossfadeAlpha((byte) 2); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (radialProgress != null) { int paddingTop = (parentActionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight(); int paddingBottom = AndroidUtilities.dp2(80f); radialProgress.setProgressRect((w - radialProgressSize) / 2, paddingTop + (h - paddingTop - paddingBottom - radialProgressSize) / 2, (w + radialProgressSize) / 2, paddingTop + (h - paddingTop - paddingBottom + radialProgressSize) / 2); } } @Override protected void onDraw(Canvas canvas) { if (radialProgress != null) { if (getImageReceiver().getDrawable() != null) { if (radialProgressHideAnimator == null) { radialProgressHideAnimatorStartValue = radialProgress.getOverrideAlpha(); radialProgressHideAnimator = ValueAnimator.ofFloat(0f, 1f); radialProgressHideAnimator.setDuration((long) (radialProgressHideAnimatorStartValue * 175f)); radialProgressHideAnimator.setInterpolator(CubicBezierInterpolator.DEFAULT); radialProgressHideAnimator.addUpdateListener(anim -> radialProgress.setOverrideAlpha(AndroidUtilities.lerp(radialProgressHideAnimatorStartValue, 0f, anim.getAnimatedFraction()))); radialProgressHideAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { radialProgress = null; radialProgresses.delete(position); } }); radialProgressHideAnimator.start(); } } else { if (firstDrawTime < 0) { firstDrawTime = System.currentTimeMillis(); } else { final long elapsedTime = System.currentTimeMillis() - firstDrawTime; if (elapsedTime <= 1000) { if (elapsedTime > 750) { radialProgress.setOverrideAlpha(CubicBezierInterpolator.DEFAULT.getInterpolation((elapsedTime - 750) / 250f)); } } } postInvalidateOnAnimation(); } canvas.drawRect(0, 0, getWidth(), getHeight(), placeholderPaint); } super.onDraw(canvas); if (radialProgress != null && radialProgress.getOverrideAlpha() > 0f) { radialProgress.draw(canvas); } } }; } if (item.imageView.getParent() == null) { container.addView(item.imageView); } return item; }
Example 16
Source File: ChatAttachAlertPhotoLayout.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public void onPreMeasure(int availableWidth, int availableHeight) { ignoreLayout = true; if (AndroidUtilities.isTablet()) { itemsPerRow = 4; } else if (AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y) { itemsPerRow = 4; } else { itemsPerRow = 3; } LayoutParams layoutParams = (LayoutParams) getLayoutParams(); layoutParams.topMargin = ActionBar.getCurrentActionBarHeight(); itemSize = (availableWidth - AndroidUtilities.dp(6 * 2) - AndroidUtilities.dp(5 * 2)) / itemsPerRow; if (lastItemSize != itemSize) { lastItemSize = itemSize; AndroidUtilities.runOnUIThread(() -> adapter.notifyDataSetChanged()); } layoutManager.setSpanCount(Math.max(1, itemSize * itemsPerRow + AndroidUtilities.dp(5) * (itemsPerRow - 1))); int rows = (int) Math.ceil((adapter.getItemCount() - 1) / (float) itemsPerRow); int contentSize = rows * itemSize + (rows - 1) * AndroidUtilities.dp(5); int newSize = Math.max(0, availableHeight - contentSize - ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(48 + 12)); if (gridExtraSpace != newSize) { gridExtraSpace = newSize; adapter.notifyDataSetChanged(); } int padding; if (!AndroidUtilities.isTablet() && AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y) { padding = (int) (availableHeight / 3.5f); } else { padding = (availableHeight / 5 * 2); } padding -= AndroidUtilities.dp(52); if (padding < 0) { padding = 0; } if (gridView.getPaddingTop() != padding) { gridView.setPadding(AndroidUtilities.dp(6), padding, AndroidUtilities.dp(6), AndroidUtilities.dp(48)); } dropDown.setTextSize(!AndroidUtilities.isTablet() && AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y ? 18 : 20); ignoreLayout = false; }
Example 17
Source File: LocationActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void fixLayoutInternal(final boolean resume) { if (listView != null) { int height = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight(); int viewHeight = fragmentView.getMeasuredHeight(); if (viewHeight == 0) { return; } overScrollHeight = viewHeight - AndroidUtilities.dp(66) - height; FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams.topMargin = height; listView.setLayoutParams(layoutParams); layoutParams = (FrameLayout.LayoutParams) mapViewClip.getLayoutParams(); layoutParams.topMargin = height; layoutParams.height = overScrollHeight; mapViewClip.setLayoutParams(layoutParams); if (searchListView != null) { layoutParams = (FrameLayout.LayoutParams) searchListView.getLayoutParams(); layoutParams.topMargin = height; searchListView.setLayoutParams(layoutParams); } adapter.setOverScrollHeight(overScrollHeight); layoutParams = (FrameLayout.LayoutParams) mapView.getLayoutParams(); if (layoutParams != null) { layoutParams.height = overScrollHeight + AndroidUtilities.dp(10); if (googleMap != null) { googleMap.setPadding(AndroidUtilities.dp(70), 0, AndroidUtilities.dp(70), AndroidUtilities.dp(10)); } mapView.setLayoutParams(layoutParams); } adapter.notifyDataSetChanged(); if (resume) { layoutManager.scrollToPositionWithOffset(0, -AndroidUtilities.dp(32 + (liveLocationType == 1 || liveLocationType == 2 ? 66 : 0))); updateClipView(layoutManager.findFirstVisibleItemPosition()); listView.post(new Runnable() { @Override public void run() { layoutManager.scrollToPositionWithOffset(0, -AndroidUtilities.dp(32 + (liveLocationType == 1 || liveLocationType == 2 ? 66 : 0))); updateClipView(layoutManager.findFirstVisibleItemPosition()); } }); } else { updateClipView(layoutManager.findFirstVisibleItemPosition()); } } }
Example 18
Source File: ChatAttachAlert.java From Telegram with GNU General Public License v2.0 | 4 votes |
private void updateSelectedPosition(int idx) { float moveProgress; AttachAlertLayout layout = idx == 0 ? currentAttachLayout : nextAttachLayout; int t = scrollOffsetY[idx] - backgroundPaddingTop; float toMove; if (layout == pollLayout) { t -= AndroidUtilities.dp(13); toMove = AndroidUtilities.dp(11); } else { t -= AndroidUtilities.dp(39); toMove = AndroidUtilities.dp(43); } if (t + backgroundPaddingTop < ActionBar.getCurrentActionBarHeight()) { moveProgress = Math.min(1.0f, (ActionBar.getCurrentActionBarHeight() - t - backgroundPaddingTop) / toMove); cornerRadius = 1.0f - moveProgress; } else { moveProgress = 0.0f; cornerRadius = 1.0f; } int finalMove; if (AndroidUtilities.isTablet()) { finalMove = 16; } else if (AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y) { finalMove = 6; } else { finalMove = 12; } float offset = actionBar.getAlpha() != 0 ? 0.0f : AndroidUtilities.dp(26 * (1.0f - selectedTextView.getAlpha())); if (menuShowed) { selectedMenuItem.setTranslationY(scrollOffsetY[idx] - AndroidUtilities.dp(37 + finalMove * moveProgress) + offset); } else { selectedMenuItem.setTranslationY(ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(4) - AndroidUtilities.dp(37 + finalMove)); } searchItem.setTranslationY(ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(4) - AndroidUtilities.dp(37 + finalMove)); selectedTextView.setTranslationY(scrollOffsetY[idx] - AndroidUtilities.dp(25 + finalMove * moveProgress) + offset); if (pollLayout != null && layout == pollLayout) { if (AndroidUtilities.isTablet()) { finalMove = 63; } else if (AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y) { finalMove = 53; } else { finalMove = 59; } doneItem.setTranslationY(Math.max(0, pollLayout.getTranslationY() + scrollOffsetY[idx] - AndroidUtilities.dp(7 + finalMove * moveProgress))); } }
Example 19
Source File: ChatAttachAlert.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
private void updateSelectedPosition(int idx) { float moveProgress; AttachAlertLayout layout = idx == 0 ? currentAttachLayout : nextAttachLayout; int t = scrollOffsetY[idx] - backgroundPaddingTop; float toMove; if (layout == pollLayout) { t -= AndroidUtilities.dp(13); toMove = AndroidUtilities.dp(11); } else { t -= AndroidUtilities.dp(39); toMove = AndroidUtilities.dp(43); } if (t + backgroundPaddingTop < ActionBar.getCurrentActionBarHeight()) { moveProgress = Math.min(1.0f, (ActionBar.getCurrentActionBarHeight() - t - backgroundPaddingTop) / toMove); cornerRadius = 1.0f - moveProgress; } else { moveProgress = 0.0f; cornerRadius = 1.0f; } int finalMove; if (AndroidUtilities.isTablet()) { finalMove = 16; } else if (AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y) { finalMove = 6; } else { finalMove = 12; } float offset = actionBar.getAlpha() != 0 ? 0.0f : AndroidUtilities.dp(26 * (1.0f - selectedTextView.getAlpha())); if (menuShowed) { selectedMenuItem.setTranslationY(scrollOffsetY[idx] - AndroidUtilities.dp(37 + finalMove * moveProgress) + offset); } else { selectedMenuItem.setTranslationY(ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(4) - AndroidUtilities.dp(37 + finalMove)); } searchItem.setTranslationY(ActionBar.getCurrentActionBarHeight() - AndroidUtilities.dp(4) - AndroidUtilities.dp(37 + finalMove)); selectedTextView.setTranslationY(scrollOffsetY[idx] - AndroidUtilities.dp(25 + finalMove * moveProgress) + offset); if (pollLayout != null && layout == pollLayout) { if (AndroidUtilities.isTablet()) { finalMove = 63; } else if (AndroidUtilities.displaySize.x > AndroidUtilities.displaySize.y) { finalMove = 53; } else { finalMove = 59; } doneItem.setTranslationY(Math.max(0, pollLayout.getTranslationY() + scrollOffsetY[idx] - AndroidUtilities.dp(7 + finalMove * moveProgress))); } }
Example 20
Source File: LocationActivity.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void fixLayoutInternal(final boolean resume) { if (listView != null) { int height = (actionBar.getOccupyStatusBar() ? AndroidUtilities.statusBarHeight : 0) + ActionBar.getCurrentActionBarHeight(); int viewHeight = fragmentView.getMeasuredHeight(); if (viewHeight == 0) { return; } overScrollHeight = viewHeight - AndroidUtilities.dp(66) - height; FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) listView.getLayoutParams(); layoutParams.topMargin = height; listView.setLayoutParams(layoutParams); layoutParams = (FrameLayout.LayoutParams) mapViewClip.getLayoutParams(); layoutParams.topMargin = height; layoutParams.height = overScrollHeight; mapViewClip.setLayoutParams(layoutParams); if (searchListView != null) { layoutParams = (FrameLayout.LayoutParams) searchListView.getLayoutParams(); layoutParams.topMargin = height; searchListView.setLayoutParams(layoutParams); } adapter.setOverScrollHeight(overScrollHeight); layoutParams = (FrameLayout.LayoutParams) mapView.getLayoutParams(); if (layoutParams != null) { layoutParams.height = overScrollHeight + AndroidUtilities.dp(10); if (googleMap != null) { googleMap.setPadding(AndroidUtilities.dp(70), 0, AndroidUtilities.dp(70), AndroidUtilities.dp(10)); } mapView.setLayoutParams(layoutParams); } adapter.notifyDataSetChanged(); if (resume) { layoutManager.scrollToPositionWithOffset(0, -AndroidUtilities.dp(32 + (liveLocationType == 1 || liveLocationType == 2 ? 66 : 0))); updateClipView(layoutManager.findFirstVisibleItemPosition()); listView.post(new Runnable() { @Override public void run() { layoutManager.scrollToPositionWithOffset(0, -AndroidUtilities.dp(32 + (liveLocationType == 1 || liveLocationType == 2 ? 66 : 0))); updateClipView(layoutManager.findFirstVisibleItemPosition()); } }); } else { updateClipView(layoutManager.findFirstVisibleItemPosition()); } } }