mirror of
https://github.com/nextcloud/notes-android.git
synced 2024-11-22 12:56:02 +03:00
Merge branch 'master' into markdown-context-menu-multiline
This commit is contained in:
commit
b213bc645f
8 changed files with 32 additions and 31 deletions
|
@ -112,7 +112,7 @@ dependencies {
|
|||
testImplementation 'androidx.test:core:1.3.0'
|
||||
testImplementation 'androidx.arch.core:core-testing:2.1.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.mockito:mockito-core:3.11.1'
|
||||
testImplementation 'org.mockito:mockito-core:3.11.2'
|
||||
testImplementation 'org.robolectric:robolectric:4.5.1'
|
||||
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
|
|
@ -184,33 +184,22 @@ public class MainActivity extends LockedActivity implements NoteClickListener, A
|
|||
// Verbose log output for https://github.com/stefan-niedermann/nextcloud-notes/issues/1256
|
||||
runOnUiThread(() -> new AlertDialog.Builder(this)
|
||||
.setTitle(NextcloudFilesAppAccountNotFoundException.class.getSimpleName())
|
||||
.setMessage(R.string.backup_and_repair)
|
||||
.setPositiveButton(R.string.simple_repair, (a, b) -> {
|
||||
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<>();
|
||||
for (Account account : mainViewModel.getAccounts()) {
|
||||
modifiedNotes.addAll(mainViewModel.getLocalModifiedNotes(account.getId()));
|
||||
}
|
||||
if (modifiedNotes.size() == 1) {
|
||||
final Note note = modifiedNotes.get(0);
|
||||
ShareUtil.openShareDialog(this, note.getTitle(), note.getContent());
|
||||
} else {
|
||||
ShareUtil.openShareDialog(this,
|
||||
getResources().getQuantityString(R.plurals.share_multiple, modifiedNotes.size(), modifiedNotes.size()),
|
||||
mainViewModel.collectNoteContents(modifiedNotes.stream().map(Note::getId).collect(Collectors.toList())));
|
||||
}
|
||||
});
|
||||
})
|
||||
.setNeutralButton(android.R.string.cancel, (a, b) -> {
|
||||
.setMessage(R.string.backup)
|
||||
.setPositiveButton(R.string.simple_backup, (a, b) -> executor.submit(() -> {
|
||||
final List<Note> modifiedNotes = new LinkedList<>();
|
||||
for (Account account : mainViewModel.getAccounts()) {
|
||||
modifiedNotes.addAll(mainViewModel.getLocalModifiedNotes(account.getId()));
|
||||
}
|
||||
if (modifiedNotes.size() == 1) {
|
||||
final Note note = modifiedNotes.get(0);
|
||||
ShareUtil.openShareDialog(this, note.getTitle(), note.getContent());
|
||||
} else {
|
||||
ShareUtil.openShareDialog(this,
|
||||
getResources().getQuantityString(R.plurals.share_multiple, modifiedNotes.size(), modifiedNotes.size()),
|
||||
mainViewModel.collectNoteContents(modifiedNotes.stream().map(Note::getId).collect(Collectors.toList())));
|
||||
}
|
||||
}))
|
||||
.setNegativeButton(R.string.simple_error, (a, b) -> {
|
||||
final SharedPreferences ssoPreferences = AccountImporter.getSharedPreferences(getApplicationContext());
|
||||
final StringBuilder ssoPreferencesString = new StringBuilder()
|
||||
.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_backup">Backup</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>
|
||||
|
|
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)
|
|
@ -60,6 +60,6 @@ dependencies {
|
|||
testImplementation 'androidx.test:core:1.3.0'
|
||||
testImplementation 'androidx.arch.core:core-testing:2.1.0'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
testImplementation 'org.mockito:mockito-core:3.11.1'
|
||||
testImplementation 'org.mockito:mockito-core:3.11.2'
|
||||
testImplementation 'org.robolectric:robolectric:4.5.1'
|
||||
}
|
|
@ -97,6 +97,7 @@ public class MarkdownUtil {
|
|||
for (EListType listType : EListType.values()) {
|
||||
if (checkboxCheckedEmoji != null) {
|
||||
line = line.replace(listType.checkboxChecked, checkboxCheckedEmoji);
|
||||
line = line.replace(listType.checkboxCheckedUpperCase, checkboxCheckedEmoji);
|
||||
}
|
||||
if (checkboxUncheckedEmoji != null) {
|
||||
line = line.replace(listType.checkboxUnchecked, checkboxUncheckedEmoji);
|
||||
|
@ -245,7 +246,7 @@ public class MarkdownUtil {
|
|||
|
||||
public static boolean lineStartsWithCheckbox(@NonNull String line, @NonNull EListType listType) {
|
||||
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 listSymbolWithTrailingSpace;
|
||||
public final String checkboxChecked;
|
||||
public final String checkboxCheckedUpperCase;
|
||||
public final String checkboxUnchecked;
|
||||
public final String checkboxUncheckedWithTrailingSpace;
|
||||
|
||||
|
@ -15,6 +16,7 @@ public enum EListType {
|
|||
this.listSymbol = String.valueOf(listSymbol);
|
||||
this.listSymbolWithTrailingSpace = listSymbol + " ";
|
||||
this.checkboxChecked = listSymbolWithTrailingSpace + "[x]";
|
||||
this.checkboxCheckedUpperCase = listSymbolWithTrailingSpace + "[X]";
|
||||
this.checkboxUnchecked = listSymbolWithTrailingSpace + "[ ]";
|
||||
this.checkboxUncheckedWithTrailingSpace = checkboxUnchecked + " ";
|
||||
}
|
||||
|
|
|
@ -658,6 +658,14 @@ public class MarkdownUtilTest extends TestCase {
|
|||
listType.checkboxUnchecked + " \n" +
|
||||
listType.checkboxChecked + " Item";
|
||||
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