<PreferenceCategory android:title="@string/prefs_category_instant_uploading"
android:key="instant_uploading_category">
- <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
- android:dependency="instant_uploading"
- android:disableDependentsState="true"
- android:title="@string/instant_upload_on_charging"
- android:key="instant_upload_on_charging"/>
+
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
android:key="instant_uploading"
- android:title="@string/prefs_instant_upload"
- android:summary="@string/prefs_instant_upload_summary"/>
- <com.owncloud.android.ui.PreferenceWithLongSummary
- android:title="@string/prefs_instant_upload_path_title"
- android:key="instant_upload_path" />
- <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
- android:title="@string/instant_upload_on_wifi"
- android:key="instant_upload_on_wifi"/>
+ android:title="@string/prefs_instant_upload"
+ android:summary="@string/prefs_instant_upload_summary"/>
+ <com.owncloud.android.ui.PreferenceWithLongSummary
+ android:dependency="instant_uploading"
+ android:disableDependentsState="true"
+ android:title="@string/prefs_instant_upload_path_title"
+ android:key="instant_upload_path" />
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
+ android:dependency="instant_uploading"
+ android:disableDependentsState="true"
+ android:title="@string/instant_upload_on_wifi"
+ android:key="instant_upload_on_wifi"/>
+ <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
+ android:dependency="instant_uploading"
+ android:disableDependentsState="true"
+ android:title="@string/instant_upload_on_charging"
+ android:key="instant_upload_on_charging"/>
+
+ <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
android:key="instant_video_uploading"
- android:title="@string/prefs_instant_video_upload"
- android:summary="@string/prefs_instant_video_upload_summary" />
+ android:title="@string/prefs_instant_video_upload"
+ android:summary="@string/prefs_instant_video_upload_summary" />
<com.owncloud.android.ui.PreferenceWithLongSummary
- android:title="@string/prefs_instant_video_upload_path_title"
- android:key="instant_video_upload_path" />
+ android:dependency="instant_video_uploading"
+ android:disableDependentsState="true"
+ android:title="@string/prefs_instant_video_upload_path_title"
+ android:key="instant_video_upload_path" />
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
- android:title="@string/instant_video_upload_on_wifi"
- android:key="instant_video_upload_on_wifi"/>
- <!-- DISABLED FOR RELEASE UNTIL FIXED
+ android:dependency="instant_video_uploading"
+ android:disableDependentsState="true"
+ android:title="@string/instant_video_upload_on_wifi"
+ android:key="instant_video_upload_on_wifi"/>
+ <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle
+ android:dependency="instant_video_uploading"
+ android:disableDependentsState="true"
+ android:title="@string/instant_video_upload_on_charging"
+ android:key="instant_video_upload_on_charging"/>
+ </PreferenceCategory>
+
+ <PreferenceCategory android:title="@string/prefs_category_more" android:key="more">
+ <!-- DISABLED FOR RELEASE UNTIL FIXED
CheckBoxPreference android:key="log_to_file"
android:title="@string/prefs_log_title"
android:summary="@string/prefs_log_summary"/>
<Preference android:key="log_history"
android:title="@string/prefs_log_title_history"
android:summary="@string/prefs_log_summary_history"/ -->
-
- </PreferenceCategory>
-
- <PreferenceCategory android:title="@string/prefs_category_more" android:key="more">
<Preference android:title="@string/prefs_help" android:key="help" />
<Preference android:title="@string/prefs_recommend" android:key="recommend" />
<Preference android:title="@string/prefs_feedback" android:key="feedback" />
if (!isOnline(context)
|| (instantVideoUploadViaWiFiOnly(context) && !isConnectedViaWiFi(context))
- || (instantUploadWhenChargingOnly(context) && !isCharging(context))
+ || (instantVideoUploadWhenChargingOnly(context) && !isCharging(context))
) {
return;
}
if (!intent.hasExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY)
&& isOnline(context)
- && (!instantUploadWhenChargingOnly(context) || (instantUploadWhenChargingOnly(context) == isCharging(context) == true))
- && (!instantPictureUploadViaWiFiOnly(context) || (instantPictureUploadViaWiFiOnly(context) == isConnectedViaWiFi(context) == true))
- && (!instantVideoUploadViaWiFiOnly(context) || (instantVideoUploadViaWiFiOnly(context) == isConnectedViaWiFi(context) == true))
+ && (!instantUploadWhenChargingOnly(context) || (instantUploadWhenChargingOnly(context) && isCharging(context)))
+ && (!instantVideoUploadWhenChargingOnly(context) || (instantVideoUploadWhenChargingOnly(context) && isCharging(context)))
+ && (!instantPictureUploadViaWiFiOnly(context) || (instantPictureUploadViaWiFiOnly(context) && isConnectedViaWiFi(context)))
+ && (!instantVideoUploadViaWiFiOnly(context) || (instantVideoUploadViaWiFiOnly(context) && isConnectedViaWiFi(context)))
) {
DbHandler db = new DbHandler(context);
Cursor c = db.getAwaitingFiles();
public static boolean isCharging(Context context){
IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
Intent batteryStatus = context.registerReceiver(null, ifilter);
-
- int status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
+
+ int status = 0;
+ if (batteryStatus != null) {
+ status = batteryStatus.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
+ }
return status == BatteryManager.BATTERY_STATUS_CHARGING ||
status == BatteryManager.BATTERY_STATUS_FULL;
}
public static boolean instantUploadWhenChargingOnly(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_upload_on_charging", false);
}
+ public static boolean instantVideoUploadWhenChargingOnly(Context context) {
+ return PreferenceManager.getDefaultSharedPreferences(context).getBoolean("instant_video_upload_on_charging", false);
+ }
}