mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Fix a crashing bug
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
8cabe1f3d9
commit
ba5ef73d47
2 changed files with 14 additions and 4 deletions
|
@ -473,7 +473,9 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
|
|||
long storedId = mSyncedFolderProvider.storeFolderSync(syncedFolderDisplayItem);
|
||||
if (storedId != -1) {
|
||||
syncedFolderDisplayItem.setId(storedId);
|
||||
EventBus.getDefault().post(new InitiateSyncedFolder(syncedFolderDisplayItem));
|
||||
if (syncedFolderDisplayItem.isEnabled()) {
|
||||
EventBus.getDefault().post(new InitiateSyncedFolder(syncedFolderDisplayItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -518,7 +520,9 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
|
|||
long storedId = mSyncedFolderProvider.storeFolderSync(newCustomFolder);
|
||||
if (storedId != -1) {
|
||||
newCustomFolder.setId(storedId);
|
||||
EventBus.getDefault().post(new InitiateSyncedFolder(newCustomFolder));
|
||||
if (newCustomFolder.isEnabled()) {
|
||||
EventBus.getDefault().post(new InitiateSyncedFolder(newCustomFolder));
|
||||
}
|
||||
}
|
||||
mAdapter.addSyncFolderItem(newCustomFolder);
|
||||
} else {
|
||||
|
@ -533,7 +537,9 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
|
|||
long storedId = mSyncedFolderProvider.storeFolderSync(item);
|
||||
if (storedId != -1) {
|
||||
item.setId(storedId);
|
||||
EventBus.getDefault().post(new InitiateSyncedFolder(item));
|
||||
if (item.isEnabled()) {
|
||||
EventBus.getDefault().post(new InitiateSyncedFolder(item));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// existing synced folder setup to be updated
|
||||
|
@ -557,7 +563,6 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
|
|||
public void onDeleteSyncedFolderPreference(SyncedFolderParcelable syncedFolder) {
|
||||
mSyncedFolderProvider.deleteSyncedFolder(syncedFolder.getId());
|
||||
mAdapter.removeItem(syncedFolder.getSection());
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -389,6 +389,11 @@ public class DisplayUtils {
|
|||
public static SpannableStringBuilder createTextWithSpan(String text, String spanText, StyleSpan style) {
|
||||
SpannableStringBuilder sb = new SpannableStringBuilder(text);
|
||||
int start = text.lastIndexOf(spanText);
|
||||
|
||||
if (start < 0) {
|
||||
start++;
|
||||
}
|
||||
|
||||
int end = start + spanText.length();
|
||||
sb.setSpan(style, start, end, Spannable.SPAN_INCLUSIVE_INCLUSIVE);
|
||||
return sb;
|
||||
|
|
Loading…
Reference in a new issue