mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +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"/>
|
android:summary="@string/prefs_pincode_summary"/>
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/prefs_category_instant_uploading">
|
<PreferenceCategory android:title="@string/prefs_category_instant_uploading" android:key="instant_uploading_category">
|
||||||
<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"
|
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
|
||||||
android:title="@string/prefs_instant_upload"
|
android:title="@string/prefs_instant_upload"
|
||||||
android:summary="@string/prefs_instant_upload_summary"/>
|
android:summary="@string/prefs_instant_upload_summary"/>
|
||||||
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:dependency="instant_uploading"
|
<com.owncloud.android.ui.PreferenceWithLongSummary
|
||||||
android:disableDependentsState="true"
|
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:title="@string/instant_upload_on_wifi"
|
||||||
android:key="instant_upload_on_wifi"/>
|
android:key="instant_upload_on_wifi"/>
|
||||||
<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"
|
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_video_uploading"
|
||||||
android:title="@string/prefs_instant_video_upload"
|
android:title="@string/prefs_instant_video_upload"
|
||||||
android:summary="@string/prefs_instant_video_upload_summary" />
|
android:summary="@string/prefs_instant_video_upload_summary" />
|
||||||
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:dependency="instant_video_uploading"
|
<com.owncloud.android.ui.PreferenceWithLongSummary
|
||||||
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:title="@string/instant_video_upload_on_wifi"
|
||||||
android:key="instant_video_upload_on_wifi"/>
|
android:key="instant_video_upload_on_wifi"/>
|
||||||
<!-- DISABLED FOR RELEASE UNTIL FIXED
|
<!-- DISABLED FOR RELEASE UNTIL FIXED
|
||||||
|
|
|
@ -79,8 +79,13 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
|
||||||
private String mAccountName;
|
private String mAccountName;
|
||||||
private boolean mShowContextMenu = false;
|
private boolean mShowContextMenu = false;
|
||||||
private String mUploadPath;
|
private String mUploadPath;
|
||||||
|
private PreferenceCategory mPrefInstantUploadCategory;
|
||||||
|
private Preference mPrefInstantUpload;
|
||||||
private Preference mPrefInstantUploadPath;
|
private Preference mPrefInstantUploadPath;
|
||||||
|
private Preference mPrefInstantUploadPathWiFi;
|
||||||
|
private Preference mPrefInstantVideoUpload;
|
||||||
private Preference mPrefInstantVideoUploadPath;
|
private Preference mPrefInstantVideoUploadPath;
|
||||||
|
private Preference mPrefInstantVideoUploadPathWiFi;
|
||||||
private String mUploadVideoPath;
|
private String mUploadVideoPath;
|
||||||
|
|
||||||
|
|
||||||
|
@ -276,6 +281,22 @@ 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");
|
mPrefInstantVideoUploadPath = findPreference("instant_video_upload_path");
|
||||||
if (mPrefInstantVideoUploadPath != null){
|
if (mPrefInstantVideoUploadPath != null){
|
||||||
|
|
||||||
|
@ -293,6 +314,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 */
|
/* About App */
|
||||||
pAboutApp = (Preference) findPreference("about_app");
|
pAboutApp = (Preference) findPreference("about_app");
|
||||||
if (pAboutApp != null) {
|
if (pAboutApp != null) {
|
||||||
|
@ -305,6 +339,26 @@ public class Preferences extends SherlockPreferenceActivity implements AccountMa
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
@Override
|
||||||
protected void onPause() {
|
protected void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
Loading…
Reference in a new issue