diff --git a/res/layout-land/account_setup.xml b/res/layout-land/account_setup.xml index b394f2ec00..34ac31dadb 100644 --- a/res/layout-land/account_setup.xml +++ b/res/layout-land/account_setup.xml @@ -64,8 +64,8 @@ android:layout_weight="1" android:ems="10" android:hint="@string/auth_host_url" - android:singleLine="true" > - + android:singleLine="true" + android:inputType="textNoSuggestions"> diff --git a/res/layout/account_setup.xml b/res/layout/account_setup.xml index c484271e51..e56c117df4 100644 --- a/res/layout/account_setup.xml +++ b/res/layout/account_setup.xml @@ -17,7 +17,6 @@ along with this program. If not, see . --> - + android:singleLine="true" + android:inputType="textNoSuggestions" > diff --git a/res/values/strings.xml b/res/values/strings.xml index 162bc1d72c..560f1d1ff7 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -194,4 +194,6 @@ The certificate could not be saved This is a placeholder + + Upload pictures via WiFi only diff --git a/res/xml/preferences.xml b/res/xml/preferences.xml index 67a7d9661c..f3c49525da 100644 --- a/res/xml/preferences.xml +++ b/res/xml/preferences.xml @@ -13,6 +13,7 @@ + diff --git a/src/com/owncloud/android/files/PhotoTakenBroadcastReceiver.java b/src/com/owncloud/android/files/PhotoTakenBroadcastReceiver.java index 8372e779e8..d39baa991c 100644 --- a/src/com/owncloud/android/files/PhotoTakenBroadcastReceiver.java +++ b/src/com/owncloud/android/files/PhotoTakenBroadcastReceiver.java @@ -31,6 +31,7 @@ import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.net.ConnectivityManager; +import android.net.NetworkInfo.State; import android.preference.PreferenceManager; import android.provider.MediaStore.Images.Media; import android.util.Log; @@ -45,10 +46,13 @@ public class PhotoTakenBroadcastReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { - if (!PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_uploading", false)) { + boolean iu_enabled = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_uploading", false); + + if (!iu_enabled) { Log.d(TAG, "Instant upload disabled, abording uploading"); return; } + if (intent.getAction().equals(android.net.ConnectivityManager.CONNECTIVITY_ACTION)) { handleConnectivityAction(context, intent); } else if (intent.getAction().equals(NEW_PHOTO_ACTION)) { @@ -71,6 +75,17 @@ public class PhotoTakenBroadcastReceiver extends BroadcastReceiver { Log.e(TAG, "Couldn't resolve given uri!"); return; } + + boolean iu_via_wifi = PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_upload_on_wifi", false); + boolean is_conn_via_wifi = false; + if (iu_via_wifi) { + ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); + if (cm != null && cm.getActiveNetworkInfo() != null && + cm.getActiveNetworkInfo().getType() == ConnectivityManager.TYPE_WIFI && + cm.getActiveNetworkInfo().getState() == State.CONNECTED) + is_conn_via_wifi = true; + } + String file_path = c.getString(c.getColumnIndex(Media.DATA)); String file_name = c.getString(c.getColumnIndex(Media.DISPLAY_NAME)); @@ -79,7 +94,7 @@ public class PhotoTakenBroadcastReceiver extends BroadcastReceiver { c.close(); - if (!isOnline(context)) { + if (!isOnline(context) || (iu_via_wifi && !is_conn_via_wifi)) { DbHandler db = new DbHandler(context); db.putFileForLater(file_path, account.name); db.close();