Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

Commit

Permalink
Add more columns of images for Add Entry in landscape mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc committed Jul 8, 2019
1 parent 77861af commit ae94e5b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import android.content.ClipboardManager
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.content.res.Configuration
import android.os.Bundle
import android.preference.PreferenceManager
import android.view.LayoutInflater
Expand Down Expand Up @@ -291,7 +292,12 @@ class AddEntryFragment : Fragment(), KodeinAware {
private fun setupImageRecycler(view: View) {
val recycler: RecyclerView = view.findViewById(R.id.recycler_add_entry_images)
this.imageRecyclerAdapter = ImageRecyclerAdapter({}, ::onImageLongClick, requireContext(), requireActivity().theme)
val layoutManager = GridLayoutManager(context, 3)

val layoutManager = if(resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT)
GridLayoutManager(context, 3)
else
GridLayoutManager(context, 5)

recycler.adapter = imageRecyclerAdapter
recycler.layoutManager = layoutManager
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_add_entry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_add_entry_images"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
Expand Down

0 comments on commit ae94e5b

Please sign in to comment.