mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 09:39:25 +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,10 +473,12 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
|
|||
long storedId = mSyncedFolderProvider.storeFolderSync(syncedFolderDisplayItem);
|
||||
if (storedId != -1) {
|
||||
syncedFolderDisplayItem.setId(storedId);
|
||||
if (syncedFolderDisplayItem.isEnabled()) {
|
||||
EventBus.getDefault().post(new InitiateSyncedFolder(syncedFolderDisplayItem));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSyncFolderSettingsClick(int section, SyncedFolderDisplayItem syncedFolderDisplayItem) {
|
||||
|
@ -518,8 +520,10 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
|
|||
long storedId = mSyncedFolderProvider.storeFolderSync(newCustomFolder);
|
||||
if (storedId != -1) {
|
||||
newCustomFolder.setId(storedId);
|
||||
if (newCustomFolder.isEnabled()) {
|
||||
EventBus.getDefault().post(new InitiateSyncedFolder(newCustomFolder));
|
||||
}
|
||||
}
|
||||
mAdapter.addSyncFolderItem(newCustomFolder);
|
||||
} else {
|
||||
SyncedFolderDisplayItem item = syncFolderItems.get(syncedFolder.getSection()-1);
|
||||
|
@ -533,8 +537,10 @@ public class FolderSyncActivity extends FileActivity implements FolderSyncAdapte
|
|||
long storedId = mSyncedFolderProvider.storeFolderSync(item);
|
||||
if (storedId != -1) {
|
||||
item.setId(storedId);
|
||||
if (item.isEnabled()) {
|
||||
EventBus.getDefault().post(new InitiateSyncedFolder(item));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// existing synced folder setup to be updated
|
||||
mSyncedFolderProvider.updateSyncFolder(item);
|
||||
|
@ -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