<commit_before>package uk.ac.st_andrews.cs.host.mk74.energymeasurement.gps;

import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.Menu;
import android.widget.TextView;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		LocationManager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
		
		class EmptyLocationListener implements LocationListener{
			
			@Override
			public void onLocationChanged(Location loc) {				
				TextView tv = (TextView) findViewById(R.id.textView1);
				tv.setText("Position: " + loc.getLongitude() + " " + loc.getLatitude() + "\n");
				System.out.println("Position: " + loc.getLongitude() + " " + loc.getLatitude() + "\n");
			}

			@Override
			public void onProviderDisabled(String arg0) {}

			@Override
			public void onProviderEnabled(String arg0) {}

			@Override
			public void onStatusChanged(String arg0, int arg1, Bundle arg2) {}
		}

		LocationListener locListener = new EmptyLocationListener();
		
		String locProvider = LocationManager.GPS_PROVIDER;
		locManager.requestLocationUpdates(locProvider, 0, 0, locListener);
		System.out.println("Location listener is registered\n");
		
		setContentView(R.layout.activity_main);
	}

	@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>reading location coordinates from gps, printing it to LogCat and keeping screen on and light<commit_after>package uk.ac.st_andrews.cs.host.mk74.energymeasurement.gps;

import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.Window;
import android.view.WindowManager;

public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		LocationManager locManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
		
		class EmptyLocationListener implements LocationListener{
			
			@Override
			public void onLocationChanged(Location loc) {			
				String output = "Position: " + loc.getLongitude() + " " + loc.getLatitude() + "\n";
				System.out.println(output);
			}

			@Override
			public void onProviderDisabled(String arg0) {}

			@Override
			public void onProviderEnabled(String arg0) {}

			@Override
			public void onStatusChanged(String arg0, int arg1, Bundle arg2) {}
		}

		LocationListener locListener = new EmptyLocationListener();
		
		String locProvider = LocationManager.GPS_PROVIDER;
		locManager.requestLocationUpdates(locProvider, 0, 0, locListener);
		System.out.println("Location listener is registered\n");
		
		Window w = getWindow();
		w.setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, 
				WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
		setContentView(R.layout.activity_main);
	}

	@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.09658928059615936, 'fraction_numerical': 0.005445686443106907, 'mean_word_length': 4.955631399317406, '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': '1468845', 'n_tokens_mistral': 1130, 'n_tokens_neox': 977, 'n_words': 239}