Don't show "Export all groups" option if there are no groups

This commit is contained in:
Alexander Bakker 2022-11-20 18:49:47 +01:00
parent fd5a0390f0
commit 282f85fb3b
2 changed files with 12 additions and 6 deletions

View file

@ -52,6 +52,7 @@ import java.util.List;
import java.util.Objects;
import java.util.Random;
import java.util.Set;
import java.util.TreeSet;
import javax.crypto.Cipher;
@ -173,11 +174,15 @@ public class ImportExportPreferencesFragment extends PreferencesFragment {
passwordInfoText.setVisibility(checkBoxEncrypt.isChecked() && isBackupPasswordSet ? View.VISIBLE : View.GONE);
});
for (String group: _vaultManager.getVault().getGroups()) {
CheckBox box = new CheckBox(requireContext());
box.setText(group);
box.setChecked(false);
groupsSelection.addView(box);
TreeSet<String> groups = _vaultManager.getVault().getGroups();
if (groups.size() > 0) {
checkBoxExportAllGroups.setVisibility(View.VISIBLE);
for (String group: groups) {
CheckBox box = new CheckBox(requireContext());
box.setText(group);
box.setChecked(false);
groupsSelection.addView(box);
}
}
AlertDialog dialog = new AlertDialog.Builder(requireContext())

View file

@ -73,7 +73,8 @@
android:layout_marginEnd="20dp"
android:layout_marginTop="5dp"
android:text="@string/export_all_groups"
android:checked="true"/>
android:checked="true"
android:visibility="gone" />
<TextView
android:id="@+id/select_groups_hint"