<commit_before>/*
 * Written by <NAME>
 */

package com.wichmannpas.tcpDbusClient;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;

public class MainActivity extends ActionBarActivity {

	private static String target = "spotify";
	private static String tcpHost = "192.168.2.201";
	private static int tcpPort = 12341;
	
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void playPause(View view) {
    	//start asynchronous network task
    	TcpClient tcpClientInstance = new TcpClient(target, "PlayPause", tcpHost, tcpPort);
    	tcpClientInstance.execute();
    }
    
    public void next(View view) {
    	//start asynchronous network task
    	TcpClient tcpClientInstance = new TcpClient(target, "Next", tcpHost, tcpPort);
    	tcpClientInstance.execute();
    }
    
    public void previous(View view) {
    	//start asynchronous network task
    	TcpClient tcpClientInstance = new TcpClient(target, "Previous", tcpHost, tcpPort);
    	tcpClientInstance.execute();
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;<commit_msg>feature: configuration values saved in SharedPreferences<commit_after>/*
 * Written by <NAME>
 */

package com.wichmannpas.tcpDbusClient;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.view.Menu;
import android.view.MenuItem;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class MainActivity extends ActionBarActivity {

	private String tcpTarget;
	private String tcpHost;
	private int tcpPort;
	
	
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        SharedPreferences preferences = getSharedPreferences("target", MODE_PRIVATE); 
        String initialized = preferences.getString("initialized", null);
        if (initialized == null) {
        	//set default values now
        	Editor editor = preferences.edit();
        	editor.putString("target", "spotify");
        	editor.putString("host", "192.168.2.201");
        	editor.putInt("port", 12341);
        	editor.commit();
        }
        tcpTarget = preferences.getString("target", "spotify");
    	tcpHost = preferences.getString("host", "192.168.2.201");
    	tcpPort = preferences.getInt("port", 12341);
    }

    public void playPause(View view) {
    	//start asynchronous network task
    	TcpClient tcpClientInstance = new TcpClient(tcpTarget, "PlayPause", tcpHost, tcpPort);
    	tcpClientInstance.execute();
    }
    
    public void next(View view) {
    	//start asynchronous network task
    	TcpClient tcpClientInstance = new TcpClient(tcpTarget, "Next", tcpHost, tcpPort);
    	tcpClientInstance.execute();
    }
    
    public void previous(View view) {
    	//start asynchronous network task
    	TcpClient tcpClientInstance = new TcpClient(tcpTarget, "Previous", tcpHost, tcpPort);
    	tcpClientInstance.execute();
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
{'fraction_non_alphanumeric': 0.09758108851017043, 'fraction_numerical': 0.01291918636613524, 'mean_word_length': 3.3790613718411553, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, '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': '1686675', 'n_tokens_mistral': 1069, 'n_tokens_neox': 999, 'n_words': 264}