summaryrefslogtreecommitdiff
path: root/client/Piztor
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-08-30 14:21:23 +0800
committerTeddy <[email protected]>2013-08-30 14:21:23 +0800
commita719efa4bc6718c7dbd5bce50e202fe05698f124 (patch)
tree1703847876bd529091aed17b826ff0dd2b349c27 /client/Piztor
parent1f9ffa4a59a5f84cbbfadee4d5407b82b8224b5f (diff)
parent3701f57f7faa5d9cb78259205f40a29ea1dbddfa (diff)
Merge branch 'master' of github.com:Determinant/piztor
Diffstat (limited to 'client/Piztor')
-rw-r--r--client/Piztor/res/layout/activity_settings.xml261
-rw-r--r--client/Piztor/src/com/macaroon/piztor/MapMaker.java59
2 files changed, 170 insertions, 150 deletions
diff --git a/client/Piztor/res/layout/activity_settings.xml b/client/Piztor/res/layout/activity_settings.xml
index 3080be0..865cbc6 100644
--- a/client/Piztor/res/layout/activity_settings.xml
+++ b/client/Piztor/res/layout/activity_settings.xml
@@ -1,26 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:background="@android:color/black"
- android:orientation="horizontal" >
-
- <RelativeLayout
- android:id="@+id/settings_headbar_layout"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentTop="true" >
-
- <include layout="@layout/settings_headbar" />
- </RelativeLayout>
-
- <LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="match_parent"
- android:layout_marginTop="48dip"
- android:orientation="vertical" >
-
- <TextView
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content" >
+
+ <LinearLayout
+
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:orientation="vertical" >
+
+ <include layout="@layout/settings_headbar"></include>
+
+ <TextView
android:id="@+id/settings_GPSrefreshrate_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -33,134 +24,108 @@
<SeekBar
android:id="@+id/settings_GPSrefreshrate"
android:layout_width="match_parent"
- android:layout_height="wrap_content" />
-
- <!--
- LinearLayout
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:orientation="horizontal"
- -->
- <!--
- TextView
- android:id="@+id/GPS_min_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentLeft="true"
- android:layout_marginLeft="10dip"
- android:text="1s"
- android:textSize="10dip"
- android:textColor="@android:color/white"/
- -->
-
-
- <!--
- TextView
- android:id="@+id/GPS_max_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_alignParentRight="true"
- android:text="30s"
- android:textColor="@android:color/white"
- android:textSize="10dip" /
- -->
-
-
- <!-- /LinearLayout -->
- <!-- end of gps text -->
-
- <View
- android:layout_width="fill_parent"
- android:layout_height="1.0px"
- android:layout_marginLeft="1.0px"
- android:layout_marginRight="1.0px"
- android:background="#ffc0c3c4" />
-
- <LinearLayout
- android:id="@+id/settings_sex_layout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_marginTop="50dip"
- >
-
- <TextView
- android:id="@+id/settings_sex_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dip"
- android:text="@string/show_sex"
- android:textColor="@android:color/white"
- android:textSize="20dip" />
-
- <CheckBox
- android:id="@+id/settings_show_male"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/male"
- android:textColor="@android:color/white" />
-
- <CheckBox
- android:id="@+id/settings_show_female"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/female"
- android:textColor="@android:color/white" />
- </LinearLayout>
-
- <View
- android:layout_width="fill_parent"
- android:layout_height="1.0px"
- android:layout_marginLeft="1.0px"
- android:layout_marginRight="1.0px"
- android:background="#ffc0c3c4" />
-
- <LinearLayout
- android:id="@+id/settings_team_layout"
- android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_marginTop="50dip" >
-
- <TextView
- android:id="@+id/settings_team_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dip"
- android:text="@string/show_team"
- android:textColor="@android:color/white"
- android:textSize="20dip" />
-
- <RadioButton
- android:id="@+id/settings_team_mine"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/mine"
- android:textColor="@android:color/white"
- android:textSize="20dip" />
-
- <RadioButton
- android:id="@+id/settings_team_all"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/all"
- android:textColor="@android:color/white"
- android:textSize="20dip" />
- </LinearLayout>
-
+ android:layout_marginLeft="40px"
+ android:layout_marginRight="40px" />
+
<View
android:layout_width="fill_parent"
android:layout_height="1.0px"
- android:layout_marginLeft="1.0px"
- android:layout_marginRight="1.0px"
+ android:layout_marginTop="40px"
+ android:layout_marginBottom="40px"
+ android:layout_marginLeft="20.0px"
+ android:layout_marginRight="20.0px"
android:background="#ffc0c3c4" />
-
- <Button
- android:id="@+id/settings_btn_logout"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="0.00"
- android:layout_marginTop="100dip"
- android:text="Logout" />
-
- </LinearLayout>
-
- </RelativeLayout>
+
+ <Button
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 2" />
+
+ <Button
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 3" />
+
+ <Button
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 4" />
+
+ <Button
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 5" />
+
+ <ProgressBar
+ android:id="@+id/progressBar1"
+ style="?android:attr/progressBarStyleHorizontal"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <RadioButton
+ android:id="@+id/radioButton2"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="RadioButton 1" />
+
+ <RadioButton
+ android:id="@+id/radioButton1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="RadioButton 2" />
+
+ <ToggleButton
+ android:id="@+id/toggleButton1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="ToggleButton" />
+
+ <Button
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 6" />
+
+ <SeekBar
+ android:id="@+id/seekBar1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
+
+ <Button
+ android:id="@+id/button3"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 7" />
+
+ <Button
+ android:id="@+id/button4"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 8" />
+
+ <CheckBox
+ android:id="@+id/checkBox1"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:text="CheckBox" />
+
+ <Button
+ android:id="@+id/button2"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 9" />
+
+ <Button
+ android:id="@+id/button1"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 10" />
+
+ <Button
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="Button 11"
+ android:id="@+id/settings_btn_logout" />
+ </LinearLayout>
+
+</ScrollView> \ No newline at end of file
diff --git a/client/Piztor/src/com/macaroon/piztor/MapMaker.java b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
index bf34d7d..0469702 100644
--- a/client/Piztor/src/com/macaroon/piztor/MapMaker.java
+++ b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
@@ -1,6 +1,7 @@
package com.macaroon.piztor;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.Timer;
import java.util.TimerTask;
import java.util.Vector;
@@ -78,7 +79,9 @@ public class MapMaker extends Activity {
private ArrayList<OverlayItem> mItems = null;
private MapInfo preMapInfo = null;
private MapInfo nowMapInfo = null;
-
+ private Vector<UserInfo> freshManInfo = null;
+ // hash from uid to overlay item
+ private HashMap<Integer, OverlayItem> hash = null;
// marker layer
private MyOverlay markerOverlay;
@@ -223,7 +226,9 @@ public class MapMaker extends Activity {
//TODO
/////////////////////////////////////////////////////////////////
+ hash = new HashMap<Integer, OverlayItem>();
mOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.circle_red), mMapView);
+ mMapView.getOverlays().add(mOverlay);
markerOverlay = new MyOverlay(context.getResources().getDrawable(R.drawable.marker1), mMapView);
}
@@ -295,6 +300,7 @@ public class MapMaker extends Activity {
/**
* Update to draw other users
*/
+ /*
public void UpdateMap(MapInfo mapInfo) {
if (mapInfo != null) {
@@ -325,12 +331,61 @@ public class MapMaker extends Activity {
if (mMapView != null) {
if (mMapView.getOverlays() != null) {
- mMapView.getOverlays().add(mOverlay);
+ //mMapView.getOverlays().add(mOverlay);
mMapView.refresh();
}
}
}
+ */
+
+ public void UpdateMap(MapInfo mapInfo) {
+ if (mapInfo == null) {
+ if (mOverlay != null && mOverlay.getAllItem().size() != 0) {
+ mOverlay.removeAll();
+ }
+ return;
+ }
+ freshManInfo = new Vector<UserInfo>();
+ // first remove all old users that are not here now
+ if (preMapInfo != null) {
+ for (UserInfo i : preMapInfo.getVector()) {
+ if (i.uid == Infomation.myInfo.uid) continue;
+ if (mapInfo.getUserInfo(i.uid) == null) {
+ mOverlay.removeItem(hash.get(i.uid));
+ hash.remove(i.uid);
+ }
+ }
+ }
+ mMapView.refresh();
+
+ // then update and add items
+ for (UserInfo i : mapInfo.getVector()) {
+ if (i.uid == Infomation.myInfo.uid) continue;
+ if (hash.containsKey(i.uid) == false) {
+ GeoPoint p = new GeoPoint((int)(i.getLatitude() * 1E6), (int)(i.getLongitude() * 1E6));
+ curItem = new OverlayItem(p, "USERNAME_HERE", "USER_SNIPPET_HERE");
+ //TODO getDrawable
+ ///////////////////////////////
+ curItem.setMarker(context.getResources().getDrawable(R.drawable.circle_red));
+ mOverlay.addItem(curItem);
+ hash.put(i.uid, curItem);
+ //if (mMapView != null)
+ // mMapView.refresh();
+ } else {
+ GeoPoint p = new GeoPoint((int)(i.getLatitude() * 1E6), (int)(i.getLongitude() * 1E6));
+ curItem = hash.get(i.uid);
+ curItem.setGeoPoint(p);
+ mOverlay.updateItem(curItem);
+ //if (mMapView != null)
+ // mMapView.refresh();
+ }
+ }
+ if (mMapView != null) {
+ mMapView.refresh();
+ }
+ preMapInfo = mapInfo;
+ }
/**