diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 27eafece..38777283 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -6,6 +6,7 @@
+
> call =
+ RetrofitClient.getApiInterface(ctx)
+ .issueListIssueAttachments(
+ issue.getRepository().getOwner(),
+ issue.getRepository().getName(),
+ (long) issueIndex);
+ call.enqueue(
+ new Callback<>() {
+
+ @Override
+ public void onResponse(
+ @NonNull Call> call,
+ @NonNull retrofit2.Response> response) {
+
+ List attachment = response.body();
+
+ if (response.code() == 200) {
+ assert attachment != null;
+
+ if (attachment.size() > 0) {
+
+ viewBinding.attachmentFrame.setVisibility(View.VISIBLE);
+ LinearLayout.LayoutParams paramsAttachment =
+ new LinearLayout.LayoutParams(96, 96);
+ paramsAttachment.setMargins(0, 0, 48, 0);
+
+ for (int i = 0; i < attachment.size(); i++) {
+
+ ImageView attachmentView = new ImageView(ctx);
+ MaterialCardView materialCardView = new MaterialCardView(ctx);
+ materialCardView.setLayoutParams(paramsAttachment);
+ materialCardView.setStrokeWidth(0);
+ materialCardView.setCardBackgroundColor(Color.TRANSPARENT);
+
+ if (Arrays.asList(
+ "bmp", "gif", "jpg", "jpeg", "png", "webp",
+ "heic", "heif")
+ .contains(
+ FilenameUtils.getExtension(
+ attachment.get(i).getName())
+ .toLowerCase())) {
+
+ PicassoService.getInstance(ctx)
+ .get()
+ .load(
+ UrlHelper.appendPath(
+ getAccount()
+ .getAccount()
+ .getInstanceUrl(),
+ "/attachments/")
+ + attachment.get(i).getUuid())
+ .placeholder(R.drawable.loader_animated)
+ .resize(120, 120)
+ .centerCrop()
+ .error(R.drawable.ic_close)
+ .into(attachmentView);
+
+ viewBinding.attachmentsView.addView(materialCardView);
+ attachmentView.setLayoutParams(paramsAttachment);
+ materialCardView.addView(attachmentView);
+
+ int finalI1 = i;
+ materialCardView.setOnClickListener(
+ v1 -> {
+ CustomImageViewDialogBinding
+ imageViewDialogBinding =
+ CustomImageViewDialogBinding
+ .inflate(
+ LayoutInflater
+ .from(
+ ctx));
+ View view = imageViewDialogBinding.getRoot();
+ materialAlertDialogBuilder.setView(view);
+
+ materialAlertDialogBuilder.setNeutralButton(
+ getString(R.string.close), null);
+ PicassoService.getInstance(ctx)
+ .get()
+ .load(
+ UrlHelper.appendPath(
+ getAccount()
+ .getAccount()
+ .getInstanceUrl(),
+ "/attachments/")
+ + attachment
+ .get(finalI1)
+ .getUuid())
+ .placeholder(R.drawable.loader_animated)
+ .resize(0, 1600)
+ .onlyScaleDown()
+ .centerCrop()
+ .error(R.drawable.ic_close)
+ .into(imageViewDialogBinding.imageView);
+ materialAlertDialogBuilder.create().show();
+ });
+
+ } else {
+
+ attachmentView.setImageResource(
+ R.drawable.ic_file_download);
+ attachmentView.setPadding(4, 4, 4, 4);
+ viewBinding.attachmentsView.addView(materialCardView);
+ attachmentView.setLayoutParams(paramsAttachment);
+ materialCardView.addView(attachmentView);
+
+ int finalI = i;
+ materialCardView.setOnClickListener(
+ v1 -> {
+ DownloadService downloadService =
+ new DownloadService();
+ downloadService.downloadFile(
+ ctx,
+ UrlHelper.appendPath(
+ getAccount()
+ .getAccount()
+ .getInstanceUrl(),
+ "/attachments/")
+ + attachment
+ .get(finalI)
+ .getUuid(),
+ attachment.get(finalI).getName());
+ });
+ }
+ }
+ } else {
+ viewBinding.attachmentFrame.setVisibility(View.GONE);
+ }
+ }
+ }
+
+ @Override
+ public void onFailure(
+ @NonNull Call> call, @NonNull Throwable t) {}
+ });
+ }
}
diff --git a/app/src/main/java/org/mian/gitnex/helpers/DownloadService.java b/app/src/main/java/org/mian/gitnex/helpers/DownloadService.java
new file mode 100644
index 00000000..f79fe045
--- /dev/null
+++ b/app/src/main/java/org/mian/gitnex/helpers/DownloadService.java
@@ -0,0 +1,32 @@
+package org.mian.gitnex.helpers;
+
+import static android.content.Context.DOWNLOAD_SERVICE;
+
+import android.app.DownloadManager;
+import android.content.Context;
+import android.net.Uri;
+import android.os.Environment;
+
+/**
+ * @author M M Arif
+ */
+public class DownloadService {
+
+ public void downloadFile(Context ctx, String fileUri, String filename) {
+
+ Uri uri = Uri.parse(fileUri);
+ DownloadManager.Request request = new DownloadManager.Request(uri);
+
+ request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
+ request.setNotificationVisibility(
+ DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
+ request.setMimeType("*/*");
+ request.setTitle("Downloading " + filename + " via GitNex");
+ DownloadManager downloadManager = (DownloadManager) ctx.getSystemService(DOWNLOAD_SERVICE);
+ downloadManager.enqueue(request);
+
+ if (DownloadManager.STATUS_SUCCESSFUL == 8) {
+ Toasty.success(ctx, "Download completed");
+ }
+ }
+}
diff --git a/app/src/main/java/org/mian/gitnex/helpers/ViewPager2Transformers.java b/app/src/main/java/org/mian/gitnex/helpers/ViewPager2Transformers.java
index 86b2d4e6..9b256a97 100644
--- a/app/src/main/java/org/mian/gitnex/helpers/ViewPager2Transformers.java
+++ b/app/src/main/java/org/mian/gitnex/helpers/ViewPager2Transformers.java
@@ -41,7 +41,7 @@ public abstract class ViewPager2Transformers {
view.setAlpha(1 - position);
// Counteract the default slide transition
- view.setTranslationX(pageWidth * -position);
+ // view.setTranslationX(pageWidth * -position);
// Scale the page down (between MIN_SCALE and 1)
float scaleFactor = MIN_SCALE + (1 - MIN_SCALE) * (1 - Math.abs(position));
diff --git a/app/src/main/res/drawable/ic_file_download.xml b/app/src/main/res/drawable/ic_file_download.xml
new file mode 100644
index 00000000..bff17f83
--- /dev/null
+++ b/app/src/main/res/drawable/ic_file_download.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
diff --git a/app/src/main/res/drawable/shape_bottom_sheet_top_corners.xml b/app/src/main/res/drawable/shape_bottom_sheet_top_corners.xml
index 68443243..e87a7595 100644
--- a/app/src/main/res/drawable/shape_bottom_sheet_top_corners.xml
+++ b/app/src/main/res/drawable/shape_bottom_sheet_top_corners.xml
@@ -3,10 +3,10 @@
android:shape="rectangle">
+ android:topLeftRadius="@dimen/dimen28dp"
+ android:topRightRadius="@dimen/dimen28dp"/>
-
+
diff --git a/app/src/main/res/layout/activity_issue_detail.xml b/app/src/main/res/layout/activity_issue_detail.xml
index ae23ed01..cf4d4187 100644
--- a/app/src/main/res/layout/activity_issue_detail.xml
+++ b/app/src/main/res/layout/activity_issue_detail.xml
@@ -132,197 +132,230 @@
+ android:orientation="vertical">
-
-
-
-
-
-
+ android:layout_height="wrap_content"
+ android:background="?attr/materialCardBackgroundColor"
+ android:foreground="?android:attr/selectableItemBackground"
+ android:orientation="vertical"
+ android:padding="@dimen/dimen12dp">
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
-
+
+
+
+
+
+ android:layout_marginLeft="@dimen/dimen16dp"
+ android:layout_marginRight="@dimen/dimen16dp"
+ android:layout_weight="1"
+ android:orientation="vertical">
+ android:ellipsize="middle"
+ android:singleLine="true"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="14sp"
+ android:textStyle="bold" />
-
+ android:orientation="horizontal">
+
+
+
+
+
+
-
-
-
-
-
+ android:gravity="end|center_vertical"
+ android:orientation="horizontal"
+ android:visibility="gone"
+ tools:ignore="UseCompoundDrawables">
-
+
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/app/src/main/res/layout/custom_image_view_dialog.xml b/app/src/main/res/layout/custom_image_view_dialog.xml
new file mode 100644
index 00000000..acb55465
--- /dev/null
+++ b/app/src/main/res/layout/custom_image_view_dialog.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+