add a divider between folders

This commit is contained in:
tibbi 2017-09-29 21:31:12 +02:00
parent 2ee425e21d
commit da00ed8422
2 changed files with 14 additions and 1 deletions

View file

@ -20,6 +20,7 @@ import com.simplemobiletools.gallery.activities.SimpleActivity
import com.simplemobiletools.gallery.dialogs.ExcludeFolderDialog import com.simplemobiletools.gallery.dialogs.ExcludeFolderDialog
import com.simplemobiletools.gallery.dialogs.PickMediumDialog import com.simplemobiletools.gallery.dialogs.PickMediumDialog
import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.extensions.*
import com.simplemobiletools.gallery.helpers.VIEW_TYPE_LIST
import com.simplemobiletools.gallery.models.AlbumCover import com.simplemobiletools.gallery.models.AlbumCover
import com.simplemobiletools.gallery.models.Directory import com.simplemobiletools.gallery.models.Directory
import kotlinx.android.synthetic.main.directory_item_grid.view.* import kotlinx.android.synthetic.main.directory_item_grid.view.*
@ -31,6 +32,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
val multiSelector = MultiSelector() val multiSelector = MultiSelector()
val config = activity.config val config = activity.config
val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST
var actMode: ActionMode? = null var actMode: ActionMode? = null
var itemViews = SparseArray<View>() var itemViews = SparseArray<View>()
@ -326,7 +328,8 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
} }
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder { override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
val view = LayoutInflater.from(parent?.context).inflate(R.layout.directory_item_grid, parent, false) val layoutType = if (isListViewType) R.layout.directory_item_list else R.layout.directory_item_grid
val view = LayoutInflater.from(parent?.context).inflate(layoutType, parent, false)
return ViewHolder(view, adapterListener, activity, multiSelectorMode, multiSelector, listener, isPickIntent, itemClick) return ViewHolder(view, adapterListener, activity, multiSelectorMode, multiSelector, listener, isPickIntent, itemClick)
} }

View file

@ -73,4 +73,14 @@
android:src="@drawable/ic_pin" android:src="@drawable/ic_pin"
android:visibility="gone"/> android:visibility="gone"/>
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/dir_list_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignBottom="@+id/dir_thumbnail"
android:layout_toRightOf="@+id/dir_thumbnail"
android:layout_marginTop="2dp"
android:background="@drawable/divider"/>
</RelativeLayout> </RelativeLayout>