Przeglądaj źródła

RA Image Android

1 修复上传完成后,进度停在99% 的bug。
2 登陆界面用户名增加自动完成,允许从曾经登陆过的用户里选择。
3 增加只允许使用WIFI网络上传的设置。
4 增加网络类型检查逻辑。未测试。
Ray Zhang 8 lat temu
rodzic
commit
e7a799a635

+ 50 - 2
RA Image/app/src/main/java/com/usai/redant/raimage/FullScreenLoginActivity.java

@@ -22,6 +22,9 @@ import android.view.KeyEvent;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodManager;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.AutoCompleteTextView;
 import android.widget.EditText;
 import android.widget.Switch;
 import android.widget.TextView;
@@ -34,6 +37,8 @@ import com.usai.util.dbgUtil;
 
 import org.json.JSONObject;
 
+import java.util.HashSet;
+
 //import android.support.v7.app.AlertDialog;
 
 public class FullScreenLoginActivity extends Activity {
@@ -47,7 +52,7 @@ public class FullScreenLoginActivity extends Activity {
     private String					m_sPassword;
 
     // UI references.
-    private EditText	m_etName;
+    private AutoCompleteTextView	m_etName;
     private EditText m_etPassword;
     private EditText	m_etServer;
 //    private View					mLoginFormView;
@@ -141,6 +146,14 @@ public class FullScreenLoginActivity extends Activity {
                     editor.putBoolean("kepppass", false);
                 }
 
+
+
+
+
+                HashSet<String> user_list= (HashSet<String>) pref.getStringSet("user_list",new HashSet<String>());
+                user_list.add(m_sName);
+                editor.putStringSet("user_list",user_list);
+
                 editor.commit();
 
                 RedAntApplication.user = m_sName;
@@ -435,15 +448,50 @@ public class FullScreenLoginActivity extends Activity {
             e1.printStackTrace();
         }
 
-        m_etName = (EditText) findViewById(R.id.et_user);
+
+
         m_etServer = (EditText) findViewById(R.id.et_server);
         // m_etName.setText(m_sName);
 
         m_etPassword = (EditText) findViewById(R.id.et_pwd);
 
         m_swSave = (Switch) findViewById(R.id.sw_save);
+
+        m_etName = (AutoCompleteTextView) findViewById(R.id.et_user);
+
         SharedPreferences pref = RedAntApplication.getInstance()
                 .getSharedPreferences("RA Image", 0);
+
+
+        HashSet<String> user_list= (HashSet<String>) pref.getStringSet("user_list",new HashSet<String>());
+        user_list.toArray(new String[0]);
+
+        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
+                android.R.layout.simple_list_item_1, user_list.toArray(new String[0]));
+        m_etName.setAdapter(adapter);
+
+
+        m_etName.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                m_etPassword.setText("");
+            }
+        });
+//        m_etName.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+//            @Override
+//            public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
+//
+//                m_etPassword.setText("");
+//            }
+//
+//            @Override
+//            public void onNothingSelected(AdapterView<?> parent) {
+//
+//            }
+//        });
+
+
+
         String u = pref.getString("user", null);
         String p = pref.getString("password", null);
         String s = pref.getString("aa", null);

+ 64 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/MainActivity.java

@@ -13,6 +13,8 @@ import android.database.Cursor;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.media.ThumbnailUtils;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Environment;
@@ -21,6 +23,7 @@ import android.support.v7.app.AppCompatActivity;
 import android.text.InputType;
 import android.text.TextUtils;
 import android.util.Log;
+import android.view.Gravity;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
@@ -29,6 +32,7 @@ import android.widget.EditText;
 import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import com.usai.redant.raimage.Model.ManufactureListActivity;
 import com.usai.redant.raimage.Model.ModelActivity;
@@ -37,6 +41,7 @@ import com.usai.redant.raimage.PhotoList.PhotoListActivity;
 import com.usai.util.AES;
 import com.usai.util.MD5;
 import com.usai.util.RAUtil;
+import com.usai.util.dbgUtil;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -296,6 +301,65 @@ public class MainActivity extends AppCompatActivity
 					return;
 				}
 
+
+
+				boolean canstart = true;
+
+				ConnectivityManager connManager = (ConnectivityManager) RedAntApplication.getInstance()
+						.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+				NetworkInfo networkInfo = connManager
+						.getActiveNetworkInfo();
+				if (networkInfo == null)
+				{
+					dbgUtil.Logd(
+							"Current Network info",
+							"can not get Active NetworkInfo!");
+					canstart = false;
+				}
+				else
+				{
+					NetworkInfo.State netState = networkInfo
+							.getState();
+					if (netState != NetworkInfo.State.CONNECTED)
+					{
+						dbgUtil.Logd(
+								"Current Network info",
+								"not Connected!State="
+										+ netState);
+						canstart = false;
+					}
+					int iconntype = -1;
+					iconntype = networkInfo
+							.getType();
+
+					SharedPreferences pref = RedAntApplication
+							.getInstance()
+							.getSharedPreferences(
+									"UploadManager",
+									0);
+					boolean
+							wifi_only
+							=pref.getBoolean("wifi_only",
+							true);
+					if(wifi_only == true
+							&& iconntype !=
+							ConnectivityManager.TYPE_WIFI
+							&& iconntype !=
+							9/* earthnet */)
+					{
+						canstart = false;
+					}
+				}
+				if(!canstart)
+				{
+					Toast toast = Toast.makeText(getApplicationContext(),
+							"App is set to upload via WIFI only. Please change your setting or try upload manually later.",
+							Toast.LENGTH_LONG);
+					toast.setGravity(Gravity.CENTER, 0, 0);
+					toast.show();
+					return;
+				}
 				try {
 
 					Intent intent = new Intent("REDANT.RAImage.ADD_TASK");

+ 81 - 13
RA Image/app/src/main/java/com/usai/redant/raimage/TaskActivity.java

@@ -5,6 +5,9 @@ import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.ServiceConnection;
+import android.content.SharedPreferences;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.support.annotation.LayoutRes;
@@ -14,6 +17,7 @@ import android.support.v7.app.ActionBar;
 import android.support.v7.app.AlertDialog;
 import android.support.v7.app.AppCompatActivity;
 import android.util.Log;
+import android.view.Gravity;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
@@ -23,8 +27,10 @@ import android.widget.ImageButton;
 import android.widget.ListView;
 import android.widget.ProgressBar;
 import android.widget.TextView;
+import android.widget.Toast;
 
 import com.usai.util.RAUploadManager;
+import com.usai.util.dbgUtil;
 
 import java.util.ArrayList;
 
@@ -285,20 +291,20 @@ public class TaskActivity extends AppCompatActivity {
                 holder = (ViewHolder)cell.getTag();
                 Log.d("_LIST", "getView: " + holder);
 
-            } else  {
+            } else {
 //                cell = LayoutInflater.from(getApplicationContext()).inflate(resourceId,null);
-                cell = View.inflate(getApplicationContext(),R.layout.upload_list_cell,null);
+                cell = View.inflate(getApplicationContext(), R.layout.upload_list_cell, null);
                 holder = new ViewHolder();
-                holder.name_tv = (TextView)cell.findViewById(R.id.upload_name_tv);
-                holder.progressBar = (ProgressBar)cell.findViewById(R.id.upload_progressBar);
-                holder.state_tv = (TextView)cell.findViewById(R.id.upload_state_tv);
-                holder.progress_tv = (TextView)cell.findViewById(R.id.upload_progress_tv);
-                holder.err_tv = (TextView)cell.findViewById(R.id.upload_err_tv);
-                holder.btn_reload=(ImageButton) cell.findViewById(R.id.btn_reload);
-
-
+                holder.name_tv = (TextView) cell.findViewById(R.id.upload_name_tv);
+                holder.progressBar = (ProgressBar) cell.findViewById(R.id.upload_progressBar);
+                holder.state_tv = (TextView) cell.findViewById(R.id.upload_state_tv);
+                holder.progress_tv = (TextView) cell.findViewById(R.id.upload_progress_tv);
+                holder.err_tv = (TextView) cell.findViewById(R.id.upload_err_tv);
+                holder.btn_reload = (ImageButton) cell.findViewById(R.id.btn_reload);
+                cell.setTag(holder);
+            }
                 holder.btn_reload.setImageResource(R.drawable.ic_action_reload);
-                if(istatus!= RAUploadManager.TaskStatus.TaskStatusError)
+                if(istatus!= RAUploadManager.TaskStatus.TaskStatusError&& istatus!= RAUploadManager.TaskStatus.TaskStatusStop)
                 {
                     holder.btn_reload.setVisibility(View.GONE);
                 }
@@ -314,13 +320,75 @@ public class TaskActivity extends AppCompatActivity {
                             Bundle task = task_arr.get(position);
 
                             Log.d("_LIST", "retry: " + task.getString("file","file is null") +"position" + position);
+
+
+
+                            boolean canstart = true;
+
+                            ConnectivityManager connManager = (ConnectivityManager) RedAntApplication.getInstance()
+                                    .getSystemService(Context.CONNECTIVITY_SERVICE);
+
+                            NetworkInfo networkInfo = connManager
+                                    .getActiveNetworkInfo();
+                            if (networkInfo == null)
+                            {
+                                dbgUtil.Logd(
+                                        "Current Network info",
+                                        "can not get Active NetworkInfo!");
+                                canstart = false;
+                            }
+                            else
+                            {
+                                NetworkInfo.State netState = networkInfo
+                                        .getState();
+                                if (netState != NetworkInfo.State.CONNECTED)
+                                {
+                                    dbgUtil.Logd(
+                                            "Current Network info",
+                                            "not Connected!State="
+                                                    + netState);
+                                    canstart = false;
+                                }
+                                int iconntype = -1;
+                                iconntype = networkInfo
+                                        .getType();
+
+                                SharedPreferences pref = RedAntApplication
+                                        .getInstance()
+                                        .getSharedPreferences(
+                                                "UploadManager",
+                                                0);
+                                boolean
+                                        wifi_only
+                                        =pref.getBoolean("wifi_only",
+                                        true);
+                                if(wifi_only == true
+                                        && iconntype !=
+                                        ConnectivityManager.TYPE_WIFI
+                                        && iconntype !=
+                                        9/* earthnet */)
+                                {
+                                    canstart = false;
+                                }
+                            }
+                            if(!canstart)
+                            {
+                                Toast toast = Toast.makeText(getApplicationContext(),
+                                        "App is set to upload via WIFI only. Please change your setting or try upload manually later.",
+                                        Toast.LENGTH_LONG);
+                                toast.setGravity(Gravity.CENTER, 0, 0);
+                                toast.show();
+                                return;
+                            }
+
+                            v.setVisibility(View.GONE);
                             uploadManager.startTask(task);
 
                         }
                     });
                 }
-                cell.setTag(holder);
-            }
+
+
 
             holder.name_tv.setText(name);
 //            holder.progressBar.setProgress(100 *(int)percent);

+ 55 - 58
RA Image/app/src/main/java/com/usai/redant/raimage/UploadService.java

@@ -14,7 +14,6 @@ import android.net.NetworkInfo;
 import android.os.Binder;
 import android.os.Bundle;
 import android.os.IBinder;
-import android.text.TextUtils;
 import android.util.Log;
 
 import com.usai.util.RAUploadManager;
@@ -632,65 +631,63 @@ public class UploadService extends Service
 															SharedPreferences pref = RedAntApplication
 																	.getInstance()
 																	.getSharedPreferences(
-																			"POP",
+																			"UploadManager",
 																			0);
 
-															String aa = pref
-																	.getString(
-																			"aa",
-																			null);
-															String ea = pref
-																	.getString(
-																			"ea",
-																			null);
-															if (iconntype == ConnectivityManager.TYPE_WIFI)
-															{
-																if (!TextUtils
-																		.isEmpty(aa))
-																	RedAntApplication.active_address = aa;
-															}
-															else
-															{
-																if (!TextUtils
-																		.isEmpty(ea))
-																	RedAntApplication.active_address = ea;
-															}
-															// boolean
-															// bUseMobileNetwork
-															// =
-															// context.getSharedPreferences(
-															// "PhoneAsstPref",
-															// 0).getBoolean("UseMobileNetwork",
-															// false);
-															//
-															// if
-															// (bUseMobileNetwork
-															// == false
-															// && iconntype !=
-															// ConnectivityManager.TYPE_WIFI
-															// && iconntype !=
-															// 9/* earthnet */)
-															// {
-															// dbgUtil.Log(Log.DEBUG,
-															// "Current Network info",
-															// "not allowed!Connection type="
-															// +
-															// networkInfo.getTypeName());
-															// return false;
-															// }
-															boolean bavailable = networkInfo
-																	.isAvailable();
-															String strtype = networkInfo
-																	.getTypeName();
-
-															dbgUtil.Logd(
-																	"Current Network info",
-																	" type = "
-																			+ strtype
-																			+ " abailable = "
-																			+ bavailable
-																			+ " state "
-																			+ netState);
+//															String aa = pref
+//																	.getString(
+//																			"aa",
+//																			null);
+//															String ea = pref
+//																	.getString(
+//																			"ea",
+//																			null);
+//															if (iconntype == ConnectivityManager.TYPE_WIFI)
+//															{
+//																if (!TextUtils
+//																		.isEmpty(aa))
+//																	RedAntApplication.active_address = aa;
+//															}
+//															else
+//															{
+//																if (!TextUtils
+//																		.isEmpty(ea))
+//																	RedAntApplication.active_address = ea;
+//															}
+															 boolean
+																	 wifi_only
+															 =pref.getBoolean("wifi_only",
+															 true);
+
+															 if
+															 (wifi_only
+															 == true
+															 && iconntype !=
+															 ConnectivityManager.TYPE_WIFI
+															 && iconntype !=
+															 9/* earthnet */)
+															 {
+																 uploadManager.stopAllTasks();
+//															 dbgUtil.Log(Log.DEBUG,
+//															 "Current Network info",
+//															 "not allowed!Connection type="
+//															 +
+//															 networkInfo.getTypeName());
+															 return ;
+															 }
+//															boolean bavailable = networkInfo
+//																	.isAvailable();
+//															String strtype = networkInfo
+//																	.getTypeName();
+//
+//															dbgUtil.Logd(
+//																	"Current Network info",
+//																	" type = "
+//																			+ strtype
+//																			+ " abailable = "
+//																			+ bavailable
+//																			+ " state "
+//																			+ netState);
 //															if (bavailable)
 //															{
 //																if (uploadThread

+ 12 - 0
RA Image/app/src/main/java/com/usai/redant/raimage/uploadSettingActivity.java

@@ -22,6 +22,7 @@ public class uploadSettingActivity extends AppCompatActivity {
     private Switch auto_rm_fs_swt;
     private Switch auto_rm_er_swt;
     private Switch compress_swt;
+    private Switch sw_wifiOnly;
     private EditText retry_count_et;
 
     private ServiceConnection serviceConnection;
@@ -34,6 +35,8 @@ public class uploadSettingActivity extends AppCompatActivity {
         boolean auto_rm_fs = true;
         boolean auto_rm_er = false;
         boolean compress = true;
+
+        boolean wifionly = true;
         int retry_count = 2;
 
 //        SharedPreferences preferences = getSharedPreferences("uploadSetting", Context.MODE_PRIVATE);
@@ -43,6 +46,8 @@ public class uploadSettingActivity extends AppCompatActivity {
             auto_upload = preferences.getBoolean("auto_upload",true);
             auto_rm_fs = preferences.getBoolean("auto_rm_finish",true);
             auto_rm_er = preferences.getBoolean("auto_rm_error",false);
+
+            wifionly = preferences.getBoolean("wifi_only",true);
             compress = preferences.getBoolean("compress",true);
             retry_count = preferences.getInt("retry_count",2);
 
@@ -51,6 +56,7 @@ public class uploadSettingActivity extends AppCompatActivity {
         }
 
 
+        sw_wifiOnly.setChecked(wifionly);
         auto_start_swt.setChecked(auto_upload);
         auto_rm_fs_swt.setChecked(auto_rm_fs);
         auto_rm_er_swt.setChecked(auto_rm_er);
@@ -76,6 +82,8 @@ public class uploadSettingActivity extends AppCompatActivity {
         final boolean auto_upload = auto_start_swt.isChecked();
         final boolean auto_rm_fs = auto_rm_fs_swt.isChecked();
         final boolean auto_rm_er = auto_rm_er_swt.isChecked();
+
+        final boolean wifi_only = sw_wifiOnly.isChecked();
         boolean compress = compress_swt.isChecked();
         final int retry_count = Integer.parseInt(retry_count_et.getText().toString());
 
@@ -84,6 +92,7 @@ public class uploadSettingActivity extends AppCompatActivity {
         editor.putBoolean("auto_rm_error",auto_rm_er);
         editor.putBoolean("compress",compress);
         editor.putInt("retry_count",retry_count);
+        editor.putBoolean("wifi_only",wifi_only);
 
         editor.commit();
 
@@ -93,6 +102,7 @@ public class uploadSettingActivity extends AppCompatActivity {
             uploadManager.removeFinish = auto_rm_fs;
             uploadManager.removeError = auto_rm_er;
             uploadManager.maxRetry = retry_count;
+            uploadManager.wifiOnly = wifi_only;
         }
 
     }
@@ -121,6 +131,8 @@ public class uploadSettingActivity extends AppCompatActivity {
 
         bindService();
 
+
+        sw_wifiOnly = (Switch)findViewById(R.id.sw_wifyonly);
         auto_start_swt = (Switch)findViewById(R.id.auto_start_swt);
         auto_rm_fs_swt = (Switch)findViewById(R.id.auto_rm_fs_swt);
         auto_rm_er_swt = (Switch)findViewById(R.id.auto_rm_er_swt);

+ 7 - 3
RA Image/app/src/main/java/com/usai/util/Network.java

@@ -1156,7 +1156,7 @@ public class Network
 						is.close();
 						if(conn!=null)
 						conn.disconnect();
-						String result="{\"result\":0,\"msg\":\"user cancel\"}";
+						String result="{\"result\":"+0+",\"msg\":\"user cancel\"}";
 						listener.onFinish(200,result);
 
 						return result;
@@ -1164,11 +1164,15 @@ public class Network
 					curbytes += len;
 					dos.write(bytes, 0, len);
 					double newprogress =1.0d*curbytes/totalbytes;
-					if(newprogress-oldprogress>=listener.percent_step()/100.0||newprogress>=100.0)
+					if(newprogress-oldprogress>=listener.percent_step()/100.0||newprogress>=1.0)
 					{
 						listener.onProgress(curbytes,newprogress);
 						oldprogress = newprogress;
 					}
+					else
+					{
+//						Log.d(TAG, "UploadFile: skiped "+newprogress);
+					}
 
 				}
 				is.close();
@@ -1192,7 +1196,7 @@ public class Network
 						if(conn!=null)
 						conn.disconnect();
 //						br.close();
-						String result="{\"result\":0,\"msg\":\"user cancel\"}";
+						String result="{\"result\":"+0+",\"msg\":\"user cancel\"}";
 						listener.onFinish(200,result);
 						return result;
 					}

+ 133 - 4
RA Image/app/src/main/java/com/usai/util/RAUploadManager.java

@@ -1,6 +1,9 @@
 package com.usai.util;
 
+import android.content.Context;
 import android.content.SharedPreferences;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
 import android.os.Bundle;
 import android.util.Base64;
 import android.util.Log;
@@ -30,6 +33,9 @@ public class RAUploadManager {
     public int activeThread;
     public int maxRetry=2;
 
+
+
+    public Boolean wifiOnly=true;
     public Boolean autoStart=true;
     public Boolean removeFinish=true;
     public Boolean removeError=false;
@@ -64,7 +70,7 @@ public class RAUploadManager {
         TaskStatusError,
         TaskStatusWait,
         TaskStatusFinish,
-        TaskStatusCancel,
+        //TaskStatusCancel,
     }
 
     public UIUpdateListener uiUpdateListener;
@@ -111,7 +117,7 @@ public class RAUploadManager {
 
             maxThread = UMSetting.getInt("max_thread",3);
 
-
+            wifiOnly = UMSetting.getBoolean("wifi_only",true);
 
         }
         operation_queue = new RAOperationQueue();
@@ -119,6 +125,73 @@ public class RAUploadManager {
             @Override
             public Boolean operate(final Bundle taskinfo) {
 
+
+//
+//                ConnectivityManager connManager = (ConnectivityManager) context
+//                        .getSystemService(Context.CONNECTIVITY_SERVICE);
+//
+//                NetworkInfo networkInfo = connManager
+//                        .getActiveNetworkInfo();
+//                if (networkInfo == null)
+//                {
+//                    dbgUtil.Logd(
+//                            "Current Network info",
+//                            "can not get Active NetworkInfo!");
+//                    false;
+//                }
+//                NetworkInfo.State netState = networkInfo
+//                        .getState();
+//                if (netState != NetworkInfo.State.CONNECTED)
+//                {
+//                    dbgUtil.Logd(
+//                            "Current Network info",
+//                            "not Connected!State="
+//                                    + netState);
+//                    return;
+//                }
+//                int iconntype = -1;
+//                iconntype = networkInfo
+//                        .getType();
+//                SharedPreferences pref = RedAntApplication
+//                        .getInstance()
+//                        .getSharedPreferences(
+//                                "UploadManager",
+//                                0);
+//
+////															String aa = pref
+////																	.getString(
+////																			"aa",
+////																			null);
+////															String ea = pref
+////																	.getString(
+////																			"ea",
+////																			null);
+////															if (iconntype == ConnectivityManager.TYPE_WIFI)
+////															{
+////																if (!TextUtils
+////																		.isEmpty(aa))
+////																	RedAntApplication.active_address = aa;
+////															}
+////															else
+////															{
+////																if (!TextUtils
+////																		.isEmpty(ea))
+////																	RedAntApplication.active_address = ea;
+////															}
+//                boolean
+//                        wifi_only
+//                        =pref.getBoolean("wifi_only",
+//                        true);
+//
+//                if
+//                        (wifi_only
+//                        == true
+//                        && iconntype !=
+//                        ConnectivityManager.TYPE_WIFI
+//                        && iconntype !=
+//                        9/* earthnet */)
+//
+
                 boolean ret=false;
                 String path=taskinfo.getString("path");
                 taskinfo.putInt("status",TaskStatus.TaskStatusStart.ordinal());
@@ -399,9 +472,65 @@ public class RAUploadManager {
     public void startTask(Bundle task)
     {
 
-        task.putInt("status",TaskStatus.TaskStatusWait.ordinal());
-        operation_queue.addOperation(task);
+        task.putBoolean("iscancel",false);
+
+
+        boolean canstart = true;
+
+                ConnectivityManager connManager = (ConnectivityManager) RedAntApplication.getInstance()
+                        .getSystemService(Context.CONNECTIVITY_SERVICE);
+
+                NetworkInfo networkInfo = connManager
+                        .getActiveNetworkInfo();
+                if (networkInfo == null)
+                {
+                    dbgUtil.Logd(
+                            "Current Network info",
+                            "can not get Active NetworkInfo!");
+                    canstart = false;
+                }
+                else
+                {
+                    NetworkInfo.State netState = networkInfo
+                            .getState();
+                    if (netState != NetworkInfo.State.CONNECTED)
+                    {
+                        dbgUtil.Logd(
+                                "Current Network info",
+                                "not Connected!State="
+                                        + netState);
+                        canstart = false;
+                    }
+                    int iconntype = -1;
+                    iconntype = networkInfo
+                            .getType();
+
+                    if(wifiOnly == true
+                            && iconntype !=
+                            ConnectivityManager.TYPE_WIFI
+                            && iconntype !=
+                            9/* earthnet */)
+                    {
+                        canstart = false;
+                    }
+                }
 
+        if(canstart) {
+
+            task.putInt("status", TaskStatus.TaskStatusWait.ordinal());
+            operation_queue.addOperation(task);
+        }
+        else
+        {
+            task.putInt("status", TaskStatus.TaskStatusStop.ordinal());
+            if (uiUpdateListener!=null) {
+                int index = arr_queue.indexOf(task);
+//                            uiUpdateListener.onProgress(index,percentage);
+
+                uiUpdateListener.updateCell(index,task);
+            }
+
+        }
 
 
     };

+ 1 - 1
RA Image/app/src/main/res/layout/activity_full_screen_login.xml

@@ -183,7 +183,7 @@
                 android:inputType="textPersonName"
                 android:textColor="@android:color/black" />
 
-            <EditText
+            <AutoCompleteTextView
                 android:id="@+id/et_user"
                 android:layout_width="match_parent"
                 android:layout_height="0dp"

+ 18 - 8
RA Image/app/src/main/res/layout/activity_upload_setting.xml

@@ -48,10 +48,9 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignBaseline="@+id/auto_rm_fs_txt"
-        android:layout_alignParentEnd="true"
-        android:layout_alignParentRight="true"
-        android:layout_marginEnd="10dp"
-        android:layout_marginRight="10dp" />
+        android:layout_alignBottom="@+id/auto_rm_fs_txt"
+        android:layout_alignLeft="@+id/auto_start_swt"
+        android:layout_alignStart="@+id/auto_start_swt" />
 
     <TextView
         android:id="@+id/auto_rm_er_txt"
@@ -71,10 +70,9 @@
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignBaseline="@+id/auto_rm_er_txt"
-        android:layout_alignParentEnd="true"
-        android:layout_alignParentRight="true"
-        android:layout_marginEnd="10dp"
-        android:layout_marginRight="10dp" />
+        android:layout_alignBottom="@+id/auto_rm_er_txt"
+        android:layout_alignLeft="@+id/auto_rm_fs_swt"
+        android:layout_alignStart="@+id/auto_rm_fs_swt" />
 
     <TextView
         android:id="@+id/compress_txt"
@@ -124,5 +122,17 @@
         android:layout_alignStart="@+id/compress_swt"
         android:inputType="number" />
 
+    <Switch
+        android:id="@+id/sw_wifyonly"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_alignEnd="@+id/retry_et"
+        android:layout_alignLeft="@+id/retry_text"
+        android:layout_alignRight="@+id/retry_et"
+        android:layout_alignStart="@+id/retry_text"
+        android:layout_below="@+id/retry_et"
+        android:layout_marginTop="23dp"
+        android:text="Only upload via WIFI" />
+
 
 </RelativeLayout>

+ 2 - 1
RedAnt Photo/src/com/usai/redant/photo/LoginActivity.java

@@ -115,7 +115,8 @@ public class LoginActivity extends Activity
 		{
 			try
 			{
-				m_etName.setText(Crypto.decrypt("apexu", u));
+
+				.setText(Crypto.decrypt("apexu", u));
 				m_etPassword.setText(Crypto.decrypt("apexp", p));
 				m_cbSave.setChecked(true);
 			}