diff --git a/app/build.gradle b/app/build.gradle index be16906b..20a46d4b 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -157,6 +157,7 @@ dependencies { implementation 'com.github.ligi.tracedroid:lib:3.0' implementation 'com.github.ligi.tracedroid:supportemail:3.0' + implementation 'com.github.ImaginativeShohag:Why-Not-Image-Carousel:v1.1.0' /** * Not in release, so not mentioned in licenses list diff --git a/app/src/main/java/com/h/pixeldroid/postCreation/PostCreationActivity.kt b/app/src/main/java/com/h/pixeldroid/postCreation/PostCreationActivity.kt index 0a0aae17..454cf265 100644 --- a/app/src/main/java/com/h/pixeldroid/postCreation/PostCreationActivity.kt +++ b/app/src/main/java/com/h/pixeldroid/postCreation/PostCreationActivity.kt @@ -1,9 +1,16 @@ package com.h.pixeldroid.postCreation import android.app.Activity +import android.content.ContentResolver +import android.content.ContentValues import android.content.Intent +import android.graphics.Bitmap +import android.media.MediaScannerConnection import android.net.Uri +import android.os.Build import android.os.Bundle +import android.os.Environment +import android.provider.MediaStore import android.provider.OpenableColumns import android.util.Log import android.view.LayoutInflater @@ -12,10 +19,12 @@ import android.view.ViewGroup import android.widget.Button import android.widget.Toast import androidx.core.net.toFile +import androidx.core.net.toUri import androidx.lifecycle.lifecycleScope import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide +import com.google.android.material.snackbar.Snackbar import com.google.android.material.textfield.TextInputLayout import com.h.pixeldroid.utils.BaseActivity import com.h.pixeldroid.MainActivity @@ -33,11 +42,18 @@ import io.reactivex.schedulers.Schedulers import kotlinx.android.synthetic.main.activity_post_creation.* import kotlinx.android.synthetic.main.image_album_creation.view.* import okhttp3.MultipartBody +import org.imaginativeworld.whynotimagecarousel.CarouselItem +import org.imaginativeworld.whynotimagecarousel.ImageCarousel import retrofit2.Call import retrofit2.Callback import retrofit2.HttpException import retrofit2.Response +import java.io.File import java.io.IOException +import java.io.OutputStream +import java.text.SimpleDateFormat +import java.util.* +import kotlin.collections.ArrayList private const val TAG = "Post Creation Activity" private const val MORE_PICTURES_REQUEST_CODE = 0xffff @@ -45,9 +61,6 @@ private const val MORE_PICTURES_REQUEST_CODE = 0xffff class PostCreationActivity : BaseActivity() { - private lateinit var recycler : RecyclerView - private lateinit var adapter : PostCreationAdapter - private lateinit var accessToken: String private lateinit var pixelfedAPI: PixelfedAPI @@ -100,10 +113,9 @@ class PostCreationActivity : BaseActivity() { progressList = posts.map { 0 } as ArrayList upload() - adapter = PostCreationAdapter(posts) - recycler = findViewById(R.id.image_grid) - recycler.layoutManager = GridLayoutManager(this, 3) - recycler.adapter = adapter + + val carousel: ImageCarousel = findViewById(R.id.carousel) + carousel.addData(posts.map { CarouselItem(it) }) // get the description and send the post findViewById