mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 07:05:49 +03:00
Merge pull request #825 from owncloud/SettingsGreyedOut
Instant Upload settings hide/show
This commit is contained in:
commit
7d21a9ec5d
2 changed files with 65 additions and 13 deletions
|
@ -31,25 +31,23 @@
|
|||
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
|
||||
|
|
|
@ -79,8 +79,13 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
|
|||
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;
|
||||
|
||||
|
||||
|
@ -275,7 +280,23 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
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){
|
||||
|
||||
|
@ -292,6 +313,19 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
mPrefInstantVideoUploadPathWiFi = findPreference("instant_video_upload_on_wifi");
|
||||
mPrefInstantVideoUpload = findPreference("instant_video_uploading");
|
||||
toggleInstantVideoOptions(((CheckBoxPreference) mPrefInstantVideoUpload).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");
|
||||
|
@ -304,6 +338,26 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
|
|||
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() {
|
||||
|
|
Loading…
Reference in a new issue