<commit_before>package de.bitdroid.flooding.alarms;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.widget.Toast;

import de.bitdroid.flooding.R;
import de.bitdroid.flooding.dataselection.Extras;
import de.bitdroid.flooding.dataselection.RiverSelectionFragment;
import de.bitdroid.flooding.dataselection.StationSelectionFragment;
import de.bitdroid.utils.StringUtils;


public class NewAlarmActivity extends FragmentActivity implements Extras {

	private String waterName, stationName;

	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		setContentView(R.layout.simple_fragment_container);

		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			waterName = extras.getString(EXTRA_WATER_NAME);
			stationName = extras.getString(EXTRA_STATION_NAME);
		}

		// select river
		if (waterName == null && stationName == null) {
			getActionBar().setTitle(StringUtils.toProperCase(getString(
							R.string.alarms_new_title_river)));
			getSupportFragmentManager()
				.beginTransaction()
				.replace(R.id.frame, RiverSelectionFragment.newInstance(
							NewAlarmActivity.class,
							NewAlarmActivity.class,
							android.R.anim.fade_in,
							android.R.anim.fade_out))
				.commit();

		// select station
		} else if (stationName == null) {
			getActionBar().setTitle(StringUtils.toProperCase(getString(
							R.string.alarms_new_title_station)));
			getSupportFragmentManager()
				.beginTransaction()
				.replace(R.id.frame, StationSelectionFragment.newInstance(
							NewAlarmActivity.class,
							android.R.anim.fade_in,
							android.R.anim.fade_out,
							waterName,
							NewAlarmActivity.class,
							false))
				.commit();

		// select level
		} else {
			getActionBar().setTitle(StringUtils.toProperCase(getString(
							R.string.alarms_new_title_level)));
			getSupportFragmentManager()
				.beginTransaction()
				.replace(R.id.frame, SelectLevelFragment.newInstance(
							waterName,
							stationName))
				.commit();
		}

    }


	@Override
	public void onBackPressed() {
		super.onBackPressed();

		// if last screen, show 'abort' message
		if (waterName == null && stationName == null) {
			Toast.makeText(this, getString(R.string.alarms_new_not_created), Toast.LENGTH_SHORT).show();
		} else {
			overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
		}
	}

}<commit_msg>alarms: show top back button when creating new alarm<commit_after>package de.bitdroid.flooding.alarms;

import android.os.Bundle;
import android.widget.Toast;

import de.bitdroid.flooding.R;
import de.bitdroid.flooding.dataselection.Extras;
import de.bitdroid.flooding.dataselection.RiverSelectionFragment;
import de.bitdroid.flooding.dataselection.StationSelectionFragment;
import de.bitdroid.flooding.utils.BaseActivity;
import de.bitdroid.utils.StringUtils;


public class NewAlarmActivity extends BaseActivity implements Extras {

	private String waterName, stationName;

	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		setContentView(R.layout.simple_fragment_container);

		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			waterName = extras.getString(EXTRA_WATER_NAME);
			stationName = extras.getString(EXTRA_STATION_NAME);
		}

		// select river
		if (waterName == null && stationName == null) {
			getActionBar().setTitle(StringUtils.toProperCase(getString(
							R.string.alarms_new_title_river)));
			getSupportFragmentManager()
				.beginTransaction()
				.replace(R.id.frame, RiverSelectionFragment.newInstance(
							NewAlarmActivity.class,
							NewAlarmActivity.class,
							android.R.anim.fade_in,
							android.R.anim.fade_out))
				.commit();

		// select station
		} else if (stationName == null) {
			getActionBar().setTitle(StringUtils.toProperCase(getString(
							R.string.alarms_new_title_station)));
			getSupportFragmentManager()
				.beginTransaction()
				.replace(R.id.frame, StationSelectionFragment.newInstance(
							NewAlarmActivity.class,
							android.R.anim.fade_in,
							android.R.anim.fade_out,
							waterName,
							NewAlarmActivity.class,
							false))
				.commit();

		// select level
		} else {
			getActionBar().setTitle(StringUtils.toProperCase(getString(
							R.string.alarms_new_title_level)));
			getSupportFragmentManager()
				.beginTransaction()
				.replace(R.id.frame, SelectLevelFragment.newInstance(
							waterName,
							stationName))
				.commit();
		}

    }


	@Override
	protected void showExitAnimation() {
		// if last screen, show 'abort' message
		if (waterName == null && stationName == null) {
			Toast.makeText(this, getString(R.string.alarms_new_not_created), Toast.LENGTH_SHORT).show();
		} else {
			overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
		}
	}

}
{'fraction_non_alphanumeric': 0.11104319478402608, 'fraction_numerical': 0.00020374898125509371, 'mean_word_length': 3.9485887096774195, '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': '6720799', 'n_tokens_mistral': 1879, 'n_tokens_neox': 1522, 'n_words': 241}