mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-21 20:35:58 +03:00
Fix #1276 Checkboxes using an uppercase X can not be toggled
Signed-off-by: Stefan Niedermann <info@niedermann.it>
This commit is contained in:
parent
110d841336
commit
eae70001d1
6 changed files with 30 additions and 29 deletions
|
@ -184,18 +184,8 @@ public class MainActivity extends LockedActivity implements NoteClickListener, A
|
||||||
// Verbose log output for https://github.com/stefan-niedermann/nextcloud-notes/issues/1256
|
// Verbose log output for https://github.com/stefan-niedermann/nextcloud-notes/issues/1256
|
||||||
runOnUiThread(() -> new AlertDialog.Builder(this)
|
runOnUiThread(() -> new AlertDialog.Builder(this)
|
||||||
.setTitle(NextcloudFilesAppAccountNotFoundException.class.getSimpleName())
|
.setTitle(NextcloudFilesAppAccountNotFoundException.class.getSimpleName())
|
||||||
.setMessage(R.string.backup_and_repair)
|
.setMessage(R.string.backup)
|
||||||
.setPositiveButton(R.string.simple_repair, (a, b) -> {
|
.setPositiveButton(R.string.simple_backup, (a, b) -> executor.submit(() -> {
|
||||||
executor.submit(() -> {
|
|
||||||
for (Account account : mainViewModel.getAccounts()) {
|
|
||||||
SingleAccountHelper.setCurrentAccount(this, account.getAccountName());
|
|
||||||
runOnUiThread(this::recreate);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.simple_backup, (a, b) -> {
|
|
||||||
executor.submit(() -> {
|
|
||||||
final List<Note> modifiedNotes = new LinkedList<>();
|
final List<Note> modifiedNotes = new LinkedList<>();
|
||||||
for (Account account : mainViewModel.getAccounts()) {
|
for (Account account : mainViewModel.getAccounts()) {
|
||||||
modifiedNotes.addAll(mainViewModel.getLocalModifiedNotes(account.getId()));
|
modifiedNotes.addAll(mainViewModel.getLocalModifiedNotes(account.getId()));
|
||||||
|
@ -208,9 +198,8 @@ public class MainActivity extends LockedActivity implements NoteClickListener, A
|
||||||
getResources().getQuantityString(R.plurals.share_multiple, modifiedNotes.size(), modifiedNotes.size()),
|
getResources().getQuantityString(R.plurals.share_multiple, modifiedNotes.size(), modifiedNotes.size()),
|
||||||
mainViewModel.collectNoteContents(modifiedNotes.stream().map(Note::getId).collect(Collectors.toList())));
|
mainViewModel.collectNoteContents(modifiedNotes.stream().map(Note::getId).collect(Collectors.toList())));
|
||||||
}
|
}
|
||||||
});
|
}))
|
||||||
})
|
.setNegativeButton(R.string.simple_error, (a, b) -> {
|
||||||
.setNeutralButton(android.R.string.cancel, (a, b) -> {
|
|
||||||
final SharedPreferences ssoPreferences = AccountImporter.getSharedPreferences(getApplicationContext());
|
final SharedPreferences ssoPreferences = AccountImporter.getSharedPreferences(getApplicationContext());
|
||||||
final StringBuilder ssoPreferencesString = new StringBuilder()
|
final StringBuilder ssoPreferencesString = new StringBuilder()
|
||||||
.append("Current SSO account: ").append(ssoPreferences.getString("PREF_CURRENT_ACCOUNT_STRING", null)).append("\n")
|
.append("Current SSO account: ").append(ssoPreferences.getString("PREF_CURRENT_ACCOUNT_STRING", null)).append("\n")
|
||||||
|
|
|
@ -297,5 +297,5 @@
|
||||||
<string name="simple_prev">Previous</string>
|
<string name="simple_prev">Previous</string>
|
||||||
<string name="simple_backup">Backup</string>
|
<string name="simple_backup">Backup</string>
|
||||||
<string name="simple_repair">Repair</string>
|
<string name="simple_repair">Repair</string>
|
||||||
<string name="backup_and_repair">We recommend to backup all unsynchronized notes and then try to repair the setup.</string>
|
<string name="backup">We detected an irrecoverably state of the app. Please backup your unsynchronized changes and clear the storage of the Notes app.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
1
fastlane/metadata/android/en-US/changelogs/3004011.txt
Normal file
1
fastlane/metadata/android/en-US/changelogs/3004011.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
- ✅ Checkboxes using an uppercase X can not be toggled (#1276)
|
|
@ -92,6 +92,7 @@ public class MarkdownUtil {
|
||||||
for (EListType listType : EListType.values()) {
|
for (EListType listType : EListType.values()) {
|
||||||
if (checkboxCheckedEmoji != null) {
|
if (checkboxCheckedEmoji != null) {
|
||||||
line = line.replace(listType.checkboxChecked, checkboxCheckedEmoji);
|
line = line.replace(listType.checkboxChecked, checkboxCheckedEmoji);
|
||||||
|
line = line.replace(listType.checkboxCheckedUpperCase, checkboxCheckedEmoji);
|
||||||
}
|
}
|
||||||
if (checkboxUncheckedEmoji != null) {
|
if (checkboxUncheckedEmoji != null) {
|
||||||
line = line.replace(listType.checkboxUnchecked, checkboxUncheckedEmoji);
|
line = line.replace(listType.checkboxUnchecked, checkboxUncheckedEmoji);
|
||||||
|
@ -240,7 +241,7 @@ public class MarkdownUtil {
|
||||||
|
|
||||||
public static boolean lineStartsWithCheckbox(@NonNull String line, @NonNull EListType listType) {
|
public static boolean lineStartsWithCheckbox(@NonNull String line, @NonNull EListType listType) {
|
||||||
final String trimmedLine = line.trim();
|
final String trimmedLine = line.trim();
|
||||||
return (trimmedLine.startsWith(listType.checkboxUnchecked) || trimmedLine.startsWith(listType.checkboxChecked));
|
return (trimmedLine.startsWith(listType.checkboxUnchecked) || trimmedLine.startsWith(listType.checkboxChecked) || trimmedLine.startsWith(listType.checkboxCheckedUpperCase));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -8,6 +8,7 @@ public enum EListType {
|
||||||
public final String listSymbol;
|
public final String listSymbol;
|
||||||
public final String listSymbolWithTrailingSpace;
|
public final String listSymbolWithTrailingSpace;
|
||||||
public final String checkboxChecked;
|
public final String checkboxChecked;
|
||||||
|
public final String checkboxCheckedUpperCase;
|
||||||
public final String checkboxUnchecked;
|
public final String checkboxUnchecked;
|
||||||
public final String checkboxUncheckedWithTrailingSpace;
|
public final String checkboxUncheckedWithTrailingSpace;
|
||||||
|
|
||||||
|
@ -15,6 +16,7 @@ public enum EListType {
|
||||||
this.listSymbol = String.valueOf(listSymbol);
|
this.listSymbol = String.valueOf(listSymbol);
|
||||||
this.listSymbolWithTrailingSpace = listSymbol + " ";
|
this.listSymbolWithTrailingSpace = listSymbol + " ";
|
||||||
this.checkboxChecked = listSymbolWithTrailingSpace + "[x]";
|
this.checkboxChecked = listSymbolWithTrailingSpace + "[x]";
|
||||||
|
this.checkboxCheckedUpperCase = listSymbolWithTrailingSpace + "[X]";
|
||||||
this.checkboxUnchecked = listSymbolWithTrailingSpace + "[ ]";
|
this.checkboxUnchecked = listSymbolWithTrailingSpace + "[ ]";
|
||||||
this.checkboxUncheckedWithTrailingSpace = checkboxUnchecked + " ";
|
this.checkboxUncheckedWithTrailingSpace = checkboxUnchecked + " ";
|
||||||
}
|
}
|
||||||
|
|
|
@ -648,6 +648,14 @@ public class MarkdownUtilTest extends TestCase {
|
||||||
listType.checkboxUnchecked + " \n" +
|
listType.checkboxUnchecked + " \n" +
|
||||||
listType.checkboxChecked + " Item";
|
listType.checkboxChecked + " Item";
|
||||||
assertEquals(expected_9, MarkdownUtil.setCheckboxStatus(origin_9, 1, true));
|
assertEquals(expected_9, MarkdownUtil.setCheckboxStatus(origin_9, 1, true));
|
||||||
|
|
||||||
|
final String origin_10 = "" +
|
||||||
|
listType.checkboxChecked + " Item\n" +
|
||||||
|
listType.checkboxCheckedUpperCase + " Item";
|
||||||
|
final String expected_10 = "" +
|
||||||
|
listType.checkboxChecked + " Item\n" +
|
||||||
|
listType.checkboxUnchecked + " Item";
|
||||||
|
assertEquals(expected_10, MarkdownUtil.setCheckboxStatus(origin_10, 1, false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue