Skip to content

Commit

Permalink
add 'loading...' to map screen
Browse files Browse the repository at this point in the history
  • Loading branch information
ge0rg committed Apr 12, 2011
1 parent 0d7919a commit 8e67571
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
17 changes: 16 additions & 1 deletion mapview.xml.tpl
@@ -1,9 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="@apiKey@"
/>
<TextView
android:id="@+id/loading"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="10sp"
android:textColor="#000"
android:textSize="14sp"
android:text="@string/map_loading"
/>
</FrameLayout>
1 change: 1 addition & 0 deletions res/values/strings.xml
Expand Up @@ -19,6 +19,7 @@
<string name="sta_lastreport">%s Last Report</string>
<string name="map_track_call">Tracking %s...</string>

<string name="map_loading">Loading...</string>

<!-- AprsService -->
<string name="aprsservice">APRSdroid Service</string>
Expand Down
12 changes: 10 additions & 2 deletions src/MapAct.scala
Expand Up @@ -6,6 +6,7 @@ import _root_.android.graphics.{Canvas, Paint, Path, Point, Rect, Typeface}
import _root_.android.os.{Bundle, Handler}
import _root_.android.util.Log
import _root_.android.view.{Menu, MenuItem, View}
import _root_.android.widget.TextView
import _root_.com.google.android.maps._
import _root_.scala.collection.mutable.ArrayBuffer
import _root_.java.util.ArrayList
Expand All @@ -22,6 +23,7 @@ class MapAct extends MapActivity {
lazy val allicons = this.getResources().getDrawable(R.drawable.allicons)
lazy val db = StorageDatabase.open(this)
lazy val staoverlay = new StationOverlay(allicons, this, db)
lazy val loading = findViewById(R.id.loading).asInstanceOf[TextView]

var showObjects = false

Expand Down Expand Up @@ -61,6 +63,7 @@ class MapAct extends MapActivity {
case R.id.objects =>
mi.setChecked(!mi.isChecked())
showObjects = mi.isChecked()
loading.setVisibility(View.VISIBLE)
staoverlay.loadDb(showObjects)
mapview.invalidate()
true
Expand Down Expand Up @@ -88,6 +91,12 @@ class MapAct extends MapActivity {
}

}

def onPostLoad() {
loading.setVisibility(View.GONE)
mapview.invalidate()
animateToCall()
}
}

class Station(val movelog : ArrayBuffer[GeoPoint], val point : GeoPoint,
Expand Down Expand Up @@ -262,8 +271,7 @@ class StationOverlay(icons : Drawable, context : MapAct, db : StorageDatabase) e
stations = s
setLastFocusedIndex(-1)
Benchmark("populate") { populate() }
context.mapview.invalidate()
context.animateToCall()
context.onPostLoad()
}
}
}

0 comments on commit 8e67571

Please sign in to comment.