<commit_before>package cgeo.geocaching;

import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import java.io.File;
import java.util.ArrayList;

public class cgeogpxes extends cgFileList<cgGPXListAdapter> {

	private ProgressDialog parseDialog = null;
	private int listId = 1;
	private int imported = 0;

	final private Handler changeParseDialogHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {
			if (msg.obj != null && parseDialog != null) {
				parseDialog.setMessage(getRes().getString(R.string.gpx_import_loading_stored) + " " + (Integer) msg.obj);
			}
		}
	};
	final private Handler loadCachesHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {
			try {
				if (parseDialog != null) {
					parseDialog.dismiss();
				}

				getWarning().helpDialog(getRes().getString(R.string.gpx_import_title_caches_imported), imported + " " + getRes().getString(R.string.gpx_import_caches_imported));
				imported = 0;
			} catch (Exception e) {
				if (parseDialog != null) {
					parseDialog.dismiss();
				}
			}
		}
	};

	@Override
	protected cgGPXListAdapter getAdapter(ArrayList<File> files) {
		return new cgGPXListAdapter(this, getSettings(), files);
	}

	@Override
	protected String[] getBaseFolders() {
		String base = Environment.getExternalStorageDirectory().toString();
		return new String[]{base + "/gpx"};
	}

	@Override
	protected String getFileExtension() {
		return "gpx";
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

	}

	public void loadGPX(File file) {

		parseDialog = ProgressDialog.show(
				getActivity(),
				getRes().getString(R.string.gpx_import_title_reading_file),
				getRes().getString(R.string.gpx_import_loading),
				true,
				false);

		new loadCaches(file).start();
	}

	private class loadCaches extends Thread {

		File file = null;

		public loadCaches(File fileIn) {
			file = fileIn;
		}

		@Override
		public void run() {
			final long searchId = getBase().parseGPX(getApp(), file, listId, changeParseDialogHandler);

			imported = getApp().getCount(searchId);

			loadCachesHandler.sendMessage(new Message());
		}
	}

	public void goHome(View view) {
		getBase().goHome(getActivity());
	}

}
<commit_msg>fix issue #72<commit_after>package cgeo.geocaching;

import java.io.File;
import java.util.ArrayList;

import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.view.View;

public class cgeogpxes extends cgFileList<cgGPXListAdapter> {

	private ProgressDialog parseDialog = null;
	private int listId = 1;
	private int imported = 0;

	final private Handler changeParseDialogHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {
			if (msg.obj != null && parseDialog != null) {
				parseDialog.setMessage(getRes().getString(R.string.gpx_import_loading_stored) + " " + (Integer) msg.obj);
			}
		}
	};
	final private Handler loadCachesHandler = new Handler() {

		@Override
		public void handleMessage(Message msg) {
			try {
				if (parseDialog != null) {
					parseDialog.dismiss();
				}

				getWarning().helpDialog(getRes().getString(R.string.gpx_import_title_caches_imported), imported + " " + getRes().getString(R.string.gpx_import_caches_imported));
				imported = 0;
			} catch (Exception e) {
				if (parseDialog != null) {
					parseDialog.dismiss();
				}
			}
		}
	};

	@Override
	protected cgGPXListAdapter getAdapter(ArrayList<File> files) {
		return new cgGPXListAdapter(this, getSettings(), files);
	}

	@Override
	protected String[] getBaseFolders() {
		String base = Environment.getExternalStorageDirectory().toString();
		return new String[]{base + "/gpx"};
	}

	@Override
	protected String getFileExtension() {
		return "gpx";
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			listId = extras.getInt("list");
		}
		if (listId <= 0) {
			listId = 1;
		}

	}

	public void loadGPX(File file) {

		parseDialog = ProgressDialog.show(
				getActivity(),
				getRes().getString(R.string.gpx_import_title_reading_file),
				getRes().getString(R.string.gpx_import_loading),
				true,
				false);

		new loadCaches(file).start();
	}

	private class loadCaches extends Thread {

		File file = null;

		public loadCaches(File fileIn) {
			file = fileIn;
		}

		@Override
		public void run() {
			final long searchId = getBase().parseGPX(getApp(), file, listId, changeParseDialogHandler);

			imported = getApp().getCount(searchId);

			loadCachesHandler.sendMessage(new Message());
		}
	}

	public void goHome(View view) {
		getBase().goHome(getActivity());
	}

}

{'fraction_non_alphanumeric': 0.12204563977180113, 'fraction_numerical': 0.002037489812550937, 'mean_word_length': 4.22790202342918, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, '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': '4919503', 'n_tokens_mistral': 1798, 'n_tokens_neox': 1549, 'n_words': 337}