Skip to content

Commit 4832fec

Browse files
Fix: Fixed the backup system.
1 parent 86540e5 commit 4832fec

File tree

3 files changed

+5
-15
lines changed

3 files changed

+5
-15
lines changed

app/src/main/java/com/github/droidworksstudio/common/ContextExtensions.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const val SMALLEST_WIDTH_600: Int = 600
9494
fun Context.createIconWithResourceCompat(
9595
@DrawableRes vectorIconId: Int,
9696
@DrawableRes adaptiveIconForegroundId: Int,
97-
@DrawableRes adaptiveIconBackgroundId: Int
97+
@DrawableRes adaptiveIconBackgroundId: Int,
9898
): IconCompat {
9999
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
100100
val adaptiveIconDrawable = AdaptiveIconDrawable(
@@ -116,7 +116,6 @@ fun Context.currentLanguage() = ConfigurationCompat.getLocales(resources.configu
116116

117117
fun Context.openBrowser(url: String, clearFromRecent: Boolean = true) {
118118
val browserIntent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
119-
browserIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
120119
if (clearFromRecent) browserIntent.flags =
121120
browserIntent.flags or Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
122121
startActivity(browserIntent)
@@ -281,7 +280,6 @@ fun Context.launchCalendar() {
281280
fun Context.openBatteryManager() {
282281
try {
283282
val intent = Intent(Intent.ACTION_POWER_USAGE_SUMMARY)
284-
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
285283
this.startActivity(intent)
286284
} catch (e: ActivityNotFoundException) {
287285
// Battery manager settings cannot be opened
@@ -312,7 +310,7 @@ fun Context.searchOnPlayStore(query: String? = null): Boolean {
312310

313311
fun Context.searchCustomSearchEngine(
314312
preferenceHelper: PreferenceHelper,
315-
searchQuery: String? = null
313+
searchQuery: String? = null,
316314
): Boolean {
317315

318316
val searchUrl = when (preferenceHelper.searchEngines) {
@@ -373,7 +371,7 @@ fun Context.hasInternetPermission(): Boolean {
373371

374372
fun Context.isPackageInstalled(
375373
packageName: String,
376-
userHandle: UserHandle = android.os.Process.myUserHandle()
374+
userHandle: UserHandle = android.os.Process.myUserHandle(),
377375
): Boolean {
378376
val launcher = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
379377
val activityInfo = launcher.getActivityList(packageName, userHandle)

app/src/main/java/com/github/droidworksstudio/launcher/helper/AppHelper.kt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ class AppHelper @Inject constructor() {
161161

162162
val intent = Intent()
163163
intent.component = ComponentName(packageName, className)
164-
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
165164
context.startActivity(intent)
166165
} catch (e: ActivityNotFoundException) {
167166
// Digital Wellbeing app is not installed or cannot be opened
@@ -264,29 +263,25 @@ class AppHelper @Inject constructor() {
264263
Intent.EXTRA_TEXT,
265264
"$description https://f-droid.org/packages/${context.packageName}"
266265
)
267-
shareIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
268266
context.startActivity(Intent.createChooser(shareIntent, "Share Application"))
269267
}
270268

271269
fun helpFeedbackButton(context: Context) {
272270
val uri = Uri.parse("https://github.com/DroidWorksStudio/EasyLauncher")
273271
val intent = Intent(Intent.ACTION_VIEW, uri)
274-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
275272
context.startActivity(intent)
276273
}
277274

278275
fun communitySupportButton(context: Context) {
279276
val uri = Uri.parse("https://t.me/DroidWorksStudio/")
280277
val intent = Intent(Intent.ACTION_VIEW, uri)
281-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
282278
context.startActivity(intent)
283279
}
284280

285281
fun emailButton(context: Context) {
286282
val emailIntent = Intent(Intent.ACTION_SENDTO)
287283
emailIntent.data = Uri.parse("mailto:droidworksstuido@063240.xyz")
288284
emailIntent.putExtra(Intent.EXTRA_SUBJECT, R.string.app_name)
289-
emailIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
290285
context.startActivity(Intent.createChooser(emailIntent, "Choose Mail Application"))
291286
}
292287

@@ -300,7 +295,6 @@ class AppHelper @Inject constructor() {
300295
type = "application/json"
301296
putExtra(Intent.EXTRA_TITLE, fileName)
302297
}
303-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
304298
activity.startActivityForResult(intent, Constants.BACKUP_WRITE, null)
305299
}
306300

@@ -309,7 +303,6 @@ class AppHelper @Inject constructor() {
309303
addCategory(Intent.CATEGORY_OPENABLE)
310304
type = "application/json"
311305
}
312-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
313306
activity.startActivityForResult(intent, Constants.BACKUP_READ, null)
314307
}
315308

@@ -370,7 +363,7 @@ class AppHelper @Inject constructor() {
370363
fun fetchWeatherData(
371364
context: Context,
372365
latitude: Float,
373-
longitude: Float
366+
longitude: Float,
374367
): WeatherResult {
375368
// Check if cached data is available and not expired
376369
val cachedWeatherData = context.getWeatherDataFromCache()

app/src/main/java/com/github/droidworksstudio/launcher/helper/AppReloader.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ object AppReloader {
1111
val intent = packageManager.getLaunchIntentForPackage(context.packageName)
1212
val componentName = intent?.component
1313
val mainIntent = Intent.makeRestartActivityTask(componentName)
14-
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
15-
mainIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP)
14+
mainIntent.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
1615

1716
// Delay the restart slightly to ensure all current activities are finished
1817
Handler(Looper.getMainLooper()).post {

0 commit comments

Comments
 (0)