adding an initial implementation of directory_item_list

This commit is contained in:
tibbi 2017-09-28 23:17:53 +02:00
parent 2eabff531b
commit c9e355eecf
3 changed files with 46 additions and 52 deletions

View file

@ -181,7 +181,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
showAllMedia()
else
getDirectories()
setupLayoutManager()
if (config.viewTypeFolders == VIEW_TYPE_GRID)
setupGridLayoutManager()
else
setupListLayoutManager()
checkIfColorChanged()
} else {
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION)
@ -295,7 +300,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter)
private fun setupLayoutManager() {
private fun setupGridLayoutManager() {
val layoutManager = directories_grid.layoutManager as GridLayoutManager
if (config.scrollHorizontally) {
layoutManager.orientation = GridLayoutManager.HORIZONTAL
@ -333,6 +338,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
}
}
private fun setupListLayoutManager() {
directories_grid.isDragSelectionEnabled = true
directories_grid.isZoomingEnabled = false
val layoutManager = directories_grid.layoutManager as GridLayoutManager
layoutManager.spanCount = 1
}
private fun createNewFolder() {
FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) {
CreateNewFolderDialog(this, it) {

View file

@ -4,12 +4,13 @@
android:id="@+id/dir_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="1px">
android:paddingLeft="@dimen/small_margin"
android:paddingTop="@dimen/small_margin">
<com.simplemobiletools.gallery.views.MySquareImageView
android:id="@+id/dir_thumbnail"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_width="@dimen/list_view_folder_thumbnail_size"
android:layout_height="@dimen/list_view_folder_thumbnail_size"/>
<ImageView
android:id="@+id/dir_check"
@ -23,67 +24,46 @@
android:padding="@dimen/tiny_margin"
android:src="@drawable/ic_check"/>
<TextView
android:id="@+id/dir_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/dir_thumbnail"
android:ellipsize="end"
android:maxLines="1"
android:paddingLeft="@dimen/small_margin"
android:paddingRight="@dimen/small_margin"
android:textColor="@android:color/white"
android:textSize="@dimen/normal_text_size"/>
<TextView
android:id="@+id/photo_cnt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/dir_name"
android:layout_toRightOf="@+id/dir_name"
android:alpha="0.4"
android:textColor="@android:color/white"
android:textSize="@dimen/smaller_text_size"/>
<ImageView
android:id="@+id/dir_pin"
android:layout_width="@dimen/selection_check_size"
android:layout_height="@dimen/selection_check_size"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_margin="@dimen/small_margin"
android:background="@drawable/circle_black_background"
android:padding="@dimen/small_margin"
android:src="@drawable/ic_pin"/>
<ImageView
android:id="@+id/dir_shadow_holder"
android:layout_width="match_parent"
android:layout_height="@dimen/tmb_shadow_height"
android:layout_alignLeft="@+id/dir_bottom_holder"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/dir_bottom_holder"
android:background="@drawable/gradient_background"/>
<LinearLayout
android:id="@+id/dir_bottom_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/dir_thumbnail"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/dir_thumbnail"
android:gravity="bottom"
android:orientation="vertical"
android:paddingBottom="@dimen/small_margin"
android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"
android:paddingTop="@dimen/small_margin">
<TextView
android:id="@+id/dir_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:paddingBottom="@dimen/small_margin"
android:textColor="@android:color/white"
android:textSize="@dimen/normal_text_size"/>
<TextView
android:id="@+id/photo_cnt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@android:color/white"
android:textSize="@dimen/normal_text_size"/>
</LinearLayout>
<ImageView
android:id="@+id/dir_sd_card"
android:layout_width="@dimen/sd_card_icon_size"
android:layout_height="@dimen/sd_card_icon_size"
android:layout_alignParentBottom="true"
android:layout_alignRight="@+id/dir_bottom_holder"
android:alpha="0.8"
android:layout_toLeftOf="@+id/dir_pin"
android:paddingBottom="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingRight="@dimen/small_margin"

View file

@ -8,4 +8,5 @@
<dimen name="timer_padding">24dp</dimen>
<dimen name="tmb_shadow_height">50dp</dimen>
<dimen name="video_side_slider_width">150dp</dimen>
<dimen name="list_view_folder_thumbnail_size">72dp</dimen>
</resources>