summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorsjtufs <[email protected]>2013-09-01 07:30:34 +0800
committersjtufs <[email protected]>2013-09-01 07:30:34 +0800
commit46dad6a4660d968a4806b108659fad1e43548294 (patch)
treea4ba97ce7f690ce5dfebab3051eeace86e50c8c3 /client
parent49d2e9d74fbf95e5b287dc8e9179e8d3d977a527 (diff)
update, close to deadline
Diffstat (limited to 'client')
-rw-r--r--client/Piztor/res/layout/activity_settings.xml61
-rw-r--r--client/Piztor/res/values/strings.xml7
-rw-r--r--client/Piztor/src/com/macaroon/piztor/AlertMaker.java33
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Main.java7
-rw-r--r--client/Piztor/src/com/macaroon/piztor/MapMaker.java48
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Settings.java36
-rw-r--r--client/Piztor/src/com/macaroon/piztor/myApp.java2
7 files changed, 154 insertions, 40 deletions
diff --git a/client/Piztor/res/layout/activity_settings.xml b/client/Piztor/res/layout/activity_settings.xml
index e1712aa..36bacf3 100644
--- a/client/Piztor/res/layout/activity_settings.xml
+++ b/client/Piztor/res/layout/activity_settings.xml
@@ -87,24 +87,22 @@
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:background="#ffc0c3c4" />
-
- <TextView
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:layout_gravity="center"
- android:gravity="center"
- android:textSize="30dip"
- android:textColor="@android:color/white"
- android:text="@string/subscribe_info"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
- android:layout_marginTop="20dip"
- android:layout_marginLeft="20dip"
- android:layout_marginRight="20dip"
+ android:layout_marginTop="10dip"
android:orientation="horizontal">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center"
+ android:textSize="30dip"
+ android:textColor="@android:color/white"
+ android:text="@string/subscribe_info"/>
+
<Button
android:id="@+id/settings_btn_subscribe"
android:layout_width="wrap_content"
@@ -123,6 +121,45 @@
android:layout_marginRight="20dip"
android:background="#ffc0c3c4" />
<LinearLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center"
+ android:gravity="center">
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textSize="20dip"
+ android:text="@string/colormode"
+ android:textColor="#FFFFFF"/>
+ <RadioGroup
+ android:id="@+id/radioGroup"
+ android:contentDescription="@string/colormode"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="10dip"
+ android:orientation="horizontal">
+ <RadioButton
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/show_by_team"
+ android:text="@string/show_team"
+ android:checked="true"/>
+ <RadioButton
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:id="@+id/show_by_sex"
+ android:text="@string/show_sex"/>
+ </RadioGroup>
+ </LinearLayout>
+ <View
+ android:layout_width="fill_parent"
+ android:layout_height="1.0px"
+ android:layout_marginTop="20dip"
+ android:layout_marginBottom="20dip"
+ android:layout_marginLeft="20dip"
+ android:layout_marginRight="20dip"
+ android:background="#ffc0c3c4" />
+ <LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dip"
diff --git a/client/Piztor/res/values/strings.xml b/client/Piztor/res/values/strings.xml
index 7cf728c..82132ed 100644
--- a/client/Piztor/res/values/strings.xml
+++ b/client/Piztor/res/values/strings.xml
@@ -9,10 +9,10 @@
<string name="fetch">获取</string>
<string name="checkin">签到</string>
<string name="focus">聚焦</string>
- <string name="show_sex">Show sex: </string>
+ <string name="show_sex">按性别</string>
<string name="male">Male</string>
<string name="female">Female</string>
- <string name="show_team">Show team: </string>
+ <string name="show_team">按班级</string>
<string name="all">All</string>
<string name="mine">Mine</string>
<string name="title_activity_login">Login</string>
@@ -34,9 +34,10 @@
<string name="company">连队</string>
<string name="section">班级</string>
<string name="add">添加</string>
- <string name="GPSrefreshrate">GPS刷新率</string>
+ <string name="GPSrefreshrate">GPS刷新率 每</string>
<string name="old_password">旧密码</string>
<string name="new_password">新密码</string>
<string name="submit">提交</string>
+ <string name="colormode">着色方式</string>
</resources>
diff --git a/client/Piztor/src/com/macaroon/piztor/AlertMaker.java b/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
index bc8e138..b1087a2 100644
--- a/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
+++ b/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
@@ -1,5 +1,6 @@
package com.macaroon.piztor;
+import java.io.Closeable;
import java.util.Calendar;
import java.util.Timer;
import java.util.TimerTask;
@@ -87,18 +88,33 @@ public class AlertMaker {
});
gpsDialog.show();
}
+
+ public void showLateAlert() {
+
+ closeBoard(context);
+ AlertDialog.Builder lateDialog = new AlertDialog.Builder(context);
+ lateDialog.setTitle("阿哦");
+ lateDialog.setMessage("你迟到了!");
+ lateDialog.setNeutralButton("知道了", new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface arg0, int arg1) {
+ arg0.cancel();
+ }
+ });
+ lateDialog.show();
+ closeBoard(context);
+ }
public long toTimestamp(int hour, int minute) {
+
calendar = Calendar.getInstance();
- int nhour = calendar.get(Calendar.HOUR_OF_DAY);
- int nminute = calendar.get(Calendar.MINUTE);
- int tmp = 0;
- if (hour > nhour) tmp = (hour - nhour) * 60 + minute - nminute;
- else if (minute > nminute) tmp = minute - nminute;
- timestamp = System.currentTimeMillis() + tmp * 60 * 1000;
- return timestamp;
+ calendar.set(calendar.get(Calendar.YEAR),
+ calendar.get(Calendar.MONTH),
+ calendar.get(Calendar.DAY_OF_MONTH),
+ hour,minute);
+ return calendar.getTimeInMillis();
}
-
+
//TODO
public void updateMarkerTime(int hour, int minute) {
Log.d("time", hour + " " + minute);
@@ -141,6 +157,7 @@ public class AlertMaker {
, calendar.get(Calendar.HOUR_OF_DAY)
, calendar.get(Calendar.MINUTE), true);
markerDialog.show();
+ closeBoard(context);
}
public void showCheckinAlter() {
diff --git a/client/Piztor/src/com/macaroon/piztor/Main.java b/client/Piztor/src/com/macaroon/piztor/Main.java
index 7ac1b21..052e267 100644
--- a/client/Piztor/src/com/macaroon/piztor/Main.java
+++ b/client/Piztor/src/com/macaroon/piztor/Main.java
@@ -40,8 +40,10 @@ public class Main extends PiztorAct {
AlertMaker alertMaker;
GeoPoint markerPoint = null;
private MKMapTouchListener mapTouchListener;
- private final int checkinRadius = 10;
-
+ public static int colorMode = 1;
+ public static int show_by_team = 1;
+ public static int show_by_sex = 2;
+
/**
* Locating component
*/
@@ -52,6 +54,7 @@ public class Main extends PiztorAct {
public MyLocationListener myListener = new MyLocationListener();
boolean isFirstLocation = true;
public static int GPSrefreshrate = 5;
+ private final int checkinRadius = 10;
ImageButton btnCheckin, btnFetch, btnFocus, btnSettings;
diff --git a/client/Piztor/src/com/macaroon/piztor/MapMaker.java b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
index d3699c3..967a34d 100644
--- a/client/Piztor/src/com/macaroon/piztor/MapMaker.java
+++ b/client/Piztor/src/com/macaroon/piztor/MapMaker.java
@@ -12,6 +12,7 @@ import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.location.LocationManager;
import android.util.Log;
+import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
@@ -80,7 +81,7 @@ public class MapMaker {
boolean isGPSEnabled;
private int[] myIcons;
private Drawable[] myBM;
- private final int iconNum = 4;
+ private final int iconNum = 9;
myApp app;
@@ -275,17 +276,25 @@ public class MapMaker {
public void initMyIcons() {
myBM[0] = context.getResources().getDrawable(R.drawable.circle_blue);
- myBM[1] = context.getResources().getDrawable(R.drawable.circle_green);
+ myBM[1] = context.getResources().getDrawable(R.drawable.circle_red);
myBM[2] = context.getResources().getDrawable(R.drawable.circle_glass);
myBM[3] = context.getResources().getDrawable(R.drawable.circle_yellow);
myBM[4] = context.getResources().getDrawable(R.drawable.circle_wood);
+ myBM[5] = context.getResources().getDrawable(R.drawable.circle_green);
+ myBM[6] = context.getResources().getDrawable(R.drawable.circle_metal);
+ myBM[7] = context.getResources().getDrawable(R.drawable.circle_paper);
+ myBM[8] = context.getResources().getDrawable(R.drawable.circle_tan);
}
- public Drawable getGroupIcon(int gid) {
- if (gid == preMapInfo.myInfo.section)
- return myBM[0];
- else
- return myBM[gid % iconNum];
+ public Drawable getGroupIcon(UserInfo userInfo) {
+ if (Main.colorMode == Main.show_by_team) {
+ if (userInfo.section == preMapInfo.myInfo.section)
+ return myBM[0];
+ else
+ return myBM[userInfo.section % iconNum + 1];
+ } else {
+ return myBM[userInfo.sex ^ preMapInfo.myInfo.sex];
+ }
}
/**
@@ -293,7 +302,6 @@ public class MapMaker {
*/
public void UpdateLocationOverlay(LocationData locationData,
boolean hasAnimation) {
-
mLocationOverlay.setData(locationData);
mMapView.refresh();
if (hasAnimation) {
@@ -301,6 +309,7 @@ public class MapMaker {
(int) (locationData.latitude * 1E6),
(int) (locationData.longitude * 1E6)));
}
+ checkMarkerTime();
}
boolean isInvalidLocation(GeoPoint point) {
@@ -315,7 +324,6 @@ public class MapMaker {
* Update to draw other users
*/
public void UpdateMap(MapInfo mapInfo) {
-
if (mapInfo == null) {
if (mOverlay != null && mOverlay.getAllItem().size() != 0) {
mOverlay.removeAll();
@@ -355,7 +363,7 @@ public class MapMaker {
"USER_SNIPPET_HERE");
// TODO getDrawable
// /////////////////////////////
- curItem.setMarker(getGroupIcon(i.section));
+ curItem.setMarker(getGroupIcon(i));
mOverlay.addItem(curItem);
hash.put(i.uid, curItem);
markerToInt.put(curItem, i.uid);
@@ -375,8 +383,9 @@ public class MapMaker {
if (mMapView != null) {
mMapView.refresh();
}
+ checkMarkerTime();
}
-
+
@SuppressWarnings("deprecation")
public void receiveMarker(MarkerInfo markerInfo) {
Log.d("marker", "Marker received!");
@@ -395,6 +404,9 @@ public class MapMaker {
mOverlay.updateItem(nowMarker);
mMapView.refresh();
mMapController.animateTo(markerInfo.markerPoint);
+ Toast toast = Toast.makeText(context,"收到新路标,集合时间:" + nowMarkerHour + ":" + nowMarkerMinute, 5000);
+ toast.setGravity(Gravity.TOP, 0, 80);
+ toast.show();
return;
}
if (nowMarker == null) {
@@ -417,6 +429,9 @@ public class MapMaker {
mOverlay.addItem(nowMarker);
mMapView.refresh();
mMapController.animateTo(markerInfo.markerPoint);
+ Toast toast = Toast.makeText(context,"收到新路标,集合时间:" + nowMarkerHour + ":" + nowMarkerMinute, 5000);
+ toast.setGravity(Gravity.TOP, 0, 80);
+ toast.show();
return;
}
}
@@ -468,6 +483,9 @@ public class MapMaker {
mMapView.refresh();
mMapController.animateTo(markerPoint);
}
+ Toast toast = Toast.makeText(context,"创建新路标,集合时间:" + nowMarkerHour + ":" + nowMarkerMinute, 5000);
+ toast.setGravity(Gravity.TOP, 0, 80);
+ toast.show();
}
public GeoPoint getMakerLocation() {
@@ -485,6 +503,14 @@ public class MapMaker {
mMapView.refresh();
}
+ public void checkMarkerTime() {
+ if (nowMarker != null && nowMarkerTimestamp <= System.currentTimeMillis()) {
+ AlertMaker lateAlert = new AlertMaker(context, this);
+ lateAlert.showLateAlert();
+ removeMarker();
+ }
+ }
+
/**
* Remove all other users
*/
diff --git a/client/Piztor/src/com/macaroon/piztor/Settings.java b/client/Piztor/src/com/macaroon/piztor/Settings.java
index 8b4a948..14d5b3e 100644
--- a/client/Piztor/src/com/macaroon/piztor/Settings.java
+++ b/client/Piztor/src/com/macaroon/piztor/Settings.java
@@ -13,19 +13,27 @@ import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
+import android.widget.RadioGroup.OnCheckedChangeListener;import android.widget.CompoundButton;
+import android.widget.RadioGroup;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast;
public class Settings extends PiztorAct {
+
+ public final int show_by_team = 1;
+ public final int show_by_sex = 2;
+
Button logout, subscribe, account;
MapInfo mapInfo;
Transam transam;
+ private int currentRate;
+ OnCheckedChangeListener radioButtonListener = null;
+ RadioGroup radioGroup;
+
// Event
final static int logoutButtonPressed = 10;
final static int logoutFailed = 11;
-
- private int currentRate;
static class ReCall extends Handler {
WeakReference<Settings> outerClass;
@@ -175,6 +183,23 @@ public class Settings extends PiztorAct {
actMgr.add(start, logoutButtonPressed, logout);
actMgr.add(logout, logoutFailed, start);
setContentView(R.layout.activity_settings);
+ radioGroup = (RadioGroup)this.findViewById(R.id.radioGroup);
+ if (Main.colorMode == Main.show_by_sex) radioGroup.check(R.id.show_by_sex);
+ else radioGroup.check(R.id.show_by_team);
+ radioButtonListener = new OnCheckedChangeListener() {
+
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ if (checkedId == R.id.show_by_team){
+ setColorMode(show_by_team);
+ }
+ if (checkedId == R.id.show_by_sex){
+ setColorMode(show_by_sex);
+ }
+ }
+ };
+ radioGroup.setOnCheckedChangeListener(radioButtonListener);
+
}
@Override
@@ -212,12 +237,17 @@ public class Settings extends PiztorAct {
private void initGPSrate() {
currentRate = Main.GPSrefreshrate;
TextView text1 = (TextView) Settings.this.findViewById(R.id.settings_GPSrefreshrate);
- text1.setText(currentRate + "s each update");
+ text1.setText(currentRate + "s一次更新");
SeekBar bar1 = (SeekBar) Settings.this.findViewById(R.id.settings_GPSrefreshrate_bar);
bar1.setProgress(currentRate);
bar1.setOnSeekBarChangeListener(new mySeekBarListener());
}
+ private void setColorMode(int colorMode) {
+ Main.colorMode = colorMode;
+ Log.d("color", "switch to " + colorMode);
+ }
+
@Override
protected void onDestroy() {
setGPSrate();
diff --git a/client/Piztor/src/com/macaroon/piztor/myApp.java b/client/Piztor/src/com/macaroon/piztor/myApp.java
index ef99a3b..ab38efa 100644
--- a/client/Piztor/src/com/macaroon/piztor/myApp.java
+++ b/client/Piztor/src/com/macaroon/piztor/myApp.java
@@ -10,7 +10,7 @@ import android.util.Log;
@SuppressLint("UseSparseArrays")
public class myApp extends Application {
- private static final String strKey = "E612ee541946c90d7b9add0347c9e601";
+ private static final String strKey = "8a0ae50048d103b2b8b12b7066f4ea7d";
BMapManager mBMapManager;
boolean isExiting = false;
boolean isLogout = false;