summaryrefslogtreecommitdiff
path: root/client/Piztor/src/com
diff options
context:
space:
mode:
authorTeddy <[email protected]>2013-09-02 14:38:42 +0800
committerTeddy <[email protected]>2013-09-02 14:38:42 +0800
commit3338d7b86c0bdfe60696ee3eef833658ace519ea (patch)
treeb8fe38beba86abcd3034eed806f6f104076876bd /client/Piztor/src/com
parentd017fb4ca8c9a5d0b6c5533f2549d13aa224e623 (diff)
.
Diffstat (limited to 'client/Piztor/src/com')
-rw-r--r--client/Piztor/src/com/macaroon/piztor/AlertMaker.java1
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Login.java12
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Main.java9
-rw-r--r--client/Piztor/src/com/macaroon/piztor/Settings.java46
-rw-r--r--client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java2
5 files changed, 53 insertions, 17 deletions
diff --git a/client/Piztor/src/com/macaroon/piztor/AlertMaker.java b/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
index 16e15db..0ee1bd9 100644
--- a/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
+++ b/client/Piztor/src/com/macaroon/piztor/AlertMaker.java
@@ -84,6 +84,7 @@ public class AlertMaker {
gpsDialog.setNegativeButton("不使用GPS",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
+ Main.locateMode = LocationClientOption.NetWorkFirst;
dialog.cancel();
}
});
diff --git a/client/Piztor/src/com/macaroon/piztor/Login.java b/client/Piztor/src/com/macaroon/piztor/Login.java
index 22c8c91..a359c6a 100644
--- a/client/Piztor/src/com/macaroon/piztor/Login.java
+++ b/client/Piztor/src/com/macaroon/piztor/Login.java
@@ -9,8 +9,10 @@ import android.view.KeyEvent;
import android.view.Menu;
import android.view.View;
import android.view.Window;
+import android.view.animation.AlphaAnimation;
import android.widget.Button;
import android.widget.EditText;
+import android.widget.ImageView;
import android.widget.Toast;
public class Login extends PiztorAct {
@@ -87,11 +89,13 @@ public class Login extends PiztorAct {
protected void onCreate(Bundle savedInstanceState) {
id = "login";
super.onCreate(savedInstanceState);
- requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
- requestWindowFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.activity_login);
- setProgressBarIndeterminateVisibility(true);
- setProgressBarVisibility(true);
+ ImageView imageView = (ImageView) findViewById(R.id.login_img);
+ AlphaAnimation alphaUp = new AlphaAnimation(0.0f, 1.0f);
+ alphaUp.setDuration(2000);
+ alphaUp.setStartOffset(500);
+ alphaUp.setFillAfter(true);
+ imageView.startAnimation(alphaUp);
}
@Override
diff --git a/client/Piztor/src/com/macaroon/piztor/Main.java b/client/Piztor/src/com/macaroon/piztor/Main.java
index 98b08a0..c6eb747 100644
--- a/client/Piztor/src/com/macaroon/piztor/Main.java
+++ b/client/Piztor/src/com/macaroon/piztor/Main.java
@@ -36,7 +36,7 @@ public class Main extends PiztorAct {
final static int FailedFetch = 5;
final static int mapViewtouched = 7;
- MapMaker mapMaker = null;
+ static MapMaker mapMaker = null;
MapView mMapView;
AlertMaker alertMaker;
GeoPoint markerPoint = null;
@@ -44,11 +44,12 @@ public class Main extends PiztorAct {
public static int colorMode = 1;
public static int show_by_team = 1;
public static int show_by_sex = 2;
+ public static int locateMode = LocationClientOption.GpsFirst;
/**
* Locating component
*/
- LocationManager locationManager;
+ static LocationManager locationManager;
boolean isGPSEnabled;
LocationClient mLocClient;
LocationData locData = null;
@@ -249,7 +250,7 @@ public class Main extends PiztorAct {
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true);
option.setCoorType("bd09ll");
- option.setPriority(LocationClientOption.GpsFirst);
+ option.setPriority(locateMode);
option.setScanSpan(GPSrefreshrate * 1000);
mLocClient.setLocOption(option);
}
@@ -380,7 +381,7 @@ public class Main extends PiztorAct {
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true);
- option.setPriority(LocationClientOption.GpsFirst);
+ option.setPriority(locateMode);
option.setCoorType("bd09ll");
option.setScanSpan(GPSrefreshrate * 1000);
mLocClient.setLocOption(option);
diff --git a/client/Piztor/src/com/macaroon/piztor/Settings.java b/client/Piztor/src/com/macaroon/piztor/Settings.java
index 276d4f6..e3a098c 100644
--- a/client/Piztor/src/com/macaroon/piztor/Settings.java
+++ b/client/Piztor/src/com/macaroon/piztor/Settings.java
@@ -3,6 +3,7 @@ package com.macaroon.piztor;
import java.lang.ref.WeakReference;
import java.util.Vector;
+import com.baidu.location.LocationClientOption;
import com.baidu.platform.comapi.basestruct.GeoPoint;
import android.annotation.SuppressLint;
@@ -28,8 +29,10 @@ public class Settings extends PiztorAct {
MapInfo mapInfo;
Transam transam;
private int currentRate;
- OnCheckedChangeListener radioButtonListener = null;
- RadioGroup radioGroup;
+ OnCheckedChangeListener colorButtonListener = null;
+ OnCheckedChangeListener locateButtonListener = null;
+ static RadioGroup colorRadioGroup;
+ static RadioGroup locateRadioGroup;
// Event
final static int logoutButtonPressed = 10;
@@ -183,10 +186,10 @@ 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() {
+ colorRadioGroup = (RadioGroup)this.findViewById(R.id.colorRadioGroup);
+ if (Main.colorMode == Main.show_by_sex) colorRadioGroup.check(R.id.show_by_sex);
+ else colorRadioGroup.check(R.id.show_by_team);
+ colorButtonListener = new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
@@ -199,8 +202,35 @@ public class Settings extends PiztorAct {
}
}
};
- radioGroup.setOnCheckedChangeListener(radioButtonListener);
-
+ colorRadioGroup.setOnCheckedChangeListener(colorButtonListener);
+
+ locateRadioGroup = (RadioGroup)this.findViewById(R.id.locateRadioGroup);
+ if (Main.locateMode == LocationClientOption.GpsFirst) locateRadioGroup.check(R.id.gps_first);
+ else locateRadioGroup.check(R.id.network_first);
+ locateButtonListener = new OnCheckedChangeListener() {
+
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ if (checkedId == R.id.gps_first){
+ boolean isGPSEnabled = Main.locationManager
+ .isProviderEnabled(Main.locationManager.GPS_PROVIDER);
+ if (isGPSEnabled)
+ Main.locateMode = LocationClientOption.GpsFirst;
+ else {
+ AlertMaker alertMaker = new AlertMaker(Settings.this, Main.mapMaker);
+ alertMaker.showSettingsAlert();
+ isGPSEnabled = Main.locationManager
+ .isProviderEnabled(Main.locationManager.GPS_PROVIDER);
+ if (! isGPSEnabled) group.check(R.id.network_first);
+ }
+ }
+ if (checkedId == R.id.network_first){
+ Main.locateMode = LocationClientOption.NetWorkFirst;
+ }
+ }
+ };
+ locateRadioGroup.setOnCheckedChangeListener(locateButtonListener);
+
}
@Override
diff --git a/client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java b/client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java
index ed019dc..d895203 100644
--- a/client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java
+++ b/client/Piztor/src/com/macaroon/piztor/SubscribeSettings.java
@@ -101,7 +101,7 @@ public class SubscribeSettings extends PiztorAct {
EException eException = (EException) m.obj;
/////////////////TODO
if (eException.Etype == EException.ESubscribeFailedException) {
- out.receiveMessage("关注信息无效");
+ out.receiveMessage("关注信息无效,可能暂无此连队或班级信息");
for (RGroup i : out.listGroup) {
Log.d("sub", i.company + " " + i.section);
}