reverting to the previous UI of the main screen
This commit is contained in:
parent
17f0c1f052
commit
4ab2b6a437
5 changed files with 61 additions and 55 deletions
|
@ -77,7 +77,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.simplemobiletools:commons:5.31.18'
|
||||
implementation 'com.simplemobiletools:commons:5.31.19'
|
||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'
|
||||
|
|
|
@ -660,22 +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) + resources.getDimension(R.dimen.medium_margin).toInt() * 2
|
||||
val columnCount = (directories.size - 1) / layoutManager.spanCount + 1
|
||||
val fullWidth = columnCount * thumbnailWidth
|
||||
val thumbnailWidth = layoutManager.getChildAt(0)?.width ?: 0
|
||||
val fullWidth = ((directories.size - 1) / layoutManager.spanCount + 1) * 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
|
||||
var thumbnailHeight = (layoutManager.getChildAt(0)?.height ?: 0)
|
||||
if (config.viewTypeFolders == VIEW_TYPE_GRID) {
|
||||
thumbnailHeight += resources.getDimension(R.dimen.medium_margin).toInt() * 2
|
||||
}
|
||||
|
||||
val rowCount = (directories.size - 1) / layoutManager.spanCount + 1
|
||||
val fullHeight = rowCount * thumbnailHeight
|
||||
val thumbnailHeight = layoutManager.getChildAt(0)?.height ?: 0
|
||||
val fullHeight = ((directories.size - 1) / layoutManager.spanCount + 1) * thumbnailHeight
|
||||
directories_vertical_fastscroller.setContentHeight(fullHeight)
|
||||
directories_vertical_fastscroller.setScrollToY(directories_grid.computeVerticalScrollOffset())
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ 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
|
||||
|
@ -662,6 +661,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
private fun setupView(view: View, directory: Directory) {
|
||||
val isSelected = selectedKeys.contains(directory.path.hashCode())
|
||||
view.apply {
|
||||
dir_name.text = if (groupDirectSubfolders && directory.subfoldersCount > 1) "${directory.name} (${directory.subfoldersCount})" else directory.name
|
||||
dir_path?.text = "${directory.path.substringBeforeLast("/")}/"
|
||||
photo_cnt.text = directory.subfoldersMediaCount.toString()
|
||||
val thumbnailType = when {
|
||||
directory.tmb.isVideoFast() -> TYPE_VIDEOS
|
||||
directory.tmb.isGif() -> TYPE_GIFS
|
||||
|
@ -675,18 +677,13 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
dir_check.background?.applyColorFilter(primaryColor)
|
||||
}
|
||||
|
||||
if (scrollHorizontally && !isListViewType) {
|
||||
(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)
|
||||
dir_lock.applyColorFilter(config.backgroundColor.getContrastColor())
|
||||
} else {
|
||||
dir_lock.beGone()
|
||||
val roundedCorners = if (isListViewType) ROUNDED_CORNERS_SMALL else ROUNDED_CORNERS_BIG
|
||||
val roundedCorners = if (isListViewType) ROUNDED_CORNERS_SMALL else ROUNDED_CORNERS_NONE
|
||||
activity.loadImage(thumbnailType, directory.tmb, dir_thumbnail, scrollHorizontally, animateGifs, cropThumbnails, roundedCorners)
|
||||
}
|
||||
|
||||
|
@ -696,28 +693,14 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
|
|||
dir_location.setImageResource(if (directory.location == LOCATION_SD) R.drawable.ic_sd_card_vector else R.drawable.ic_usb_vector)
|
||||
}
|
||||
|
||||
dir_name.setTextColor(textColor)
|
||||
photo_cnt.beVisibleIf(showMediaCount)
|
||||
|
||||
if (isListViewType) {
|
||||
dir_path.text = "${directory.path.substringBeforeLast("/")}/"
|
||||
photo_cnt.setTextColor(textColor)
|
||||
photo_cnt.text = directory.subfoldersMediaCount.toString()
|
||||
photo_cnt.beVisibleIf(showMediaCount)
|
||||
dir_name.setTextColor(textColor)
|
||||
dir_path.setTextColor(textColor)
|
||||
photo_cnt.setTextColor(textColor)
|
||||
dir_pin.applyColorFilter(textColor)
|
||||
dir_location.applyColorFilter(textColor)
|
||||
dir_name.text = if (groupDirectSubfolders && directory.subfoldersCount > 1) {
|
||||
"${directory.name} [${directory.subfoldersCount}]"
|
||||
} else {
|
||||
directory.name
|
||||
}
|
||||
} else {
|
||||
dir_name.text = if (groupDirectSubfolders && directory.subfoldersCount > 1) {
|
||||
"${directory.name} [${directory.subfoldersCount}]"
|
||||
} else if (showMediaCount) {
|
||||
"${directory.name} (${directory.subfoldersMediaCount})"
|
||||
} else {
|
||||
directory.name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,10 +3,9 @@
|
|||
android:id="@+id/dir_holder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/medium_margin"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:paddingTop="@dimen/medium_margin">
|
||||
android:padding="1px">
|
||||
|
||||
<com.simplemobiletools.gallery.pro.views.MySquareImageView
|
||||
android:id="@+id/dir_thumbnail"
|
||||
|
@ -32,9 +31,10 @@
|
|||
android:id="@+id/dir_check"
|
||||
android:layout_width="@dimen/selection_check_size"
|
||||
android:layout_height="@dimen/selection_check_size"
|
||||
android:layout_alignEnd="@+id/dir_shadow_holder"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_margin="@dimen/medium_margin"
|
||||
android:layout_margin="@dimen/small_margin"
|
||||
android:background="@drawable/circle_background"
|
||||
android:contentDescription="@null"
|
||||
android:padding="@dimen/tiny_margin"
|
||||
|
@ -47,37 +47,68 @@
|
|||
android:layout_height="@dimen/selection_check_size"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_margin="@dimen/medium_margin"
|
||||
android:layout_margin="@dimen/small_margin"
|
||||
android:background="@drawable/circle_black_background"
|
||||
android:contentDescription="@string/pin"
|
||||
android:padding="@dimen/small_margin"
|
||||
android:src="@drawable/ic_pin"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/dir_name"
|
||||
<ImageView
|
||||
android:id="@+id/dir_shadow_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/tmb_shadow_height"
|
||||
android:layout_alignStart="@+id/dir_bottom_holder"
|
||||
android:layout_alignEnd="@+id/dir_bottom_holder"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="@drawable/gradient_background"
|
||||
android:contentDescription="@null" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dir_bottom_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@+id/dir_thumbnail"
|
||||
android:layout_alignStart="@+id/dir_thumbnail"
|
||||
android:layout_alignEnd="@+id/dir_thumbnail"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_toStartOf="@+id/dir_location"
|
||||
android:ellipsize="middle"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:singleLine="true"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/normal_text_size" />
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/medium_margin"
|
||||
android:paddingTop="@dimen/small_margin"
|
||||
android:paddingRight="@dimen/medium_margin"
|
||||
android:paddingBottom="@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:shadowColor="@color/default_background_color"
|
||||
android:shadowRadius="4"
|
||||
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_location"
|
||||
android:layout_width="@dimen/sd_card_icon_size"
|
||||
android:layout_height="@dimen/sd_card_icon_size"
|
||||
android:layout_alignBottom="@+id/dir_name"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_alignEnd="@+id/dir_bottom_holder"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:alpha="0.8"
|
||||
android:contentDescription="@null"
|
||||
android:paddingTop="@dimen/tiny_margin"
|
||||
android:paddingBottom="@dimen/tiny_margin"
|
||||
android:paddingEnd="@dimen/small_margin"
|
||||
android:paddingBottom="@dimen/small_margin"
|
||||
android:src="@drawable/ic_sd_card_vector"
|
||||
android:visibility="gone" />
|
||||
|
||||
|
|
|
@ -23,6 +23,4 @@
|
|||
<dimen name="widget_initial_size">110dp</dimen>
|
||||
<dimen name="full_brush_size">40dp</dimen>
|
||||
<dimen name="lock_padding">30dp</dimen>
|
||||
<dimen name="rounded_corner_radius_small">4dp</dimen>
|
||||
<dimen name="rounded_corner_radius_big">10dp</dimen>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue