gt:         ScrollView scrollView = (ScrollView) fragmentView;
context: /*
   * This is the source code of Telegram for Android v. 3.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-2015.
   */
  
  package org.telegram.ui;
  
  import android.app.AlertDialog;
  import android.app.ProgressDialog;
  import android.content.Context;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.os.Bundle;
  import android.os.Vibrator;
  import android.text.Editable;
  import android.text.InputFilter;
  import android.text.InputType;
  import android.text.TextWatcher;
  import android.util.TypedValue;
  import android.view.Gravity;
  import android.view.KeyEvent;
  import android.view.View;
  import android.view.ViewGroup;
  import android.view.inputmethod.EditorInfo;
  import android.widget.EditText;
  import android.widget.FrameLayout;
  import android.widget.LinearLayout;
  import android.widget.ScrollView;
  import android.widget.TextView;
  
  import org.telegram.messenger.AndroidUtilities;
  import org.telegram.messenger.FileLog;
  import org.telegram.messenger.LocaleController;
  import org.telegram.messenger.MessagesController;
  import org.telegram.messenger.MessagesStorage;
  import org.telegram.messenger.NotificationCenter;
  import org.telegram.messenger.R;
  import org.telegram.messenger.UserConfig;
  import org.telegram.tgnet.ConnectionsManager;
  import org.telegram.tgnet.RequestDelegate;
  import org.telegram.tgnet.TLObject;
  import org.telegram.tgnet.TLRPC;
  import org.telegram.ui.ActionBar.ActionBar;
  import org.telegram.ui.ActionBar.ActionBarMenu;
  import org.telegram.ui.ActionBar.BaseFragment;
  import org.telegram.ui.Cells.ShadowSectionCell;
  import org.telegram.ui.Cells.TextInfoPrivacyCell;
  import org.telegram.ui.Cells.TextSettingsCell;
  import org.telegram.ui.Components.AvatarDrawable;
  import org.telegram.ui.Components.AvatarUpdater;
  import org.telegram.ui.Components.BackupImageView;
  import org.telegram.ui.Components.FrameLayoutFixed;
  import org.telegram.ui.Components.LayoutHelper;
  
  import java.util.concurrent.Semaphore;
  
  public class ChannelEditActivity extends BaseFragment implements AvatarUpdater.AvatarUpdaterDelegate, NotificationCenter.NotificationCenterDelegate {
  
      private View doneButton;
      private EditText nameTextView;
      private EditText descriptionTextView;
      private EditText userNameTextView;
      private BackupImageView avatarImage;
      private AvatarDrawable avatarDrawable;
      private AvatarUpdater avatarUpdater;
      private TextView checkTextView;
      private ProgressDialog progressDialog = null;
  
      private TLRPC.FileLocation avatar;
      private int checkReqId = 0;
      private String lastCheckName = null;
      private Runnable checkRunnable = null;
      private boolean lastNameAvailable = false;
      private TLRPC.Chat currentChat;
      private TLRPC.ChatFull info;
      private int chatId;
      private boolean allowComments = true;
      private TLRPC.InputFile uploadedAvatar;
      private boolean wasPrivate;
      private boolean privateAlertShown;
  
      private boolean createAfterUpload;
      private boolean donePressed;
  
      private final static int done_button = 1;
  
      public ChannelEditActivity(Bundle args) {
          super(args);
          avatarDrawable = new AvatarDrawable();
          avatarUpdater = new AvatarUpdater();
          chatId = args.getInt("chat_id", 0);
      }
  
      @SuppressWarnings("unchecked")
      @Override
      public boolean onFragmentCreate() {
          currentChat = MessagesController.getInstance().getChat(chatId);
          if (currentChat == null) {
              final Semaphore semaphore = new Semaphore(0);
              MessagesStorage.getInstance().getStorageQueue().postRunnable(new Runnable() {
                  @Override
                  public void run() {
                      currentChat = MessagesStorage.getInstance().getChat(chatId);
                      semaphore.release();
                  }
              });
              try {
                  semaphore.acquire();
              } catch (Exception e) {
                  FileLog.e("tmessages", e);
              }
              if (currentChat != null) {
                  MessagesController.getInstance().putChat(currentChat, true);
              } else {
                  return false;
              }
              if (info == null) {
                  MessagesStorage.getInstance().loadChatInfo(chatId, semaphore, false);
                  try {
                      semaphore.acquire();
                  } catch (Exception e) {
                      FileLog.e("tmessages", e);
                  }
                  if (info == null) {
                      return false;
                  }
              }
          }
          wasPrivate = currentChat.username == null || currentChat.username.length() == 0;
          avatarUpdater.parentFragment = this;
          avatarUpdater.delegate = this;
          allowComments = (currentChat.flags & TLRPC.CHAT_FLAG_IS_BROADCAST) == 0;
          return super.onFragmentCreate();
      }
  
      public void setInfo(TLRPC.ChatFull chatFull) {
          info = chatFull;
      }
  
      @Override
      public void onFragmentDestroy() {
          super.onFragmentDestroy();
          if (avatarUpdater != null) {
              avatarUpdater.clear();
          }
          AndroidUtilities.removeAdjustResize(getParentActivity(), classGuid);
      }
  
      @Override
      public void onResume() {
          super.onResume();
          AndroidUtilities.requestAdjustResize(getParentActivity(), classGuid);
      }
  
      @Override
      public View createView(Context context) {
          actionBar.setBackButtonImage(R.drawable.ic_ab_back);
          actionBar.setAllowOverlayTitle(true);
  
          actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
              @Override
              public void onItemClick(int id) {
                  if (id == -1) {
                      finishFragment();
                  } else if (id == done_button) {
                      if (donePressed) {
                          return;
                      }
                      donePressed = true;
                      if (nameTextView.length() == 0) {
                          Vibrator v = (Vibrator) getParentActivity().getSystemService(Context.VIBRATOR_SERVICE);
                          if (v != null) {
                              v.vibrate(200);
                          }
                          AndroidUtilities.shakeView(nameTextView, 2, 0);
                          return;
                      }
                      if ((currentChat.username == null && userNameTextView.length() != 0) || (currentChat.username != null && !currentChat.username.equalsIgnoreCase(userNameTextView.getText().toString()))) {
                          if (userNameTextView.length() != 0 && !lastNameAvailable) {
                              Vibrator v = (Vibrator) getParentActivity().getSystemService(Context.VIBRATOR_SERVICE);
                              if (v != null) {
                                  v.vibrate(200);
                              }
                              AndroidUtilities.shakeView(checkTextView, 2, 0);
                              return;
                          }
                      }
  
                      if (avatarUpdater.uploadingAvatar != null) {
                          createAfterUpload = true;
                          progressDialog = new ProgressDialog(getParentActivity());
                          progressDialog.setMessage(LocaleController.getString("Loading", R.string.Loading));
                          progressDialog.setCanceledOnTouchOutside(false);
                          progressDialog.setCancelable(false);
                          progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, LocaleController.getString("Cancel", R.string.Cancel), new DialogInterface.OnClickListener() {
                              @Override
                              public void onClick(DialogInterface dialog, int which) {
                                  createAfterUpload = false;
                                  progressDialog = null;
                                  donePressed = false;
                                  try {
                                      dialog.dismiss();
                                  } catch (Exception e) {
                                      FileLog.e("tmessages", e);
                                  }
                              }
                          });
                          progressDialog.show();
                          return;
                      }
                      boolean currentAllowComments = (currentChat.flags & TLRPC.CHAT_FLAG_IS_BROADCAST) == 0;
                      if (allowComments != currentAllowComments) {
                          MessagesController.getInstance().toogleChannelComments(chatId, allowComments);
                      }
                      if (!currentChat.title.equals(nameTextView.getText().toString())) {
                          MessagesController.getInstance().changeChatTitle(chatId, nameTextView.getText().toString());
                      }
                      if (info != null && !info.about.equals(descriptionTextView.getText().toString())) {
                          MessagesController.getInstance().updateChannelAbout(chatId, descriptionTextView.getText().toString(), info);
                      }
                      String oldUserName = currentChat.username != null ? currentChat.username : "";
                      if (!oldUserName.equals(userNameTextView.getText().toString())) {
                          MessagesController.getInstance().updateChannelUserName(chatId, userNameTextView.getText().toString());
                      }
                      if (uploadedAvatar != null) {
                          MessagesController.getInstance().changeChatAvatar(chatId, uploadedAvatar);
                      } else if (avatar == null && currentChat.photo instanceof TLRPC.TL_chatPhoto) {
                          MessagesController.getInstance().changeChatAvatar(chatId, null);
                      }
                      finishFragment();
                  }
              }
          });
  
          ActionBarMenu menu = actionBar.createMenu();
          doneButton = menu.addItemWithWidth(done_button, R.drawable.ic_done, AndroidUtilities.dp(56));
  
          LinearLayout linearLayout;
  
          fragmentView = new ScrollView(context);
          fragmentView.setBackgroundColor(0xfff0f0f0);
  