formatting some code style and imports in activities, no real change
This commit is contained in:
parent
3781ee1f04
commit
841d770167
14 changed files with 268 additions and 119 deletions
|
@ -215,7 +215,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
return false
|
||||
}
|
||||
|
||||
override fun onResourceReady(bitmap: Bitmap?, model: Any?, target: Target<Bitmap>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||
override fun onResourceReady(
|
||||
bitmap: Bitmap?,
|
||||
model: Any?,
|
||||
target: Target<Bitmap>?,
|
||||
dataSource: DataSource?,
|
||||
isFirstResource: Boolean
|
||||
): Boolean {
|
||||
val currentFilter = getFiltersAdapter()?.getCurrentFilter()
|
||||
if (filterInitialBitmap == null) {
|
||||
loadCropImageView()
|
||||
|
@ -604,7 +610,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
return false
|
||||
}
|
||||
|
||||
override fun onResourceReady(resource: Bitmap?, model: Any?, target: Target<Bitmap>?, dataSource: DataSource?, isFirstResource: Boolean) = false
|
||||
override fun onResourceReady(
|
||||
resource: Bitmap?,
|
||||
model: Any?,
|
||||
target: Target<Bitmap>?,
|
||||
dataSource: DataSource?,
|
||||
isFirstResource: Boolean
|
||||
) = false
|
||||
})
|
||||
.submit(thumbnailSize, thumbnailSize)
|
||||
.get()
|
||||
|
@ -678,7 +690,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
}
|
||||
|
||||
private fun updateAspectRatioButtons() {
|
||||
arrayOf(bottom_aspect_ratio_free, bottom_aspect_ratio_one_one, bottom_aspect_ratio_four_three, bottom_aspect_ratio_sixteen_nine, bottom_aspect_ratio_other).forEach {
|
||||
arrayOf(
|
||||
bottom_aspect_ratio_free,
|
||||
bottom_aspect_ratio_one_one,
|
||||
bottom_aspect_ratio_four_three,
|
||||
bottom_aspect_ratio_sixteen_nine,
|
||||
bottom_aspect_ratio_other
|
||||
).forEach {
|
||||
it.setTextColor(Color.WHITE)
|
||||
}
|
||||
|
||||
|
@ -808,7 +826,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
if (newPath.isEmpty()) {
|
||||
val filename = applicationContext.getFilenameFromContentUri(saveUri) ?: ""
|
||||
if (filename.isNotEmpty()) {
|
||||
val path = if (intent.extras?.containsKey(REAL_FILE_PATH) == true) intent.getStringExtra(REAL_FILE_PATH)?.getParentPath() else internalStoragePath
|
||||
val path =
|
||||
if (intent.extras?.containsKey(REAL_FILE_PATH) == true) intent.getStringExtra(REAL_FILE_PATH)?.getParentPath() else internalStoragePath
|
||||
newPath = "$path/$filename"
|
||||
shouldAppendFilename = false
|
||||
}
|
||||
|
@ -825,7 +844,8 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
|
|||
private fun saveBitmapToFile(bitmap: Bitmap, path: String, showSavingToast: Boolean) {
|
||||
if (!packageName.contains("slootelibomelpmis".reversed(), true)) {
|
||||
if (baseConfig.appRunCount > 100) {
|
||||
val label = "sknahT .moc.slootelibomelpmis.www morf eno lanigiro eht daolnwod ytefas nwo ruoy roF .ppa eht fo noisrev ekaf a gnisu era uoY".reversed()
|
||||
val label =
|
||||
"sknahT .moc.slootelibomelpmis.www morf eno lanigiro eht daolnwod ytefas nwo ruoy roF .ppa eht fo noisrev ekaf a gnisu era uoY".reversed()
|
||||
runOnUiThread {
|
||||
ConfirmationDialog(this, label, positive = com.simplemobiletools.commons.R.string.ok, negative = 0) {
|
||||
launchViewIntent("6629852208836920709=di?ved/sppa/erots/moc.elgoog.yalp//:sptth".reversed())
|
||||
|
|
|
@ -548,7 +548,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
}
|
||||
|
||||
override fun deleteFolders(folders: ArrayList<File>) {
|
||||
val fileDirItems = folders.asSequence().filter { it.isDirectory }.map { FileDirItem(it.absolutePath, it.name, true) }.toMutableList() as ArrayList<FileDirItem>
|
||||
val fileDirItems =
|
||||
folders.asSequence().filter { it.isDirectory }.map { FileDirItem(it.absolutePath, it.name, true) }.toMutableList() as ArrayList<FileDirItem>
|
||||
when {
|
||||
fileDirItems.isEmpty() -> return
|
||||
fileDirItems.size == 1 -> {
|
||||
|
@ -609,7 +610,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
}
|
||||
|
||||
if (config.deleteEmptyFolders) {
|
||||
folders.filter { !it.absolutePath.isDownloadsFolder() && it.isDirectory && it.toFileDirItem(this).getProperFileCount(this, true) == 0 }.forEach {
|
||||
folders.filter { !it.absolutePath.isDownloadsFolder() && it.isDirectory && it.toFileDirItem(this).getProperFileCount(this, true) == 0 }
|
||||
.forEach {
|
||||
tryDeleteFileDirItem(it.toFileDirItem(this), true, true)
|
||||
}
|
||||
}
|
||||
|
@ -958,8 +960,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 ||
|
||||
grouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 0
|
||||
|
||||
val curMedia = mLastMediaFetcher!!.getFilesFrom(directory.path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified,
|
||||
getProperFileSize, favoritePaths, false, lastModifieds, dateTakens)
|
||||
val curMedia = mLastMediaFetcher!!.getFilesFrom(
|
||||
directory.path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified,
|
||||
getProperFileSize, favoritePaths, false, lastModifieds, dateTakens
|
||||
)
|
||||
|
||||
val newDir = if (curMedia.isEmpty()) {
|
||||
if (directory.path != tempFolderPath) {
|
||||
|
@ -1057,8 +1061,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 ||
|
||||
grouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 0
|
||||
|
||||
val newMedia = mLastMediaFetcher!!.getFilesFrom(folder, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified,
|
||||
getProperFileSize, favoritePaths, false, lastModifieds, dateTakens)
|
||||
val newMedia = mLastMediaFetcher!!.getFilesFrom(
|
||||
folder, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified,
|
||||
getProperFileSize, favoritePaths, false, lastModifieds, dateTakens
|
||||
)
|
||||
|
||||
if (newMedia.isEmpty()) {
|
||||
continue
|
||||
|
@ -1189,7 +1195,15 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
if (currAdapter == null || forceRecreate) {
|
||||
initZoomListener()
|
||||
val fastscroller = if (config.scrollHorizontally) directories_horizontal_fastscroller else directories_vertical_fastscroller
|
||||
DirectoryAdapter(this, dirsToShow, this, directories_grid, isPickIntent(intent) || isGetAnyContentIntent(intent), directories_refresh_layout, fastscroller) {
|
||||
DirectoryAdapter(
|
||||
this,
|
||||
dirsToShow,
|
||||
this,
|
||||
directories_grid,
|
||||
isPickIntent(intent) || isGetAnyContentIntent(intent),
|
||||
directories_refresh_layout,
|
||||
fastscroller
|
||||
) {
|
||||
val clickedDir = it as Directory
|
||||
val path = clickedDir.path
|
||||
if (clickedDir.subfoldersCount == 1 || !config.groupDirectSubfolders) {
|
||||
|
@ -1216,7 +1230,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
} else {
|
||||
runOnUiThread {
|
||||
if (textToSearch.isNotEmpty()) {
|
||||
dirsToShow = dirsToShow.filter { it.name.contains(textToSearch, true) }.sortedBy { !it.name.startsWith(textToSearch, true) }.toMutableList() as ArrayList
|
||||
dirsToShow = dirsToShow.filter { it.name.contains(textToSearch, true) }.sortedBy { !it.name.startsWith(textToSearch, true) }
|
||||
.toMutableList() as ArrayList
|
||||
}
|
||||
checkPlaceholderVisibility(dirsToShow)
|
||||
|
||||
|
@ -1299,7 +1314,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
|||
|
||||
private fun getCurrentlyDisplayedDirs() = getRecyclerAdapter()?.dirs ?: ArrayList()
|
||||
|
||||
private fun getBubbleTextItem(index: Int) = getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting, this, mDateFormat, mTimeFormat)
|
||||
private fun getBubbleTextItem(index: Int) =
|
||||
getRecyclerAdapter()?.dirs?.getOrNull(index)?.getBubbleText(config.directorySorting, this, mDateFormat, mTimeFormat)
|
||||
?: ""
|
||||
|
||||
private fun setupLatestMediaId() {
|
||||
|
|
|
@ -411,8 +411,10 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
|||
if (currAdapter == null) {
|
||||
initZoomListener()
|
||||
val fastscroller = if (config.scrollHorizontally) media_horizontal_fastscroller else media_vertical_fastscroller
|
||||
MediaAdapter(this, mMedia.clone() as ArrayList<ThumbnailItem>, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent,
|
||||
mAllowPickingMultiple, mPath, media_grid, fastscroller) {
|
||||
MediaAdapter(
|
||||
this, mMedia.clone() as ArrayList<ThumbnailItem>, this, mIsGetImageIntent || mIsGetVideoIntent || mIsGetAnyIntent,
|
||||
mAllowPickingMultiple, mPath, media_grid, fastscroller
|
||||
) {
|
||||
if (it is Medium && !isFinishing) {
|
||||
itemClicked(it.path)
|
||||
}
|
||||
|
|
|
@ -14,7 +14,9 @@ import com.google.vr.sdk.widgets.pano.VrPanoramaView
|
|||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.extensions.*
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
import com.simplemobiletools.gallery.pro.extensions.hideSystemUI
|
||||
import com.simplemobiletools.gallery.pro.extensions.showSystemUI
|
||||
import com.simplemobiletools.gallery.pro.helpers.PATH
|
||||
import kotlinx.android.synthetic.main.activity_panorama_photo.*
|
||||
|
||||
|
|
|
@ -14,7 +14,10 @@ import com.google.vr.sdk.widgets.video.VrVideoEventListener
|
|||
import com.google.vr.sdk.widgets.video.VrVideoView
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.extensions.*
|
||||
import com.simplemobiletools.gallery.pro.extensions.config
|
||||
import com.simplemobiletools.gallery.pro.extensions.hasNavBar
|
||||
import com.simplemobiletools.gallery.pro.extensions.hideSystemUI
|
||||
import com.simplemobiletools.gallery.pro.extensions.showSystemUI
|
||||
import com.simplemobiletools.gallery.pro.helpers.MIN_SKIP_LENGTH
|
||||
import com.simplemobiletools.gallery.pro.helpers.PATH
|
||||
import kotlinx.android.synthetic.main.activity_panorama_video.*
|
||||
|
@ -244,7 +247,8 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
|
|||
video_time_holder.setPadding(0, 0, right, bottom)
|
||||
video_time_holder.background = resources.getDrawable(R.drawable.gradient_background)
|
||||
video_time_holder.onGlobalLayout {
|
||||
val newBottomMargin = video_time_holder.height - resources.getDimension(R.dimen.video_player_play_pause_size).toInt() - resources.getDimension(R.dimen.activity_margin).toInt()
|
||||
val newBottomMargin = video_time_holder.height - resources.getDimension(R.dimen.video_player_play_pause_size)
|
||||
.toInt() - resources.getDimension(R.dimen.activity_margin).toInt()
|
||||
(explore.layoutParams as RelativeLayout.LayoutParams).bottomMargin = newBottomMargin
|
||||
|
||||
(cardboard.layoutParams as RelativeLayout.LayoutParams).apply {
|
||||
|
|
|
@ -296,8 +296,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
|
|||
}
|
||||
|
||||
private fun initBottomActionButtons() {
|
||||
arrayListOf(bottom_favorite, bottom_delete, bottom_rotate, bottom_properties, bottom_change_orientation, bottom_slideshow, bottom_show_on_map,
|
||||
bottom_toggle_file_visibility, bottom_rename, bottom_copy, bottom_move, bottom_resize).forEach {
|
||||
arrayListOf(
|
||||
bottom_favorite, bottom_delete, bottom_rotate, bottom_properties, bottom_change_orientation, bottom_slideshow, bottom_show_on_map,
|
||||
bottom_toggle_file_visibility, bottom_rename, bottom_copy, bottom_move, bottom_resize
|
||||
).forEach {
|
||||
it.beGone()
|
||||
}
|
||||
|
||||
|
|
|
@ -106,7 +106,8 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
|
|||
val items = arrayListOf(
|
||||
RadioItem(WallpaperManager.FLAG_SYSTEM, getString(R.string.home_screen)),
|
||||
RadioItem(WallpaperManager.FLAG_LOCK, getString(R.string.lock_screen)),
|
||||
RadioItem(WallpaperManager.FLAG_SYSTEM or WallpaperManager.FLAG_LOCK, getString(R.string.home_and_lock_screen)))
|
||||
RadioItem(WallpaperManager.FLAG_SYSTEM or WallpaperManager.FLAG_LOCK, getString(R.string.home_and_lock_screen))
|
||||
)
|
||||
|
||||
RadioGroupDialog(this, items) {
|
||||
wallpaperFlag = it as Int
|
||||
|
|
|
@ -107,9 +107,11 @@ class SettingsActivity : SimpleActivity() {
|
|||
|
||||
private fun setupSectionColors() {
|
||||
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||
arrayListOf(visibility_label, videos_label, thumbnails_label, scrolling_label, fullscreen_media_label, security_label,
|
||||
arrayListOf(
|
||||
visibility_label, videos_label, thumbnails_label, scrolling_label, fullscreen_media_label, security_label,
|
||||
file_operations_label, deep_zoomable_images_label, extended_details_label, bottom_actions_label, recycle_bin_label,
|
||||
migrating_label).forEach {
|
||||
migrating_label
|
||||
).forEach {
|
||||
it.setTextColor(adjustedPrimaryColor)
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +144,8 @@ class SettingsActivity : SimpleActivity() {
|
|||
val items = arrayListOf(
|
||||
RadioItem(PRIORITY_SPEED, getString(R.string.speed)),
|
||||
RadioItem(PRIORITY_COMPROMISE, getString(R.string.compromise)),
|
||||
RadioItem(PRIORITY_VALIDITY, getString(R.string.avoid_showing_invalid_files)))
|
||||
RadioItem(PRIORITY_VALIDITY, getString(R.string.avoid_showing_invalid_files))
|
||||
)
|
||||
|
||||
RadioGroupDialog(this@SettingsActivity, items, config.fileLoadingPriority) {
|
||||
config.fileLoadingPriority = it as Int
|
||||
|
@ -151,11 +154,13 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getFileLoadingPriorityText() = getString(when (config.fileLoadingPriority) {
|
||||
private fun getFileLoadingPriorityText() = getString(
|
||||
when (config.fileLoadingPriority) {
|
||||
PRIORITY_SPEED -> R.string.speed
|
||||
PRIORITY_COMPROMISE -> R.string.compromise
|
||||
else -> R.string.avoid_showing_invalid_files
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
private fun setupManageIncludedFolders() {
|
||||
settings_manage_included_folders_holder.setOnClickListener {
|
||||
|
@ -403,10 +408,12 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getFolderStyleText() = getString(when (config.folderStyle) {
|
||||
private fun getFolderStyleText() = getString(
|
||||
when (config.folderStyle) {
|
||||
FOLDER_STYLE_SQUARE -> R.string.square
|
||||
else -> R.string.rounded_corners
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
private fun setupKeepLastModified() {
|
||||
settings_keep_last_modified.isChecked = config.keepLastModified
|
||||
|
@ -508,7 +515,8 @@ class SettingsActivity : SimpleActivity() {
|
|||
val items = arrayListOf(
|
||||
RadioItem(ROTATE_BY_SYSTEM_SETTING, getString(R.string.screen_rotation_system_setting)),
|
||||
RadioItem(ROTATE_BY_DEVICE_ROTATION, getString(R.string.screen_rotation_device_rotation)),
|
||||
RadioItem(ROTATE_BY_ASPECT_RATIO, getString(R.string.screen_rotation_aspect_ratio)))
|
||||
RadioItem(ROTATE_BY_ASPECT_RATIO, getString(R.string.screen_rotation_aspect_ratio))
|
||||
)
|
||||
|
||||
RadioGroupDialog(this@SettingsActivity, items, config.screenRotation) {
|
||||
config.screenRotation = it as Int
|
||||
|
@ -517,11 +525,13 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getScreenRotationText() = getString(when (config.screenRotation) {
|
||||
private fun getScreenRotationText() = getString(
|
||||
when (config.screenRotation) {
|
||||
ROTATE_BY_SYSTEM_SETTING -> R.string.screen_rotation_system_setting
|
||||
ROTATE_BY_DEVICE_ROTATION -> R.string.screen_rotation_device_rotation
|
||||
else -> R.string.screen_rotation_aspect_ratio
|
||||
})
|
||||
}
|
||||
)
|
||||
|
||||
private fun setupBottomActions() {
|
||||
settings_bottom_actions.isChecked = config.bottomActions
|
||||
|
|
|
@ -443,7 +443,16 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
|||
}
|
||||
|
||||
val newAlpha = if (isFullScreen) 0f else 1f
|
||||
arrayOf(video_prev_file, video_toggle_play_pause, video_next_file, video_curr_time, video_seekbar, video_duration, top_shadow, video_bottom_gradient).forEach {
|
||||
arrayOf(
|
||||
video_prev_file,
|
||||
video_toggle_play_pause,
|
||||
video_next_file,
|
||||
video_curr_time,
|
||||
video_seekbar,
|
||||
video_duration,
|
||||
top_shadow,
|
||||
video_bottom_gradient
|
||||
).forEach {
|
||||
it.animate().alpha(newAlpha).start()
|
||||
}
|
||||
video_seekbar.setOnSeekBarChangeListener(if (mIsFullscreen) null else this)
|
||||
|
@ -541,7 +550,8 @@ open class VideoPlayerActivity : SimpleActivity(), SeekBar.OnSeekBarChangeListen
|
|||
val downGestureDuration = System.currentTimeMillis() - mTouchDownTime
|
||||
if (config.allowDownGesture && !mIgnoreCloseDown && Math.abs(diffY) > Math.abs(diffX) && diffY < -mCloseDownThreshold &&
|
||||
downGestureDuration < MAX_CLOSE_DOWN_GESTURE_DURATION &&
|
||||
video_surface_frame.controller.state.zoom == 1f) {
|
||||
video_surface_frame.controller.state.zoom == 1f
|
||||
) {
|
||||
supportFinishAfterTransition()
|
||||
}
|
||||
|
||||
|
|
|
@ -180,10 +180,14 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
findItem(R.id.menu_save_as).isVisible = rotationDegrees != 0
|
||||
findItem(R.id.menu_print).isVisible = currentMedium.isImage() || currentMedium.isRaw()
|
||||
findItem(R.id.menu_resize).isVisible = visibleBottomActions and BOTTOM_ACTION_RESIZE == 0 && currentMedium.isImage()
|
||||
findItem(R.id.menu_hide).isVisible = !currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin()
|
||||
findItem(R.id.menu_unhide).isVisible = currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin()
|
||||
findItem(R.id.menu_add_to_favorites).isVisible = !currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0 && !currentMedium.getIsInRecycleBin()
|
||||
findItem(R.id.menu_remove_from_favorites).isVisible = currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0 && !currentMedium.getIsInRecycleBin()
|
||||
findItem(R.id.menu_hide).isVisible =
|
||||
!currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin()
|
||||
findItem(R.id.menu_unhide).isVisible =
|
||||
currentMedium.isHidden() && visibleBottomActions and BOTTOM_ACTION_TOGGLE_VISIBILITY == 0 && !currentMedium.getIsInRecycleBin()
|
||||
findItem(R.id.menu_add_to_favorites).isVisible =
|
||||
!currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0 && !currentMedium.getIsInRecycleBin()
|
||||
findItem(R.id.menu_remove_from_favorites).isVisible =
|
||||
currentMedium.isFavorite && visibleBottomActions and BOTTOM_ACTION_TOGGLE_FAVORITE == 0 && !currentMedium.getIsInRecycleBin()
|
||||
findItem(R.id.menu_restore_file).isVisible = currentMedium.path.startsWith(recycleBinPath)
|
||||
findItem(R.id.menu_create_shortcut).isVisible = isOreoPlus()
|
||||
findItem(R.id.menu_change_orientation).isVisible = rotationDegrees == 0 && visibleBottomActions and BOTTOM_ACTION_CHANGE_ORIENTATION == 0
|
||||
|
@ -193,7 +197,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
MenuItem.SHOW_AS_ACTION_ALWAYS
|
||||
} else {
|
||||
MenuItem.SHOW_AS_ACTION_IF_ROOM
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
if (visibleBottomActions != 0) {
|
||||
|
@ -401,7 +406,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
val isFavorite = favoritesDB.isFavorite(mPath)
|
||||
val duration = if (type == TYPE_VIDEOS) getDuration(mPath) ?: 0 else 0
|
||||
val ts = System.currentTimeMillis()
|
||||
val medium = Medium(null, mPath.getFilenameFromPath(), mPath, mPath.getParentPath(), ts, ts, File(mPath).length(), type, duration, isFavorite, 0)
|
||||
val medium =
|
||||
Medium(null, mPath.getFilenameFromPath(), mPath, mPath.getParentPath(), ts, ts, File(mPath).length(), type, duration, isFavorite, 0)
|
||||
mediaDB.insert(medium)
|
||||
}
|
||||
}
|
||||
|
@ -952,7 +958,13 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
return false
|
||||
}
|
||||
|
||||
override fun onResourceReady(bitmap: Bitmap?, model: Any?, target: Target<Bitmap>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||
override fun onResourceReady(
|
||||
bitmap: Bitmap?,
|
||||
model: Any?,
|
||||
target: Target<Bitmap>?,
|
||||
dataSource: DataSource?,
|
||||
isFirstResource: Boolean
|
||||
): Boolean {
|
||||
if (bitmap != null) {
|
||||
printHelper.printBitmap(path.getFilenameFromPath(), bitmap)
|
||||
}
|
||||
|
@ -1134,7 +1146,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
|
||||
private fun gotMedia(thumbnailItems: ArrayList<ThumbnailItem>, ignorePlayingVideos: Boolean = false) {
|
||||
val media = thumbnailItems.asSequence().filter { it is Medium && !mIgnoredPaths.contains(it.path) }.map { it as Medium }.toMutableList() as ArrayList<Medium>
|
||||
val media =
|
||||
thumbnailItems.asSequence().filter { it is Medium && !mIgnoredPaths.contains(it.path) }.map { it as Medium }.toMutableList() as ArrayList<Medium>
|
||||
if (isDirEmpty(media) || media.hashCode() == mPrevHashcode) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -178,6 +178,7 @@ class WidgetConfigureActivity : SimpleActivity() {
|
|||
private fun handleFolderNameDisplay() {
|
||||
val showFolderName = folder_picker_show_folder_name.isChecked
|
||||
config_folder_name.beVisibleIf(showFolderName)
|
||||
(config_image.layoutParams as RelativeLayout.LayoutParams).bottomMargin = if (showFolderName) 0 else resources.getDimension(R.dimen.normal_margin).toInt()
|
||||
(config_image.layoutParams as RelativeLayout.LayoutParams).bottomMargin =
|
||||
if (showFolderName) 0 else resources.getDimension(R.dimen.normal_margin).toInt()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,14 @@ package com.simplemobiletools.gallery.pro.extensions
|
|||
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.ComponentName
|
||||
import android.content.ContentUris
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.database.Cursor
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.PictureDrawable
|
||||
import android.media.AudioManager
|
||||
import android.net.Uri
|
||||
import android.os.Process
|
||||
import android.provider.MediaStore.Files
|
||||
import android.provider.MediaStore.Images
|
||||
|
@ -27,6 +29,7 @@ import com.bumptech.glide.request.target.Target
|
|||
import com.bumptech.glide.signature.ObjectKey
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.FileDirItem
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.activities.SettingsActivity
|
||||
import com.simplemobiletools.gallery.pro.asynctasks.GetMediaAsynctask
|
||||
|
@ -42,8 +45,7 @@ import java.io.File
|
|||
import java.io.FileInputStream
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.channels.FileChannel
|
||||
import java.util.HashSet
|
||||
import java.util.LinkedHashSet
|
||||
import java.util.*
|
||||
import kotlin.Comparator
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
|
@ -239,7 +241,8 @@ fun Context.getDirectParentSubfolders(dirs: ArrayList<Directory>, currentPathPre
|
|||
mediaTypes = mediaTypes or it.types
|
||||
}
|
||||
|
||||
val directory = Directory(newDirId++,
|
||||
val directory = Directory(
|
||||
newDirId++,
|
||||
parent,
|
||||
subDirs.first().tmb,
|
||||
getFolderNameFromPath(parent),
|
||||
|
@ -249,7 +252,8 @@ fun Context.getDirectParentSubfolders(dirs: ArrayList<Directory>, currentPathPre
|
|||
subDirs.sumByLong { it.size },
|
||||
getPathLocation(parent),
|
||||
mediaTypes,
|
||||
"")
|
||||
""
|
||||
)
|
||||
|
||||
directory.containsMediaFilesDirectly = false
|
||||
dirs.add(directory)
|
||||
|
@ -422,8 +426,10 @@ fun Context.getFolderNameFromPath(path: String): String {
|
|||
}
|
||||
}
|
||||
|
||||
fun Context.loadImage(type: Int, path: String, target: MySquareImageView, horizontalScroll: Boolean, animateGifs: Boolean, cropThumbnails: Boolean,
|
||||
roundCorners: Int, signature: ObjectKey, skipMemoryCacheAtPaths: ArrayList<String>? = null) {
|
||||
fun Context.loadImage(
|
||||
type: Int, path: String, target: MySquareImageView, horizontalScroll: Boolean, animateGifs: Boolean, cropThumbnails: Boolean,
|
||||
roundCorners: Int, signature: ObjectKey, skipMemoryCacheAtPaths: ArrayList<String>? = null
|
||||
) {
|
||||
target.isHorizontalScrolling = horizontalScroll
|
||||
if (type == TYPE_IMAGES || type == TYPE_VIDEOS || type == TYPE_RAWS || type == TYPE_PORTRAITS) {
|
||||
if (type == TYPE_IMAGES && path.isPng()) {
|
||||
|
@ -474,7 +480,14 @@ fun Context.getPathLocation(path: String): Int {
|
|||
}
|
||||
}
|
||||
|
||||
fun Context.loadPng(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, signature: ObjectKey, skipMemoryCacheAtPaths: ArrayList<String>? = null) {
|
||||
fun Context.loadPng(
|
||||
path: String,
|
||||
target: MySquareImageView,
|
||||
cropThumbnails: Boolean,
|
||||
roundCorners: Int,
|
||||
signature: ObjectKey,
|
||||
skipMemoryCacheAtPaths: ArrayList<String>? = null
|
||||
) {
|
||||
val options = RequestOptions()
|
||||
.signature(signature)
|
||||
.skipMemoryCache(skipMemoryCacheAtPaths?.contains(path) == true)
|
||||
|
@ -493,7 +506,13 @@ fun Context.loadPng(path: String, target: MySquareImageView, cropThumbnails: Boo
|
|||
return true
|
||||
}
|
||||
|
||||
override fun onResourceReady(resource: Bitmap?, model: Any?, targetBitmap: Target<Bitmap>?, dataSource: DataSource?, isFirstResource: Boolean): Boolean {
|
||||
override fun onResourceReady(
|
||||
resource: Bitmap?,
|
||||
model: Any?,
|
||||
targetBitmap: Target<Bitmap>?,
|
||||
dataSource: DataSource?,
|
||||
isFirstResource: Boolean
|
||||
): Boolean {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
@ -507,7 +526,14 @@ fun Context.loadPng(path: String, target: MySquareImageView, cropThumbnails: Boo
|
|||
builder.into(target)
|
||||
}
|
||||
|
||||
fun Context.loadJpg(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, signature: ObjectKey, skipMemoryCacheAtPaths: ArrayList<String>? = null) {
|
||||
fun Context.loadJpg(
|
||||
path: String,
|
||||
target: MySquareImageView,
|
||||
cropThumbnails: Boolean,
|
||||
roundCorners: Int,
|
||||
signature: ObjectKey,
|
||||
skipMemoryCacheAtPaths: ArrayList<String>? = null
|
||||
) {
|
||||
val options = RequestOptions()
|
||||
.signature(signature)
|
||||
.skipMemoryCache(skipMemoryCacheAtPaths?.contains(path) == true)
|
||||
|
@ -529,7 +555,14 @@ fun Context.loadJpg(path: String, target: MySquareImageView, cropThumbnails: Boo
|
|||
builder.into(target)
|
||||
}
|
||||
|
||||
fun Context.loadStaticGIF(path: String, target: MySquareImageView, cropThumbnails: Boolean, roundCorners: Int, signature: ObjectKey, skipMemoryCacheAtPaths: ArrayList<String>? = null) {
|
||||
fun Context.loadStaticGIF(
|
||||
path: String,
|
||||
target: MySquareImageView,
|
||||
cropThumbnails: Boolean,
|
||||
roundCorners: Int,
|
||||
signature: ObjectKey,
|
||||
skipMemoryCacheAtPaths: ArrayList<String>? = null
|
||||
) {
|
||||
val options = RequestOptions()
|
||||
.signature(signature)
|
||||
.skipMemoryCache(skipMemoryCacheAtPaths?.contains(path) == true)
|
||||
|
@ -598,7 +631,12 @@ fun Context.tryLoadingWithPicasso(path: String, view: MySquareImageView, cropThu
|
|||
}
|
||||
}
|
||||
|
||||
fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly: Boolean = false, forceShowHidden: Boolean = false, callback: (ArrayList<Directory>) -> Unit) {
|
||||
fun Context.getCachedDirectories(
|
||||
getVideosOnly: Boolean = false,
|
||||
getImagesOnly: Boolean = false,
|
||||
forceShowHidden: Boolean = false,
|
||||
callback: (ArrayList<Directory>) -> Unit
|
||||
) {
|
||||
ensureBackgroundThread {
|
||||
try {
|
||||
Process.setThreadPriority(Process.THREAD_PRIORITY_MORE_FAVORABLE)
|
||||
|
@ -780,7 +818,16 @@ fun Context.updateDBMediaPath(oldPath: String, newPath: String) {
|
|||
|
||||
fun Context.updateDBDirectory(directory: Directory) {
|
||||
try {
|
||||
directoryDao.updateDirectory(directory.path, directory.tmb, directory.mediaCnt, directory.modified, directory.taken, directory.size, directory.types, directory.sortValue)
|
||||
directoryDao.updateDirectory(
|
||||
directory.path,
|
||||
directory.tmb,
|
||||
directory.mediaCnt,
|
||||
directory.modified,
|
||||
directory.taken,
|
||||
directory.size,
|
||||
directory.types,
|
||||
directory.sortValue
|
||||
)
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
|
@ -923,8 +970,10 @@ fun Context.addPathToDB(path: String) {
|
|||
try {
|
||||
val isFavorite = favoritesDB.isFavorite(path)
|
||||
val videoDuration = if (type == TYPE_VIDEOS) getDuration(path) ?: 0 else 0
|
||||
val medium = Medium(null, path.getFilenameFromPath(), path, path.getParentPath(), System.currentTimeMillis(), System.currentTimeMillis(),
|
||||
File(path).length(), type, videoDuration, isFavorite, 0L)
|
||||
val medium = Medium(
|
||||
null, path.getFilenameFromPath(), path, path.getParentPath(), System.currentTimeMillis(), System.currentTimeMillis(),
|
||||
File(path).length(), type, videoDuration, isFavorite, 0L
|
||||
)
|
||||
|
||||
mediaDB.insert(medium)
|
||||
} catch (ignored: Exception) {
|
||||
|
@ -932,8 +981,10 @@ fun Context.addPathToDB(path: String) {
|
|||
}
|
||||
}
|
||||
|
||||
fun Context.createDirectoryFromMedia(path: String, curMedia: ArrayList<Medium>, albumCovers: ArrayList<AlbumCover>, hiddenString: String,
|
||||
includedFolders: MutableSet<String>, getProperFileSize: Boolean, noMediaFolders: ArrayList<String>): Directory {
|
||||
fun Context.createDirectoryFromMedia(
|
||||
path: String, curMedia: ArrayList<Medium>, albumCovers: ArrayList<AlbumCover>, hiddenString: String,
|
||||
includedFolders: MutableSet<String>, getProperFileSize: Boolean, noMediaFolders: ArrayList<String>
|
||||
): Directory {
|
||||
val OTGPath = config.OTGPath
|
||||
val grouped = MediaFetcher(this).groupMedia(curMedia, path)
|
||||
var thumbnail: String? = null
|
||||
|
@ -1018,8 +1069,10 @@ fun Context.updateDirectoryPath(path: String) {
|
|||
val lastModifieds = if (getProperLastModified) mediaFetcher.getFolderLastModifieds(path) else HashMap()
|
||||
val dateTakens = mediaFetcher.getFolderDateTakens(path)
|
||||
val favoritePaths = getFavoritePaths()
|
||||
val curMedia = mediaFetcher.getFilesFrom(path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize,
|
||||
favoritePaths, false, lastModifieds, dateTakens)
|
||||
val curMedia = mediaFetcher.getFilesFrom(
|
||||
path, getImagesOnly, getVideosOnly, getProperDateTaken, getProperLastModified, getProperFileSize,
|
||||
favoritePaths, false, lastModifieds, dateTakens
|
||||
)
|
||||
val directory = createDirectoryFromMedia(path, curMedia, albumCovers, hiddenString, includedFolders, getProperFileSize, noMediaFolders)
|
||||
updateDBDirectory(directory)
|
||||
}
|
||||
|
|
|
@ -24,9 +24,11 @@ import java.util.*
|
|||
class MediaFetcher(val context: Context) {
|
||||
var shouldStop = false
|
||||
|
||||
fun getFilesFrom(curPath: String, isPickImage: Boolean, isPickVideo: Boolean, getProperDateTaken: Boolean, getProperLastModified: Boolean,
|
||||
fun getFilesFrom(
|
||||
curPath: String, isPickImage: Boolean, isPickVideo: Boolean, getProperDateTaken: Boolean, getProperLastModified: Boolean,
|
||||
getProperFileSize: Boolean, favoritePaths: ArrayList<String>, getVideoDurations: Boolean,
|
||||
lastModifieds: HashMap<String, Long>, dateTakens: HashMap<String, Long>): ArrayList<Medium> {
|
||||
lastModifieds: HashMap<String, Long>, dateTakens: HashMap<String, Long>
|
||||
): ArrayList<Medium> {
|
||||
val filterMedia = context.config.filterMedia
|
||||
if (filterMedia == 0) {
|
||||
return ArrayList()
|
||||
|
@ -39,8 +41,10 @@ class MediaFetcher(val context: Context) {
|
|||
curMedia.addAll(newMedia)
|
||||
}
|
||||
} else {
|
||||
val newMedia = getMediaInFolder(curPath, isPickImage, isPickVideo, filterMedia, getProperDateTaken, getProperLastModified, getProperFileSize,
|
||||
favoritePaths, getVideoDurations, lastModifieds, dateTakens)
|
||||
val newMedia = getMediaInFolder(
|
||||
curPath, isPickImage, isPickVideo, filterMedia, getProperDateTaken, getProperLastModified, getProperFileSize,
|
||||
favoritePaths, getVideoDurations, lastModifieds, dateTakens
|
||||
)
|
||||
curMedia.addAll(newMedia)
|
||||
}
|
||||
|
||||
|
@ -248,9 +252,11 @@ class MediaFetcher(val context: Context) {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getMediaInFolder(folder: String, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int, getProperDateTaken: Boolean,
|
||||
private fun getMediaInFolder(
|
||||
folder: String, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int, getProperDateTaken: Boolean,
|
||||
getProperLastModified: Boolean, getProperFileSize: Boolean, favoritePaths: ArrayList<String>,
|
||||
getVideoDurations: Boolean, lastModifieds: HashMap<String, Long>, dateTakens: HashMap<String, Long>): ArrayList<Medium> {
|
||||
getVideoDurations: Boolean, lastModifieds: HashMap<String, Long>, dateTakens: HashMap<String, Long>
|
||||
): ArrayList<Medium> {
|
||||
val media = ArrayList<Medium>()
|
||||
val isRecycleBin = folder == RECYCLE_BIN
|
||||
val deletedMedia = if (isRecycleBin) {
|
||||
|
@ -387,8 +393,10 @@ class MediaFetcher(val context: Context) {
|
|||
return media
|
||||
}
|
||||
|
||||
private fun getMediaOnOTG(folder: String, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int, favoritePaths: ArrayList<String>,
|
||||
getVideoDurations: Boolean): ArrayList<Medium> {
|
||||
private fun getMediaOnOTG(
|
||||
folder: String, isPickImage: Boolean, isPickVideo: Boolean, filterMedia: Int, favoritePaths: ArrayList<String>,
|
||||
getVideoDurations: Boolean
|
||||
): ArrayList<Medium> {
|
||||
val media = ArrayList<Medium>()
|
||||
val files = context.getDocumentFile(folder)?.listFiles() ?: return media
|
||||
val checkFileExistence = context.config.fileLoadingPriority == PRIORITY_VALIDITY
|
||||
|
@ -443,7 +451,9 @@ class MediaFetcher(val context: Context) {
|
|||
else -> TYPE_IMAGES
|
||||
}
|
||||
|
||||
val path = Uri.decode(file.uri.toString().replaceFirst("${context.config.OTGTreeUri}/document/${context.config.OTGPartition}%3A", "${context.config.OTGPath}/"))
|
||||
val path = Uri.decode(
|
||||
file.uri.toString().replaceFirst("${context.config.OTGTreeUri}/document/${context.config.OTGPartition}%3A", "${context.config.OTGPath}/")
|
||||
)
|
||||
val videoDuration = if (getVideoDurations) context.getDuration(path) ?: 0 else 0
|
||||
val isFavorite = favoritePaths.contains(path)
|
||||
val medium = Medium(null, filename, path, folder, dateModified, dateTaken, size, type, videoDuration, isFavorite, 0L)
|
||||
|
@ -692,7 +702,8 @@ class MediaFetcher(val context: Context) {
|
|||
|
||||
val sortDescending = currentGrouping and GROUP_DESCENDING != 0
|
||||
val sorted = if (currentGrouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 || currentGrouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 0 ||
|
||||
currentGrouping and GROUP_BY_DATE_TAKEN_DAILY != 0 || currentGrouping and GROUP_BY_DATE_TAKEN_MONTHLY != 0) {
|
||||
currentGrouping and GROUP_BY_DATE_TAKEN_DAILY != 0 || currentGrouping and GROUP_BY_DATE_TAKEN_MONTHLY != 0
|
||||
) {
|
||||
mediumGroups.toSortedMap(if (sortDescending) compareByDescending {
|
||||
it.toLongOrNull() ?: 0L
|
||||
} else {
|
||||
|
@ -726,7 +737,11 @@ class MediaFetcher(val context: Context) {
|
|||
|
||||
private fun getFormattedKey(key: String, grouping: Int, today: String, yesterday: String): String {
|
||||
var result = when {
|
||||
grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 || grouping and GROUP_BY_DATE_TAKEN_DAILY != 0 -> getFinalDate(formatDate(key, true), today, yesterday)
|
||||
grouping and GROUP_BY_LAST_MODIFIED_DAILY != 0 || grouping and GROUP_BY_DATE_TAKEN_DAILY != 0 -> getFinalDate(
|
||||
formatDate(key, true),
|
||||
today,
|
||||
yesterday
|
||||
)
|
||||
grouping and GROUP_BY_LAST_MODIFIED_MONTHLY != 0 || grouping and GROUP_BY_DATE_TAKEN_MONTHLY != 0 -> formatDate(key, false)
|
||||
grouping and GROUP_BY_FILE_TYPE != 0 -> getFileTypeString(key)
|
||||
grouping and GROUP_BY_EXTENSION != 0 -> key.toUpperCase()
|
||||
|
|
Loading…
Reference in a new issue