From a4d8c0f8981eff1462deaa02cffad0ef3f1de34d Mon Sep 17 00:00:00 2001 From: Georg Lukas Date: Sat, 21 May 2011 01:31:37 +0200 Subject: [PATCH] commit the chooser activity --- src/APRSdroid.scala | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/APRSdroid.scala diff --git a/src/APRSdroid.scala b/src/APRSdroid.scala new file mode 100644 index 0000000..9851997 --- /dev/null +++ b/src/APRSdroid.scala @@ -0,0 +1,25 @@ +package org.aprsdroid.app + +import _root_.android.app.Activity +import _root_.android.content.Intent +import _root_.android.os.Bundle +import _root_.android.preference.PreferenceManager + +class APRSdroid extends Activity { + def replaceAct(act : Class[_]) { + val i = new Intent(this, act) + i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) + startActivity(i) + finish() + } + + override def onCreate(savedInstanceState : Bundle) { + super.onCreate(savedInstanceState) + val prefs = PreferenceManager.getDefaultSharedPreferences(this) + prefs.getString("activity", "log") match { + case "hub" => replaceAct(classOf[HubActivity]) + case "map" => replaceAct(classOf[MapAct]) + case _ => replaceAct(classOf[LogActivity]) + } + } +}