|
|
@@ -64,6 +64,7 @@ import java.util.Date;
|
|
|
public class MainActivity extends AppCompatActivity
|
|
|
{
|
|
|
|
|
|
+
|
|
|
private VerifyCodeTask verifytask=null;
|
|
|
private QueryManufacturer qmtask=null;
|
|
|
private JSONArray manufacture_arr=null;
|
|
|
@@ -472,6 +473,8 @@ public class MainActivity extends AppCompatActivity
|
|
|
private String manufacture;
|
|
|
|
|
|
void setManufacture(String value) {
|
|
|
+ if(manufactureBtn==null)
|
|
|
+ return;
|
|
|
manufacture = value;
|
|
|
if (TextUtils.isEmpty(value)) {
|
|
|
manufactureBtn.setText("Select Manufacturer");
|
|
|
@@ -1180,12 +1183,9 @@ public class MainActivity extends AppCompatActivity
|
|
|
+ RedAntApplication.password);
|
|
|
IntentFilter msgFilter = new IntentFilter();
|
|
|
Intent intent = getIntent();
|
|
|
- msgFilter.addAction("android.intent.action.SCREEN_OFF");
|
|
|
- msgFilter.addAction("REDANT.POP.STATION_CHANGE");
|
|
|
- msgFilter.addAction("REDANT.POP.STATION_NOT_CHANGE");
|
|
|
- msgFilter.addAction("REDANT.POP.FINISH_UPLOAD_QUEUE");
|
|
|
- msgFilter.addAction("REDANT.POP.FINISH_UPLOAD_QUEUE_WITH_ERROR");
|
|
|
- msgFilter.addAction("REDANT.POP.CLEAR_UPLOAD_QUEUE");
|
|
|
+
|
|
|
+ msgFilter.addAction("REDANT.RAImage.UPLOAD_COMPLETE");
|
|
|
+
|
|
|
msgFilter.setPriority(2147483647);
|
|
|
registerReceiver(MainActivityReceiver, msgFilter);
|
|
|
Log.d(TAG, "=======================>msgFilter registed!");
|
|
|
@@ -1827,213 +1827,39 @@ public class MainActivity extends AppCompatActivity
|
|
|
{
|
|
|
String action = intent
|
|
|
.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.RAImage.UPLOAD_COMPLETE".equals(action))
|
|
|
+ {
|
|
|
+
|
|
|
+ String result = intent.getStringExtra("result");
|
|
|
+ String message="";
|
|
|
+ if(result.equals("finish"))
|
|
|
+ {
|
|
|
+ message="Upload complete.";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ message="Upload complete with some warring.";
|
|
|
+ }
|
|
|
+
|
|
|
+// Toast toast = Toast.makeText(getApplicationContext(),
|
|
|
+// message,
|
|
|
+// Toast.LENGTH_LONG);
|
|
|
+// toast.setGravity(Gravity.CENTER, 0, 0);
|
|
|
+// toast.show();
|
|
|
+
|
|
|
+
|
|
|
+ new AlertDialog.Builder(MainActivity.this)
|
|
|
+ .setTitle("Upload list")
|
|
|
+ .setMessage(message)
|
|
|
+ .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .show();
|
|
|
+ Log.e("Finish_msg", "MainActivity onReceive: ");
|
|
|
+ }
|
|
|
}
|
|
|
};
|
|
|
|