android:summary="@string/prefs_pincode_summary"/>
</PreferenceCategory>
- <PreferenceCategory android:title="@string/prefs_category_instant_uploading">
- <com.owncloud.android.ui.PreferenceWithLongSummary
- android:title="@string/prefs_instant_upload_path_title"
- android:key="instant_upload_path" />
- <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
+ <PreferenceCategory android:title="@string/prefs_category_instant_uploading" android:key="instant_uploading_category">
+ <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.CheckBoxPreferenceWithLongTitle android:dependency="instant_uploading"
- android:disableDependentsState="true"
+ <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"/>
+ <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" />
<com.owncloud.android.ui.PreferenceWithLongSummary
android:title="@string/prefs_instant_video_upload_path_title"
android:key="instant_video_upload_path" />
- <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"/>
- <com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:dependency="instant_video_uploading"
- android:disableDependentsState="true"
+ <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
private String mAccountName;
private boolean mShowContextMenu = false;
private String mUploadPath;
+ private PreferenceCategory mPrefInstantUploadCategory;
+ private Preference mPrefInstantUpload;
private Preference mPrefInstantUploadPath;
+ private Preference mPrefInstantUploadPathWiFi;
+ private Preference mPrefInstantVideoUpload;
private Preference mPrefInstantVideoUploadPath;
+ private Preference mPrefInstantVideoUploadPathWiFi;
private String mUploadVideoPath;
}
});
}
-
+
+ mPrefInstantUploadCategory = (PreferenceCategory) findPreference("instant_uploading_category");
+
+ mPrefInstantUploadPathWiFi = findPreference("instant_upload_on_wifi");
+ mPrefInstantUpload = findPreference("instant_uploading");
+
+ toggleInstantPictureOptions(((CheckBoxPreference) mPrefInstantUpload).isChecked());
+
+ mPrefInstantUpload.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ toggleInstantPictureOptions((Boolean) newValue);
+ return true;
+ }
+ });
+
mPrefInstantVideoUploadPath = findPreference("instant_video_upload_path");
if (mPrefInstantVideoUploadPath != null){
}
});
}
+
+ mPrefInstantVideoUploadPathWiFi = findPreference("instant_video_upload_on_wifi");
+ mPrefInstantVideoUpload = findPreference("instant_video_uploading");
+ toggleInstantVideoOptions(((CheckBoxPreference) mPrefInstantUpload).isChecked());
+
+ mPrefInstantVideoUpload.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ toggleInstantVideoOptions((Boolean) newValue);
+ return true;
+ }
+ });
/* About App */
pAboutApp = (Preference) findPreference("about_app");
loadInstantUploadVideoPath();
}
+
+ private void toggleInstantPictureOptions(Boolean value){
+ if (value){
+ mPrefInstantUploadCategory.addPreference(mPrefInstantUploadPathWiFi);
+ mPrefInstantUploadCategory.addPreference(mPrefInstantUploadPath);
+ } else {
+ mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPathWiFi);
+ mPrefInstantUploadCategory.removePreference(mPrefInstantUploadPath);
+ }
+ }
+
+ private void toggleInstantVideoOptions(Boolean value){
+ if (value){
+ mPrefInstantUploadCategory.addPreference(mPrefInstantVideoUploadPathWiFi);
+ mPrefInstantUploadCategory.addPreference(mPrefInstantVideoUploadPath);
+ } else {
+ mPrefInstantUploadCategory.removePreference(mPrefInstantVideoUploadPathWiFi);
+ mPrefInstantUploadCategory.removePreference(mPrefInstantVideoUploadPath);
+ }
+ }
@Override
protected void onPause() {