<commit_before>package net.yasme.android;

import java.util.ArrayList;
import java.util.Iterator;

import net.yasme.android.entities.Chat;
import net.yasme.android.entities.Id;
import net.yasme.android.entities.Message;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class YasmeChat extends Activity {
	public final static String USER_NAME = "net.yasme.andriod.USER_NAME";
	public final static String USER_ID = "net.yasme.andriod.USER_ID";
	public final static String CHAT_ID = "net.yasme.andriod.CHAT_ID";


	private EditText EditMessage;
	private TextView status;
	private Chat chat;
	private String user_name;
	private long user_id;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_chat);

		if (savedInstanceState == null) {
			getFragmentManager().beginTransaction()
					.add(R.id.container, new PlaceholderFragment()).commit();
		}
		Intent intent = getIntent();
		user_name = intent.getStringExtra(USER_NAME);
		
		String user_string = intent.getStringExtra(USER_ID);
		user_id = Long.parseLong(user_string);
		String url = getResources().getString(R.string.server_url);
		long chat_id = intent.getIntExtra(CHAT_ID, 1);
		if(false) {
			//TODO: existierenden Chat verwenden
		} else {
			chat = new Chat(chat_id, user_id, url, this);
		}
		
	}

	@Override
	protected void onStart() {
		super.onStart();
		initializeViews();
	}

	@Override
	protected void onStop() {
		super.onStop();
	}

	public TextView getStatus() {
		return status;
	}

	private void initializeViews() {
		EditMessage = (EditText) findViewById(R.id.text_message);
		status = (TextView) findViewById(R.id.text_status);
		status.setText("Eingeloggt: " + user_name);
	}

	public void send(View view) {
		String msg = EditMessage.getText().toString();

		if (msg.isEmpty()) {
			status.setText("Nichts eingegeben");
			return;
		}
				
		chat.send(msg);
		EditMessage.setText("");
		msg = null;
	}

	public void update(View view) {<commit_msg>switched focus to message input field after sending<commit_after>package net.yasme.android;

import java.util.ArrayList;
import java.util.Iterator;

import net.yasme.android.entities.Chat;
import net.yasme.android.entities.Id;
import net.yasme.android.entities.Message;
import android.app.Activity;
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

public class YasmeChat extends Activity {
	public final static String USER_NAME = "net.yasme.andriod.USER_NAME";
	public final static String USER_ID = "net.yasme.andriod.USER_ID";
	public final static String CHAT_ID = "net.yasme.andriod.CHAT_ID";


	private EditText EditMessage;
	private TextView status;
	private Chat chat;
	private String user_name;
	private long user_id;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_chat);

		if (savedInstanceState == null) {
			getFragmentManager().beginTransaction()
					.add(R.id.container, new PlaceholderFragment()).commit();
		}
		Intent intent = getIntent();
		user_name = intent.getStringExtra(USER_NAME);
		
		String user_string = intent.getStringExtra(USER_ID);
		user_id = Long.parseLong(user_string);
		String url = getResources().getString(R.string.server_url);
		long chat_id = intent.getIntExtra(CHAT_ID, 1);
		if(false) {
			//TODO: existierenden Chat verwenden
		} else {
			chat = new Chat(chat_id, user_id, url, this);
		}
		
	}

	@Override
	protected void onStart() {
		super.onStart();
		initializeViews();
	}

	@Override
	protected void onStop() {
		super.onStop();
	}

	public TextView getStatus() {
		return status;
	}

	private void initializeViews() {
		EditMessage = (EditText) findViewById(R.id.text_message);
		status = (TextView) findViewById(R.id.text_status);
		status.setText("Eingeloggt: " + user_name);
	}

	public void send(View view) {
		String msg = EditMessage.getText().toString();

		if (msg.isEmpty()) {
			status.setText("Nichts eingegeben");
			return;
		}
				
		chat.send(msg);
		EditMessage.setText("");
		EditMessage.requestFocus();
		msg = null;
	}

	public void update(View view) {
{'fraction_non_alphanumeric': 0.11508425811755035, 'fraction_numerical': 0.0004110152075626798, 'mean_word_length': 4.82177033492823, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7572311', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1544, 'n_words': 344}