Skip to content

Commit

Permalink
Merge pull request #178 from TeamAmaze/feature
Browse files Browse the repository at this point in the history
Release 1.93 to main
  • Loading branch information
VishalNehra authored Jul 14, 2024
2 parents c6378a3 + 9b7ef51 commit 9fac371
Show file tree
Hide file tree
Showing 58 changed files with 6,402 additions and 5,065 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ The device vendors/ROM developers are free to include Amaze apk pre-installed in

We strongly recommend using apk signed by us (either Play Store version or from AFH link above) so that users would be able to update directly from Play Store after distribution. Furthermore, a change in digital signature will break plug-ins.

## License:
## License
Amaze File Utilities is licenced under [GPLv3](https://teamamaze.xyz/license-agreement-utilities) and anyone wanting to use it (as a base for your own project or even use some of its parts or features) has to adhere to this license completely. Make sure that you are aware of all the licensing terms before creating your own project based on Amaze Utilities.

Here some important points to keep in mind, as to how we handle licensing:
Expand Down
8 changes: 4 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ android {
minSdk 21
targetSdk 33

Integer sudoVersionCode = 33
String versionNameText = "1.92"
Integer sudoVersionCode = 34
String versionNameText = "1.93"

String[] abiFilterList = property("abiFilters").toString().split(';')
Integer minorVersion = 0
Expand Down Expand Up @@ -202,7 +202,7 @@ android {
// track.set("internal")
track.set("production")
userFraction.set(1.0d)
updatePriority.set(2)
updatePriority.set(4)
releaseStatus.set(com.github.triplet.gradle.androidpublisher.ReleaseStatus.COMPLETED)
}
}
Expand Down Expand Up @@ -263,7 +263,7 @@ dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.3.0'
implementation 'com.google.android.exoplayer:exoplayer:2.16.0'
implementation 'com.google.android.exoplayer:extension-mediasession:2.16.0'
implementation 'com.ramijemli.percentagechartview:percentagechartview:0.3.1'
implementation 'com.github.DroidsOnRoids:PercentageChartView:5a6836bd0d'
implementation 'com.github.massoudss:waveformSeekBar:5.0.1'
implementation 'com.github.lincollincol:amplituda:2.1.6'
//Simple library show
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<activity
android:name=".image_viewer.ImageViewerActivity"
android:label="@string/image_viewer"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark.Fallback"
android:exported="true"
>
<intent-filter
Expand All @@ -111,7 +111,7 @@
<activity
android:name=".image_viewer.editor.EditImageActivity"
android:label="@string/image_editor"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark.Fallback"
android:exported="true"
>
<intent-filter
Expand Down Expand Up @@ -159,7 +159,7 @@
android:supportsPictureInPicture="true"
android:resizeableActivity="true"
android:taskAffinity="com.amaze.fileutilitiespip"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark"
android:theme="@style/Theme.AmazeFileUtilities.FullScreen.Dark.Fallback"
android:exported="true">
<intent-filter
android:label="@string/video_player_full_screen"
Expand Down
44 changes: 27 additions & 17 deletions app/src/main/java/com/amaze/fileutilities/PermissionsActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -161,30 +161,35 @@ open class PermissionsActivity :

private fun checkStoragePermission(): Boolean {
// Verify that all required contact permissions have been granted.
var isFound = false
if (VERSION.SDK_INT >= Build.VERSION_CODES.R) {
try {
isFound = (
ActivityCompat.checkSelfPermission(
this, Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
)
== PackageManager.PERMISSION_GRANTED
) || (
ActivityCompat.checkSelfPermission(
this, Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
)

// Verify that all required contact permissions have been granted.
return if (VERSION.SDK_INT >= Build.VERSION_CODES.R) {
(
ActivityCompat.checkSelfPermission(
this, Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
)
== PackageManager.PERMISSION_GRANTED
) || (
ActivityCompat.checkSelfPermission(
this, Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
)

== PackageManager.PERMISSION_GRANTED
) || Environment.isExternalStorageManager()
} else {
(
== PackageManager.PERMISSION_GRANTED
) || Environment.isExternalStorageManager()
} catch (anfe: ActivityNotFoundException) {
log.warn("all files access permission activity missing, fallback to default", anfe)
}
}
if (!isFound) {
isFound = (
ActivityCompat.checkSelfPermission(
this,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
== PackageManager.PERMISSION_GRANTED
)
}
return isFound
}

fun isLocationEnabled(onPermissionGranted: OnPermissionGranted) {
Expand All @@ -204,7 +209,12 @@ open class PermissionsActivity :
.setPositiveButton(
resources.getString(R.string.yes)
) { dialog, _ ->
startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
try {
startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
} catch (anfe: ActivityNotFoundException) {
log.warn("failed to find location settings activity", anfe)
this.showToastInCenter(getString(R.string.grantfailed))
}
dialog.cancel()
}
.setNegativeButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,11 @@ class MainActivity :
}

private fun exit() {
if (getFilesModel().backPressedToExitOnce) {
val confirmBeforeExitPref = getAppCommonSharedPreferences().getBoolean(
PreferencesConstants.KEY_CONFIRM_BEFORE_EXIT,
PreferencesConstants.DEFAULT_CONFIRM_BEFORE_EXIT
)
if (!confirmBeforeExitPref || getFilesModel().backPressedToExitOnce) {
finish()
} else {
getFilesModel().backPressedToExitOnce = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,27 +147,35 @@ abstract class WelcomePermissionScreen :

fun checkStoragePermission(): Boolean {
// Verify that all required contact permissions have been granted.
return if (VERSION.SDK_INT >= Build.VERSION_CODES.R) {
(
ActivityCompat.checkSelfPermission(
this, Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
)
== PackageManager.PERMISSION_GRANTED
) || (
ActivityCompat.checkSelfPermission(
this, Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
)
== PackageManager.PERMISSION_GRANTED
) || Environment.isExternalStorageManager()
} else {
(
var isFound = false
if (VERSION.SDK_INT >= Build.VERSION_CODES.R) {
try {
isFound = (
ActivityCompat.checkSelfPermission(
this, Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
)
== PackageManager.PERMISSION_GRANTED
) || (
ActivityCompat.checkSelfPermission(
this, Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
)

== PackageManager.PERMISSION_GRANTED
) || Environment.isExternalStorageManager()
} catch (anfe: ActivityNotFoundException) {
log.warn("all files access permission activity missing, fallback to default", anfe)
}
}
if (!isFound) {
isFound = (
ActivityCompat.checkSelfPermission(
this,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
== PackageManager.PERMISSION_GRANTED
)
}
return isFound
}

fun isLocationEnabled(onPermissionGranted: OnPermissionGranted) {
Expand All @@ -187,7 +195,12 @@ abstract class WelcomePermissionScreen :
.setPositiveButton(
resources.getString(R.string.yes)
) { dialog, _ ->
startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
try {
startActivity(Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS))
} catch (anfe: ActivityNotFoundException) {
log.warn("failed to find location settings activity", anfe)
this.showToastInCenter(getString(R.string.grantfailed))
}
dialog.cancel()
}
.setNegativeButton(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

package com.amaze.fileutilities.home_page.ui.analyse

import android.content.ActivityNotFoundException
import android.content.Intent
import android.content.SharedPreferences
import android.net.Uri
Expand Down Expand Up @@ -48,11 +49,16 @@ import com.amaze.fileutilities.utilis.AbstractMediaFileInfoOperationsFragment
import com.amaze.fileutilities.utilis.PreferencesConstants
import com.amaze.fileutilities.utilis.Utils
import com.amaze.fileutilities.utilis.getAppCommonSharedPreferences
import com.amaze.fileutilities.utilis.showToastInCenter
import com.amaze.fileutilities.utilis.showToastOnBottom
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import kotlin.concurrent.thread

class AnalyseFragment : AbstractMediaFileInfoOperationsFragment() {

private var log: Logger = LoggerFactory.getLogger(AnalyseFragment::class.java)

private lateinit var analyseViewModel: AnalyseViewModel
private val filesViewModel: FilesViewModel by activityViewModels()

Expand Down Expand Up @@ -483,9 +489,7 @@ class AnalyseFragment : AbstractMediaFileInfoOperationsFragment() {
unusedAppsPreview.visibility = View.VISIBLE
if (!isUsageStatsPermissionGranted()) {
unusedAppsPreview.loadRequireElevatedPermission({
val intent = Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)
intent.data = Uri.parse("package:${requireActivity().packageName}")
startActivity(intent)
launchUsageAccessScreen()
}, ::usageStatsPermissionReload)
} else {
filesViewModel.getUnusedApps().observe(viewLifecycleOwner) {
Expand All @@ -508,14 +512,10 @@ class AnalyseFragment : AbstractMediaFileInfoOperationsFragment() {
leastUsedAppsPreview.visibility = View.VISIBLE
if (!isUsageStatsPermissionGranted()) {
mostUsedAppsPreview.loadRequireElevatedPermission({
val intent = Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)
intent.data = Uri.parse("package:${requireActivity().packageName}")
startActivity(intent)
launchUsageAccessScreen()
}, ::usageStatsPermissionReload)
leastUsedAppsPreview.loadRequireElevatedPermission({
val intent = Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)
intent.data = Uri.parse("package:${requireActivity().packageName}")
startActivity(intent)
launchUsageAccessScreen()
}, ::usageStatsPermissionReload)
} else {
filesViewModel.getMostUsedApps().observe(viewLifecycleOwner) {
Expand Down Expand Up @@ -554,9 +554,7 @@ class AnalyseFragment : AbstractMediaFileInfoOperationsFragment() {
!isUsageStatsPermissionGranted()
) {
networkIntensiveAppsPreview.loadRequireElevatedPermission({
val intent = Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)
intent.data = Uri.parse("package:${requireActivity().packageName}")
startActivity(intent)
launchUsageAccessScreen()
}, ::usageStatsPermissionReload)
} else {
filesViewModel.getNetworkIntensiveApps().observe(viewLifecycleOwner) {
Expand Down Expand Up @@ -617,8 +615,7 @@ class AnalyseFragment : AbstractMediaFileInfoOperationsFragment() {
// Starting with version O, the PACKAGE_USAGE_STATS permission is necessary to query
// the size of other apps
largeSizeDiffAppsPreview.loadRequireElevatedPermission({
val intent = Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)
startActivity(intent)
launchUsageAccessScreen()
}, ::usageStatsPermissionReload)
} else {
filesViewModel.getLargeSizeDiffApps()
Expand Down Expand Up @@ -1084,4 +1081,15 @@ class AnalyseFragment : AbstractMediaFileInfoOperationsFragment() {
}
}
}

private fun launchUsageAccessScreen() {
try {
val intent = Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS)
intent.data = Uri.parse("package:${requireActivity().packageName}")
startActivity(intent)
} catch (anfe: ActivityNotFoundException) {
log.warn("usage access activity not found", anfe)
requireContext().showToastInCenter(getString(R.string.grantfailed))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import com.amaze.fileutilities.home_page.ui.files.MediaInfoRecyclerViewHolder
import com.amaze.fileutilities.utilis.AbstractMediaFilesAdapter
import com.amaze.fileutilities.utilis.EmptyViewHolder
import com.amaze.fileutilities.utilis.FileUtils
import com.amaze.fileutilities.utilis.Utils
import java.lang.ref.WeakReference

class ReviewAnalysisAdapter(
Expand Down Expand Up @@ -99,6 +100,16 @@ class ReviewAnalysisAdapter(
} else {
holder.infoSummary.text = totalSize
}
} else if (analysisType == ReviewImagesFragment.TYPE_MOST_USED_APPS) {
val timeForeground =
Utils.convertMillisToHoursMinutes(
this.mediaFileInfo?.extraInfo
?.apkMetaData?.timeForeground ?: 0L
)
val size = this.mediaFileInfo?.getFormattedSize(context)
holder.infoSummary.text = "${context.getString(R.string.size)}: $size"
holder.extraInfo.text = "${context.getString(R.string.usage)}: " +
"$timeForeground"
} else {
holder.infoSummary.text = this.mediaFileInfo?.getFormattedSize(context)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,14 +579,16 @@ class AudiosListFragment : AbstractMediaInfoListFragment(), IAudioPlayerInterfac
val selectedSongList = getMediaFileAdapter()?.checkItemsList
if (selectedSongList?.size == 1) {
selectedSongList[0].mediaFileInfo?.getContentUri(requireContext())?.let { it1 ->
audioPlaybackServiceConnection
.getAudioServiceInstance()?.insertPlayNextSong(
it1
)
Toast.makeText(
requireContext(), R.string.play_next_success,
Toast.LENGTH_LONG
).show()
if (::audioPlaybackServiceConnection.isInitialized) {
audioPlaybackServiceConnection
.getAudioServiceInstance()?.insertPlayNextSong(
it1
)
Toast.makeText(
requireContext(), R.string.play_next_success,
Toast.LENGTH_LONG
).show()
}
}
}
hideActionBar()
Expand Down
Loading

0 comments on commit 9fac371

Please sign in to comment.