gt:                 int h = chatActivityEnterView.getMeasuredHeight();
context: /*
   * This is the source code of Telegram for Android v. 5.x.x.
   * It is licensed under GNU GPL v. 2 or later.
   * You should have received a copy of the license in this archive (see LICENSE).
   *
   * Copyright Nikolai Kudashov, 2013-2018.
   */
  
  package org.telegram.ui;
  
  import android.animation.Animator;
  import android.animation.AnimatorListenerAdapter;
  import android.animation.AnimatorSet;
  import android.animation.ObjectAnimator;
  import android.app.Activity;
  import android.app.KeyguardManager;
  import android.content.Context;
  import android.content.Intent;
  import android.content.pm.PackageManager;
  import android.content.res.Configuration;
  import android.net.Uri;
  import android.os.Bundle;
  import android.os.PowerManager;
  import android.text.TextUtils;
  import android.util.AttributeSet;
  import android.util.TypedValue;
  import android.view.Gravity;
  import android.view.MotionEvent;
  import android.view.VelocityTracker;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.ViewTreeObserver;
  import android.view.WindowManager;
  import android.widget.FrameLayout;
  import android.widget.LinearLayout;
  import android.widget.RelativeLayout;
  import android.widget.ScrollView;
  import android.widget.TextView;
  
  import org.telegram.messenger.AndroidUtilities;
  import org.telegram.messenger.ContactsController;
  import org.telegram.messenger.DownloadController;
  import org.telegram.messenger.ImageLocation;
  import org.telegram.messenger.LocaleController;
  import org.telegram.messenger.MediaController;
  import org.telegram.messenger.MessagesController;
  import org.telegram.PhoneFormat.PhoneFormat;
  import org.telegram.messenger.NotificationsController;
  import org.telegram.messenger.SendMessagesHelper;
  import org.telegram.messenger.SharedConfig;
  import org.telegram.messenger.UserConfig;
  import org.telegram.messenger.UserObject;
  import org.telegram.messenger.ApplicationLoader;
  import org.telegram.messenger.FileLoader;
  import org.telegram.messenger.FileLog;
  import org.telegram.messenger.NotificationCenter;
  import org.telegram.messenger.R;
  import org.telegram.messenger.WebFile;
  import org.telegram.tgnet.ConnectionsManager;
  import org.telegram.tgnet.TLRPC;
  import org.telegram.messenger.MessageObject;
  import org.telegram.ui.ActionBar.ActionBar;
  import org.telegram.ui.ActionBar.ActionBarMenu;
  import org.telegram.ui.ActionBar.ActionBarMenuItem;
  import org.telegram.ui.ActionBar.AlertDialog;
  import org.telegram.ui.Components.AvatarDrawable;
  import org.telegram.ui.Components.BackupImageView;
  import org.telegram.ui.Components.ChatActivityEnterView;
  import org.telegram.ui.Components.LayoutHelper;
  import org.telegram.ui.Components.PlayingGameDrawable;
  import org.telegram.ui.Components.PopupAudioView;
  import org.telegram.ui.Components.RecordStatusDrawable;
  import org.telegram.ui.Components.RoundStatusDrawable;
  import org.telegram.ui.Components.SendingFileDrawable;
  import org.telegram.ui.Components.SizeNotifierFrameLayout;
  import org.telegram.ui.ActionBar.Theme;
  import org.telegram.ui.Components.StatusDrawable;
  import org.telegram.ui.Components.TypingDotsDrawable;
  
  import java.io.File;
  import java.util.ArrayList;
  
  public class PopupNotificationActivity extends Activity implements NotificationCenter.NotificationCenterDelegate {
  
      private ActionBar actionBar;
      private ChatActivityEnterView chatActivityEnterView;
      private BackupImageView avatarImageView;
      private TextView nameTextView;
      private TextView onlineTextView;
      private FrameLayout avatarContainer;
      private TextView countText;
      private ViewGroup messageContainer;
      private ViewGroup centerView;
      private ViewGroup leftView;
      private ViewGroup rightView;
  
      private ViewGroup centerButtonsView;
      private ViewGroup leftButtonsView;
      private ViewGroup rightButtonsView;
  
      private RelativeLayout popupContainer;
      private ArrayList<ViewGroup> textViews = new ArrayList<>();
      private ArrayList<ViewGroup> imageViews = new ArrayList<>();
      private ArrayList<ViewGroup> audioViews = new ArrayList<>();
      private VelocityTracker velocityTracker = null;
      private StatusDrawable[] statusDrawables = new StatusDrawable[5];
  
      private final static int id_chat_compose_panel = 1000;
  
      private int classGuid;
      private int lastResumedAccount = -1;
      private TLRPC.User currentUser;
      private TLRPC.Chat currentChat;
      private boolean finished = false;
      private CharSequence lastPrintString;
      private MessageObject currentMessageObject = null;
      private MessageObject[] setMessageObjects = new MessageObject[3];
      private int currentMessageNum = 0;
      private PowerManager.WakeLock wakeLock = null;
      private boolean animationInProgress = false;
      private long animationStartTime = 0;
      private float moveStartX = -1;
      private boolean startedMoving = false;
      private Runnable onAnimationEndRunnable = null;
      private boolean isReply;
      private ArrayList<MessageObject> popupMessages = new ArrayList<>();
  
      private class FrameLayoutTouch extends FrameLayout {
          public FrameLayoutTouch(Context context) {
              super(context);
          }
  
          public FrameLayoutTouch(Context context, AttributeSet attrs) {
              super(context, attrs);
          }
  
          public FrameLayoutTouch(Context context, AttributeSet attrs, int defStyle) {
              super(context, attrs, defStyle);
          }
  
          @Override
          public boolean onInterceptTouchEvent(MotionEvent ev) {
              return checkTransitionAnimation() || ((PopupNotificationActivity) getContext()).onTouchEventMy(ev);
          }
  
          @Override
          public boolean onTouchEvent(MotionEvent ev) {
              return checkTransitionAnimation() || ((PopupNotificationActivity) getContext()).onTouchEventMy(ev);
          }
  
          @Override
          public void requestDisallowInterceptTouchEvent(boolean disallowIntercept) {
              ((PopupNotificationActivity) getContext()).onTouchEventMy(null);
              super.requestDisallowInterceptTouchEvent(disallowIntercept);
          }
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Theme.createChatResources(this, false);
  
          AndroidUtilities.fillStatusBarHeight(this);
          for (int a = 0; a < UserConfig.MAX_ACCOUNT_COUNT; a++) {
              NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.appDidLogout);
              NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.updateInterfaces);
              NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.messagePlayingProgressDidChanged);
              NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.messagePlayingDidReset);
              NotificationCenter.getInstance(a).addObserver(this, NotificationCenter.contactsDidLoad);
          }
          NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.pushMessagesUpdated);
          NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.emojiDidLoad);
          classGuid = ConnectionsManager.generateClassGuid();
  
          statusDrawables[0] = new TypingDotsDrawable(false);
          statusDrawables[1] = new RecordStatusDrawable(false);
          statusDrawables[2] = new SendingFileDrawable(false);
          statusDrawables[3] = new PlayingGameDrawable(false);
          statusDrawables[4] = new RoundStatusDrawable(false);
  
          SizeNotifierFrameLayout contentView = new SizeNotifierFrameLayout(this) {
              @Override
              protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                  int widthMode = MeasureSpec.getMode(widthMeasureSpec);
                  int heightMode = MeasureSpec.getMode(heightMeasureSpec);
                  int widthSize = MeasureSpec.getSize(widthMeasureSpec);
                  int heightSize = MeasureSpec.getSize(heightMeasureSpec);
  
                  setMeasuredDimension(widthSize, heightSize);
  
                  int keyboardSize = measureKeyboardHeight();
  
                  if (keyboardSize <= AndroidUtilities.dp(20)) {
                      heightSize -= chatActivityEnterView.getEmojiPadding();
                  }
  
                  int childCount = getChildCount();
                  for (int i = 0; i < childCount; i++) {
                      View child = getChildAt(i);
                      if (child.getVisibility() == GONE) {
                          continue;
                      }
                      if (chatActivityEnterView.isPopupView(child)) {
                          child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(child.getLayoutParams().height, MeasureSpec.EXACTLY));
                      } else if (chatActivityEnterView.isRecordCircle(child)) {
                          measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0);
                      } else {
                          child.measure(MeasureSpec.makeMeasureSpec(widthSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(Math.max(AndroidUtilities.dp(10), heightSize + AndroidUtilities.dp(2)), MeasureSpec.EXACTLY));
                      }
                  }
              }
  
              @Override
              protected void onLayout(boolean changed, int l, int t, int r, int b) {
                  final int count = getChildCount();
  
                  int paddingBottom = measureKeyboardHeight() <= AndroidUtilities.dp(20) ? chatActivityEnterView.getEmojiPadding() : 0;
  
                  for (int i = 0; i < count; i++) {
                      final View child = getChildAt(i);
                      if (child.getVisibility() == GONE) {
                          continue;
                      }
                      final LayoutParams lp = (LayoutParams) child.getLayoutParams();
  
                      int width = child.getMeasuredWidth();
                      int height = child.getMeasuredHeight();
  
                      int childLeft;
                      int childTop;
  
                      int gravity = lp.gravity;
                      if (gravity == -1) {
                          gravity = Gravity.TOP | Gravity.LEFT;
                      }
  
                      final int absoluteGravity = gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
                      final int verticalGravity = gravity & Gravity.VERTICAL_GRAVITY_MASK;
  
                      switch (absoluteGravity & Gravity.HORIZONTAL_GRAVITY_MASK) {
                          case Gravity.CENTER_HORIZONTAL:
                              childLeft = (r - l - width) / 2 + lp.leftMargin - lp.rightMargin;
                              break;
                          case Gravity.RIGHT:
                              childLeft = r - width - lp.rightMargin;
                              break;
                          case Gravity.LEFT:
                          default:
                              childLeft = lp.leftMargin;
                      }
  
                      switch (verticalGravity) {
                          case Gravity.CENTER_VERTICAL:
                              childTop = ((b - paddingBottom) - t - height) / 2 + lp.topMargin - lp.bottomMargin;
                              break;
                          case Gravity.BOTTOM:
                              childTop = ((b - paddingBottom) - t) - height - lp.bottomMargin;
                              break;
                          default:
                              childTop = lp.topMargin;
                      }
                      if (chatActivityEnterView.isPopupView(child)) {
                          childTop = paddingBottom != 0 ? getMeasuredHeight() - paddingBottom : getMeasuredHeight();
                      } else if (chatActivityEnterView.isRecordCircle(child)) {
                          childTop = popupContainer.getTop() + popupContainer.getMeasuredHeight() - child.getMeasuredHeight() - lp.bottomMargin;
                          childLeft = popupContainer.getLeft() + popupContainer.getMeasuredWidth() - child.getMeasuredWidth() - lp.rightMargin;
                      }
                      child.layout(childLeft, childTop, childLeft + width, childTop + height);
                  }
  
                  notifyHeightChanged();
              }
          };
          setContentView(contentView);
          contentView.setBackgroundColor(0x99000000);
  
          RelativeLayout relativeLayout = new RelativeLayout(this);
          contentView.addView(relativeLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
  
          popupContainer = new RelativeLayout(this) {
              @Override
              protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
                  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
                  int w = chatActivityEnterView.getMeasuredWidth();
  