From fab8aa90acce08ce195b18d6d1b5850bfdd70e97 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Fri, 21 Apr 2017 20:46:17 +0100 Subject: [PATCH] Collection owner: Handle the case of owner == null. --- .../main/java/com/etesync/syncadapter/ui/AccountActivity.java | 3 ++- .../com/etesync/syncadapter/ui/ViewCollectionActivity.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/etesync/syncadapter/ui/AccountActivity.java b/app/src/main/java/com/etesync/syncadapter/ui/AccountActivity.java index 1936a777..ad091144 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/AccountActivity.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/AccountActivity.java @@ -417,7 +417,8 @@ public class AccountActivity extends AppCompatActivity implements Toolbar.OnMenu readOnly.setVisibility(journalEntity.isReadOnly() ? View.VISIBLE : View.GONE); final View shared = v.findViewById(R.id.shared); - shared.setVisibility(account.name.equals(journalEntity.getOwner()) ? View.GONE : View.VISIBLE); + boolean isOwner = (journalEntity.getOwner() == null) || journalEntity.getOwner().equals(account.name); + shared.setVisibility(isOwner ? View.GONE : View.VISIBLE); return v; } diff --git a/app/src/main/java/com/etesync/syncadapter/ui/ViewCollectionActivity.java b/app/src/main/java/com/etesync/syncadapter/ui/ViewCollectionActivity.java index 02febe81..1a117511 100644 --- a/app/src/main/java/com/etesync/syncadapter/ui/ViewCollectionActivity.java +++ b/app/src/main/java/com/etesync/syncadapter/ui/ViewCollectionActivity.java @@ -74,7 +74,7 @@ public class ViewCollectionActivity extends AppCompatActivity implements Refresh } info = journalEntity.getInfo(); - isOwner = account.name.equals(journalEntity.getOwner()); + isOwner = (journalEntity.getOwner() == null) || journalEntity.getOwner().equals(account.name); final View colorSquare = findViewById(R.id.color); if (info.type == CollectionInfo.Type.CALENDAR) {