|
|
@@ -21,7 +21,6 @@ import android.provider.MediaStore;
|
|
|
import android.support.v7.app.AppCompatActivity;
|
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
|
-import android.view.KeyEvent;
|
|
|
import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
|
@@ -40,7 +39,6 @@ import com.usai.util.MD5;
|
|
|
import com.usai.util.Network;
|
|
|
import com.usai.util.RAUtil;
|
|
|
import com.usai.util.dbUtil;
|
|
|
-import com.usai.util.dbgUtil;
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
import java.io.File;
|
|
|
@@ -48,7 +46,6 @@ import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
-import java.io.InputStream;
|
|
|
import java.io.Serializable;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
@@ -120,7 +117,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
new AlertDialog.Builder(MainActivity.this)
|
|
|
.setTitle("Warning")
|
|
|
.setMessage(msg)
|
|
|
- .setPositiveButton("YES", new DialogInterface.OnClickListener() {
|
|
|
+ .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
@@ -202,9 +199,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
{
|
|
|
Log.d(TAG, "==============>Click Scan button");
|
|
|
|
|
|
- if (!RAUtil.checkPermission(MainActivity.this,"android.permission.CAMERA")) {
|
|
|
- return;
|
|
|
- }
|
|
|
+//®
|
|
|
|
|
|
Intent intent = new Intent();
|
|
|
|
|
|
@@ -231,32 +226,36 @@ public class MainActivity extends AppCompatActivity
|
|
|
{
|
|
|
if (TextUtils.isEmpty(pidval.getText().toString())) {
|
|
|
String barcode_title = "PIID";
|
|
|
- if (this.getClass().equals(ModelActivity.class)) { // model
|
|
|
+ if (MainActivity.this.getClass().equals(ModelActivity.class)) { // model
|
|
|
barcode_title = "Model";
|
|
|
}
|
|
|
showWarning(barcode_title + " can not be blank!");
|
|
|
return;
|
|
|
}
|
|
|
+ if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
+ if (TextUtils.isEmpty(manufacture)) {
|
|
|
+ showWarning("manufacture can not be blank!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if (photoList.size() < 1) {
|
|
|
showWarning("You must take at least one photo");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (this.getClass().equals(ModelActivity.class)) { // model
|
|
|
- if (TextUtils.isEmpty(manufacture)) {
|
|
|
- showWarning("Manufacturer does not set.");
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
try {
|
|
|
|
|
|
Intent intent = new Intent("REDANT.RAImage.ADD_TASK");
|
|
|
|
|
|
ArrayList<Bundle> taskArr = new ArrayList<Bundle>();
|
|
|
String name = "POP";
|
|
|
- if (this.getClass().equals(ModelActivity.class)) {
|
|
|
+
|
|
|
+// if(MainActivity.this instanceof ModelActivity)
|
|
|
+// name=name = "Model";
|
|
|
+ if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
name = "Model";
|
|
|
}
|
|
|
for (String path : photoList) {
|
|
|
@@ -279,8 +278,9 @@ public class MainActivity extends AppCompatActivity
|
|
|
params.putString("platform","android");
|
|
|
params.putString("md5",md5);
|
|
|
|
|
|
- // model
|
|
|
- if (this.getClass().equals(ModelActivity.class)) {
|
|
|
+
|
|
|
+ if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
+
|
|
|
if (!TextUtils.isEmpty(manufacture)) {
|
|
|
params.putString("manufacturer",manufacture);
|
|
|
}
|
|
|
@@ -297,6 +297,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
intent.putParcelableArrayListExtra("tasks",taskArr);
|
|
|
|
|
|
sendBroadcast(intent);
|
|
|
+ clearfornew();
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -447,9 +448,9 @@ public class MainActivity extends AppCompatActivity
|
|
|
private void StartCamera()
|
|
|
{
|
|
|
|
|
|
- if (!RAUtil.checkPermission(this,"android.permission.CAMERA")) {
|
|
|
- return;
|
|
|
- }
|
|
|
+// if (!RAUtil.checkPermission(this,"android.permission.CAMERA")) {
|
|
|
+// return;
|
|
|
+// }
|
|
|
|
|
|
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
|
|
// Ensure that there's a camera activity to handle the intent
|
|
|
@@ -507,18 +508,18 @@ public class MainActivity extends AppCompatActivity
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
- public boolean onKeyDown(int keyCode, KeyEvent event)
|
|
|
- {
|
|
|
- if (keyCode == KeyEvent.KEYCODE_BACK)
|
|
|
- {
|
|
|
- dbgUtil.fileLog("back button click , clear&exit");
|
|
|
- clear();
|
|
|
-
|
|
|
- }
|
|
|
- return super.onKeyDown(keyCode, event);
|
|
|
-
|
|
|
- }
|
|
|
+// @Override
|
|
|
+// public boolean onKeyDown(int keyCode, KeyEvent event)
|
|
|
+// {
|
|
|
+// if (keyCode == KeyEvent.KEYCODE_BACK)
|
|
|
+// {
|
|
|
+// dbgUtil.fileLog("back button click , clear&exit");
|
|
|
+// clear();
|
|
|
+//
|
|
|
+// }
|
|
|
+// return super.onKeyDown(keyCode, event);
|
|
|
+//
|
|
|
+// }
|
|
|
|
|
|
@Override
|
|
|
protected void onResume()
|
|
|
@@ -665,6 +666,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
protected void onDestroy()
|
|
|
{
|
|
|
// sendBroadcast(new Intent("REDANT.POP.GPS_OFF"));
|
|
|
+ clear();
|
|
|
Log.d(TAG, "=======================>MainActivity Destroyed!");
|
|
|
unregisterReceiver(MainActivityReceiver);
|
|
|
Log.d(TAG, "=======================>msgFilter unregisted!");
|
|
|
@@ -753,7 +755,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
return;
|
|
|
}
|
|
|
TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
- ImageButton ibtnUpload = (ImageButton) findViewById(R.id.ibtnOk);
|
|
|
+ ImageButton ibtnUpload = (ImageButton) findViewById(R.id.upload_btn);
|
|
|
|
|
|
|
|
|
if (photoList.size() > 0 && pidval.getText().length() > 0)
|
|
|
@@ -944,71 +946,72 @@ public class MainActivity extends AppCompatActivity
|
|
|
}
|
|
|
break;
|
|
|
case android.R.id.home: {
|
|
|
+ clear();
|
|
|
finish();
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
- return true;
|
|
|
- }
|
|
|
- // TODO Auto-generated method stub
|
|
|
- switch (item.getItemId())
|
|
|
- {
|
|
|
- case R.id.action_clear:
|
|
|
- dbgUtil.fileLog("menu item clear click , clear...");
|
|
|
- clear();
|
|
|
- break;
|
|
|
- case R.id.action_type_pid:
|
|
|
- {
|
|
|
- final View edit = new EditText(this);
|
|
|
- new AlertDialog.Builder(this)
|
|
|
- .setIconAttribute(android.R.attr.alertDialogIcon)
|
|
|
- .setTitle(R.string.title_input_pid)
|
|
|
- .setView(edit)
|
|
|
- .setPositiveButton(android.R.string.ok,
|
|
|
- new DialogInterface.OnClickListener()
|
|
|
- {
|
|
|
- public void onClick(DialogInterface dialog,
|
|
|
- int whichButton)
|
|
|
- {
|
|
|
- String pid = ((EditText) edit)
|
|
|
- .getText().toString();
|
|
|
- TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
- pidval.setText(pid);
|
|
|
- updateUploadButton();
|
|
|
-
|
|
|
- /* User clicked OK so do some stuff */
|
|
|
- }
|
|
|
- })
|
|
|
- .setNegativeButton(android.R.string.cancel,
|
|
|
- new DialogInterface.OnClickListener()
|
|
|
- {
|
|
|
- public void onClick(DialogInterface dialog,
|
|
|
- int whichButton)
|
|
|
- {
|
|
|
- updateUploadButton();
|
|
|
- /* User clicked cancel so do some stuff */
|
|
|
- }
|
|
|
- }).create().show();
|
|
|
- }
|
|
|
- break;
|
|
|
- case R.id.action_server_settings:
|
|
|
- {
|
|
|
- Intent intent = new Intent();
|
|
|
- intent.setClass(MainActivity.this, ServerSettingActivity.class);
|
|
|
- startActivity(intent);
|
|
|
-
|
|
|
- }
|
|
|
- break;
|
|
|
- case R.id.action_view_queue:
|
|
|
- {
|
|
|
- Intent intent = new Intent();
|
|
|
- intent.setClass(MainActivity.this, UploadQueueActivity.class);
|
|
|
- startActivity(intent);
|
|
|
- break;
|
|
|
- }
|
|
|
- default:
|
|
|
- break;
|
|
|
+ return super.onOptionsItemSelected(item);
|
|
|
}
|
|
|
+// // TODO Auto-generated method stub
|
|
|
+// switch (item.getItemId())
|
|
|
+// {
|
|
|
+// case R.id.action_clear:
|
|
|
+// dbgUtil.fileLog("menu item clear click , clear...");
|
|
|
+// clear();
|
|
|
+// break;
|
|
|
+// case R.id.action_type_pid:
|
|
|
+// {
|
|
|
+// final View edit = new EditText(this);
|
|
|
+// new AlertDialog.Builder(this)
|
|
|
+// .setIconAttribute(android.R.attr.alertDialogIcon)
|
|
|
+// .setTitle(R.string.title_input_pid)
|
|
|
+// .setView(edit)
|
|
|
+// .setPositiveButton(android.R.string.ok,
|
|
|
+// new DialogInterface.OnClickListener()
|
|
|
+// {
|
|
|
+// public void onClick(DialogInterface dialog,
|
|
|
+// int whichButton)
|
|
|
+// {
|
|
|
+// String pid = ((EditText) edit)
|
|
|
+// .getText().toString();
|
|
|
+// TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
+// pidval.setText(pid);
|
|
|
+// updateUploadButton();
|
|
|
+//
|
|
|
+// /* User clicked OK so do some stuff */
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .setNegativeButton(android.R.string.cancel,
|
|
|
+// new DialogInterface.OnClickListener()
|
|
|
+// {
|
|
|
+// public void onClick(DialogInterface dialog,
|
|
|
+// int whichButton)
|
|
|
+// {
|
|
|
+// updateUploadButton();
|
|
|
+// /* User clicked cancel so do some stuff */
|
|
|
+// }
|
|
|
+// }).create().show();
|
|
|
+// }
|
|
|
+// break;
|
|
|
+// case R.id.action_server_settings:
|
|
|
+// {
|
|
|
+// Intent intent = new Intent();
|
|
|
+// intent.setClass(MainActivity.this, ServerSettingActivity.class);
|
|
|
+// startActivity(intent);
|
|
|
+//
|
|
|
+// }
|
|
|
+// break;
|
|
|
+// case R.id.action_view_queue:
|
|
|
+// {
|
|
|
+// Intent intent = new Intent();
|
|
|
+// intent.setClass(MainActivity.this, UploadQueueActivity.class);
|
|
|
+// startActivity(intent);
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// default:
|
|
|
+// break;
|
|
|
+// }
|
|
|
return super.onOptionsItemSelected(item);
|
|
|
}
|
|
|
|
|
|
@@ -1060,23 +1063,34 @@ public class MainActivity extends AppCompatActivity
|
|
|
return BitmapFactory.decodeByteArray(data, 0, data.length);// ���ֽ��������λͼ
|
|
|
}
|
|
|
|
|
|
- private void clear()
|
|
|
+ @Override
|
|
|
+ public void onBackPressed() {
|
|
|
+ clear();
|
|
|
+ super.onBackPressed();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void clear()
|
|
|
{
|
|
|
for (int i = 0; i < photoList.size(); i++)
|
|
|
{
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- String timeStamp = new SimpleDateFormat("yyyy_MM_dd")
|
|
|
- .format(new Date());
|
|
|
-
|
|
|
- File storageDir = new File(Environment.getExternalStorageDirectory()
|
|
|
- .getPath() + "/redant/pop/clear/"+timeStamp);
|
|
|
-
|
|
|
- if (!storageDir.exists())
|
|
|
- storageDir.mkdirs();
|
|
|
+
|
|
|
+
|
|
|
+//
|
|
|
+//
|
|
|
+// String timeStamp = new SimpleDateFormat("yyyy_MM_dd")
|
|
|
+// .format(new Date());
|
|
|
+//
|
|
|
+// File storageDir = new File(Environment.getExternalStorageDirectory()
|
|
|
+// .getPath() + "/redant/pop/clear/"+timeStamp);
|
|
|
+//
|
|
|
+// if (!storageDir.exists())
|
|
|
+// storageDir.mkdirs();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ new File(photoList.get(i)).delete();
|
|
|
+
|
|
|
|
|
|
// File dir1 = new File(Environment.getExternalStorageDirectory()
|
|
|
// .getPath() + "/redant");
|
|
|
@@ -1085,7 +1099,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
// File dir3 = new File(Environment.getExternalStorageDirectory()
|
|
|
// .getPath() + "/redant/pop/clear");
|
|
|
//
|
|
|
-//
|
|
|
+//
|
|
|
// if (!dir1.exists())
|
|
|
// {
|
|
|
// boolean b = dir1.mkdir();
|
|
|
@@ -1098,20 +1112,20 @@ public class MainActivity extends AppCompatActivity
|
|
|
// {
|
|
|
// boolean b = dir3.mkdir();
|
|
|
// }
|
|
|
-//
|
|
|
+//
|
|
|
// if (!storageDir.exists())
|
|
|
// {
|
|
|
// boolean b = storageDir.mkdir();
|
|
|
// }
|
|
|
-
|
|
|
- File srcFile = new File(photoList.get(i));
|
|
|
- // file.delete();
|
|
|
- dbgUtil.fileLog("move file "+srcFile.getName()+" to "+Environment.getExternalStorageDirectory()
|
|
|
- .getPath() + "/redant/pop/clear/"+timeStamp + File.separator);
|
|
|
- srcFile.renameTo(new File(Environment.getExternalStorageDirectory()
|
|
|
- .getPath() + "/redant/pop/clear/"+timeStamp + File.separator + srcFile.getName()));
|
|
|
-
|
|
|
-
|
|
|
+//
|
|
|
+// File srcFile = new File(photoList.get(i));
|
|
|
+// // file.delete();
|
|
|
+// dbgUtil.fileLog("move file "+srcFile.getName()+" to "+Environment.getExternalStorageDirectory()
|
|
|
+// .getPath() + "/redant/pop/clear/"+timeStamp + File.separator);
|
|
|
+// srcFile.renameTo(new File(Environment.getExternalStorageDirectory()
|
|
|
+// .getPath() + "/redant/pop/clear/"+timeStamp + File.separator + srcFile.getName()));
|
|
|
+//
|
|
|
+
|
|
|
|
|
|
// // Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
|
|
|
// // Log.d(TAG, "DIR:" + storageDir);
|
|
|
@@ -1121,24 +1135,26 @@ public class MainActivity extends AppCompatActivity
|
|
|
// ".jpg", /* suffix */
|
|
|
// storageDir /* directory */
|
|
|
// );
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
|
|
|
- if (newVersion) {
|
|
|
- return;
|
|
|
- // 以下会造成Crash
|
|
|
+
|
|
|
}
|
|
|
+ photoList.clear();
|
|
|
|
|
|
- photoList.clear();
|
|
|
- TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
- pidval.setText("");
|
|
|
- updateUploadButton();
|
|
|
- ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
|
|
|
- thumbsImageView.setImageResource(R.drawable.no_pic);
|
|
|
- thumbBitmap = null;
|
|
|
- TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
- countTextView.setText("no photo");
|
|
|
+
|
|
|
+// if (newVersion) {
|
|
|
+// return;
|
|
|
+// // 以下会造成Crash
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
+// pidval.setText("");
|
|
|
+// updateUploadButton();
|
|
|
+// ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
|
|
|
+// thumbsImageView.setImageResource(R.drawable.no_pic);
|
|
|
+// thumbBitmap = null;
|
|
|
+// TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
+// countTextView.setText("no photo");
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -1168,211 +1184,211 @@ public class MainActivity extends AppCompatActivity
|
|
|
.getAction();
|
|
|
// 如果捕捉到的action是ACTION_BATTERY_CHANGED
|
|
|
|
|
|
- if ("REDANT.POP.USER_CHECK_FAILED"
|
|
|
- .equals(action))
|
|
|
- {
|
|
|
- m_tvalert
|
|
|
- .setTextColor(getResources()
|
|
|
- .getColor(
|
|
|
- R.color.message_fail));
|
|
|
- m_tvalert
|
|
|
- .setText("Upload failed:user verify failure.");
|
|
|
-
|
|
|
- }
|
|
|
- else if ("REDANT.POP.STATION_NOT_CHANGE"
|
|
|
- .equals(action))
|
|
|
- {
|
|
|
- new AlertDialog.Builder(
|
|
|
- MainActivity.this)
|
|
|
- .setIconAttribute(
|
|
|
- android.R.attr.alertDialogIcon)
|
|
|
- .setTitle(
|
|
|
- R.string.confirm_to_upload)
|
|
|
- .setMessage(
|
|
|
- "Upload to station "
|
|
|
- + RedAntApplication.station_name)
|
|
|
- .setPositiveButton(
|
|
|
- android.R.string.ok,
|
|
|
- new DialogInterface.OnClickListener()
|
|
|
- {
|
|
|
- public void onClick(
|
|
|
- DialogInterface dialog,
|
|
|
- int whichButton)
|
|
|
- {
|
|
|
-
|
|
|
- SQLiteDatabase db = dbUtil
|
|
|
- .OpenDB(MainActivity.this,
|
|
|
- null,
|
|
|
- true);
|
|
|
- TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
- String pid = pidval
|
|
|
- .getText()
|
|
|
- .toString();
|
|
|
- for (int i = 0; i < photoList
|
|
|
- .size(); i++)
|
|
|
- {
|
|
|
-
|
|
|
- ContentValues cv = new ContentValues();
|
|
|
- cv.put("picker",
|
|
|
- RedAntApplication.user);
|
|
|
- cv.put("server",
|
|
|
- RedAntApplication.active_address);
|
|
|
- cv.put("err_code",
|
|
|
- Network.STATUS_WAIT);
|
|
|
- cv.put("pid",
|
|
|
- pid);
|
|
|
- cv.put("local_path",
|
|
|
- photoList
|
|
|
- .get(i));
|
|
|
- db.insert(
|
|
|
- "pics",
|
|
|
- null,
|
|
|
- cv);
|
|
|
-
|
|
|
- }
|
|
|
- dbUtil.CloseDB(db);
|
|
|
- // new
|
|
|
- // UploadTask().execute((Void)
|
|
|
- // null);
|
|
|
- clearfornew();
|
|
|
- sendBroadcast(new Intent(
|
|
|
- "REDANT.POP.RESET_LOCATION"));
|
|
|
- Intent intent = new Intent(
|
|
|
- "REDANT.POP.MODIFY_QUEUE");
|
|
|
- sendBroadcast(intent);
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- })
|
|
|
- .setNegativeButton(
|
|
|
- android.R.string.cancel,
|
|
|
- new DialogInterface.OnClickListener()
|
|
|
- {
|
|
|
- public void onClick(
|
|
|
- DialogInterface dialog,
|
|
|
- int whichButton)
|
|
|
- {
|
|
|
- // debug
|
|
|
- // update_location();
|
|
|
- }
|
|
|
- })
|
|
|
- .create()
|
|
|
- .show();
|
|
|
-
|
|
|
- }
|
|
|
- else if ("REDANT.POP.STATION_CHANGE"
|
|
|
- .equals(action))
|
|
|
- {
|
|
|
-
|
|
|
- sendBroadcast(new Intent(
|
|
|
- "REDANT.POP.RESET_LOCATION"));
|
|
|
- new AlertDialog.Builder(
|
|
|
- MainActivity.this)
|
|
|
- .setIconAttribute(
|
|
|
- android.R.attr.alertDialogIcon)
|
|
|
- .setTitle(
|
|
|
- R.string.location_changed)
|
|
|
- .setMessage(
|
|
|
- "We have detected that your position has changed,do you want to modify the server setting? ")
|
|
|
- .setPositiveButton(
|
|
|
- android.R.string.ok,
|
|
|
- new DialogInterface.OnClickListener()
|
|
|
- {
|
|
|
- public void onClick(
|
|
|
- DialogInterface dialog,
|
|
|
- int whichButton)
|
|
|
- {
|
|
|
-
|
|
|
- Intent intent = new Intent();
|
|
|
- intent.setClass(
|
|
|
- MainActivity.this,
|
|
|
- ServerSettingActivity.class);
|
|
|
- startActivity(intent);
|
|
|
- }
|
|
|
- })
|
|
|
- .setNegativeButton(
|
|
|
- android.R.string.cancel,
|
|
|
- new DialogInterface.OnClickListener()
|
|
|
- {
|
|
|
- public void onClick(
|
|
|
- DialogInterface dialog,
|
|
|
- int whichButton)
|
|
|
- {
|
|
|
-
|
|
|
- // debug
|
|
|
- // update_location();
|
|
|
- }
|
|
|
- })
|
|
|
- .create()
|
|
|
- .show();
|
|
|
-
|
|
|
- }
|
|
|
- else if ("REDANT.POP.FINISH_UPLOAD_QUEUE"
|
|
|
- .equals(action))
|
|
|
- {
|
|
|
- m_tvalert
|
|
|
- .setTextColor(getResources()
|
|
|
- .getColor(
|
|
|
- R.color.message_success));
|
|
|
- m_tvalert
|
|
|
- .setText("Upload successes!");
|
|
|
-
|
|
|
- }
|
|
|
- else if ("REDANT.POP.FINISH_UPLOAD_QUEUE_WITH_ERROR"
|
|
|
- .equals(action))
|
|
|
- {
|
|
|
- m_tvalert
|
|
|
- .setTextColor(getResources()
|
|
|
- .getColor(
|
|
|
- R.color.message_fail));
|
|
|
- m_tvalert
|
|
|
- .setText("Upload finish with some error!");
|
|
|
-
|
|
|
- }
|
|
|
- else if ("REDANT.POP.CLEAR_UPLOAD_QUEUE"
|
|
|
- .equals(action))
|
|
|
- {
|
|
|
- m_tvalert
|
|
|
- .setTextColor(getResources()
|
|
|
- .getColor(
|
|
|
- R.color.message_success));
|
|
|
- m_tvalert
|
|
|
- .setText("Error Cleared.");
|
|
|
-
|
|
|
- }
|
|
|
- else if (action
|
|
|
- .equals(Intent.ACTION_SCREEN_OFF))
|
|
|
- {
|
|
|
- Log.d("hg",
|
|
|
- "�յ��㲥!!!=======>m_blocked="
|
|
|
- + m_blocked);
|
|
|
- if (m_blocked == true)
|
|
|
- return;
|
|
|
-
|
|
|
- SharedPreferences pref = RedAntApplication
|
|
|
- .getInstance()
|
|
|
- .getSharedPreferences(
|
|
|
- "POP",
|
|
|
- 0);
|
|
|
- boolean autologin = pref
|
|
|
- .getBoolean(
|
|
|
- "kepppass",
|
|
|
- false);
|
|
|
- if (autologin)
|
|
|
- return;
|
|
|
-
|
|
|
- Intent activityintent = new Intent();
|
|
|
- activityintent
|
|
|
- .setClass(
|
|
|
- MainActivity.this,
|
|
|
- LockerActivity.class);
|
|
|
- startActivityForResult(
|
|
|
- activityintent,
|
|
|
- REQUEST_LOCKER);
|
|
|
- Log.d(TAG,
|
|
|
- "===================>start locker");
|
|
|
- m_blocked = true;
|
|
|
- }
|
|
|
+// if ("REDANT.POP.USER_CHECK_FAILED"
|
|
|
+// .equals(action))
|
|
|
+// {
|
|
|
+// m_tvalert
|
|
|
+// .setTextColor(getResources()
|
|
|
+// .getColor(
|
|
|
+// R.color.message_fail));
|
|
|
+// m_tvalert
|
|
|
+// .setText("Upload failed:user verify failure.");
|
|
|
+//
|
|
|
+// }
|
|
|
+// else if ("REDANT.POP.STATION_NOT_CHANGE"
|
|
|
+// .equals(action))
|
|
|
+// {
|
|
|
+// new AlertDialog.Builder(
|
|
|
+// MainActivity.this)
|
|
|
+// .setIconAttribute(
|
|
|
+// android.R.attr.alertDialogIcon)
|
|
|
+// .setTitle(
|
|
|
+// R.string.confirm_to_upload)
|
|
|
+// .setMessage(
|
|
|
+// "Upload to station "
|
|
|
+// + RedAntApplication.station_name)
|
|
|
+// .setPositiveButton(
|
|
|
+// android.R.string.ok,
|
|
|
+// new DialogInterface.OnClickListener()
|
|
|
+// {
|
|
|
+// public void onClick(
|
|
|
+// DialogInterface dialog,
|
|
|
+// int whichButton)
|
|
|
+// {
|
|
|
+//
|
|
|
+// SQLiteDatabase db = dbUtil
|
|
|
+// .OpenDB(MainActivity.this,
|
|
|
+// null,
|
|
|
+// true);
|
|
|
+// TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
+// String pid = pidval
|
|
|
+// .getText()
|
|
|
+// .toString();
|
|
|
+// for (int i = 0; i < photoList
|
|
|
+// .size(); i++)
|
|
|
+// {
|
|
|
+//
|
|
|
+// ContentValues cv = new ContentValues();
|
|
|
+// cv.put("picker",
|
|
|
+// RedAntApplication.user);
|
|
|
+// cv.put("server",
|
|
|
+// RedAntApplication.active_address);
|
|
|
+// cv.put("err_code",
|
|
|
+// Network.STATUS_WAIT);
|
|
|
+// cv.put("pid",
|
|
|
+// pid);
|
|
|
+// cv.put("local_path",
|
|
|
+// photoList
|
|
|
+// .get(i));
|
|
|
+// db.insert(
|
|
|
+// "pics",
|
|
|
+// null,
|
|
|
+// cv);
|
|
|
+//
|
|
|
+// }
|
|
|
+// dbUtil.CloseDB(db);
|
|
|
+// // new
|
|
|
+// // UploadTask().execute((Void)
|
|
|
+// // null);
|
|
|
+// clearfornew();
|
|
|
+// sendBroadcast(new Intent(
|
|
|
+// "REDANT.POP.RESET_LOCATION"));
|
|
|
+// Intent intent = new Intent(
|
|
|
+// "REDANT.POP.MODIFY_QUEUE");
|
|
|
+// sendBroadcast(intent);
|
|
|
+//
|
|
|
+//
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .setNegativeButton(
|
|
|
+// android.R.string.cancel,
|
|
|
+// new DialogInterface.OnClickListener()
|
|
|
+// {
|
|
|
+// public void onClick(
|
|
|
+// DialogInterface dialog,
|
|
|
+// int whichButton)
|
|
|
+// {
|
|
|
+// // debug
|
|
|
+// // update_location();
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .create()
|
|
|
+// .show();
|
|
|
+//
|
|
|
+// }
|
|
|
+// else if ("REDANT.POP.STATION_CHANGE"
|
|
|
+// .equals(action))
|
|
|
+// {
|
|
|
+//
|
|
|
+// sendBroadcast(new Intent(
|
|
|
+// "REDANT.POP.RESET_LOCATION"));
|
|
|
+// new AlertDialog.Builder(
|
|
|
+// MainActivity.this)
|
|
|
+// .setIconAttribute(
|
|
|
+// android.R.attr.alertDialogIcon)
|
|
|
+// .setTitle(
|
|
|
+// R.string.location_changed)
|
|
|
+// .setMessage(
|
|
|
+// "We have detected that your position has changed,do you want to modify the server setting? ")
|
|
|
+// .setPositiveButton(
|
|
|
+// android.R.string.ok,
|
|
|
+// new DialogInterface.OnClickListener()
|
|
|
+// {
|
|
|
+// public void onClick(
|
|
|
+// DialogInterface dialog,
|
|
|
+// int whichButton)
|
|
|
+// {
|
|
|
+//
|
|
|
+// Intent intent = new Intent();
|
|
|
+// intent.setClass(
|
|
|
+// MainActivity.this,
|
|
|
+// ServerSettingActivity.class);
|
|
|
+// startActivity(intent);
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .setNegativeButton(
|
|
|
+// android.R.string.cancel,
|
|
|
+// new DialogInterface.OnClickListener()
|
|
|
+// {
|
|
|
+// public void onClick(
|
|
|
+// DialogInterface dialog,
|
|
|
+// int whichButton)
|
|
|
+// {
|
|
|
+//
|
|
|
+// // debug
|
|
|
+// // update_location();
|
|
|
+// }
|
|
|
+// })
|
|
|
+// .create()
|
|
|
+// .show();
|
|
|
+//
|
|
|
+// }
|
|
|
+// else if ("REDANT.POP.FINISH_UPLOAD_QUEUE"
|
|
|
+// .equals(action))
|
|
|
+// {
|
|
|
+// m_tvalert
|
|
|
+// .setTextColor(getResources()
|
|
|
+// .getColor(
|
|
|
+// R.color.message_success));
|
|
|
+// m_tvalert
|
|
|
+// .setText("Upload successes!");
|
|
|
+//
|
|
|
+// }
|
|
|
+// else if ("REDANT.POP.FINISH_UPLOAD_QUEUE_WITH_ERROR"
|
|
|
+// .equals(action))
|
|
|
+// {
|
|
|
+// m_tvalert
|
|
|
+// .setTextColor(getResources()
|
|
|
+// .getColor(
|
|
|
+// R.color.message_fail));
|
|
|
+// m_tvalert
|
|
|
+// .setText("Upload finish with some error!");
|
|
|
+//
|
|
|
+// }
|
|
|
+// else if ("REDANT.POP.CLEAR_UPLOAD_QUEUE"
|
|
|
+// .equals(action))
|
|
|
+// {
|
|
|
+// m_tvalert
|
|
|
+// .setTextColor(getResources()
|
|
|
+// .getColor(
|
|
|
+// R.color.message_success));
|
|
|
+// m_tvalert
|
|
|
+// .setText("Error Cleared.");
|
|
|
+//
|
|
|
+// }
|
|
|
+// else if (action
|
|
|
+// .equals(Intent.ACTION_SCREEN_OFF))
|
|
|
+// {
|
|
|
+//// Log.d("hg",
|
|
|
+//// "�յ��㲥!!!=======>m_blocked="
|
|
|
+//// + m_blocked);
|
|
|
+//// if (m_blocked == true)
|
|
|
+//// return;
|
|
|
+////
|
|
|
+//// SharedPreferences pref = RedAntApplication
|
|
|
+//// .getInstance()
|
|
|
+//// .getSharedPreferences(
|
|
|
+//// "POP",
|
|
|
+//// 0);
|
|
|
+//// boolean autologin = pref
|
|
|
+//// .getBoolean(
|
|
|
+//// "kepppass",
|
|
|
+//// false);
|
|
|
+//// if (autologin)
|
|
|
+//// return;
|
|
|
+////
|
|
|
+//// Intent activityintent = new Intent();
|
|
|
+//// activityintent
|
|
|
+//// .setClass(
|
|
|
+//// MainActivity.this,
|
|
|
+//// LockerActivity.class);
|
|
|
+//// startActivityForResult(
|
|
|
+//// activityintent,
|
|
|
+//// REQUEST_LOCKER);
|
|
|
+//// Log.d(TAG,
|
|
|
+//// "===================>start locker");
|
|
|
+//// m_blocked = true;
|
|
|
+// }
|
|
|
}
|
|
|
};
|
|
|
|