<commit_before>package mil.nga.giat.mage.disclaimer;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import org.apache.commons.lang3.StringUtils;

import javax.inject.Inject;

import dagger.android.support.DaggerAppCompatActivity;
import mil.nga.giat.mage.MageApplication;
import mil.nga.giat.mage.R;
import mil.nga.giat.mage.event.EventsActivity;
import mil.nga.giat.mage.login.LoginActivity;

public class DisclaimerActivity extends DaggerAppCompatActivity {

	@Inject
	protected MageApplication application;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);

		setContentView(R.layout.activity_disclaimer);
		getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
	}

	@Override
	protected void onResume() {
		super.onResume();

		SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
		String disclaimerText = sharedPreferences.getString(getString(R.string.serverDisclaimerText), null);
		if(disclaimerText == null) {
			disclaimerText = "";
		}
		sharedPreferences.edit().putString(getString(R.string.disclaimerText), disclaimerText).apply();

		if (StringUtils.isBlank(sharedPreferences.getString(getString(R.string.disclaimerText), null))) {
			agree(null);
		} else {
			TextView disclaimerTitleView = (TextView) findViewById(R.id.disclaimer_text);
			disclaimerTitleView.setText(disclaimerText);
		}

		String disclaimerTitle = sharedPreferences.getString(getString(R.string.serverDisclaimerTitle), null);
		if (disclaimerTitle != null) {
			TextView disclaimerTitleView = (TextView) findViewById(R.id.disclaimer_title);
			disclaimerTitleView.setText(disclaimerTitle);
		}
	}

	public void agree(View view) {
		SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
		sharedPreferences.edit().putBoolean(getString(R.string.disclaimerAcceptedKey), true).apply();

		Intent intent = new Intent(getApplicationContext(), EventsActivity.class);
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			intent.putExtras(extras);
		}
		startActivity(intent);
		finish();
	}

	public void exit(View view) {
		application.onLogout(true, new MageApplication.OnLogoutListener() {
			@Override
			public void onLogout() {
				startActivity(new Intent(getApplicationContext(), LoginActivity.class));
				finish();
			}
		});
	}

	@Override
	public void onBackPressed() {
	}
}<commit_msg>Skip disclaimer if "show disclaimer" is false on server settings<commit_after>package mil.nga.giat.mage.disclaimer;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import javax.inject.Inject;

import dagger.android.support.DaggerAppCompatActivity;
import mil.nga.giat.mage.MageApplication;
import mil.nga.giat.mage.R;
import mil.nga.giat.mage.event.EventsActivity;
import mil.nga.giat.mage.login.LoginActivity;

public class DisclaimerActivity extends DaggerAppCompatActivity {

	@Inject
	protected MageApplication application;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);

		setContentView(R.layout.activity_disclaimer);
		getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
	}

	@Override
	protected void onResume() {
		super.onResume();

		SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());

		boolean showDisclaimer = sharedPreferences.getBoolean(getString(R.string.serverDisclaimerShow), false);

		if (showDisclaimer) {
			String disclaimerTitle = sharedPreferences.getString(getString(R.string.serverDisclaimerTitle), null);
			TextView disclaimerTitleView = findViewById(R.id.disclaimer_title);
			disclaimerTitleView.setText(disclaimerTitle);

			TextView disclaimerTextView = findViewById(R.id.disclaimer_text);
			String disclaimerText = sharedPreferences.getString(getString(R.string.serverDisclaimerText), null);
			disclaimerTextView.setText(disclaimerText);
		} else {
			agree(null);
		}
	}

	public void agree(View view) {
		SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
		sharedPreferences.edit().putBoolean(getString(R.string.disclaimerAcceptedKey), true).apply();

		Intent intent = new Intent(getApplicationContext(), EventsActivity.class);
		Bundle extras = getIntent().getExtras();
		if (extras != null) {
			intent.putExtras(extras);
		}

		startActivity(intent);
		finish();
	}

	public void exit(View view) {
		application.onLogout(true, new MageApplication.OnLogoutListener() {
			@Override
			public void onLogout() {
				startActivity(new Intent(getApplicationContext(), LoginActivity.class));
				finish();
			}
		});
	}

	@Override
	public void onBackPressed() {
	}
}
{'fraction_non_alphanumeric': 0.10487941671340438, 'fraction_numerical': 0.0001869508319312021, 'mean_word_length': 6.2888283378746594, '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': '1220444', 'n_tokens_mistral': 1659, 'n_tokens_neox': 1504, 'n_words': 262}