<commit_before>package uk.co.jarofgreen.progressbarthegame;

import java.security.acl.LastOwnerException;

import android.opengl.Visibility;
import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;


/**
 * 
 * @author <NAME> <<EMAIL>>
 * @copyright JMB Technology Limited
 * @license Open Source under the 3-clause BSD License
 * @url https://github.com/jarofgreen/Progress-Bar--The-Game-Android
 *  */
public class GameActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_game);
		progressBar = (ProgressBar)findViewById(R.id.progressBar);
		progressBar.setMax(100);
		handler=new Handler();
		levelTextView = (TextView)findViewById(R.id.level);
		nextLevelButton = (Button)findViewById(R.id.nextLevel);
		startLevel();
	}

	protected int level = 1;
	protected int timePerPercent = 100;
	protected ProgressBar progressBar;
	protected TextView levelTextView;
	protected Button nextLevelButton;
	
	Handler handler;
	final Runnable runnable = new Runnable() {
		public void run() {
			GameActivity.this.addOnePerCent();
		}
	};;
	
	
	protected void startLevel() {
		timePerPercent = level * 75;
		levelTextView.setText("Level "+Integer.toString(level));
		progressBar.setProgress(0);
		handler.postDelayed(runnable, getTimeTillNextPerCent()); 
	}
	
	protected void addOnePerCent() {
		int current = progressBar.getProgress();
		Log.d("CURRENT",Integer.toString(current));
		if (current == 99) {
			Toast.makeText(this, "Congratulations!", Toast.LENGTH_LONG).show();
			progressBar.setProgress(100);
			nextLevelButton.setVisibility(View.VISIBLE);
		} else {
			progressBar.setProgress(current+1);
			handler.postDelayed(runnable, getTimeTillNextPerCent()); 
		}
	}
	
	protected int getTimeTillNextPerCent() {
		return timePerPercent;
	}
	
	public void nextLevel(View v) {
		nextLevelButton.setVisibility(View.INVISIBLE);
		level = level + 1;
		startLevel();
	}
}<commit_msg>Random time<commit_after>package uk.co.jarofgreen.progressbarthegame;

import java.security.acl.LastOwnerException;
import java.util.Random;

import android.opengl.Visibility;
import android.os.Bundle;
import android.os.Handler;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;


/**
 * 
 * @author <NAME> <<EMAIL>>
 * @copyright JMB Technology Limited
 * @license Open Source under the 3-clause BSD License
 * @url https://github.com/jarofgreen/Progress-Bar--The-Game-Android
 *  */
public class GameActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_game);
		progressBar = (ProgressBar)findViewById(R.id.progressBar);
		progressBar.setMax(100);
		handler=new Handler();
		levelTextView = (TextView)findViewById(R.id.level);
		nextLevelButton = (Button)findViewById(R.id.nextLevel);
		randomGenerator = new Random();
		startLevel();
	}

	protected int level = 1;
	protected int timePerPercent = 100;
	protected int randomTimePerPercent = 100;
	protected ProgressBar progressBar;
	protected TextView levelTextView;
	protected Button nextLevelButton;
	private Random randomGenerator;
	
	Handler handler;
	final Runnable runnable = new Runnable() {
		public void run() {
			GameActivity.this.addOnePerCent();
		}
	};;
	
	
	protected void startLevel() {
		timePerPercent = level * 75;
		randomTimePerPercent = level * 30;
		levelTextView.setText("Level "+Integer.toString(level));
		progressBar.setProgress(0);
		handler.postDelayed(runnable, getTimeTillNextPerCent()); 
	}
	
	protected void addOnePerCent() {
		int current = progressBar.getProgress();
		Log.d("CURRENT",Integer.toString(current));
		if (current == 99) {
			Toast.makeText(this, "Congratulations!", Toast.LENGTH_LONG).show();
			progressBar.setProgress(100);
			nextLevelButton.setVisibility(View.VISIBLE);
		} else {
			progressBar.setProgress(current+1);
			handler.postDelayed(runnable, getTimeTillNextPerCent()); 
		}
	}
	
	protected int getTimeTillNextPerCent() {
		if (randomGenerator.nextBoolean()) {
			return timePerPercent + randomGenerator.nextInt(randomTimePerPercent);
		} else {
			return timePerPercent - randomGenerator.nextInt(randomTimePerPercent);
		}
	}
	
	public void nextLevel(View v) {
		nextLevelButton.setVisibility(View.INVISIBLE);
		level = level + 1;
		startLevel();
	}
}
{'fraction_non_alphanumeric': 0.11576303119112413, 'fraction_numerical': 0.008582792547624032, 'mean_word_length': 5.205194805194806, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '2559212', 'n_tokens_mistral': 1614, 'n_tokens_neox': 1433, 'n_words': 297}