<commit_before>package org.javarosa.demo.util;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Gauge;

import org.javarosa.j2me.log.HandledThread;


public class ProgressScreenFormDownload extends Form{
	
	private Gauge progressbar;
	private Thread updater_T;
	public final Command CMD_CANCEL = new Command("Cancel",Command.BACK, 1);
	public final Command CMD_RETRY = new Command("Retry",Command.ITEM, 1);

	public ProgressScreenFormDownload(String title,String msg,CommandListener cmdListener) {
		super(title);
		//#style loadingGauge
		progressbar = new Gauge(null, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING );

		addCommand(CMD_CANCEL);
		append(progressbar);
		setCommandListener(cmdListener);
		updater_T = new HandledThread(new GaugeUpdater());
		updater_T.start();
	}
	
	public void setText(String text) {
		progressbar.setLabel(text);
	}
	
	public void closeThread(){
		if(updater_T!=null){
			updater_T = null;			
		}
	}
	
	class GaugeUpdater implements Runnable {
		
		public void run() {

			int i = 0;
			while (progressbar.getValue() < progressbar.getMaxValue()) {
				
				try {
					Thread.sleep(500);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
				//i++;
			//	progressbar.setValue(progressbar.getValue()+(i%2)*2);
			}

		}
	}

	
}
	<commit_msg>Merging in Melissa's fixes to the JR-app (starting on a new named branch, commit history wasn't moved over).<commit_after>package org.javarosa.demo.util;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Gauge;

import org.javarosa.j2me.log.HandledThread;


public class ProgressScreenFormDownload extends Form{
	
	private Gauge progressbar;
	private Thread updater_T;
	public final Command CMD_CANCEL = new Command("Cancel",Command.BACK, 1);
	public final Command CMD_RETRY = new Command("Retry",Command.ITEM, 1);

	public ProgressScreenFormDownload(String title,String  msg,CommandListener cmdListener) {
		//#style capturingPopup
		super(title);
		//#style capturingGauge
		progressbar = new Gauge(msg, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING );

		addCommand(CMD_CANCEL);
		append(progressbar);
		setCommandListener(cmdListener);
		
		// TODO if this is ever an incremental progress bar, put this back in?
		// updater_T = new HandledThread(new GaugeUpdater());
		// updater_T.start();
	}
	
	public void setText(String text) {
		progressbar.setLabel(text);
	}
	
	public void stopProgressBar(){
		progressbar.setValue(Gauge.CONTINUOUS_IDLE);
	}
	
	public void startProgressBar(){
		progressbar.setValue(Gauge.CONTINUOUS_RUNNING);
	}
	
	public void closeThread(){
		if(updater_T!=null){
			updater_T = null;			
		}
	}
	
	class GaugeUpdater implements Runnable {
		
		public void run() {

			int i = 0;
			while (progressbar.getValue() < progressbar.getMaxValue()) {
				
				try {
					Thread.sleep(500);
				} catch (InterruptedException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				
				//i++;
			//	progressbar.setValue(progressbar.getValue()+(i%2)*2);
			}

		}
	}

	
}
	
{'fraction_non_alphanumeric': 0.10683012259194395, 'fraction_numerical': 0.005253940455341506, 'mean_word_length': 3.399229781771502, 'pattern_counts': {'":': 0, '<': 5, '<?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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6442571', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1104, 'n_words': 230}