|
|
@@ -35,8 +35,6 @@ import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.usai.redant.raimage.Model.ManufactureListActivity;
|
|
|
-import com.usai.redant.raimage.Model.ModelActivity;
|
|
|
-import com.usai.redant.raimage.POP.PopActivity;
|
|
|
import com.usai.redant.raimage.PhotoList.PhotoGridActivity;
|
|
|
import com.usai.util.AES;
|
|
|
import com.usai.util.MD5;
|
|
|
@@ -63,6 +61,8 @@ public class MainActivity extends AppCompatActivity
|
|
|
{
|
|
|
|
|
|
|
|
|
+ protected String mode=null;
|
|
|
+ protected String name=null;
|
|
|
private VerifyCodeTask verifytask=null;
|
|
|
private QueryManufacturer qmtask=null;
|
|
|
private JSONArray manufacture_arr=null;
|
|
|
@@ -75,12 +75,11 @@ public class MainActivity extends AppCompatActivity
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ String title = "Verifying "+name;
|
|
|
|
|
|
- String title = "Verifying PIID";
|
|
|
-
|
|
|
- if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
- title = "Verifying Model";
|
|
|
- }
|
|
|
+// if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
+// title = "Verifying Model";
|
|
|
+// }
|
|
|
|
|
|
vfdialog=new AlertDialog.Builder(MainActivity.this)
|
|
|
.setTitle(title)
|
|
|
@@ -361,13 +360,13 @@ public class MainActivity extends AppCompatActivity
|
|
|
Intent intent = new Intent("REDANT.RAImage.ADD_TASK");
|
|
|
|
|
|
ArrayList<Bundle> taskArr = new ArrayList<Bundle>();
|
|
|
- String name = "POP";
|
|
|
-
|
|
|
-// if(MainActivity.this instanceof ModelActivity)
|
|
|
-// name=name = "Model";
|
|
|
- if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
- name = "Model";
|
|
|
- }
|
|
|
+// String name = "POP";
|
|
|
+//
|
|
|
+//// if(MainActivity.this instanceof ModelActivity)
|
|
|
+//// name=name = "Model";
|
|
|
+// if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
+// name = "Model";
|
|
|
+// }
|
|
|
for (String path : photoList) {
|
|
|
Bundle task = new Bundle();
|
|
|
|
|
|
@@ -382,14 +381,14 @@ public class MainActivity extends AppCompatActivity
|
|
|
Bundle params = new Bundle();
|
|
|
params.putString("user",encryptUser);
|
|
|
params.putString("password",encryptPwd);
|
|
|
- params.putString("mode",name);
|
|
|
+ params.putString("mode",mode);
|
|
|
params.putString("barcode",pidval.getText().toString());
|
|
|
params.putString("_operate","upload");
|
|
|
params.putString("platform","android");
|
|
|
params.putString("md5",md5);
|
|
|
|
|
|
|
|
|
- if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
+ if (mode.equals("Model")) {
|
|
|
|
|
|
if (!TextUtils.isEmpty(manufacture)) {
|
|
|
params.putString("manufacturer",manufacture);
|
|
|
@@ -426,11 +425,11 @@ public class MainActivity extends AppCompatActivity
|
|
|
// model , piid not exist
|
|
|
|
|
|
|
|
|
- String msg = "PIID does not exist";
|
|
|
+ String msg = name+" does not exist";
|
|
|
|
|
|
- if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
- msg = "Model does not exist.";
|
|
|
- }
|
|
|
+// if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
+// msg = "Model does not exist.";
|
|
|
+// }
|
|
|
// Toast toast = Toast.makeText(getApplicationContext(),
|
|
|
// msg,
|
|
|
// Toast.LENGTH_LONG);
|
|
|
@@ -623,7 +622,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
countTextView = (TextView)findViewById(R.id.photo_count_lb);
|
|
|
pidval = (EditText)findViewById(R.id.barcode_et);
|
|
|
|
|
|
- if (MainActivity.this.getClass().equals(ModelActivity.class)) { // model
|
|
|
+ if (mode.equals("Model")) { // model
|
|
|
|
|
|
pidval.addTextChangedListener(new TextWatcher() {
|
|
|
|
|
|
@@ -680,16 +679,21 @@ public class MainActivity extends AppCompatActivity
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
final EditText edit = new EditText(MainActivity.this);
|
|
|
- String msg = "Please enter model name";
|
|
|
+ String msg = "Please enter "+name;
|
|
|
// if (MainActivity.this.getClass().equals(ModelActivity.class)) { // model
|
|
|
//
|
|
|
//
|
|
|
// }
|
|
|
// else
|
|
|
- if (MainActivity.this.getClass().equals(PopActivity.class))
|
|
|
+// if (MainActivity.this.getClass().equals(PopActivity.class))
|
|
|
+// {
|
|
|
+// edit.setInputType(InputType.TYPE_CLASS_NUMBER);
|
|
|
+// msg = "Please enter PIID code";
|
|
|
+// }
|
|
|
+
|
|
|
+ if(mode.equals("POP")||mode.equals("Returns"))
|
|
|
{
|
|
|
edit.setInputType(InputType.TYPE_CLASS_NUMBER);
|
|
|
- msg = "Please enter PIID code";
|
|
|
}
|
|
|
|
|
|
edit.setSingleLine(true);
|
|
|
@@ -791,14 +795,15 @@ public class MainActivity extends AppCompatActivity
|
|
|
public void onClick(View v)
|
|
|
{
|
|
|
if (TextUtils.isEmpty(pidval.getText().toString())) {
|
|
|
- String barcode_title = "PIID";
|
|
|
- if (MainActivity.this.getClass().equals(ModelActivity.class)) { // model
|
|
|
- barcode_title = "Model";
|
|
|
- }
|
|
|
+ String barcode_title = name;//"PIID";
|
|
|
+// 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 (name.equals("Model"))//(MainActivity.this.getClass().equals(ModelActivity.class))
|
|
|
+ {
|
|
|
if (TextUtils.isEmpty(manufacture)) {
|
|
|
showWarning("manufacture can not be blank!");
|
|
|
return;
|
|
|
@@ -886,13 +891,13 @@ public class MainActivity extends AppCompatActivity
|
|
|
}
|
|
|
try {
|
|
|
|
|
|
- String name = "POP";
|
|
|
-
|
|
|
-// if(MainActivity.this instanceof ModelActivity)
|
|
|
-// name=name = "Model";
|
|
|
- if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
- name = "Model";
|
|
|
- }
|
|
|
+// String name = "POP";
|
|
|
+//
|
|
|
+//// if(MainActivity.this instanceof ModelActivity)
|
|
|
+//// name=name = "Model";
|
|
|
+// if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
+// name = "Model";
|
|
|
+// }
|
|
|
String encryptUser = AES.encrypt("usai",RedAntApplication.user);
|
|
|
String encryptPwd = AES.encrypt("usai",RedAntApplication.password);
|
|
|
|
|
|
@@ -902,12 +907,12 @@ public class MainActivity extends AppCompatActivity
|
|
|
Bundle params = new Bundle();
|
|
|
params.putString("user",encryptUser);
|
|
|
params.putString("password",encryptPwd);
|
|
|
- params.putString("mode",name);
|
|
|
+ params.putString("mode",mode);
|
|
|
params.putString("barcode",pidval.getText().toString());
|
|
|
params.putString("_operate","upload");
|
|
|
params.putString("platform","android");
|
|
|
|
|
|
- if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
+ if (mode.equals("Model")) {
|
|
|
|
|
|
if (!TextUtils.isEmpty(manufacture)) {
|
|
|
params.putString("manufacturer",manufacture);
|
|
|
@@ -916,56 +921,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
}
|
|
|
|
|
|
verifyandupload(params);
|
|
|
-// Intent intent = new Intent("REDANT.RAImage.ADD_TASK");
|
|
|
-//
|
|
|
-// ArrayList<Bundle> taskArr = new ArrayList<Bundle>();
|
|
|
-// String name = "POP";
|
|
|
-//
|
|
|
-//// if(MainActivity.this instanceof ModelActivity)
|
|
|
-//// name=name = "Model";
|
|
|
-// if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
-// name = "Model";
|
|
|
-// }
|
|
|
-// 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",name);
|
|
|
-// params.putString("barcode",pidval.getText().toString());
|
|
|
-// params.putString("_operate","upload");
|
|
|
-// params.putString("platform","android");
|
|
|
-// params.putString("md5",md5);
|
|
|
-//
|
|
|
-//
|
|
|
-// if (MainActivity.this.getClass().equals(ModelActivity.class)) {
|
|
|
-//
|
|
|
-// if (!TextUtils.isEmpty(manufacture)) {
|
|
|
-// params.putString("manufacturer",manufacture);
|
|
|
-// }
|
|
|
-// 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();
|
|
|
+
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -976,7 +932,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
});
|
|
|
|
|
|
/**Model*/
|
|
|
- if (this.getClass().equals(ModelActivity.class)) {
|
|
|
+ if (mode.equals("model")) {
|
|
|
if (manufactureBtn != null) {
|
|
|
manufactureBtn.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
@@ -1083,7 +1039,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
countTextView.setText(photoList.size() + " Photos");
|
|
|
|
|
|
/** Model */
|
|
|
- if (this.getClass().equals(ModelActivity.class)) {
|
|
|
+ if (mode.equals("Model")) {
|
|
|
if (!TextUtils.isEmpty(savedNote)) {
|
|
|
noteTextView.setText(savedNote);
|
|
|
noteTextView.setSelection(savedNote.length());
|
|
|
@@ -1100,10 +1056,10 @@ public class MainActivity extends AppCompatActivity
|
|
|
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss")
|
|
|
.format(new Date());
|
|
|
|
|
|
- String barcode_title = "PIID";
|
|
|
- if (MainActivity.this.getClass().equals(ModelActivity.class)) { // model
|
|
|
- barcode_title = "Model";
|
|
|
- }
|
|
|
+ String barcode_title = name;//"PIID";
|
|
|
+// if (MainActivity.this.getClass().equals(ModelActivity.class)) { // model
|
|
|
+// barcode_title = "Model";
|
|
|
+// }
|
|
|
String imageFileName = barcode_title + timeStamp +".jpg";
|
|
|
|
|
|
|
|
|
@@ -1284,7 +1240,10 @@ public class MainActivity extends AppCompatActivity
|
|
|
|
|
|
|
|
|
|
|
|
- // m_sName = intent.getStringExtra("user");
|
|
|
+ mode = getIntent().getStringExtra("mode");
|
|
|
+ name = getIntent().getStringExtra("name");
|
|
|
+
|
|
|
+ // m_sName = intent.getStringExtra("user");
|
|
|
// m_sPassword = intent.getStringExtra("password");
|
|
|
|
|
|
Log.d(TAG, "user=" + RedAntApplication.user + ",password="
|
|
|
@@ -1594,14 +1553,14 @@ public class MainActivity extends AppCompatActivity
|
|
|
+ bundle.getString("pid"));
|
|
|
if (newVersion) {
|
|
|
|
|
|
- if (this.getClass().equals(PopActivity.class))
|
|
|
+ if (mode.equals("POP")||mode.equals("Returns"))
|
|
|
{
|
|
|
if(!RAUtil.isNumeric(pid))
|
|
|
{
|
|
|
|
|
|
new AlertDialog.Builder(MainActivity.this)
|
|
|
.setTitle("Warning")
|
|
|
- .setMessage("PIID must be a number")
|
|
|
+ .setMessage(name+" must be a number")
|
|
|
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(DialogInterface dialog, int which) {
|
|
|
@@ -1793,7 +1752,7 @@ public class MainActivity extends AppCompatActivity
|
|
|
|
|
|
if (newVersion) {
|
|
|
outState.putString("PIID", pidval.getText().toString());
|
|
|
- if (this.getClass().equals(ModelActivity.class)) {
|
|
|
+ if (mode.equals("Model")) {
|
|
|
outState.putString("Note",noteTextView.getText().toString());
|
|
|
outState.putString("manufacture",manufacture);
|
|
|
}
|