aboutsummaryrefslogtreecommitdiffstats
path: root/src/cgeo/geocaching/cgSearchThread.java
blob: 0cd99ce45430be4ad8938a6a306405a6934cbedf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package cgeo.geocaching;

import android.os.Handler;
import android.util.Log;

public class cgSearchThread extends Thread {
	private Handler recaptchaHandler = null;
	private String recaptchaChallenge = null;
	private String recaptchaText = null;

	public void setRecaptchaHandler(Handler recaptchaHandlerIn) {
		recaptchaHandler = recaptchaHandlerIn;
	}

	public void notifyNeed() {
		if (recaptchaHandler != null) {
			recaptchaHandler.sendEmptyMessage(1);
		}
	}

	public synchronized void waitForUser() {
		try {
			wait();
		} catch (InterruptedException e) {
			Log.w(cgSettings.tag, "searchThread is not waiting for user...");
		}
	}

	public void setChallenge(String challenge) {
		recaptchaChallenge = challenge;
	}

	public String getChallenge() {
		return recaptchaChallenge;
	}

	public synchronized void setText(String text) {
		recaptchaText = text;

		notify();
	}

	public String getText() {
		return recaptchaText;
	}
}