Skip to content

Commit d0d1c56

Browse files
committed
Merge branch 'remote' into mkq-mr1
Change-Id: I3ec206380b45fea632f6c0d4300c184a876b5269
2 parents 329e3f8 + 27107fe commit d0d1c56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+365
-119
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
Changelog
22
==========
33

4+
Version 6.23.1 *(2022-04-16)*
5+
----------------------------
6+
7+
* Fixed some file operations on Android 10 and 11
8+
* Restore Recycle bin files in Pictures, if the original folder is inaccessible
9+
10+
Version 6.23.0 *(2022-04-15)*
11+
----------------------------
12+
13+
* Mark favorited file thumbnails
14+
* Added an Auto and Material You theme on Android 12+
15+
* Changed some file operations to comply with the latest Google permissions policy, apps like this can no longer show hidden items on Android 11+
16+
* Properly delete items in the recycle bin after 30 days
17+
* Added many other stability, translation, performance, UX and UI improvements
18+
419
Version 6.22.3 *(2021-12-19)*
520
----------------------------
621

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ android {
1515
defaultConfig {
1616
applicationId "com.simplemobiletools.gallery.pro"
1717
minSdk 21
18-
targetSdk 30
19-
versionCode 358
20-
versionName "6.22.3"
18+
targetSdk 31
19+
versionCode 360
20+
versionName "6.23.1"
2121
vectorDrawables.useSupportLibrary = true
2222
android.applicationVariants.all { variant ->
2323
variant.outputs.all {
@@ -81,7 +81,7 @@ android {
8181
}
8282

8383
dependencies {
84-
implementation 'com.github.MoKee:android_packages_apps_SimpleCommons:41503be352'
84+
implementation 'com.github.MoKee:android_packages_apps_SimpleCommons:f3661fce8a'
8585
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
8686
implementation 'it.sephiroth.android.exif:library:1.0.1'
8787
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'
@@ -103,7 +103,7 @@ dependencies {
103103
}
104104
compileOnly 'com.squareup.okhttp3:okhttp:4.9.0'
105105

106-
kapt 'com.github.bumptech.glide:compiler:4.12.0'
106+
kapt 'com.github.bumptech.glide:compiler:4.13.1'
107107

108108
kapt 'androidx.room:room-compiler:2.3.0'
109109
implementation 'androidx.room:room-runtime:2.3.0'

app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
<uses-permission android:name="android.permission.SET_WALLPAPER" />
1414
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
15+
<uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />
16+
<uses-permission
17+
android:name="android.permission.MANAGE_MEDIA"
18+
tools:ignore="ProtectedPermissions" />
19+
1520
<uses-permission
1621
android:name="android.permission.ACCESS_NETWORK_STATE"
1722
tools:node="remove" />
@@ -296,7 +301,8 @@
296301
<receiver
297302
android:name=".helpers.MyWidgetProvider"
298303
android:exported="true"
299-
android:icon="@drawable/img_widget_preview">
304+
android:icon="@drawable/img_widget_preview"
305+
android:label="@string/folder">
300306
<intent-filter>
301307
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
302308
</intent-filter>

app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/EditActivity.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import com.bumptech.glide.request.target.Target
2828
import com.simplemobiletools.commons.dialogs.ColorPickerDialog
2929
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
3030
import com.simplemobiletools.commons.extensions.*
31+
import com.simplemobiletools.commons.helpers.PERMISSION_WRITE_STORAGE
3132
import com.simplemobiletools.commons.helpers.REAL_FILE_PATH
3233
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
3334
import com.simplemobiletools.commons.helpers.isNougatPlus
@@ -101,7 +102,13 @@ class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener
101102
return
102103
}
103104

104-
initEditActivity()
105+
handlePermission(PERMISSION_WRITE_STORAGE){
106+
if (!it) {
107+
toast(R.string.no_storage_permissions)
108+
finish()
109+
}
110+
initEditActivity()
111+
}
105112
}
106113

107114
override fun onResume() {

app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
6464
private var mShouldStopFetching = false
6565
private var mIsSearchOpen = false
6666
private var mWasDefaultFolderChecked = false
67+
private var mWasMediaManagementPromptShown = false
6768
private var mLatestMediaId = 0L
6869
private var mLatestMediaDateId = 0L
6970
private var mCurrentPathPrefix = "" // used at "Group direct subfolders" for navigation
@@ -145,14 +146,27 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
145146
}
146147

147148
// just request the permission, tryLoadGallery will then trigger in onResume
148-
handlePermission(PERMISSION_WRITE_STORAGE) {
149+
handleMediaPermissions {
149150
if (!it) {
150151
toast(R.string.no_storage_permissions)
151152
finish()
152153
}
153154
}
154155
}
155156

157+
private fun handleMediaPermissions(callback: (granted: Boolean) -> Unit) {
158+
handlePermission(PERMISSION_WRITE_STORAGE) { granted ->
159+
callback(granted)
160+
if (granted && isRPlus()) {
161+
handlePermission(PERMISSION_MEDIA_LOCATION) {}
162+
if (!mWasMediaManagementPromptShown && (config.appRunCount == 1 || config.appRunCount % 5 == 0)) {
163+
mWasMediaManagementPromptShown = true
164+
handleMediaManagementPrompt { }
165+
}
166+
}
167+
}
168+
}
169+
156170
override fun onStart() {
157171
super.onStart()
158172
mTempShowHiddenHandler.removeCallbacksAndMessages(null)
@@ -184,7 +198,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
184198

185199
val primaryColor = getProperPrimaryColor()
186200
if (mStoredPrimaryColor != primaryColor) {
187-
getRecyclerAdapter()?.updatePrimaryColor(primaryColor)
201+
getRecyclerAdapter()?.updatePrimaryColor()
188202
}
189203

190204
val styleString = "${config.folderStyle}${config.showFolderMediaCount}${config.limitFolderTitle}"
@@ -435,9 +449,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
435449
private fun tryLoadGallery() {
436450
// avoid calling anything right after granting the permission, it will be called from onResume()
437451
val wasMissingPermission = config.appRunCount == 1 && !hasPermission(PERMISSION_WRITE_STORAGE)
438-
handlePermission(PERMISSION_WRITE_STORAGE) {
452+
handleMediaPermissions {
439453
if (wasMissingPermission) {
440-
return@handlePermission
454+
return@handleMediaPermissions
441455
}
442456

443457
if (it) {
@@ -1429,6 +1443,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
14291443
add(Release(277, R.string.release_277))
14301444
add(Release(295, R.string.release_295))
14311445
add(Release(327, R.string.release_327))
1446+
add(Release(359, R.string.faq_16_text))
14321447
checkWhatsNew(this, BuildConfig.VERSION_CODE)
14331448
}
14341449
}

app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
145145

146146
val primaryColor = getProperPrimaryColor()
147147
if (mStoredPrimaryColor != primaryColor) {
148-
getMediaAdapter()?.updatePrimaryColor(primaryColor)
148+
getMediaAdapter()?.updatePrimaryColor()
149149
}
150150

151151
if (

app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaPhotoActivity.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ import android.net.Uri
88
import android.os.Bundle
99
import android.view.View
1010
import android.view.Window
11+
import android.view.WindowInsetsController
1112
import android.widget.RelativeLayout
1213
import com.google.vr.sdk.widgets.pano.VrPanoramaEventListener
1314
import com.google.vr.sdk.widgets.pano.VrPanoramaView
1415
import com.simplemobiletools.commons.extensions.*
1516
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
17+
import com.simplemobiletools.commons.helpers.isRPlus
1618
import com.simplemobiletools.gallery.pro.R
1719
import com.simplemobiletools.gallery.pro.extensions.config
1820
import com.simplemobiletools.gallery.pro.extensions.hideSystemUI
@@ -48,6 +50,10 @@ open class PanoramaPhotoActivity : SimpleActivity() {
4850
}
4951

5052
checkIntent()
53+
54+
if (isRPlus()) {
55+
window.insetsController?.setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS)
56+
}
5157
}
5258

5359
override fun onResume() {

app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PanoramaVideoActivity.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ import android.os.Bundle
77
import android.os.Handler
88
import android.view.View
99
import android.view.Window
10+
import android.view.WindowInsetsController
1011
import android.view.WindowManager
1112
import android.widget.RelativeLayout
1213
import android.widget.SeekBar
1314
import com.google.vr.sdk.widgets.video.VrVideoEventListener
1415
import com.google.vr.sdk.widgets.video.VrVideoView
1516
import com.simplemobiletools.commons.extensions.*
17+
import com.simplemobiletools.commons.helpers.isRPlus
1618
import com.simplemobiletools.gallery.pro.R
1719
import com.simplemobiletools.gallery.pro.extensions.config
1820
import com.simplemobiletools.gallery.pro.extensions.hasNavBar
@@ -47,6 +49,10 @@ open class PanoramaVideoActivity : SimpleActivity(), SeekBar.OnSeekBarChangeList
4749

4850
checkNotchSupport()
4951
checkIntent()
52+
53+
if (isRPlus()) {
54+
window.insetsController?.setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS)
55+
}
5056
}
5157

5258
override fun onResume() {

app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/PhotoVideoActivity.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ import android.graphics.drawable.ColorDrawable
77
import android.net.Uri
88
import android.os.Bundle
99
import android.provider.MediaStore
10+
import android.text.Html
1011
import android.view.Menu
1112
import android.view.MenuItem
1213
import android.view.View
14+
import android.view.WindowInsetsController
1315
import com.simplemobiletools.commons.dialogs.PropertiesDialog
1416
import com.simplemobiletools.commons.extensions.*
1517
import com.simplemobiletools.commons.helpers.*
@@ -36,6 +38,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
3638
var mIsVideo = false
3739

3840
public override fun onCreate(savedInstanceState: Bundle?) {
41+
if (config.isUsingSystemTheme) {
42+
setTheme(R.style.AppTheme_Material)
43+
}
44+
3945
super.onCreate(savedInstanceState)
4046
setContentView(R.layout.fragment_holder)
4147
if (checkAppSideloading()) {
@@ -50,6 +56,10 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
5056
finish()
5157
}
5258
}
59+
60+
if (isRPlus()) {
61+
window.insetsController?.setSystemBarsAppearance(0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS)
62+
}
5363
}
5464

5565
override fun onResume() {
@@ -80,7 +90,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
8090
findItem(R.id.menu_show_on_map).isVisible = visibleBottomActions and BOTTOM_ACTION_SHOW_ON_MAP == 0
8191
}
8292

83-
updateMenuItemColors(menu)
93+
updateMenuItemColors(menu, forceWhiteIcons = true)
8494
return true
8595
}
8696

@@ -132,7 +142,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
132142
if (intent.extras?.containsKey(REAL_FILE_PATH) == true) {
133143
val realPath = intent.extras!!.getString(REAL_FILE_PATH)
134144
if (realPath != null && getDoesFilePathExist(realPath)) {
135-
val avoidShowingHiddenFiles = isRPlus() && File(realPath).isHidden
145+
val avoidShowingHiddenFiles = isRPlus() && (File(realPath).isHidden || File(realPath.getParentPath(), NOMEDIA).exists())
136146
if (!avoidShowingHiddenFiles) {
137147
if (realPath.getFilenameFromPath().contains('.') || filename.contains('.')) {
138148
if (isFileTypeVisible(realPath)) {
@@ -189,7 +199,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
189199

190200
mIsVideo = type == TYPE_VIDEOS
191201
mMedium = Medium(null, filename, mUri.toString(), mUri!!.path!!.getParentPath(), 0, 0, file.length(), type, 0, false, 0L, 0)
192-
supportActionBar?.title = mMedium!!.name
202+
supportActionBar?.title = Html.fromHtml("<font color='${Color.WHITE.toHex()}'>${mMedium!!.name}</font>")
193203
bundle.putSerializable(MEDIUM, mMedium)
194204

195205
if (savedInstanceState == null) {

app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SetWallpaperActivity.kt

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,12 @@ import kotlinx.android.synthetic.main.activity_set_wallpaper.*
2020
import kotlinx.android.synthetic.main.bottom_set_wallpaper_actions.*
2121

2222
class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener {
23+
private val RATIO_PORTRAIT = 0
24+
private val RATIO_LANDSCAPE = 1
25+
private val RATIO_SQUARE = 2
26+
2327
private val PICK_IMAGE = 1
24-
private var isLandscapeRatio = true
28+
private var aspectRatio = RATIO_PORTRAIT
2529
private var wallpaperFlag = -1
2630

2731
lateinit var uri: Uri
@@ -80,7 +84,7 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
8084

8185
private fun setupBottomActions() {
8286
bottom_set_wallpaper_aspect_ratio.setOnClickListener {
83-
changeAspectRatio(!isLandscapeRatio)
87+
changeAspectRatio()
8488
}
8589

8690
bottom_set_wallpaper_rotate.setOnClickListener {
@@ -89,13 +93,15 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete
8993
}
9094

9195
private fun setupAspectRatio() {
92-
val wallpaperWidth = if (isLandscapeRatio) wallpaperManager.desiredMinimumWidth else wallpaperManager.desiredMinimumWidth / 2
93-
crop_image_view.setAspectRatio(wallpaperWidth, wallpaperManager.desiredMinimumHeight)
94-
bottom_set_wallpaper_aspect_ratio.setImageResource(if (isLandscapeRatio) R.drawable.ic_minimize_vector else R.drawable.ic_maximize_vector)
96+
when (aspectRatio) {
97+
RATIO_LANDSCAPE -> crop_image_view.setAspectRatio(wallpaperManager.desiredMinimumWidth, wallpaperManager.desiredMinimumHeight / 2)
98+
RATIO_PORTRAIT -> crop_image_view.setAspectRatio(wallpaperManager.desiredMinimumWidth / 2, wallpaperManager.desiredMinimumHeight)
99+
else -> crop_image_view.setAspectRatio(wallpaperManager.desiredMinimumWidth, wallpaperManager.desiredMinimumWidth)
100+
}
95101
}
96102

97-
private fun changeAspectRatio(isLandscape: Boolean) {
98-
isLandscapeRatio = isLandscape
103+
private fun changeAspectRatio() {
104+
aspectRatio = ++aspectRatio % (RATIO_SQUARE + 1)
99105
setupAspectRatio()
100106
}
101107

0 commit comments

Comments
 (0)