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:
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/ui/attachments/AttachmentAdapter.java2
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentAdapter.java16
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java34
-rw-r--r--app/src/main/res/values/strings.xml2
-rw-r--r--fastlane/metadata/android/en-US/changelogs/1008002.txt1
-rw-r--r--fastlane/metadata/android/en-US/changelogs/1008003.txt25
6 files changed, 65 insertions, 15 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/attachments/AttachmentAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/attachments/AttachmentAdapter.java
index 0794323ec..b17b34137 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/attachments/AttachmentAdapter.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/attachments/AttachmentAdapter.java
@@ -52,7 +52,7 @@ public class AttachmentAdapter extends RecyclerView.Adapter<AttachmentViewHolder
@Override
public void onBindViewHolder(@NonNull AttachmentViewHolder holder, int position) {
final Attachment attachment = attachments.get(position);
- final String uri = AttachmentUtil.getRemoteUrl(account.getUrl(), cardRemoteId, attachment.getId());
+ final String uri = AttachmentUtil.getRemoteOrLocalUrl(account.getUrl(), cardRemoteId, attachment);
if (MimeTypeUtil.isImage(attachment.getMimetype())) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
holder.binding.preview.setTransitionName(context.getString(R.string.transition_attachment_preview, String.valueOf(attachment.getLocalId())));
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentAdapter.java
index a72ed8ef2..978c13fdd 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentAdapter.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/ui/card/attachments/CardAttachmentAdapter.java
@@ -3,7 +3,6 @@ package it.niedermann.nextcloud.deck.ui.card.attachments;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
-import android.net.Uri;
import android.os.Build;
import android.text.format.Formatter;
import android.view.LayoutInflater;
@@ -99,9 +98,7 @@ public class CardAttachmentAdapter extends RecyclerView.Adapter<AttachmentViewHo
final Attachment attachment = attachments.get(position);
final int viewType = getItemViewType(position);
- @Nullable final String uri = (attachment.getId() == null || cardRemoteId == null)
- ? attachment.getLocalPath() :
- AttachmentUtil.getRemoteUrl(account.getUrl(), cardRemoteId, attachment.getId());
+ @Nullable final String uri = AttachmentUtil.getRemoteOrLocalUrl(account.getUrl(), cardRemoteId, attachment);
holder.setNotSyncedYetStatus(!DBStatus.LOCAL_EDITED.equals(attachment.getStatusEnum()), mainColor);
holder.itemView.setOnCreateContextMenuListener((menu, v, menuInfo) -> {
menuInflater.inflate(R.menu.attachment_menu, menu);
@@ -109,9 +106,10 @@ public class CardAttachmentAdapter extends RecyclerView.Adapter<AttachmentViewHo
DeleteAttachmentDialogFragment.newInstance(attachment).show(fragmentManager, DeleteAttachmentDialogFragment.class.getCanonicalName());
return false;
});
- if (uri == null) {
+ if (uri == null || attachment.getId() == null || cardRemoteId == null) {
menu.findItem(android.R.id.copyUrl).setVisible(false);
} else {
+ menu.findItem(android.R.id.copyUrl).setVisible(true);
menu.findItem(android.R.id.copyUrl).setOnMenuItemClickListener(item -> copyToClipboard(context, attachment.getFilename(), uri));
}
});
@@ -155,13 +153,7 @@ public class CardAttachmentAdapter extends RecyclerView.Adapter<AttachmentViewHo
holder.getPreview().setImageResource(R.drawable.ic_attach_file_grey600_24dp);
}
- if (cardRemoteId != null) {
- defaultHolder.itemView.setOnClickListener((event) -> {
- Intent openURL = new Intent(Intent.ACTION_VIEW);
- openURL.setData(Uri.parse(AttachmentUtil.getRemoteUrl(account.getUrl(), cardRemoteId, attachment.getId())));
- context.startActivity(openURL);
- });
- }
+ defaultHolder.itemView.setOnClickListener((event) -> AttachmentUtil.openAttachmentInBrowser(context, account.getUrl(), cardRemoteId, attachment.getId()));
defaultHolder.binding.filename.setText(attachment.getBasename());
defaultHolder.binding.filesize.setText(Formatter.formatFileSize(context, attachment.getFilesize()));
if (attachment.getLastModifiedLocal() != null) {
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java b/app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java
index 6b2d6925f..844a301e8 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/util/AttachmentUtil.java
@@ -1,9 +1,12 @@
package it.niedermann.nextcloud.deck.util;
import android.content.Context;
+import android.content.Intent;
import android.net.Uri;
+import android.widget.Toast;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
import java.io.File;
import java.io.FileNotFoundException;
@@ -12,6 +15,8 @@ import java.io.IOException;
import java.io.InputStream;
import it.niedermann.nextcloud.deck.DeckLog;
+import it.niedermann.nextcloud.deck.R;
+import it.niedermann.nextcloud.deck.model.Attachment;
/**
* Created by stefan on 07.03.20.
@@ -22,7 +27,34 @@ public class AttachmentUtil {
private AttachmentUtil() {
}
- public static String getRemoteUrl(String accountUrl, long cardRemoteId, long attachmentRemoteId) {
+ /**
+ * @return {@link AttachmentUtil#getRemoteUrl} or {@link Attachment#getLocalPath()} as fallback in case this {@param attachment} has not yet been synced.
+ */
+ @Nullable
+ public static String getRemoteOrLocalUrl(@NonNull String accountUrl, @Nullable Long cardRemoteId, @NonNull Attachment attachment) {
+ return (attachment.getId() == null || cardRemoteId == null)
+ ? attachment.getLocalPath()
+ : getRemoteUrl(accountUrl, cardRemoteId, attachment.getId());
+ }
+
+ /**
+ * Tries to open the given {@link Attachment} in web browser. Displays a toast on failure.
+ */
+ public static void openAttachmentInBrowser(@NonNull Context context, @NonNull String accountUrl, Long cardRemoteId, Long attachmentRemoteId) {
+ if (cardRemoteId == null) {
+ Toast.makeText(context, R.string.card_does_not_yet_exist, Toast.LENGTH_LONG).show();
+ DeckLog.logError(new IllegalArgumentException("cardRemoteId must not be null."));
+ return;
+ }
+ if (attachmentRemoteId == null) {
+ Toast.makeText(context, R.string.attachment_does_not_yet_exist, Toast.LENGTH_LONG).show();
+ DeckLog.logError(new IllegalArgumentException("attachmentRemoteId must not be null."));
+ return;
+ }
+ context.startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse(AttachmentUtil.getRemoteUrl(accountUrl, cardRemoteId, attachmentRemoteId))));
+ }
+
+ private static String getRemoteUrl(@NonNull String accountUrl, @NonNull Long cardRemoteId, @NonNull Long attachmentRemoteId) {
return accountUrl + "/index.php/apps/deck/cards/" + cardRemoteId + "/attachment/" + attachmentRemoteId;
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2a779cfe4..99240667b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -287,4 +287,6 @@
<string name="clone_board">Clone board</string>
<string name="cloning_board">Cloning %1$sā€¦</string>
<string name="successfully_cloned_board">Successfully cloned %1$s</string>
+ <string name="attachment_does_not_yet_exist">Attachment does not yet exist in Deck</string>
+ <string name="card_does_not_yet_exist">Card does not yet exist in Deck</string>
</resources>
diff --git a/fastlane/metadata/android/en-US/changelogs/1008002.txt b/fastlane/metadata/android/en-US/changelogs/1008002.txt
index 1c6fb803c..97ad56919 100644
--- a/fastlane/metadata/android/en-US/changelogs/1008002.txt
+++ b/fastlane/metadata/android/en-US/changelogs/1008002.txt
@@ -2,7 +2,6 @@
- šŸš« Filter by unassigned cards
-
1.8.1
- šŸ”€ Move cards to other boards and accounts (#453)
diff --git a/fastlane/metadata/android/en-US/changelogs/1008003.txt b/fastlane/metadata/android/en-US/changelogs/1008003.txt
new file mode 100644
index 000000000..9787f5024
--- /dev/null
+++ b/fastlane/metadata/android/en-US/changelogs/1008003.txt
@@ -0,0 +1,25 @@
+1.8.3
+
+- šŸž Fix opening not yet synchronized attachment (#599)
+
+1.8.2
+
+- šŸš« Filter by unassigned cards
+
+1.8.1
+
+- šŸ”€ Move cards to other boards and accounts (#453)
+- āž• Clone boards with existing stacks and labels (#455)
+- šŸž Fix synchronization bug (#596)
+
+1.7.0
+
+- šŸ†• Compact mode (#579)
+
+1.6.0
+
+- āœØ Adjust design to new style of Nextcloud Android app (#525)
+- šŸŽØ Brand now uses board color to provide better context (#525)
+- šŸŽØ Offer the same default board colors as the server app
+- šŸ” Display all available users as search results when sharing a board (#510)
+- šŸž "Archive cards" of list crashes the app when there is no list (#557) \ No newline at end of file