|
|
@@ -36,6 +36,7 @@ import android.view.KeyEvent;
|
|
|
import android.view.Menu;
|
|
|
import android.view.MenuItem;
|
|
|
import android.view.View;
|
|
|
+import android.widget.Button;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageButton;
|
|
|
import android.widget.ImageView;
|
|
|
@@ -78,6 +79,92 @@ public class MainActivity extends AppCompatActivity
|
|
|
// super.onResume();
|
|
|
// }
|
|
|
|
|
|
+ /** RA Image */
|
|
|
+ protected ImageView thumbsImageView;
|
|
|
+ protected TextView countTextView;
|
|
|
+ protected TextView pidval;
|
|
|
+ protected EditText noteTextView;
|
|
|
+ protected ImageButton ibtnscan;
|
|
|
+ protected ImageButton captureButton;
|
|
|
+ protected ImageButton uploadButton;
|
|
|
+
|
|
|
+ protected void initView() {
|
|
|
+ thumbsImageView = (ImageView)findViewById(R.id.photo_iv);
|
|
|
+ countTextView = (TextView)findViewById(R.id.photo_count_lb);
|
|
|
+ pidval = (EditText)findViewById(R.id.barcode_et);
|
|
|
+ noteTextView = (EditText)findViewById(R.id.note_et);
|
|
|
+ ibtnscan = (ImageButton)findViewById(R.id.scan_btn);
|
|
|
+ captureButton = (ImageButton)findViewById(R.id.camera_btn);
|
|
|
+ uploadButton = (ImageButton)findViewById(R.id.upload_btn);
|
|
|
+
|
|
|
+ /***/
|
|
|
+
|
|
|
+
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ captureButton.setOnClickListener(new View.OnClickListener()
|
|
|
+ {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v)
|
|
|
+ {
|
|
|
+
|
|
|
+ StartCamera();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ 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);
|
|
|
+
|
|
|
+ sendBroadcast(new Intent("REDANT.POP.MODIFY_QUEUE"));
|
|
|
+// updateUploadButton();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ protected void recovery(Bundle savedInstanceState) {
|
|
|
+ if (savedInstanceState != null)
|
|
|
+ {
|
|
|
+ thumbBitmap = getBitmap(savedInstanceState
|
|
|
+ .getByteArray("thumbBitmap"));
|
|
|
+ photoList.clear();
|
|
|
+ photoList = savedInstanceState.getStringArrayList("photoList");
|
|
|
+
|
|
|
+ pidval.setText(savedInstanceState.getString("PIID"));
|
|
|
+ photoFile = (File) savedInstanceState.getSerializable("photoFile");
|
|
|
+
|
|
|
+ if (thumbBitmap != null)
|
|
|
+ {
|
|
|
+ thumbsImageView.setImageBitmap(thumbBitmap);
|
|
|
+ }
|
|
|
+ countTextView.setText(photoList.size() + " Photos");
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void StartCamera()
|
|
|
{
|
|
|
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
|
|
|
@@ -143,27 +230,29 @@ public class MainActivity extends AppCompatActivity
|
|
|
{
|
|
|
Log.d(TAG, "=======================>MainActivity Created!");
|
|
|
super.onCreate(savedInstanceState);
|
|
|
-
|
|
|
-// setContentView(R.layout.activity_main1);
|
|
|
-//
|
|
|
-// setTitle(getTitle() + "(" + RedAntApplication.station_name + ")");
|
|
|
-// ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
|
|
|
-// thumbsImageView.setOnClickListener(new View.OnClickListener()
|
|
|
-// {
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void onClick(View v)
|
|
|
-// {
|
|
|
-// if (photoList.size() < 1)
|
|
|
-// return;
|
|
|
-//
|
|
|
-// Intent intent = new Intent(MainActivity.this,
|
|
|
-// PhotoPreviewActivity.class);
|
|
|
-// intent.putExtra("pic_list", (Serializable) photoList);
|
|
|
-// startActivityForResult(intent, REQUEST_PREVIEW);
|
|
|
-//
|
|
|
-// }
|
|
|
-// });
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ setContentView(R.layout.activity_main1);
|
|
|
+
|
|
|
+ setTitle(getTitle() + "(" + RedAntApplication.station_name + ")");
|
|
|
+ ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
|
|
|
+ thumbsImageView.setOnClickListener(new View.OnClickListener()
|
|
|
+ {
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onClick(View v)
|
|
|
+ {
|
|
|
+ if (photoList.size() < 1)
|
|
|
+ return;
|
|
|
+
|
|
|
+ Intent intent = new Intent(MainActivity.this,
|
|
|
+ PhotoPreviewActivity.class);
|
|
|
+ intent.putExtra("pic_list", (Serializable) photoList);
|
|
|
+ startActivityForResult(intent, REQUEST_PREVIEW);
|
|
|
+
|
|
|
+ }
|
|
|
+ });
|
|
|
// m_sName = intent.getStringExtra("user");
|
|
|
// m_sPassword = intent.getStringExtra("password");
|
|
|
|
|
|
@@ -180,6 +269,11 @@ public class MainActivity extends AppCompatActivity
|
|
|
msgFilter.setPriority(2147483647);
|
|
|
registerReceiver(MainActivityReceiver, msgFilter);
|
|
|
Log.d(TAG, "=======================>msgFilter registed!");
|
|
|
+
|
|
|
+ if (true) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (savedInstanceState != null)
|
|
|
{
|
|
|
thumbBitmap = getBitmap(savedInstanceState
|
|
|
@@ -188,70 +282,70 @@ public class MainActivity extends AppCompatActivity
|
|
|
// ArrayList list = (ArrayList)
|
|
|
// Arrays.asList(savedInstanceState.getStringArray("arrayLabel"));
|
|
|
photoList = savedInstanceState.getStringArrayList("photoList");
|
|
|
-
|
|
|
-// TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
-// pidval.setText(savedInstanceState.getString("PIID"));
|
|
|
+
|
|
|
+ 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);
|
|
|
+ thumbsImageView.setImageBitmap(thumbBitmap);
|
|
|
// Log.d(TAG, "load thumbpath==" + thumbpath);
|
|
|
}
|
|
|
// photoFile.delete();
|
|
|
-// TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
-// countTextView.setText(photoList.size() + " Photos");
|
|
|
+ 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();
|
|
|
+ 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
|
|
|
@@ -264,13 +358,16 @@ public class MainActivity extends AppCompatActivity
|
|
|
super.onDestroy();
|
|
|
}
|
|
|
|
|
|
-// @Override
|
|
|
-// public boolean onCreateOptionsMenu(Menu menu)
|
|
|
-// {
|
|
|
-// // Inflate the menu; this adds items to the action bar if it is present.
|
|
|
-// getMenuInflater().inflate(R.menu.main, menu);
|
|
|
-// return true;
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ public boolean onCreateOptionsMenu(Menu menu)
|
|
|
+ {
|
|
|
+ if (true) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ // Inflate the menu; this adds items to the action bar if it is present.
|
|
|
+ getMenuInflater().inflate(R.menu.main, menu);
|
|
|
+ return true;
|
|
|
+ }
|
|
|
|
|
|
private File createImageFile() throws IOException
|
|
|
{
|
|
|
@@ -340,6 +437,8 @@ public class MainActivity extends AppCompatActivity
|
|
|
{
|
|
|
TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
ImageButton ibtnUpload = (ImageButton) findViewById(R.id.ibtnOk);
|
|
|
+
|
|
|
+
|
|
|
if (photoList.size() > 0 && pidval.getText().length() > 0)
|
|
|
{
|
|
|
ibtnUpload.setVisibility(View.VISIBLE);
|
|
|
@@ -359,88 +458,88 @@ public class MainActivity extends AppCompatActivity
|
|
|
* @see android.app.Activity#onActivityResult(int, int,
|
|
|
* android.content.Intent)
|
|
|
*/
|
|
|
-// @Override
|
|
|
-// public void onActivityResult(int requestCode, int resultCode, Intent data)
|
|
|
-// {
|
|
|
-//
|
|
|
-// if (requestCode == REQUEST_TAKE_PHOTO)
|
|
|
-// // ������������յ�ͼƬ
|
|
|
-// if (resultCode == Activity.RESULT_OK) // ��������
|
|
|
-//
|
|
|
-// {
|
|
|
-//
|
|
|
-// Log.d(TAG, photoFile.toString());
|
|
|
-// photoList.add(photoFile.toString());
|
|
|
-//
|
|
|
-// StartCamera();
|
|
|
-// // iPhotoCount++;
|
|
|
-// super.onActivityResult(requestCode, resultCode, data);
|
|
|
-//
|
|
|
-// }
|
|
|
-// else
|
|
|
-// {
|
|
|
-//
|
|
|
-// ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
|
|
|
-//
|
|
|
-// if (photoList.size() > 0)
|
|
|
-// {
|
|
|
-// thumbBitmap = ThumbnailUtils.extractThumbnail(BitmapFactory
|
|
|
-// .decodeFile(photoList.get(photoList.size() - 1)),
|
|
|
-// iwidth, iheight);
|
|
|
-// if (thumbBitmap != null)
|
|
|
-// thumbsImageView.setImageBitmap(thumbBitmap);
|
|
|
-// }
|
|
|
-//
|
|
|
-// photoFile.delete();
|
|
|
-// TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
-// countTextView.setText(photoList.size() + " Photos");
|
|
|
-// // ImageButton ibtnUpload = (ImageButton)
|
|
|
-// // findViewById(R.id.ibtnOk);
|
|
|
-// updateUploadButton();
|
|
|
-//
|
|
|
-// }
|
|
|
-//
|
|
|
-// else if (requestCode == REQUEST_LOCKER)
|
|
|
-// {
|
|
|
-// if (resultCode == Activity.RESULT_OK)
|
|
|
-// m_blocked = false;
|
|
|
-// }
|
|
|
-// else if (requestCode == REQUEST_PREVIEW)
|
|
|
-// {
|
|
|
-// for (int i = 0; i < photoList.size(); i++)
|
|
|
-// {
|
|
|
-// File file = new File(photoList.get(i));
|
|
|
-// if (!file.exists())
|
|
|
-// {
|
|
|
-// photoList.remove(i);
|
|
|
-// i--;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
-// countTextView.setText(photoList.size() + " Photos");
|
|
|
-// if (photoList.size() == 0)
|
|
|
-// {
|
|
|
-// ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
|
|
|
-// thumbsImageView.setImageResource(R.drawable.no_pic);
|
|
|
-// thumbBitmap = null;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// else if (requestCode == REQUEST_SCAN_BARCODE)
|
|
|
-// {
|
|
|
-// if (resultCode == Activity.RESULT_OK)
|
|
|
-// {
|
|
|
-// Bundle bundle = data.getExtras();
|
|
|
-// String pid = bundle.getString("pid");
|
|
|
-// Log.d(TAG,
|
|
|
-// "REQUEST_SCAN_BARCODE==========>pid="
|
|
|
-// + bundle.getString("pid"));
|
|
|
-// TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
-// pidval.setText(pid);
|
|
|
-// updateUploadButton();
|
|
|
-// }
|
|
|
-// }
|
|
|
-// super.onActivityResult(requestCode, resultCode, data);
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ public void onActivityResult(int requestCode, int resultCode, Intent data)
|
|
|
+ {
|
|
|
+
|
|
|
+ if (requestCode == REQUEST_TAKE_PHOTO)
|
|
|
+ // ������������յ�ͼƬ
|
|
|
+ if (resultCode == Activity.RESULT_OK) // ��������
|
|
|
+
|
|
|
+ {
|
|
|
+
|
|
|
+ Log.d(TAG, photoFile.toString());
|
|
|
+ photoList.add(photoFile.toString());
|
|
|
+
|
|
|
+ StartCamera();
|
|
|
+ // iPhotoCount++;
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+
|
|
|
+ ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
|
|
|
+
|
|
|
+ if (photoList.size() > 0)
|
|
|
+ {
|
|
|
+ thumbBitmap = ThumbnailUtils.extractThumbnail(BitmapFactory
|
|
|
+ .decodeFile(photoList.get(photoList.size() - 1)),
|
|
|
+ iwidth, iheight);
|
|
|
+ if (thumbBitmap != null)
|
|
|
+ thumbsImageView.setImageBitmap(thumbBitmap);
|
|
|
+ }
|
|
|
+
|
|
|
+ photoFile.delete();
|
|
|
+ TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
+ countTextView.setText(photoList.size() + " Photos");
|
|
|
+ // ImageButton ibtnUpload = (ImageButton)
|
|
|
+ // findViewById(R.id.ibtnOk);
|
|
|
+ updateUploadButton();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ else if (requestCode == REQUEST_LOCKER)
|
|
|
+ {
|
|
|
+ if (resultCode == Activity.RESULT_OK)
|
|
|
+ m_blocked = false;
|
|
|
+ }
|
|
|
+ else if (requestCode == REQUEST_PREVIEW)
|
|
|
+ {
|
|
|
+ for (int i = 0; i < photoList.size(); i++)
|
|
|
+ {
|
|
|
+ File file = new File(photoList.get(i));
|
|
|
+ if (!file.exists())
|
|
|
+ {
|
|
|
+ photoList.remove(i);
|
|
|
+ i--;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ TextView countTextView = (TextView) findViewById(R.id.tvPhotoCount);
|
|
|
+ countTextView.setText(photoList.size() + " Photos");
|
|
|
+ if (photoList.size() == 0)
|
|
|
+ {
|
|
|
+ ImageView thumbsImageView = (ImageView) findViewById(R.id.ivThumbs);
|
|
|
+ thumbsImageView.setImageResource(R.drawable.no_pic);
|
|
|
+ thumbBitmap = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (requestCode == REQUEST_SCAN_BARCODE)
|
|
|
+ {
|
|
|
+ if (resultCode == Activity.RESULT_OK)
|
|
|
+ {
|
|
|
+ Bundle bundle = data.getExtras();
|
|
|
+ String pid = bundle.getString("pid");
|
|
|
+ Log.d(TAG,
|
|
|
+ "REQUEST_SCAN_BARCODE==========>pid="
|
|
|
+ + bundle.getString("pid"));
|
|
|
+ TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
+ pidval.setText(pid);
|
|
|
+ updateUploadButton();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ super.onActivityResult(requestCode, resultCode, data);
|
|
|
+ }
|
|
|
|
|
|
public void saveMyBitmap(String bitName, Bitmap mBitmap)
|
|
|
{
|
|
|
@@ -489,93 +588,99 @@ public class MainActivity extends AppCompatActivity
|
|
|
//
|
|
|
// return bret;
|
|
|
// }
|
|
|
-// @Override
|
|
|
-// public boolean onOptionsItemSelected(MenuItem 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);
|
|
|
-// }
|
|
|
-
|
|
|
-// @Override
|
|
|
-// protected void onSaveInstanceState(Bundle outState)
|
|
|
-// {
|
|
|
-// // TODO Auto-generated method stub
|
|
|
-// super.onSaveInstanceState(outState);
|
|
|
-// if (photoFile != null)
|
|
|
-// outState.putSerializable("photoFile", photoFile);
|
|
|
-//
|
|
|
-// if (thumbBitmap != null)
|
|
|
-// outState.putByteArray("thumbBitmap", getBytes(thumbBitmap));// ("thumbBitmap",
|
|
|
-// // (Object)thumbBitmap);
|
|
|
-// // outState.putString("thumbpath",
|
|
|
-// // thumbpath);
|
|
|
-// // outState.putString("m_sName", m_sName);
|
|
|
-// // outState.putString("m_sPassword", m_sPassword);
|
|
|
-//
|
|
|
-// outState.putStringArrayList("photoList", photoList);
|
|
|
-// // Log.d(TAG, "save thumbpath==" + thumbpath);
|
|
|
-// //outState.putInt("iPhotoCount", photoList.size());
|
|
|
-// TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
-// outState.putString("PIID", pidval.getText().toString());
|
|
|
-// }
|
|
|
+ @Override
|
|
|
+ public boolean onOptionsItemSelected(MenuItem item)
|
|
|
+ {
|
|
|
+ if (true) {
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected void onSaveInstanceState(Bundle outState)
|
|
|
+ {
|
|
|
+ if (true) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // TODO Auto-generated method stub
|
|
|
+ super.onSaveInstanceState(outState);
|
|
|
+ if (photoFile != null)
|
|
|
+ outState.putSerializable("photoFile", photoFile);
|
|
|
+
|
|
|
+ if (thumbBitmap != null)
|
|
|
+ outState.putByteArray("thumbBitmap", getBytes(thumbBitmap));// ("thumbBitmap",
|
|
|
+ // (Object)thumbBitmap);
|
|
|
+ // outState.putString("thumbpath",
|
|
|
+ // thumbpath);
|
|
|
+ // outState.putString("m_sName", m_sName);
|
|
|
+ // outState.putString("m_sPassword", m_sPassword);
|
|
|
+
|
|
|
+ outState.putStringArrayList("photoList", photoList);
|
|
|
+ // Log.d(TAG, "save thumbpath==" + thumbpath);
|
|
|
+ //outState.putInt("iPhotoCount", photoList.size());
|
|
|
+ TextView pidval = (TextView) findViewById(R.id.pidval);
|
|
|
+ outState.putString("PIID", pidval.getText().toString());
|
|
|
+ }
|
|
|
|
|
|
public static byte[] getBytes(Bitmap bitmap)
|
|
|
{
|
|
|
@@ -657,29 +762,29 @@ public class MainActivity extends AppCompatActivity
|
|
|
|
|
|
}
|
|
|
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");
|
|
|
+ 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()
|
|
|
{
|
|
|
|
|
|
-// 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");
|
|
|
+ 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");
|
|
|
|
|
|
}
|
|
|
|