gt:                 Intent callIntent = new Intent(Intent.ACTION_CALL);
context: package com.moez.QKSMS.ui.popup;
  
  import android.app.LoaderManager;
  import android.content.CursorLoader;
  import android.content.DialogInterface;
  import android.content.Intent;
  import android.content.Loader;
  import android.database.Cursor;
  import android.net.Uri;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import com.moez.QKSMS.R;
  import com.moez.QKSMS.data.Conversation;
  import com.moez.QKSMS.data.ConversationLegacy;
  import com.moez.QKSMS.data.Message;
  import com.moez.QKSMS.interfaces.ActivityLauncher;
  import com.moez.QKSMS.service.CopyUnreadMessageTextService;
  import com.moez.QKSMS.service.DeleteUnreadMessageService;
  import com.moez.QKSMS.common.utils.CursorUtils;
  import com.moez.QKSMS.common.utils.KeyboardUtils;
  import com.moez.QKSMS.transaction.SmsHelper;
  import com.moez.QKSMS.ui.MainActivity;
  import com.moez.QKSMS.ui.base.QKPopupActivity;
  import com.moez.QKSMS.ui.messagelist.MessageColumns;
  import com.moez.QKSMS.ui.messagelist.MessageListAdapter;
  import com.moez.QKSMS.ui.view.ComposeView;
  import com.moez.QKSMS.ui.view.MessageListRecyclerView;
  import com.moez.QKSMS.ui.view.WrappingLinearLayoutManager;
  import com.moez.QKSMS.ui.welcome.DemoConversationCursorLoader;
  
  public class QKReplyActivity extends QKPopupActivity implements DialogInterface.OnDismissListener,
          LoaderManager.LoaderCallbacks<Cursor>, ActivityLauncher, ComposeView.OnSendListener {
  
      @SuppressWarnings("unused")
      private String TAG = "QKReplyActivity";
  
      // Intent extras for configuring a QuickReplyActivity intent
      public static final String EXTRA_THREAD_ID = "thread_id";
      public static final String EXTRA_SHOW_KEYBOARD = "open_keyboard";
  
      public static boolean sIsShowing = false;
      public static long sThreadId;
  
      private Conversation mConversation;
      private ConversationLegacy mConversationLegacy;
  
      private Cursor mCursor;
      private boolean mShowUnreadOnly = true;
  
      private MessageListRecyclerView mRecyclerView;
      private WrappingLinearLayoutManager mLayoutManager;
      private MessageListAdapter mAdapter;
      private ComposeView mComposeView;
  
      /**
       * True if we're starting an activity. This will let us know whether or not we should finish()
       * in onPause().
       */
      private boolean mIsStartingActivity = false;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          Bundle extras = getIntent().getExtras();
  
          mConversation = Conversation.get(this, extras.getLong(EXTRA_THREAD_ID), false);
          mConversationLegacy = new ConversationLegacy(this, extras.getLong(EXTRA_THREAD_ID));
  
          // Set up the compose view.
          mComposeView = (ComposeView) findViewById(R.id.compose_view);
          mComposeView.setActivityLauncher(this);
          mComposeView.setOnSendListener(this);
          mComposeView.setLabel("QKReply");
          mComposeView.refresh();
  
          mLayoutManager = new WrappingLinearLayoutManager(this);
          mLayoutManager.setStackFromEnd(true);
          mAdapter = new MessageListAdapter(this);
          mAdapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() {
              @Override
              public void onChanged() {
                  LinearLayoutManager manager = (LinearLayoutManager) mRecyclerView.getLayoutManager();
                  int position = CursorUtils.isValid(mCursor) && mCursor.getCount() > 0 ? mCursor.getCount() - 1 : 0;
                  manager.smoothScrollToPosition(mRecyclerView, null, position);
              }
          });
  
          mRecyclerView = (MessageListRecyclerView) findViewById(R.id.popup_messages);
          mRecyclerView.setLayoutManager(mLayoutManager);
          mRecyclerView.setAdapter(mAdapter);
  
          // Disable the compose view for the welcome screen (so that they can't send texts to nobody)
          if (extras.getLong(EXTRA_THREAD_ID) == DemoConversationCursorLoader.THREAD_ID_WELCOME_SCREEN) {
              String sendingBlockedMessage = getString(R.string.sending_blocked_welcome_screen_message);
              mComposeView.setSendingBlocked(sendingBlockedMessage);
          }
  
          // Set the conversation data objects. These are used to save drafts, send sms messages, etc.
          mComposeView.onOpenConversation(mConversation, mConversationLegacy);
  
          // If the user has the "show keyboard" for popups option enabled, show the keyboard here by
          // requesting the focus on the reply text.
          if (extras.getBoolean(EXTRA_SHOW_KEYBOARD, false)) {
              mComposeView.requestReplyTextFocus();
          }
  
          new AsyncTask<Void, Void, Void>() {
  
              @Override
              protected Void doInBackground(Void... params) {
                  mConversationLegacy.getName(true);
  
                  return null;
              }
  
              @Override
              protected void onPostExecute(Void aVoid) {
                  super.onPostExecute(aVoid);
  
                  // FIXME
                  if (sThreadId == DemoConversationCursorLoader.THREAD_ID_WELCOME_SCREEN) {
                      setTitle("QKSMS");
                  } else {
                      setTitle(mConversationLegacy.getName(true));
                  }
  
                  initLoaderManager();
              }
          }.execute((Void[]) null);
      }
  
      @Override
      protected int getLayoutResource() {
          return R.layout.activity_qkreply;
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.qkreply, menu);
          return super.onCreateOptionsMenu(menu);
      }
  
      private void switchView() {
          mShowUnreadOnly = !mShowUnreadOnly;
          getLoaderManager().restartLoader(0, null, this);
      }
  
      private void initLoaderManager() {
          getLoaderManager().initLoader(0, null, this);
      }
  
      @Override
      protected void onPause() {
          super.onPause();
  
          KeyboardUtils.hide(this, mComposeView);
  
          mComposeView.saveDraft();
  
          sIsShowing = false;
          sThreadId = 0;
  
          // When the home button is pressed, this ensures that the QK Reply is shut down
          // Don't shut it down if it pauses and the screen is off though
          if (!mIsStartingActivity && !isChangingConfigurations() && isScreenOn()) {
              finish();
          }
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          boolean handledByComposeView = mComposeView.onActivityResult(requestCode, resultCode, data);
          if (!handledByComposeView) {
              // ...
          }
      }
  
      @Override
      protected void onResume() {
          super.onResume();
          sIsShowing = true;
          sThreadId = mConversationLegacy.getThreadId();
          mIsStartingActivity = false;
      }
  
      @Override
      public void finish() {
          // Override pending transitions so that we don't see black for a second when QuickReply
          // closes
          super.finish();
          overridePendingTransition(0, 0);
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          switch (item.getItemId()) {
  
              case R.id.menu_fold:
                  switchView();
                  if (mShowUnreadOnly) {
                      item.setIcon(R.drawable.ic_unfold);
                      item.setTitle(R.string.menu_show_all);
                  } else {
                      item.setIcon(R.drawable.ic_fold);
                      item.setTitle(R.string.menu_show_unread);
                  }
                  return true;
  
              case R.id.menu_open_thread:
                  Intent threadIntent = new Intent(this, MainActivity.class);
                  threadIntent.putExtra(MainActivity.EXTRA_THREAD_ID, mConversationLegacy.getThreadId());
                  startActivity(threadIntent);
                  finish();
                  return true;
  
              case R.id.menu_call:
  