mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
add a prompt for making the app the default media management app
This commit is contained in:
parent
dc2605e723
commit
6428836c73
3 changed files with 25 additions and 3 deletions
|
@ -77,7 +77,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:9d9b24290c'
|
implementation 'com.github.SimpleMobileTools:Simple-Commons:cab93be34d'
|
||||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.24'
|
||||||
|
|
|
@ -455,10 +455,12 @@ class SettingsActivity : SimpleActivity() {
|
||||||
private fun setupKeepLastModified() {
|
private fun setupKeepLastModified() {
|
||||||
settings_keep_last_modified.isChecked = config.keepLastModified
|
settings_keep_last_modified.isChecked = config.keepLastModified
|
||||||
settings_keep_last_modified_holder.setOnClickListener {
|
settings_keep_last_modified_holder.setOnClickListener {
|
||||||
|
handleMediaManagementPrompt {
|
||||||
settings_keep_last_modified.toggle()
|
settings_keep_last_modified.toggle()
|
||||||
config.keepLastModified = settings_keep_last_modified.isChecked
|
config.keepLastModified = settings_keep_last_modified.isChecked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupEnablePullToRefresh() {
|
private fun setupEnablePullToRefresh() {
|
||||||
settings_enable_pull_to_refresh.isChecked = config.enablePullToRefresh
|
settings_enable_pull_to_refresh.isChecked = config.enablePullToRefresh
|
||||||
|
|
|
@ -15,8 +15,10 @@ import android.os.Build
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.provider.MediaStore.Files
|
import android.provider.MediaStore.Files
|
||||||
import android.provider.MediaStore.Images
|
import android.provider.MediaStore.Images
|
||||||
|
import android.provider.Settings
|
||||||
import android.util.DisplayMetrics
|
import android.util.DisplayMetrics
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.exifinterface.media.ExifInterface
|
import androidx.exifinterface.media.ExifInterface
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
|
@ -123,6 +125,24 @@ fun SimpleActivity.launchAbout() {
|
||||||
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
|
startAboutActivity(R.string.app_name, licenses, BuildConfig.VERSION_NAME, faqItems, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequiresApi(Build.VERSION_CODES.S)
|
||||||
|
fun SimpleActivity.launchMediaManagementIntent() {
|
||||||
|
Intent(Settings.ACTION_REQUEST_MANAGE_MEDIA).apply {
|
||||||
|
data = Uri.parse("package:$packageName")
|
||||||
|
startActivity(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun SimpleActivity.handleMediaManagementPrompt(callback: () -> Unit) {
|
||||||
|
if (isSPlus() && !MediaStore.canManageMedia(this)) {
|
||||||
|
ConfirmationDialog(this, "", R.string.media_management_prompt, R.string.ok, 0) {
|
||||||
|
launchMediaManagementIntent()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
callback()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun AppCompatActivity.showSystemUI(toggleActionBarVisibility: Boolean) {
|
fun AppCompatActivity.showSystemUI(toggleActionBarVisibility: Boolean) {
|
||||||
if (toggleActionBarVisibility) {
|
if (toggleActionBarVisibility) {
|
||||||
supportActionBar?.show()
|
supportActionBar?.show()
|
||||||
|
|
Loading…
Reference in a new issue