|
@@ -486,16 +486,80 @@ public class MainActivity extends AppCompatActivity
|
|
|
// toast.show();
|
|
// toast.show();
|
|
|
// return;
|
|
// return;
|
|
|
|
|
|
|
|
- new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
- .setTitle("Warning")
|
|
|
|
|
- .setMessage("can not verify input information.")
|
|
|
|
|
- .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
|
+// new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
+// .setTitle("Warning")
|
|
|
|
|
+// .setMessage("can not verify input information.")
|
|
|
|
|
+// .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// })
|
|
|
|
|
+// .show();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
+ .setTitle("Warning")
|
|
|
|
|
+ .setMessage("Can not verify input information, add upload task anyway?")
|
|
|
|
|
+ .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Intent intent = new Intent("REDANT.RAImage.ADD_TASK");
|
|
|
|
|
|
|
|
|
|
+ ArrayList<Bundle> taskArr = new ArrayList<Bundle>();
|
|
|
|
|
+
|
|
|
|
|
+ for (String path : photoList) {
|
|
|
|
|
+ Bundle task = new Bundle();
|
|
|
|
|
+
|
|
|
|
|
+ task.putString("path",path);
|
|
|
|
|
+ task.putString("file",RAUtil.lastPathComponent(path));
|
|
|
|
|
+ task.putString("url",RedAntApplication.active_address);
|
|
|
|
|
+
|
|
|
|
|
+ String md5 = MD5.md5sum(path);
|
|
|
|
|
+ String encryptUser = AES.encrypt("usai",RedAntApplication.user);
|
|
|
|
|
+ String encryptPwd = AES.encrypt("usai",RedAntApplication.password);
|
|
|
|
|
+
|
|
|
|
|
+ Bundle params = new Bundle();
|
|
|
|
|
+ params.putString("user",encryptUser);
|
|
|
|
|
+ params.putString("password",encryptPwd);
|
|
|
|
|
+ params.putString("mode",mode);
|
|
|
|
|
+ params.putString("barcode",pidval.getText().toString());
|
|
|
|
|
+ params.putString("_operate","upload");
|
|
|
|
|
+ params.putString("platform","android");
|
|
|
|
|
+ params.putString("md5",md5);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ if (mode.equals("Model")) {
|
|
|
|
|
+
|
|
|
|
|
+ if (!TextUtils.isEmpty(manufacture)) {
|
|
|
|
|
+ params.putString("manufacturer",manufacture);
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
- .show();
|
|
|
|
|
|
|
+ if (!TextUtils.isEmpty(noteTextView.getText().toString())) {
|
|
|
|
|
+ params.putString("note",noteTextView.getText().toString());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ task.putBundle("params",params);
|
|
|
|
|
+
|
|
|
|
|
+ taskArr.add(task);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ intent.putParcelableArrayListExtra("tasks",taskArr);
|
|
|
|
|
+
|
|
|
|
|
+ sendBroadcast(intent);
|
|
|
|
|
+ clearfornew();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ })
|
|
|
|
|
+ .setNegativeButton("No", new DialogInterface.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .show();
|
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -819,7 +883,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- boolean canstart = true;
|
|
|
|
|
|
|
+ // boolean canstart = true;
|
|
|
|
|
|
|
|
ConnectivityManager connManager = (ConnectivityManager) RedAntApplication.getInstance()
|
|
ConnectivityManager connManager = (ConnectivityManager) RedAntApplication.getInstance()
|
|
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
.getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
@@ -831,7 +895,17 @@ public class MainActivity extends AppCompatActivity
|
|
|
dbgUtil.Logd(
|
|
dbgUtil.Logd(
|
|
|
"Current Network info",
|
|
"Current Network info",
|
|
|
"can not get Active NetworkInfo!");
|
|
"can not get Active NetworkInfo!");
|
|
|
- canstart = false;
|
|
|
|
|
|
|
+// canstart = false;
|
|
|
|
|
+ new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
+ .setTitle("Warning")
|
|
|
|
|
+ .setMessage("No available network, new task will not start, you must start it manually.")
|
|
|
|
|
+ .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .show();
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
@@ -843,52 +917,98 @@ public class MainActivity extends AppCompatActivity
|
|
|
"Current Network info",
|
|
"Current Network info",
|
|
|
"not Connected!State="
|
|
"not Connected!State="
|
|
|
+ netState);
|
|
+ netState);
|
|
|
- canstart = false;
|
|
|
|
|
- }
|
|
|
|
|
- int iconntype = -1;
|
|
|
|
|
- iconntype = networkInfo
|
|
|
|
|
- .getType();
|
|
|
|
|
-
|
|
|
|
|
- SharedPreferences pref = RedAntApplication
|
|
|
|
|
- .getInstance()
|
|
|
|
|
- .getSharedPreferences(
|
|
|
|
|
- "UploadManager",
|
|
|
|
|
- 0);
|
|
|
|
|
- boolean
|
|
|
|
|
- wifi_only
|
|
|
|
|
- =pref.getBoolean("wifi_only",
|
|
|
|
|
- false);
|
|
|
|
|
- if(wifi_only == true
|
|
|
|
|
- && iconntype !=
|
|
|
|
|
- ConnectivityManager.TYPE_WIFI
|
|
|
|
|
- && iconntype !=
|
|
|
|
|
- 9/* earthnet */)
|
|
|
|
|
- {
|
|
|
|
|
- canstart = false;
|
|
|
|
|
|
|
+// canstart = false;
|
|
|
|
|
+
|
|
|
|
|
+ new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
+ .setTitle("Warning")
|
|
|
|
|
+ .setMessage("No network connection, new task will not start, you must start it manually.")
|
|
|
|
|
+ .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .show();
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- if(!canstart)
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ int iconntype = -1;
|
|
|
|
|
+ iconntype = networkInfo
|
|
|
|
|
+ .getType();
|
|
|
|
|
+
|
|
|
|
|
+ SharedPreferences pref = RedAntApplication
|
|
|
|
|
+ .getInstance()
|
|
|
|
|
+ .getSharedPreferences(
|
|
|
|
|
+ "UploadManager",
|
|
|
|
|
+ 0);
|
|
|
|
|
+ boolean
|
|
|
|
|
+ wifi_only
|
|
|
|
|
+ =pref.getBoolean("wifi_only",
|
|
|
|
|
+ false);
|
|
|
|
|
+ if(wifi_only == true
|
|
|
|
|
+ && iconntype !=
|
|
|
|
|
+ ConnectivityManager.TYPE_WIFI
|
|
|
|
|
+ && iconntype !=
|
|
|
|
|
+ 9/* earthnet */)
|
|
|
|
|
+ {
|
|
|
|
|
+// canstart = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
- new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
- .setTitle("Warning")
|
|
|
|
|
- .setMessage("App is set to upload via WIFI only. Please change your setting or try upload later.")
|
|
|
|
|
- .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
|
|
+ new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
+ .setTitle("Warning")
|
|
|
|
|
+ .setMessage("You have setup upload via WIFI only, new task will not start, you must start it manually.")
|
|
|
|
|
+ .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .show();
|
|
|
|
|
+
|
|
|
|
|
+// new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
+// .setTitle("Warning")
|
|
|
|
|
+// .setMessage("You have setup upload via WIFI only, new task will not start until your phone connect to WIFI.")
|
|
|
|
|
+// .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// })
|
|
|
|
|
+// .show();
|
|
|
|
|
+// return;
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- .show();
|
|
|
|
|
- return;
|
|
|
|
|
-// Toast toast = Toast.makeText(getApplicationContext(),
|
|
|
|
|
-// "App is set to upload via WIFI only. Please change your setting or try upload later.",
|
|
|
|
|
-// Toast.LENGTH_LONG);
|
|
|
|
|
-// toast.setGravity(Gravity.CENTER, 0, 0);
|
|
|
|
|
-// toast.show();
|
|
|
|
|
-// return;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+// if(!canstart)
|
|
|
|
|
+// {
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
+// .setTitle("Warning")
|
|
|
|
|
+// .setMessage("You have setup upload via WIFI only, new task will not start until your phone connect to WIFI.")
|
|
|
|
|
+// .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
|
|
+// })
|
|
|
|
|
+// .show();
|
|
|
|
|
+//// new AlertDialog.Builder(MainActivity.this)
|
|
|
|
|
+//// .setTitle("Warning")
|
|
|
|
|
+//// .setMessage("App is set to upload via WIFI only. Please change your setting or try upload later.")
|
|
|
|
|
+//// .setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
|
|
+//// @Override
|
|
|
|
|
+//// public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+////
|
|
|
|
|
+//// }
|
|
|
|
|
+//// })
|
|
|
|
|
+//// .show();
|
|
|
|
|
+//// return;
|
|
|
|
|
+//
|
|
|
|
|
+// }
|
|
|
try {
|
|
try {
|
|
|
|
|
|
|
|
// String name = "POP";
|
|
// String name = "POP";
|
|
@@ -1005,7 +1125,6 @@ public class MainActivity extends AppCompatActivity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- //photoList.clear();
|
|
|
|
|
if (savedPhotoList != null) {
|
|
if (savedPhotoList != null) {
|
|
|
photoList = savedPhotoList;
|
|
photoList = savedPhotoList;
|
|
|
|
|
|
|
@@ -1120,7 +1239,9 @@ public class MainActivity extends AppCompatActivity
|
|
|
outputStream.flush();
|
|
outputStream.flush();
|
|
|
outputStream.close();
|
|
outputStream.close();
|
|
|
|
|
|
|
|
|
|
+ String rotedpath = routedFile.getAbsolutePath();
|
|
|
routedFile.delete();
|
|
routedFile.delete();
|
|
|
|
|
+ RAUtil.updateGallery(rotedpath);
|
|
|
// scaleFile.renameTo(new File(path));
|
|
// scaleFile.renameTo(new File(path));
|
|
|
return scaleFile;
|
|
return scaleFile;
|
|
|
|
|
|
|
@@ -1202,18 +1323,7 @@ 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
|
|
@Override
|
|
|
protected void onResume()
|
|
protected void onResume()
|
|
@@ -1261,85 +1371,12 @@ public class MainActivity extends AppCompatActivity
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// if (savedInstanceState != null)
|
|
|
|
|
-// {
|
|
|
|
|
-// thumbBitmap = getBitmap(savedInstanceState
|
|
|
|
|
-// .getByteArray("thumbBitmap"));
|
|
|
|
|
-// photoList.clear();
|
|
|
|
|
-// // ArrayList list = (ArrayList)
|
|
|
|
|
-// // Arrays.asList(savedInstanceState.getStringArray("arrayLabel"));
|
|
|
|
|
-// photoList = savedInstanceState.getStringArrayList("photoList");
|
|
|
|
|
-//
|
|
|
|
|
-// TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
|
|
-// pidval.setText(savedInstanceState.getString("PIID"));
|
|
|
|
|
-// // photoList = A
|
|
|
|
|
-// // savedInstanceState.getStringArrayList("photoList");
|
|
|
|
|
-// photoFile = (File) savedInstanceState.getSerializable("photoFile");
|
|
|
|
|
-//
|
|
|
|
|
-// if (thumbBitmap != null)
|
|
|
|
|
-// {
|
|
|
|
|
-// thumbsImageView.setImageBitmap(thumbBitmap);
|
|
|
|
|
-// // Log.d(TAG, "load thumbpath==" + thumbpath);
|
|
|
|
|
-// }
|
|
|
|
|
-// // photoFile.delete();
|
|
|
|
|
-// TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
|
|
-// countTextView.setText(photoList.size() + " Photos");
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// ImageButton ibtnscan = (ImageButton) findViewById(R.id.ibtnScan);
|
|
|
|
|
-// ibtnscan.setOnClickListener(new View.OnClickListener()
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public void onClick(View v)
|
|
|
|
|
-// {
|
|
|
|
|
-// Log.d(TAG, "==============>Click Scan button");
|
|
|
|
|
-// Intent intent = new Intent();
|
|
|
|
|
-//
|
|
|
|
|
-// intent.setClass(MainActivity.this, CaptureActivity.class);
|
|
|
|
|
-// startActivityForResult(intent, REQUEST_SCAN_BARCODE);
|
|
|
|
|
-// }
|
|
|
|
|
-// });
|
|
|
|
|
-//
|
|
|
|
|
-// ImageButton captureButton = (ImageButton) findViewById(R.id.ibtnCapture);
|
|
|
|
|
-// captureButton.setOnClickListener(new View.OnClickListener()
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public void onClick(View v)
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// StartCamera();
|
|
|
|
|
-// }
|
|
|
|
|
-// });
|
|
|
|
|
-// ImageButton uploadButton = (ImageButton) findViewById(R.id.ibtnOk);
|
|
|
|
|
-// uploadButton.setOnClickListener(new View.OnClickListener()
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public void onClick(View v)
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// sendBroadcast(new Intent("REDANT.POP.REQUEST_LOCATION"));
|
|
|
|
|
-// return;
|
|
|
|
|
-//
|
|
|
|
|
-// }
|
|
|
|
|
-// });
|
|
|
|
|
-//
|
|
|
|
|
-// m_tvalert = (TextView) findViewById(R.id.tvalert);
|
|
|
|
|
-// m_tvalert.setSelected(true);
|
|
|
|
|
-//
|
|
|
|
|
-// // Intent intent = ;
|
|
|
|
|
-// sendBroadcast(new Intent("REDANT.POP.MODIFY_QUEUE"));
|
|
|
|
|
-// updateUploadButton();
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
protected void onDestroy()
|
|
protected void onDestroy()
|
|
|
{
|
|
{
|
|
|
- // sendBroadcast(new Intent("REDANT.POP.GPS_OFF"));
|
|
|
|
|
-// clear();
|
|
|
|
|
|
|
+
|
|
|
Log.d(TAG, "=======================>MainActivity Destroyed!");
|
|
Log.d(TAG, "=======================>MainActivity Destroyed!");
|
|
|
unregisterReceiver(MainActivityReceiver);
|
|
unregisterReceiver(MainActivityReceiver);
|
|
|
Log.d(TAG, "=======================>msgFilter unregisted!");
|
|
Log.d(TAG, "=======================>msgFilter unregisted!");
|
|
@@ -1396,6 +1433,9 @@ public class MainActivity extends AppCompatActivity
|
|
|
storageDir /* directory */
|
|
storageDir /* directory */
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
|
|
+ Log.d(TAG, "File:" + image.getAbsolutePath());
|
|
|
|
|
+// RAUtil.updateGallery(LastFileName);
|
|
|
|
|
+
|
|
|
// Save a file: path for use with ACTION_VIEW intents
|
|
// Save a file: path for use with ACTION_VIEW intents
|
|
|
// mCurrentPhotoPath = "file:" + image.getAbsolutePath();
|
|
// mCurrentPhotoPath = "file:" + image.getAbsolutePath();
|
|
|
return image;
|
|
return image;
|
|
@@ -1466,8 +1506,13 @@ public class MainActivity extends AppCompatActivity
|
|
|
if (scaleFile != null) {
|
|
if (scaleFile != null) {
|
|
|
photoFile = scaleFile;
|
|
photoFile = scaleFile;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
photoList.add(photoFile.toString());
|
|
photoList.add(photoFile.toString());
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+// Log.d(TAG, "File:" + image.getAbsolutePath());
|
|
|
|
|
+ RAUtil.updateGallery(photoFile.toString());
|
|
|
StartCamera();
|
|
StartCamera();
|
|
|
// iPhotoCount++;
|
|
// iPhotoCount++;
|
|
|
// super.onActivityResult(requestCode, resultCode, data);
|
|
// super.onActivityResult(requestCode, resultCode, data);
|
|
@@ -1492,7 +1537,9 @@ public class MainActivity extends AppCompatActivity
|
|
|
thumbsImageView.setImageBitmap(thumbBitmap);
|
|
thumbsImageView.setImageBitmap(thumbBitmap);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ String photopath=photoFile.getAbsolutePath();
|
|
|
photoFile.delete();
|
|
photoFile.delete();
|
|
|
|
|
+ RAUtil.updateGallery(photopath);
|
|
|
TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
if (newVersion) {
|
|
if (newVersion) {
|
|
|
countTextView = this.countTextView;
|
|
countTextView = this.countTextView;
|
|
@@ -1665,65 +1712,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
}
|
|
}
|
|
|
return super.onOptionsItemSelected(item);
|
|
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);
|
|
return super.onOptionsItemSelected(item);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1783,11 +1772,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
super.onBackPressed();
|
|
super.onBackPressed();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// @Override
|
|
|
|
|
-// protected void finalize() throws Throwable {
|
|
|
|
|
-// Log.e(TAG, "finalize: photolist clear" );
|
|
|
|
|
-// clear();
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
private void clear()
|
|
private void clear()
|
|
|
{
|
|
{
|
|
@@ -1797,86 +1782,18 @@ public class MainActivity extends AppCompatActivity
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// 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");
|
|
|
|
|
-// File dir2 = new File(Environment.getExternalStorageDirectory()
|
|
|
|
|
-// .getPath() + "/redant/pop");
|
|
|
|
|
-// File dir3 = new File(Environment.getExternalStorageDirectory()
|
|
|
|
|
-// .getPath() + "/redant/pop/clear");
|
|
|
|
|
-//
|
|
|
|
|
-//
|
|
|
|
|
-// if (!dir1.exists())
|
|
|
|
|
-// {
|
|
|
|
|
-// boolean b = dir1.mkdir();
|
|
|
|
|
-// }
|
|
|
|
|
-// if (!dir2.exists())
|
|
|
|
|
-// {
|
|
|
|
|
-// boolean b = dir2.mkdir();
|
|
|
|
|
-// }
|
|
|
|
|
-// if (!dir3.exists())
|
|
|
|
|
-// {
|
|
|
|
|
-// 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()));
|
|
|
|
|
-//
|
|
|
|
|
|
|
+// new File(photoList.get(i)).delete();
|
|
|
|
|
+// RAUtil.updateGallery(photoList.get(i));
|
|
|
|
|
|
|
|
|
|
|
|
|
-// // Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
|
|
|
|
|
-// // Log.d(TAG, "DIR:" + storageDir);
|
|
|
|
|
-// LastFileName = storageDir + imageFileName + ".jpg";
|
|
|
|
|
-// Log.d(TAG, "File:" + LastFileName);
|
|
|
|
|
-// File image = File.createTempFile(imageFileName, /* prefix */
|
|
|
|
|
-// ".jpg", /* suffix */
|
|
|
|
|
-// storageDir /* directory */
|
|
|
|
|
-// );
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
photoList.clear();
|
|
photoList.clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
-// 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");
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void clearfornew()
|
|
private void clearfornew()
|