Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Niedermann <info@niedermann.it>2021-06-11 18:21:56 +0300
committerStefan Niedermann <info@niedermann.it>2021-06-11 18:21:56 +0300
commitd578669ebf22fc349cdcc89a18b230c0dde49c6d (patch)
tree29b2f1f7b0f855a77a22b17372d1ced707239691 /app/src/main/java/it/niedermann/nextcloud/deck/ui/card
parent69e701f80a3750c7be790c18276d687a7071e059 (diff)
Remove legacy code
Signed-off-by: Stefan Niedermann <info@niedermann.it>
Diffstat (limited to 'app/src/main/java/it/niedermann/nextcloud/deck/ui/card')
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java95
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditCardViewModel.java79
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/ui/card/activities/CardActivityFragment.java25
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java78
4 files changed, 97 insertions, 180 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java
index 71725c88a..41550e769 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditActivity.java
@@ -10,7 +10,6 @@ import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
-import android.view.WindowManager;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
@@ -39,12 +38,10 @@ import static it.niedermann.nextcloud.deck.ui.branding.BrandingUtil.applyBrandTo
import static it.niedermann.nextcloud.deck.ui.branding.BrandingUtil.tintMenuIcon;
public class EditActivity extends AppCompatActivity {
+
private static final String BUNDLE_KEY_ACCOUNT = "account";
- private static final String BUNDLE_KEY_BOARD_ID = "boardId";
- private static final String BUNDLE_KEY_STACK_ID = "stackId";
- private static final String BUNDLE_KEY_CARD_ID = "cardId";
- private static final String BUNDLE_KEY_TITLE = "title";
- private static final String BUNDLE_KEY_DESCRIPTION = "description";
+ private static final String BUNDLE_KEY_BOARD_LOCAL_ID = "boardLocalId";
+ private static final String BUNDLE_KEY_CARD_LOCAL_ID = "cardLocalId";
private ActivityEditBinding binding;
private EditCardViewModel viewModel;
@@ -103,17 +100,14 @@ public class EditActivity extends AppCompatActivity {
private void loadDataFromIntent() {
final Bundle args = getIntent().getExtras();
- if (args == null || !args.containsKey(BUNDLE_KEY_ACCOUNT) || !args.containsKey(BUNDLE_KEY_BOARD_ID)) {
- throw new IllegalArgumentException("Provide at least " + BUNDLE_KEY_ACCOUNT + " and " + BUNDLE_KEY_BOARD_ID + " of the card that should be edited or created.");
+ if (args == null || !args.containsKey(BUNDLE_KEY_ACCOUNT) || !args.containsKey(BUNDLE_KEY_BOARD_LOCAL_ID)) {
+ throw new IllegalArgumentException("Provide at least " + BUNDLE_KEY_ACCOUNT + " and " + BUNDLE_KEY_BOARD_LOCAL_ID + " of the card that should be edited or created.");
}
- long cardId = args.getLong(BUNDLE_KEY_CARD_ID);
+ long cardLocalId = args.getLong(BUNDLE_KEY_CARD_LOCAL_ID);
- if (cardId == 0L) {
- viewModel.setCreateMode(true);
- if (!args.containsKey(BUNDLE_KEY_STACK_ID)) {
- throw new IllegalArgumentException("When creating a card, passing the " + BUNDLE_KEY_STACK_ID + " is mandatory");
- }
+ if (cardLocalId <= 0L) {
+ throw new IllegalArgumentException("Invalid cardLocalId: " + cardLocalId);
}
final Account account = (Account) args.getSerializable(BUNDLE_KEY_ACCOUNT);
@@ -122,38 +116,29 @@ public class EditActivity extends AppCompatActivity {
}
viewModel.setAccount(account);
- final long boardId = args.getLong(BUNDLE_KEY_BOARD_ID);
+ final long boardId = args.getLong(BUNDLE_KEY_BOARD_LOCAL_ID);
observeOnce(viewModel.getFullBoardById(account.getId(), boardId), EditActivity.this, (fullBoard -> {
viewModel.setBrandingColor(fullBoard.getBoard().getColor());
viewModel.setCanEdit(fullBoard.getBoard().isPermissionEdit());
invalidateOptionsMenu();
- if (viewModel.isCreateMode()) {
- viewModel.initializeNewCard(boardId, args.getLong(BUNDLE_KEY_STACK_ID), account.getServerDeckVersionAsObject().isSupported());
- invalidateOptionsMenu();
- fillTitleAndDescription(viewModel.getFullCard().getCard(), viewModel.getAccount().getServerDeckVersionAsObject(),
- args.getString(BUNDLE_KEY_TITLE), args.getString(BUNDLE_KEY_DESCRIPTION));
- setupViewPager();
- setupTitle();
- } else {
- observeOnce(viewModel.getFullCardWithProjectsByLocalId(account.getId(), cardId), EditActivity.this, (fullCard) -> {
- if (fullCard == null) {
- new AlertDialog.Builder(this)
- .setTitle(R.string.card_not_found)
- .setMessage(R.string.card_not_found_message)
- .setPositiveButton(R.string.simple_close, (a, b) -> super.finish())
- .show();
- } else {
- viewModel.initializeExistingCard(boardId, fullCard, account.getServerDeckVersionAsObject().isSupported());
- invalidateOptionsMenu();
- setupViewPager();
- setupTitle();
- }
- });
- }
+ observeOnce(viewModel.getFullCardWithProjectsByLocalId(account.getId(), cardLocalId), EditActivity.this, (fullCard) -> {
+ if (fullCard == null) {
+ new AlertDialog.Builder(this)
+ .setTitle(R.string.card_not_found)
+ .setMessage(R.string.card_not_found_message)
+ .setPositiveButton(R.string.simple_close, (a, b) -> super.finish())
+ .show();
+ } else {
+ viewModel.initializeExistingCard(boardId, fullCard, account.getServerDeckVersionAsObject().isSupported());
+ invalidateOptionsMenu();
+ setupViewPager();
+ setupTitle();
+ }
+ });
}));
- DeckLog.verbose("Finished loading intent data: { accountId =", viewModel.getAccount().getId(), "cardId =", cardId, "}");
+ DeckLog.verbose("Finished loading intent data: { accountId =", viewModel.getAccount().getId(), "cardId =", cardLocalId, "}");
}
private static void fillTitleAndDescription(@NonNull Card card, @NonNull Version version, @Nullable String title, @Nullable String description) {
@@ -244,18 +229,18 @@ public class EditActivity extends AppCompatActivity {
final CardTabAdapter adapter = new CardTabAdapter(this);
final TabLayoutMediator mediator = new TabLayoutMediator(binding.tabLayout, binding.pager, (tab, position) -> {
- tab.setIcon(!viewModel.isCreateMode() && viewModel.hasCommentsAbility()
+ tab.setIcon(viewModel.hasCommentsAbility()
? tabIconsWithComments[position]
: tabIcons[position]
);
- tab.setContentDescription(!viewModel.isCreateMode() && viewModel.hasCommentsAbility()
+ tab.setContentDescription(viewModel.hasCommentsAbility()
? tabTitlesWithComments[position]
: tabTitles[position]
);
});
binding.pager.setAdapter(adapter);
- if (!viewModel.isCreateMode() && viewModel.hasCommentsAbility()) {
+ if (viewModel.hasCommentsAbility()) {
adapter.enableComments();
binding.pager.setOffscreenPageLimit(3);
} else {
@@ -268,14 +253,7 @@ public class EditActivity extends AppCompatActivity {
binding.title.setText(viewModel.getFullCard().getCard().getTitle());
binding.title.setFilters(new InputFilter[]{new InputFilter.LengthFilter(viewModel.getAccount().getServerDeckVersionAsObject().getCardTitleMaxLength())});
if (viewModel.canEdit()) {
- if (viewModel.isCreateMode()) {
- binding.title.requestFocus();
- getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
- if (viewModel.getFullCard().getCard().getTitle() != null) {
- binding.title.setSelection(viewModel.getFullCard().getCard().getTitle().length());
- }
- }
- binding.title.setHint(getString(viewModel.isCreateMode() ? R.string.simple_add : R.string.edit));
+ binding.title.setHint(R.string.edit);
binding.title.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
@@ -325,23 +303,12 @@ public class EditActivity extends AppCompatActivity {
applyBrandToPrimaryTabLayout(mainColor, binding.tabLayout);
}
- @Deprecated
- @NonNull
- public static Intent createNewCardIntent(@NonNull Context context, @NonNull Account account, Long boardLocalId, Long stackId) {
- return createBasicIntent(context, account, boardLocalId)
- .putExtra(BUNDLE_KEY_STACK_ID, stackId);
- }
-
@NonNull
- public static Intent createEditCardIntent(@NonNull Context context, @NonNull Account account, Long boardLocalId, Long cardId) {
- return createBasicIntent(context, account, boardLocalId)
- .putExtra(BUNDLE_KEY_CARD_ID, cardId);
- }
-
- private static Intent createBasicIntent(@NonNull Context context, @NonNull Account account, Long boardLocalId) {
+ public static Intent createEditCardIntent(@NonNull Context context, @NonNull Account account, long boardLocalId, long cardLocalId) {
return new Intent(context, EditActivity.class)
.putExtra(BUNDLE_KEY_ACCOUNT, account)
- .putExtra(BUNDLE_KEY_BOARD_ID, boardLocalId)
+ .putExtra(BUNDLE_KEY_BOARD_LOCAL_ID, boardLocalId)
+ .putExtra(BUNDLE_KEY_CARD_LOCAL_ID, cardLocalId)
.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
}
}
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditCardViewModel.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditCardViewModel.java
index 1ebb3af0d..f7113ccf5 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditCardViewModel.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/EditCardViewModel.java
@@ -13,7 +13,6 @@ import androidx.lifecycle.MutableLiveData;
import androidx.preference.PreferenceManager;
import java.io.File;
-import java.util.ArrayList;
import java.util.List;
import it.niedermann.android.sharedpreferences.SharedPreferenceBooleanLiveData;
@@ -46,7 +45,6 @@ public class EditCardViewModel extends AndroidViewModel {
private boolean hasCommentsAbility = false;
private boolean pendingCreation = false;
private boolean canEdit = false;
- private boolean createMode = false;
private final MutableLiveData<Integer> brandingColor$ = new MutableLiveData<>();
private final SharedPreferences sharedPreferences;
private final MutableLiveData<Boolean> descriptionIsPreview = new MutableLiveData<>(false);
@@ -60,40 +58,33 @@ public class EditCardViewModel extends AndroidViewModel {
/**
* The result {@link LiveData} will emit <code>true</code> if the preview mode is enabled and <code>false</code> if the edit mode is enabled.
- * In {@link #createMode} it will not emit the last persisted state but only a temporary value.
*/
public LiveData<Boolean> getDescriptionMode() {
- if (isCreateMode()) {
- return distinctUntilChanged(descriptionIsPreview);
- } else {
- return distinctUntilChanged(switchMap(distinctUntilChanged(new SharedPreferenceBooleanLiveData(sharedPreferences, getApplication().getString(R.string.shared_preference_description_preview), false)), (isPreview) -> {
- // When we are in preview mode but the description of the card is empty, we explicitly switch to the edit mode
- final FullCardWithProjects fullCard = getFullCard();
- if (fullCard == null) {
- throw new IllegalStateException("Description mode must be queried after initializing " + EditCardViewModel.class.getSimpleName() + " with a card.");
- }
- if (isPreview && TextUtils.isEmpty(fullCard.getCard().getDescription())) {
- descriptionIsPreview.setValue(false);
- } else {
- descriptionIsPreview.setValue(isPreview);
- }
- return descriptionIsPreview;
- }));
- }
+ return distinctUntilChanged(switchMap(distinctUntilChanged(new SharedPreferenceBooleanLiveData(sharedPreferences, getApplication().getString(R.string.shared_preference_description_preview), false)), (isPreview) -> {
+ // When we are in preview mode but the description of the card is empty, we explicitly switch to the edit mode
+ final FullCardWithProjects fullCard = getFullCard();
+ if (fullCard == null) {
+ throw new IllegalStateException("Description mode must be queried after initializing " + EditCardViewModel.class.getSimpleName() + " with a card.");
+ }
+ if (isPreview && TextUtils.isEmpty(fullCard.getCard().getDescription())) {
+ descriptionIsPreview.setValue(false);
+ } else {
+ descriptionIsPreview.setValue(isPreview);
+ }
+ return descriptionIsPreview;
+ }));
}
/**
- * Will toggle the edit / preview mode and persist the new state if not in {@link #createMode}.
+ * Will toggle the edit / preview mode and persist the new state
*/
public void toggleDescriptionPreviewMode() {
final boolean newValue = Boolean.FALSE.equals(descriptionIsPreview.getValue());
descriptionIsPreview.setValue(newValue);
- if (!isCreateMode()) {
- sharedPreferences
- .edit()
- .putBoolean(getApplication().getString(R.string.shared_preference_description_preview), newValue)
- .apply();
- }
+ sharedPreferences
+ .edit()
+ .putBoolean(getApplication().getString(R.string.shared_preference_description_preview), newValue)
+ .apply();
}
public LiveData<Integer> getBrandingColor() {
@@ -117,23 +108,6 @@ public class EditCardViewModel extends AndroidViewModel {
this.isSupportedVersion = isSupportedVersion;
}
- /**
- * Stores a deep copy of the given fullCard to be able to compare the state at every time in #{@link EditCardViewModel#hasChanges()}
- *
- * @param boardId Local ID, expecting a positive long value
- * @param stackId Local ID, expecting a positive long value where the card should be created
- */
- public void initializeNewCard(long boardId, long stackId, boolean isSupportedVersion) {
- final FullCardWithProjects fullCard = new FullCardWithProjects();
- fullCard.setLabels(new ArrayList<>());
- fullCard.setAssignedUsers(new ArrayList<>());
- fullCard.setAttachments(new ArrayList<>());
- final Card card = new Card();
- card.setStackId(stackId);
- fullCard.setCard(card);
- initializeExistingCard(boardId, fullCard, isSupportedVersion);
- }
-
public void setAccount(@NonNull Account account) {
this.account = account;
this.syncManager = new SyncManager(getApplication(), account.getName());
@@ -176,17 +150,6 @@ public class EditCardViewModel extends AndroidViewModel {
this.canEdit = canEdit;
}
- public boolean isCreateMode() {
- return createMode;
- }
-
- public void setCreateMode(boolean createMode) {
- this.createMode = createMode;
- if (createMode) {
- this.descriptionIsPreview.setValue(false);
- }
- }
-
public long getBoardId() {
return boardId;
}
@@ -207,11 +170,7 @@ public class EditCardViewModel extends AndroidViewModel {
* Saves the current {@link #fullCard}. If it is a new card, it will be created, otherwise it will be updated.
*/
public void saveCard(@NonNull IResponseCallback<FullCard> callback) {
- if (isCreateMode()) {
- syncManager.createFullCard(getAccount().getId(), getBoardId(), getFullCard().getCard().getStackId(), getFullCard(), callback);
- } else {
- syncManager.updateCard(getFullCard(), callback);
- }
+ syncManager.updateCard(getFullCard(), callback);
}
public LiveData<List<Activity>> syncActivitiesForCard(@NonNull Card card) {
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/activities/CardActivityFragment.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/activities/CardActivityFragment.java
index f95eea89f..650670653 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/activities/CardActivityFragment.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/activities/CardActivityFragment.java
@@ -36,21 +36,16 @@ public class CardActivityFragment extends Fragment {
return binding.getRoot();
}
- if (!viewModel.isCreateMode()) {
- viewModel.syncActivitiesForCard(viewModel.getFullCard().getCard()).observe(getViewLifecycleOwner(), (activities -> {
- if (activities == null || activities.size() == 0) {
- binding.emptyContentView.setVisibility(View.VISIBLE);
- binding.activitiesList.setVisibility(View.GONE);
- } else {
- binding.emptyContentView.setVisibility(View.GONE);
- binding.activitiesList.setVisibility(View.VISIBLE);
- binding.activitiesList.setAdapter(new CardActivityAdapter(activities, requireActivity().getMenuInflater()));
- }
- }));
- } else {
- binding.emptyContentView.setVisibility(View.VISIBLE);
- binding.activitiesList.setVisibility(View.GONE);
- }
+ viewModel.syncActivitiesForCard(viewModel.getFullCard().getCard()).observe(getViewLifecycleOwner(), (activities -> {
+ if (activities == null || activities.size() == 0) {
+ binding.emptyContentView.setVisibility(View.VISIBLE);
+ binding.activitiesList.setVisibility(View.GONE);
+ } else {
+ binding.emptyContentView.setVisibility(View.GONE);
+ binding.activitiesList.setVisibility(View.VISIBLE);
+ binding.activitiesList.setAdapter(new CardActivityAdapter(activities, requireActivity().getMenuInflater()));
+ }
+ }));
return binding.getRoot();
}
}
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java
index 4b6d308ae..4594fcf79 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentsFragment.java
@@ -195,21 +195,19 @@ public class CardAttachmentsFragment extends Fragment implements AttachmentDelet
}
});
binding.attachmentsList.setLayoutManager(glm);
- if (!editViewModel.isCreateMode()) {
- // https://android-developers.googleblog.com/2018/02/continuous-shared-element-transitions.html?m=1
- // https://github.com/android/animation-samples/blob/master/GridToPager/app/src/main/java/com/google/samples/gridtopager/fragment/ImagePagerFragment.java
- setExitSharedElementCallback(new SharedElementCallback() {
- @Override
- public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
- AttachmentViewHolder selectedViewHolder = (AttachmentViewHolder) binding.attachmentsList
- .findViewHolderForAdapterPosition(clickedItemPosition);
- if (selectedViewHolder != null) {
- sharedElements.put(names.get(0), selectedViewHolder.getPreview());
- }
+ // https://android-developers.googleblog.com/2018/02/continuous-shared-element-transitions.html?m=1
+ // https://github.com/android/animation-samples/blob/master/GridToPager/app/src/main/java/com/google/samples/gridtopager/fragment/ImagePagerFragment.java
+ setExitSharedElementCallback(new SharedElementCallback() {
+ @Override
+ public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) {
+ AttachmentViewHolder selectedViewHolder = (AttachmentViewHolder) binding.attachmentsList
+ .findViewHolderForAdapterPosition(clickedItemPosition);
+ if (selectedViewHolder != null) {
+ sharedElements.put(names.get(0), selectedViewHolder.getPreview());
}
- });
- adapter.setAttachments(editViewModel.getFullCard().getAttachments(), editViewModel.getFullCard().getId());
- }
+ }
+ });
+ adapter.setAttachments(editViewModel.getFullCard().getAttachments(), editViewModel.getFullCard().getId());
if (editViewModel.canEdit()) {
binding.fab.setOnClickListener(v -> {
@@ -462,33 +460,31 @@ public class CardAttachmentsFragment extends Fragment implements AttachmentDelet
a.setStatusEnum(DBStatus.LOCAL_EDITED);
editViewModel.getFullCard().getAttachments().add(0, a);
adapter.addAttachment(a);
- if (!editViewModel.isCreateMode()) {
- editViewModel.addAttachmentToCard(editViewModel.getAccount().getId(), editViewModel.getFullCard().getLocalId(), a.getMimetype(), fileToUpload, new IResponseCallback<Attachment>() {
- @Override
- public void onResponse(Attachment response) {
- requireActivity().runOnUiThread(() -> {
- editViewModel.getFullCard().getAttachments().remove(a);
- editViewModel.getFullCard().getAttachments().add(0, response);
- adapter.replaceAttachment(a, response);
- });
- }
+ editViewModel.addAttachmentToCard(editViewModel.getAccount().getId(), editViewModel.getFullCard().getLocalId(), a.getMimetype(), fileToUpload, new IResponseCallback<Attachment>() {
+ @Override
+ public void onResponse(Attachment response) {
+ requireActivity().runOnUiThread(() -> {
+ editViewModel.getFullCard().getAttachments().remove(a);
+ editViewModel.getFullCard().getAttachments().add(0, response);
+ adapter.replaceAttachment(a, response);
+ });
+ }
- @Override
- public void onError(Throwable throwable) {
- requireActivity().runOnUiThread(() -> {
- if (throwable instanceof NextcloudHttpRequestFailedException && ((NextcloudHttpRequestFailedException) throwable).getStatusCode() == HTTP_CONFLICT) {
- IResponseCallback.super.onError(throwable);
- // https://github.com/stefan-niedermann/nextcloud-deck/issues/534
- editViewModel.getFullCard().getAttachments().remove(a);
- adapter.removeAttachment(a);
- BrandedSnackbar.make(binding.coordinatorLayout, R.string.attachment_already_exists, Snackbar.LENGTH_LONG).show();
- } else {
- ExceptionDialogFragment.newInstance(new UploadAttachmentFailedException("Unknown URI scheme", throwable), editViewModel.getAccount()).show(getChildFragmentManager(), ExceptionDialogFragment.class.getSimpleName());
- }
- });
- }
- });
- }
+ @Override
+ public void onError(Throwable throwable) {
+ requireActivity().runOnUiThread(() -> {
+ if (throwable instanceof NextcloudHttpRequestFailedException && ((NextcloudHttpRequestFailedException) throwable).getStatusCode() == HTTP_CONFLICT) {
+ IResponseCallback.super.onError(throwable);
+ // https://github.com/stefan-niedermann/nextcloud-deck/issues/534
+ editViewModel.getFullCard().getAttachments().remove(a);
+ adapter.removeAttachment(a);
+ BrandedSnackbar.make(binding.coordinatorLayout, R.string.attachment_already_exists, Snackbar.LENGTH_LONG).show();
+ } else {
+ ExceptionDialogFragment.newInstance(new UploadAttachmentFailedException("Unknown URI scheme", throwable), editViewModel.getAccount()).show(getChildFragmentManager(), ExceptionDialogFragment.class.getSimpleName());
+ }
+ });
+ }
+ });
}
@Override
@@ -527,7 +523,7 @@ public class CardAttachmentsFragment extends Fragment implements AttachmentDelet
public void onAttachmentDeleted(Attachment attachment) {
adapter.removeAttachment(attachment);
editViewModel.getFullCard().getAttachments().remove(attachment);
- if (!editViewModel.isCreateMode() && attachment.getLocalId() != null) {
+ if (attachment.getLocalId() != null) {
editViewModel.deleteAttachmentOfCard(editViewModel.getAccount().getId(), editViewModel.getFullCard().getLocalId(), attachment.getLocalId(), new IResponseCallback<Void>() {
@Override
public void onResponse(Void response) {