fix the new UI with horizontal view too
This commit is contained in:
parent
9181d7c4f9
commit
c7d4be1d9d
3 changed files with 11 additions and 3 deletions
|
@ -660,15 +660,16 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
|
||||
private fun calculateContentWidth(directories: ArrayList<Directory>) {
|
||||
val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
|
||||
val thumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0
|
||||
val fullWidth = ((directories.size - 1) / layoutManager.spanCount + 1) * thumbnailWidth
|
||||
val thumbnailWidth = (layoutManager.getChildAt(0)?.width ?: 0) + resources.getDimension(R.dimen.medium_margin).toInt() * 2
|
||||
val columnCount = (directories.size - 1) / layoutManager.spanCount + 1
|
||||
val fullWidth = columnCount * thumbnailWidth
|
||||
directories_horizontal_fastscroller.setContentWidth(fullWidth)
|
||||
directories_horizontal_fastscroller.setScrollToX(directories_grid.computeHorizontalScrollOffset())
|
||||
}
|
||||
|
||||
private fun calculateContentHeight(directories: ArrayList<Directory>) {
|
||||
val layoutManager = directories_grid.layoutManager as MyGridLayoutManager
|
||||
val thumbnailHeight = (layoutManager.getChildAt(0)?.height ?: 0) + (resources.getDimension(R.dimen.medium_margin).toInt() * 2)
|
||||
val thumbnailHeight = (layoutManager.getChildAt(0)?.height ?: 0) + resources.getDimension(R.dimen.medium_margin).toInt() * 2
|
||||
val rowCount = (directories.size - 1) / layoutManager.spanCount + 1
|
||||
val fullHeight = rowCount * thumbnailHeight
|
||||
directories_vertical_fastscroller.setContentHeight(fullHeight)
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.graphics.drawable.Icon
|
|||
import android.view.Menu
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.RelativeLayout
|
||||
import com.bumptech.glide.Glide
|
||||
import com.google.gson.Gson
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
|
@ -674,6 +675,11 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
dir_check.background?.applyColorFilter(primaryColor)
|
||||
}
|
||||
|
||||
if (scrollHorizontally) {
|
||||
(dir_name.layoutParams as RelativeLayout.LayoutParams).removeRule(RelativeLayout.BELOW)
|
||||
(dir_thumbnail.layoutParams as RelativeLayout.LayoutParams).addRule(RelativeLayout.ABOVE, dir_name.id)
|
||||
}
|
||||
|
||||
if (lockedFolderPaths.contains(directory.path)) {
|
||||
dir_lock.beVisible()
|
||||
dir_lock.background = ColorDrawable(config.backgroundColor)
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/dir_thumbnail"
|
||||
android:layout_alignStart="@+id/dir_thumbnail"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toStartOf="@+id/dir_location"
|
||||
android:ellipsize="middle"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
|
|
Loading…
Reference in a new issue