gt:     final Bundle bundle = new Bundle();
context: /*
   * Copyright (C) 2014 - 2015 Initial Author
   * Copyright (C) 2017 Nicolai Ehemann
   *
   * This file is part of Peris.
   *
   * Peris is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or
   * (at your option) any later version.
   *
   * Peris is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with Peris.  If not, see <http://www.gnu.org/licenses/>.
   *
   */
  
  package de.enlightened.peris;
  
  import android.annotation.SuppressLint;
  import android.content.Context;
  import android.content.Intent;
  import android.content.SharedPreferences;
  import android.graphics.Color;
  import android.graphics.Typeface;
  import android.os.AsyncTask;
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuInflater;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.ImageView;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  
  import com.nostra13.universalimageloader.core.ImageLoader;
  
  import java.util.ArrayList;
  
  import de.enlightened.peris.api.ApiResult;
  import de.enlightened.peris.db.PerisDBHelper;
  import de.enlightened.peris.db.ServerRepository;
  import de.enlightened.peris.site.Message;
  import de.enlightened.peris.support.DateTimeUtils;
  import de.enlightened.peris.support.Net;
  
  public class MessageActivity extends FragmentActivity {
  
    private static final String TAG = MessageActivity.class.getName();
    private static final int MAX_ITEM_COUNT = 50;
    private static final boolean RETURN_HTML = true;
    private static final int DEFAULT_FONT_SIZE = 16;
  
    private String messageId;
    private String partnerName;
    private String folderId = "0";
    private String senderName = "";
    private String conversationModerator;
    private String accent = "";
    private PerisApp application;
    private String externalServer = "0";
    private Session mailSession;
    private AnalyticsHelper ah;
    private PerisDBHelper dbHelper;
  
    /**
     * Called when the activity is first created.
     */
    @SuppressLint("NewApi")
    @Override
    public void onCreate(final Bundle savedInstanceState) {
      this.dbHelper = new PerisDBHelper(this);
      this.application = (PerisApp) getApplication();
      final Bundle bundle = getIntent().getExtras();
      this.messageId = bundle.getString("id");
      this.partnerName = bundle.getString("name");
      this.conversationModerator = bundle.getString("moderator");
  
      if (bundle.getString("background") != null) {
        final String bgc = bundle.getString("background");
  
        if (bgc.contains("#")) {
          this.accent = bgc;
  
        } else {
          this.accent = this.application.getSession().getServer().serverColor;
        }
      } else {
        this.accent = this.application.getSession().getServer().serverColor;
      }
  
      ThemeSetter.setTheme(this, this.accent);
      super.onCreate(savedInstanceState);
      ThemeSetter.setActionBar(this, this.accent);
  
      //Track app analytics
      this.ah = ((PerisApp) getApplication()).getAnalyticsHelper();
      this.ah.trackScreen(getClass().getName(), false);
  
      this.setContentView(R.layout.message_layout);
  
      if (bundle.getString("boxid") != null) {
        this.folderId = bundle.getString("boxid");
      }
  
      setTitle(this.partnerName);
  
      if (bundle.containsKey("server")) {
        this.externalServer = bundle.getString("server");
        Log.i(TAG, "Mail bundle contains server!");
        final Server server = ServerRepository.findOne(this.dbHelper.getWritableDatabase(), Long.parseLong(this.externalServer));
        if (server == null) {
          Log.i(TAG, "Conversation Server is null!");
          return;
        }
        this.mailSession = new Session(this, (PerisApp) getApplication(), this.dbHelper);
        this.mailSession.setSessionListener(new Session.SessionListener() {
  
          @Override
          public void onSessionConnected() {
            new LoadMessageTask(MessageActivity.this.messageId, MessageActivity.this.folderId).execute();
          }
  
          @Override
          public void onSessionConnectionFailed(final String reason) {
            return;
          }
  
        });
        this.mailSession.setServer(server);
      } else {
        this.mailSession = this.application.getSession();
        new LoadMessageTask(MessageActivity.this.messageId, MessageActivity.this.folderId).execute();
      }
  
      if (getString(R.string.server_location).contentEquals("0")) {
        if (ThemeSetter.getForegroundDark(this.mailSession.getServer().serverColor)) {
          getActionBar().setIcon(R.drawable.ic_ab_main_black);
        } else {
          getActionBar().setIcon(R.drawable.ic_ab_main_white);
        }
      }
    }
  
    @Override
    protected void onDestroy() {
      this.dbHelper.close();
      super.onDestroy();
    }
  
    @Override
    public void onResume() {
      //new fetchParticipants().execute();
      super.onResume();
    }
  
    @Override
    public void onStart() {
      super.onStart();
    }
  
    @Override
    public void onStop() {
      super.onStop();
    }
  
    @Override
    public boolean onCreateOptionsMenu(final Menu menu) {
      final MenuInflater inflater = getMenuInflater();
      inflater.inflate(R.menu.conversation_menu, menu);
  
      if (ThemeSetter.getForegroundDark(this.accent)) {
        final MenuItem itemReply = menu.findItem(R.id.convo_menu_reply);
        final MenuItem itemDelete = menu.findItem(R.id.convo_menu_delete);
  
        itemReply.setIcon(R.drawable.ic_action_reply_dark);
        itemDelete.setIcon(R.drawable.ic_action_discard_dark);
      }
  
      return true;
    }
  
    @Override
    public boolean onOptionsItemSelected(final MenuItem item) {
      // Handle item selection
      switch (item.getItemId()) {
        case R.id.convo_menu_reply:
          this.launchComposer();
          break;
        case R.id.convo_menu_delete:
          this.deleteMessage();
          break;
        default:
          return super.onOptionsItemSelected(item);
      }
      return true;
    }
  
    private void launchComposer() {
      final Intent myIntent = new Intent(MessageActivity.this, NewPost.class);
  
  