@@ -31,7 +31,6 @@ import androidx.annotation.DrawableRes
31
31
import androidx.core.content.ContextCompat
32
32
import androidx.core.graphics.drawable.IconCompat
33
33
import androidx.core.graphics.drawable.toBitmap
34
- import androidx.core.os.ConfigurationCompat
35
34
import androidx.lifecycle.LifecycleObserver
36
35
import androidx.lifecycle.LifecycleOwner
37
36
import com.github.droidworksstudio.launcher.data.entities.AppInfo
@@ -112,8 +111,6 @@ fun Context.createIconWithResourceCompat(
112
111
}
113
112
}
114
113
115
- fun Context.currentLanguage () = ConfigurationCompat .getLocales(resources.configuration)[0 ]?.language
116
-
117
114
fun Context.openBrowser (url : String , clearFromRecent : Boolean = true) {
118
115
val browserIntent = Intent (Intent .ACTION_VIEW , Uri .parse(url))
119
116
if (clearFromRecent) browserIntent.flags =
@@ -182,7 +179,7 @@ fun Context.resetDefaultLauncher() {
182
179
try {
183
180
val intent = Intent (" android.settings.HOME_SETTINGS" )
184
181
this .startActivity(intent)
185
- } catch (e : ActivityNotFoundException ) {
182
+ } catch (_ : ActivityNotFoundException ) {
186
183
// Fallback to general settings if specific launcher settings are not found
187
184
try {
188
185
val intent = Intent (Settings .ACTION_SETTINGS )
@@ -266,7 +263,7 @@ fun Context.launchCalendar() {
266
263
builder.appendPath(" time" )
267
264
builder.appendPath(time.toString())
268
265
this .startActivity(Intent (Intent .ACTION_VIEW , builder.build()))
269
- } catch (e : Exception ) {
266
+ } catch (_ : Exception ) {
270
267
try {
271
268
val intent = Intent (this , LauncherActivity ::class .java)
272
269
intent.addCategory(Intent .CATEGORY_APP_CALENDAR )
@@ -281,7 +278,7 @@ fun Context.openBatteryManager() {
281
278
try {
282
279
val intent = Intent (Intent .ACTION_POWER_USAGE_SUMMARY )
283
280
this .startActivity(intent)
284
- } catch (e : ActivityNotFoundException ) {
281
+ } catch (_ : ActivityNotFoundException ) {
285
282
// Battery manager settings cannot be opened
286
283
// Handle this case as needed
287
284
showLongToast(" Battery manager settings are not available on this device." )
@@ -375,7 +372,7 @@ fun Context.isPackageInstalled(
375
372
): Boolean {
376
373
val launcher = getSystemService(Context .LAUNCHER_APPS_SERVICE ) as LauncherApps
377
374
val activityInfo = launcher.getActivityList(packageName, userHandle)
378
- return activityInfo.size > 0
375
+ return activityInfo.isNotEmpty()
379
376
}
380
377
381
378
fun Context.getAppNameFromPackageName (packageName : String ): String? {
0 commit comments