check minimum update interval

remotes/nogy/http_proxy_broken
Georg Lukas 2010-03-07 23:47:13 +01:00
rodzic 3247b9c570
commit e676ce6bd2
2 zmienionych plików z 13 dodań i 4 usunięć

Wyświetl plik

@ -4,6 +4,7 @@
<!-- APRSdroid activity --> <!-- APRSdroid activity -->
<string name="firstrun">You need to configure APRSdroid with your callsign and passcode!</string> <string name="firstrun">You need to configure APRSdroid with your callsign and passcode!</string>
<string name="wrongpasscode">Your passcode does not match your callsign!</string> <string name="wrongpasscode">Your passcode does not match your callsign!</string>
<string name="mininterval">Minimum update time is 1 minute!</string>
<string name="singlelog">Single Shot</string> <string name="singlelog">Single Shot</string>
<string name="startlog">Start Logging</string> <string name="startlog">Start Logging</string>
<string name="stoplog">Stop Logging</string> <string name="stoplog">Stop Logging</string>

Wyświetl plik

@ -102,18 +102,26 @@ class APRSdroid extends Activity with OnClickListener
true true
} }
def openPrefs(toastId : Int) {
startActivity(new Intent(this, classOf[PrefsAct]));
Toast.makeText(this, toastId, Toast.LENGTH_SHORT).show()
}
def checkConfig() : Boolean = { def checkConfig() : Boolean = {
val callsign = prefs.getString("callsign", "") val callsign = prefs.getString("callsign", "")
val passcode = prefs.getString("passcode", "") val passcode = prefs.getString("passcode", "")
if (callsign == "" || passcode == "") { if (callsign == "" || passcode == "") {
startActivity(new Intent(this, classOf[PrefsAct])); openPrefs(R.string.firstrun)
Toast.makeText(this, R.string.firstrun, Toast.LENGTH_SHORT).show()
return false return false
} }
val genpasscode = AprsPacket.passcode(callsign) val genpasscode = AprsPacket.passcode(callsign)
if (passcode != genpasscode.toString()) { if (passcode != genpasscode.toString()) {
startActivity(new Intent(this, classOf[PrefsAct])); openPrefs(R.string.wrongpasscode)
Toast.makeText(this, R.string.wrongpasscode, Toast.LENGTH_SHORT).show() return false
}
val intval = prefs.getString("interval", "10")
if (intval == "" || intval.toInt < 1) {
openPrefs(R.string.mininterval)
return false return false
} }
true true