Fix: Fixed the backup system.
This commit is contained in:
@@ -94,7 +94,7 @@ const val SMALLEST_WIDTH_600: Int = 600
|
||||
fun Context.createIconWithResourceCompat(
|
||||
@DrawableRes vectorIconId: Int,
|
||||
@DrawableRes adaptiveIconForegroundId: Int,
|
||||
@DrawableRes adaptiveIconBackgroundId: Int
|
||||
@DrawableRes adaptiveIconBackgroundId: Int,
|
||||
): IconCompat {
|
||||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val adaptiveIconDrawable = AdaptiveIconDrawable(
|
||||
@@ -116,7 +116,6 @@ fun Context.currentLanguage() = ConfigurationCompat.getLocales(resources.configu
|
||||
|
||||
fun Context.openBrowser(url: String, clearFromRecent: Boolean = true) {
|
||||
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
|
||||
browserIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
if (clearFromRecent) browserIntent.flags =
|
||||
browserIntent.flags or Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
|
||||
startActivity(browserIntent)
|
||||
@@ -281,7 +280,6 @@ fun Context.launchCalendar() {
|
||||
fun Context.openBatteryManager() {
|
||||
try {
|
||||
val intent = Intent(Intent.ACTION_POWER_USAGE_SUMMARY)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
this.startActivity(intent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
// Battery manager settings cannot be opened
|
||||
@@ -312,7 +310,7 @@ fun Context.searchOnPlayStore(query: String? = null): Boolean {
|
||||
|
||||
fun Context.searchCustomSearchEngine(
|
||||
preferenceHelper: PreferenceHelper,
|
||||
searchQuery: String? = null
|
||||
searchQuery: String? = null,
|
||||
): Boolean {
|
||||
|
||||
val searchUrl = when (preferenceHelper.searchEngines) {
|
||||
@@ -373,7 +371,7 @@ fun Context.hasInternetPermission(): Boolean {
|
||||
|
||||
fun Context.isPackageInstalled(
|
||||
packageName: String,
|
||||
userHandle: UserHandle = android.os.Process.myUserHandle()
|
||||
userHandle: UserHandle = android.os.Process.myUserHandle(),
|
||||
): Boolean {
|
||||
val launcher = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||
val activityInfo = launcher.getActivityList(packageName, userHandle)
|
||||
|
||||
@@ -161,7 +161,6 @@ class AppHelper @Inject constructor() {
|
||||
|
||||
val intent = Intent()
|
||||
intent.component = ComponentName(packageName, className)
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
context.startActivity(intent)
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
// Digital Wellbeing app is not installed or cannot be opened
|
||||
@@ -264,21 +263,18 @@ class AppHelper @Inject constructor() {
|
||||
Intent.EXTRA_TEXT,
|
||||
"$description https://f-droid.org/packages/${context.packageName}"
|
||||
)
|
||||
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(Intent.createChooser(shareIntent, "Share Application"))
|
||||
}
|
||||
|
||||
fun helpFeedbackButton(context: Context) {
|
||||
val uri = Uri.parse("https://github.com/DroidWorksStudio/EasyLauncher")
|
||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
fun communitySupportButton(context: Context) {
|
||||
val uri = Uri.parse("https://t.me/DroidWorksStudio/")
|
||||
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
@@ -286,7 +282,6 @@ class AppHelper @Inject constructor() {
|
||||
val emailIntent = Intent(Intent.ACTION_SENDTO)
|
||||
emailIntent.data = Uri.parse("mailto:droidworksstuido@063240.xyz")
|
||||
emailIntent.putExtra(Intent.EXTRA_SUBJECT, R.string.app_name)
|
||||
emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(Intent.createChooser(emailIntent, "Choose Mail Application"))
|
||||
}
|
||||
|
||||
@@ -300,7 +295,6 @@ class AppHelper @Inject constructor() {
|
||||
type = "application/json"
|
||||
putExtra(Intent.EXTRA_TITLE, fileName)
|
||||
}
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
activity.startActivityForResult(intent, Constants.BACKUP_WRITE, null)
|
||||
}
|
||||
|
||||
@@ -309,7 +303,6 @@ class AppHelper @Inject constructor() {
|
||||
addCategory(Intent.CATEGORY_OPENABLE)
|
||||
type = "application/json"
|
||||
}
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
activity.startActivityForResult(intent, Constants.BACKUP_READ, null)
|
||||
}
|
||||
|
||||
@@ -370,7 +363,7 @@ class AppHelper @Inject constructor() {
|
||||
fun fetchWeatherData(
|
||||
context: Context,
|
||||
latitude: Float,
|
||||
longitude: Float
|
||||
longitude: Float,
|
||||
): WeatherResult {
|
||||
// Check if cached data is available and not expired
|
||||
val cachedWeatherData = context.getWeatherDataFromCache()
|
||||
|
||||
@@ -11,8 +11,7 @@ object AppReloader {
|
||||
val intent = packageManager.getLaunchIntentForPackage(context.packageName)
|
||||
val componentName = intent?.component
|
||||
val mainIntent = Intent.makeRestartActivityTask(componentName)
|
||||
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
mainIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
|
||||
mainIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
|
||||
|
||||
// Delay the restart slightly to ensure all current activities are finished
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
|
||||
Reference in New Issue
Block a user